[TIMOB-25633] Android: Add "androidback" callback property to camera overlay
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-08-14T18:10:01.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.1.0 |
Components | Android |
Labels | android, back, camera |
Reporter | Rainer Schleevoigt |
Assignee | Joshua Quick |
Created | 2017-12-23T21:17:48.000+0000 |
Updated | 2020-08-14T18:10:01.000+0000 |
Description
*Summary:*
When showing a camera overlay on Android (ie: use camera in-app instead of 3rd party camera app), you are unable to override the Back button. We should support his by adding a new "androidback" callback property like this.
Ti.Media.showCamera({
overlay: Ti.UI.createView(),
androidback: function() {
// This callback only applies when using "overlay" property.
// Back button won't close camera window unless you hide it yourself.
// Ti.Media.hideCamera();
}
});
Hello, Can you create a PR and assign to this ticket?
I have created a new version of TiCameraActivity.java. In core this updated function: @Override public void onBackPressed() { if (androidbackCallback != null) { KrollDict response = new KrollDict(); response.putCodeAndMessage(-1, "User pressed androidback"); androidbackCallback.callAsync(callbackContext, response); } else { if (cancelCallback != null) { KrollDict response = new KrollDict(); response.putCodeAndMessage(-1, "User cancelled the request"); cancelCallback.callAsync(callbackContext, response); } super.onBackPressed(); } } Now I try to PR this both files (+ MediaModule.java)
Changes: Modifying 'onBackPressed' callback in Ti.CameraActivity and some little modifications in module (adding callback)
Unfort. I have linted the source code, I hope the PR can still be done.
new PR: https://github.com/appcelerator/titanium_mobile/pull/11270
FR Passed, waiting on Jenkins build.
merged to master for 9.1.0 target
*Closing ticket*, Fix verified in SDK Version
9.1.0.v20200814072027
*Test and other information can be found at:* https://github.com/appcelerator/titanium_mobile/pull/11270