Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25633] Android: Add "androidback" callback property to camera overlay

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-08-14T18:10:01.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.1.0
ComponentsAndroid
Labelsandroid, back, camera
ReporterRainer Schleevoigt
AssigneeJoshua Quick
Created2017-12-23T21:17:48.000+0000
Updated2020-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();
	}
});

Comments

  1. Sharif AbuDarda 2017-12-24

    Hello, Can you create a PR and assign to this ticket?
  2. Rainer Schleevoigt 2017-12-27

    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)
  3. Rainer Schleevoigt 2017-12-27

    Changes: Modifying 'onBackPressed' callback in Ti.CameraActivity and some little modifications in module (adding callback)
  4. Rainer Schleevoigt 2017-12-28

    Unfort. I have linted the source code, I hope the PR can still be done.
  5. Michael Gangolf 2019-10-09

    new PR: https://github.com/appcelerator/titanium_mobile/pull/11270
  6. Samir Mohammed 2020-04-29

    FR Passed, waiting on Jenkins build.
  7. Christopher Williams 2020-04-29

    merged to master for 9.1.0 target
  8. Samir Mohammed 2020-08-14

    *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

JSON Source