Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): adding androidback property to showCamera #11270

Merged
merged 8 commits into from
Apr 29, 2020

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Oct 9, 2019

JIRA: https://jira.appcelerator.org/browse/TIMOB-25633

Ti.Media.showCamera({
	overlay: Ti.UI.createView(),
	androidback: function() {
		// go back in stack history etc or
		console.log("android back");
		// Ti.Media.hideCamera();  // won't close the camera unless you use this
	}
});

Updating this PR #9697 for @AppWerft

  • clang
  • documentation
  • fixed conflicts
  • updated example

This PR will add androidback to showCamera() on Android so you can use the phones back button in overlay mode. You have to take care of hideCamera() yourself inside the callback.

Credit goes to @AppWerft for working on the original PR

@build
Copy link
Contributor

build commented Oct 9, 2019

Warnings
⚠️

Commit ec38ae6089ffe86337f30778b144f009cdaab6a4 has a message "make style check happy" giving 2 errors:

  • subject may not be empty
  • type may not be empty
⚠️

Commit 0e0aaa408f8832bfa3d33d022e3364ea44f5e09b has a message "fix imports" giving 2 errors:

  • subject may not be empty
  • type may not be empty
Messages
📖

💾 Here's the generated SDK zipfile.

📖 🎉 Another contribution from our awesome community member, m1ga! Thanks again for helping us make Titanium SDK better. 👍
📖

🚨 This PR has one or more commits with warnings/errors for commit messages not matching our configuration. You may want to squash merge this PR and edit the message to match our conventions, or ask the original developer to modify their history.

📖

✅ All tests are passing
Nice one! All 6627 tests are passing.
(There are 708 skipped tests not included in that total)

Generated by 🚫 dangerJS against 0e0aaa4

@m1ga m1ga changed the title feat(android): Adding androidback property to showCamera feat(android): adding androidback property to showCamera Oct 9, 2019
@sgtcoolguy sgtcoolguy removed this from the 8.3.0 milestone Dec 10, 2019
Copy link
Contributor

@sgtcoolguy sgtcoolguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look ok.

I updated the commit message and the outdated since value in the doc change.

@sgtcoolguy sgtcoolguy self-requested a review December 10, 2019 19:13
@ewanharris ewanharris modified the milestones: 9.0.0, 9.1.0 Feb 12, 2020
@ssjsamir ssjsamir self-requested a review April 29, 2020 14:20
Copy link
Contributor

@ssjsamir ssjsamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FR Passed: Camera does not close automatically unless Ti.Media.hideCamera(); is used. Also able to use the androidback property.

Test case (alloy app):
index.js:

_.delay(function() {
	Titanium.Media.showCamera({
		overlay: Ti.UI.createView(),
		androidback: function() {
		// go back in stack history etc or
		console.log("android back");
		//Ti.Media.hideCamera();  // won't close the camera unless you use this
	}
	});
}, 4000);

$.index.open();

index.xml

<Alloy>
	<Window class="container">
		<ImageView id="img"></ImageView>
	</Window>
</Alloy>

Every time back button is pressed the following is logged (unless Ti.Media.hideCamera(); is uncommented)
[INFO] �� � android back
Test Environment

MacOS Catalina: 10.15.5 Beta
Xcode: 11.4
Java Version: 1.8.0_131
Android NDK: 21.1.6273396-beta2
Node.js: 10.16.3
""NPM":"5.0.0-1","CLI":"8.0.0-master.10""
Pixel XL 10.0

@sgtcoolguy sgtcoolguy merged commit b890f7c into tidev:master Apr 29, 2020
@m1ga m1ga deleted the cameraBack branch March 3, 2021 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants