Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13543] Android: add support for activityEnterAnimation and activityExitAnimation for Window.close method

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-07-10T20:37:14.000+0000
Affected Version/sRelease 3.2.0
Fix Version/s2013 Sprint 14, 2013 Sprint 14 API, Release 3.1.2, Release 3.2.0
ComponentsAndroid
LabelsactivityExitAnimation, android, close, exalture, module_window, open, qe-testadded, window
ReporterCarter Lathrop
AssigneeBiju pm
Created2013-04-12T14:09:27.000+0000
Updated2013-10-23T23:15:18.000+0000

Description

*Problem* The ability to animate enter and exit activities on opening windows is working fine, but this is only useful when you need to progress forward in an apps UI. If one wants to close windows and go backwards (hit the back button) they cannot use the animations which only work on win.open() and not on win.close(). The pull request below allows the ability to use the activityAnimations when closing a window. test case for the pull request

var win = Ti.UI.createWindow({
	backgroundColor:'white'
});

var button = Ti.UI.createButton({title:'open'});
button.addEventListener('click', function (){
	var win = Ti.UI.createWindow({
		backgroundColor:'blue',
		modal:false
	});
	win.addEventListener('android:back', function(){
		win.close({
		    activityExitAnimation: Ti.Android.R.anim.slide_out_right
		});
	})
	win.open({
	    activityEnterAnimation: Ti.Android.R.anim.fade_in,
	})
	
})
win.add(button);
win.open();

Comments

  1. Martin Guillon 2013-04-12

    pull request https://github.com/appcelerator/titanium_mobile/pull/4152
  2. Carter Lathrop 2013-04-12

    Martin, what version of Ti SDK are you experiencing this on?
  3. Carter Lathrop 2013-04-12

    Unable to reproduce with 3.0.2GA and 3.1.xx on Android 4.1.2. Fading working as expected on both exit and entrance to new blue window. Can you please provide more details as well as steps to reproduce so that I may have better luck reproducing this issue? For reference on how to submit a bug report: https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report Regards, Carter
  4. Martin Guillon 2013-04-12

    This feature was introduced for 3.2.0 and as mentioned in the environment this bugs is on 3.2.0 master In fact after working on it it apperas that activityExitAnimtation doesn't do what we expect it to do. It doesn't hanfdle the closing of your window but how the current window disappear. So it s much of a new addition tu support window close animation
  5. Martin Guillon 2013-04-12

    You won't be able to test this with any official release. It s not yet in. You have to build and use the master branch
  6. Carter Lathrop 2013-04-12

    Martin, wasn't this implemented in 3.1? I made a mistake using 3.0.2 before, I thought it was implemented then. Regardless this is a bug due to the activityEnterAnimation working but the exit is not. Thanks for bringing this to our attention, Carter
  7. Carter Lathrop 2013-04-12

    Docs say 3.1: http://docs.appcelerator.com/titanium/3.0/#!/api/openWindowParams-property-activityExitAnimation
  8. Martin Guillon 2013-04-12

    Yes you are right. That s it. It often misunderstood what activityExitAnimation does and I did! My pull request add what I was expecting it to do, it adds support for animation when closing a heavyweight window I will update my test case tomorrow to ahow its full potential( alreDy using it and it s working great)
  9. Martin Guillon 2013-04-12

    Maybe you could rename that ticket to "support for activityEnterAnimation and activityExitAnimation for Window.close method"
  10. Carter Lathrop 2013-04-12

    I'm pretty sure that activityEnterAnimation is working, it's just activityExitAnimation that is not triggering. Am I missing something?
  11. Martin Guillon 2013-04-12

    Both were working. While creating that pullrequest i thought the exit one wasn't working I was expexting it to define the animation when I close my window I was wrong. My pull request adds the support for what I was missing: animation upon window close. The two properties can be used for Aactivity.start and Activity.finish
  12. Carter Lathrop 2013-04-12

    Ok, so the activityEnterAnimation is for the new window that is being opened and the activityExitAnimation is for the OLD window that is being opened over, for some reason I didn't realize this before. Now I understand your need for the close activityAnimations for when you want to return to previous windows using an animation, Ill change around the ticket description to reflect this.
  13. Martin Guillon 2013-04-12

    I didn't realized that either. That's why my bug request was misleading you. Sorry
  14. Carter Lathrop 2013-04-12

    Ok, made the changes, feel free to add to it for clarity. I may have removed your first test code on accident, if you want to replace it, go ahead if you think it is needed.
  15. Martin Guillon 2013-04-12

    I ll update the testcase tomorrow to show the full potential
  16. Carter Lathrop 2013-04-12

    Ok, thanks again for your input and pull request. Engineering will review it asap.
  17. Martin Guillon 2013-04-13

    new test case showing the full power of it
        var win = Ti.UI.createWindow({
            backgroundColor:'white'
        });
         
        var button = Ti.UI.createButton({title:'open'});
        button.addEventListener('click', function (){
            var win = Ti.UI.createWindow({
                backgroundColor:'blue',
                modal:false
            });
            win.addEventListener('android:back', function(){
                win.close({
                    activityEnterAnimation: Ti.Android.R.anim.fade_in,
                    activityExitAnimation: Ti.Android.R.anim.slide_out_right
                });
            })
            win.open({
                activityEnterAnimation: Ti.Android.R.anim.fade_in,
                activityExitAnimation: Ti.Android.R.anim.slide_out_right
            })
             
        })
        win.add(button);
        win.open();
        
    Everything else seems fine to me. Thanks for your work
  18. Biju pm 2013-05-31

    add support enter animation and exit animation for window close activity https://github.com/appcelerator/titanium_mobile/pull/4344
  19. Allen Yeung 2013-07-10

    Fixed as a part of https://github.com/appcelerator/titanium_mobile/pull/4417
  20. Priya Agarwal 2013-07-29

    Updated Label. Closing as Fixed. Verified with: Studio: 3.1.2.201307261628 SDK: 3.1.2.v20130726192706 acs:1.0.4 alloy:1.2.0-alpha titanium:3.1.1 titanium-code-processor:1.0.2-alpha OS: OSX 10.8.4 Device: Google Nexus 7 (v4.2.1) activityEnterAnimation and activityExitAnimation working well both for Window.close and Window.open method.

JSON Source