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

fix(android): Window.open() wrongly does fade-in animation by default as of 8.0.1 #10910

Merged
merged 9 commits into from Jun 5, 2019

Conversation

jquick-axway
Copy link
Contributor

@jquick-axway jquick-axway commented May 25, 2019

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

Summary:
Was always defaulting to the shared-element activity transition animation if "animated" was true and open() method was not assigned a "activityEnterAnimation" and "activityExitAnimation" property.

Modified to only do a shared-element transition if at least 1 transition property was assigned (such as "activityEnterTransition" or if at least 1 view was given to the addSharedElement() method. Otherwise it'll use the activity's normal activity animations. This was, TIMOB-25678 is still supported which allows you to use shared-element transition properties without having to add shared-element views for convenience.


Default Window Transition Test:
(This verifies that the Titanium 8.0.1 regression is fixed.)

  1. Build and run the code shown in TIMOB-27101 on Android.
  2. Tap on the "Open" button.
  3. Verify that child window slides-up from the bottom of the screen. (Should no longer fade-in.)

Custom Window Transitions Test:
(This tests that transition animations will work without using the addSharedElement() method.)

  1. Build and run the below code on Android.
  2. Tap on the "Slide From Left" button.
  3. Verify that a blue window slides-in from the left.
  4. Tap on the Android "Back" button.
  5. Verify that the blue window slides-out towards the left.
  6. Tap on the "Slide From Right" button.
  7. Verify that a blue window slides-in from the right.
  8. Tap on the Android "Back" button.
  9. Verify that the blue window slides-out towards the right.
  10. Tap on the "Slide From Top" button.
  11. Verify that a blue window slides-in from the top.
  12. Tap on the Android "Back" button.
  13. Verify that the blue window slides-out towards the top.
  14. Tap on the "Slide From Bottom" button.
  15. Verify that a blue window slides-in from the bottom.
  16. Tap on the Android "Back" button.
  17. Verify that the blue window slides-out towards the bottom.
  18. Tap on the "Fade In" button.
  19. Verify that a blue window fades into the screen. (Should not slide-in.)
  20. Tap on the Android "Back" button.
  21. Verify that the blue window fades out.
function openWindowUsing(windowSettings) {
	windowSettings.title = "Child Window";
	windowSettings.backgroundColor = "blue";
	var childWindow = Ti.UI.createWindow(windowSettings);
	var closeButton = Ti.UI.createButton({ title: "Close" });
	closeButton.addEventListener("click", function() {
		childWindow.close();
	});
	childWindow.add(closeButton);
	childWindow.open();
}

var parentWindow = Ti.UI.createWindow({
	title: "Parent Window",
	layout: "vertical",
	backgroundColor: "white",
});
var slideLeftButton = Ti.UI.createButton({
	title: "Slide From Left",
	top: "8dp"
});
slideLeftButton.addEventListener("click", function() {
	openWindowUsing({ activityEnterTransition: Titanium.UI.Android.TRANSITION_SLIDE_LEFT });
});
parentWindow.add(slideLeftButton);
var slideRightButton = Ti.UI.createButton({
	title: "Slide From Right",
	top: "8dp"
});
slideRightButton.addEventListener("click", function() {
	openWindowUsing({ activityEnterTransition: Titanium.UI.Android.TRANSITION_SLIDE_RIGHT });
});
parentWindow.add(slideRightButton);
var slideTopButton = Ti.UI.createButton({
	title: "Slide From Top",
	top: "8dp"
});
slideTopButton.addEventListener("click", function() {
	openWindowUsing({ activityEnterTransition: Titanium.UI.Android.TRANSITION_SLIDE_TOP });
});
parentWindow.add(slideTopButton);
var slideBottomButton = Ti.UI.createButton({
	title: "Slide From Bottom",
	top: "8dp"
});
slideBottomButton.addEventListener("click", function() {
	openWindowUsing({ activityEnterTransition: Titanium.UI.Android.TRANSITION_SLIDE_BOTTOM });
});
parentWindow.add(slideBottomButton);
var fadeButton = Ti.UI.createButton({
	title: "Fade In",
	top: "8dp"
});
fadeButton.addEventListener("click", function() {
	openWindowUsing({
		activityEnterTransition: Ti.UI.Android.TRANSITION_FADE_IN,
		activityReenterTransition: Ti.UI.Android.TRANSITION_FADE_IN,
		activityExitTransition: Ti.UI.Android.TRANSITION_FADE_OUT,
		activityReturnTransition: Ti.UI.Android.TRANSITION_FADE_OUT,
	});
});
parentWindow.add(fadeButton);
parentWindow.open();

Shared Element Transition Test:
(This tests that views in one window can slide/animate to a different position in another window.)

  1. Build and run the below code on Android.
  2. Tap on the "Open Child Window" button.
  3. Verify that a purple window fades-in to the screen.
  4. Verify that label in top-left corner slides down to the bottom-left corner.
  5. Verify that label in bottom-right corner slides up to the top-right-corner.
  6. Tap on the Android "Back" button.
  7. Verify that the purple window fades-out and back to the blue parent window.
  8. Verify that label in bottom-left corner slides up back to the top-left corner.
  9. Verify that label in top-right corner slides down back to the bottom-right corner.
var parentWindow = Ti.UI.createWindow({
	title: "Parent Window",
	backgroundColor: "blue",
});
var sourceLabel1 = Ti.UI.createLabel({
	text: "Transition Label 1",
	top: "10dp",
	left: "10dp",
});
parentWindow.add(sourceLabel1);
var sourceLabel2 = Ti.UI.createLabel({
	text: "Transition Label 2",
	bottom: "10dp",
	right: "10dp",
});
parentWindow.add(sourceLabel2);
var openButton = Ti.UI.createButton({
	title: "Open Child Window",
});
openButton.addEventListener("click", function() {
	var childWindow = Ti.UI.createWindow({
		title: "Child Window",
		backgroundColor: "purple",
	});
	var targetLabel1 = Ti.UI.createLabel({
		text: "Transition Label 1",
		transitionName: "label1Transition",
		bottom: "10dp",
		left: "10dp",
	});
	childWindow.add(targetLabel1);
	childWindow.addSharedElement(sourceLabel1, targetLabel1.transitionName);
	var targetLabel2 = Ti.UI.createLabel({
		text: "Transition Label 2",
		transitionName: "label2Transition",
		top: "10dp",
		right: "10dp",
	});
	childWindow.add(targetLabel2);
	childWindow.addSharedElement(sourceLabel2, targetLabel2.transitionName);
	var closeButton = Ti.UI.createButton({
		title: "Close Child Window",
	});
	closeButton.addEventListener("click", function() {
		childWindow.close();
	});
	childWindow.add(closeButton);
	childWindow.open();
});
parentWindow.add(openButton);
parentWindow.open();

…ement fade-in animation by default as of 8.0.1
@jquick-axway jquick-axway added this to the 8.1.0 milestone May 25, 2019
@build build requested review from a team May 25, 2019 05:07
@build build added the docs label May 25, 2019
@build
Copy link
Contributor

build commented May 25, 2019

Messages
📖

💾 Here's the generated SDK zipfile.

📖

✅ All tests are passing
Nice one! All 3613 tests are passing.
(There are 464 tests skipped)

Generated by 🚫 dangerJS against ac3a2c6

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

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

CR: PASS

@sgtcoolguy sgtcoolguy modified the milestones: 8.1.0, 8.2.0 Jun 3, 2019
@keerthi1032
Copy link
Contributor

FR passed. Tested with the testcase provided in the PR. Windows transition works as expected in default transition test, custom transition test, and shared element transition test.

Test Enviornment:
Name = Mac OS X
Version = 10.13.6
Node.js
Node.js Version = 8.9.1
npm Version = 5.5.1
Titanium CLI
CLI Version = 5.1.1
Titanium SDK
SDK Version = local sdk 8.1.0.v20190531110029 and local sdk 8.0.2.v20190604110038
CLI =7.0.11
Device = samsung s5 android 6,Nexus 4 android 4.4,Pixel android 9

@lokeshchdhry lokeshchdhry merged commit a85caa0 into tidev:master Jun 5, 2019
hansemannn pushed a commit to hansemannn/titanium_mobile that referenced this pull request Jul 8, 2019
… as of 8.0.1 (tidev#10910)

* [TIMOB-27101] Android: Fixed bug where Window.open() does a shared-element fade-in animation by default as of 8.0.1

* Android: Improved transition animation to not overlap status bar and navigation bar for [TIMOB-27101]

* Android: Added shared-element transition unit test for [TIMOB-27101]

* Increased timeouts in unit tests for [TIMOB-27101]
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