Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17083] Android: Animation: App freezes when continously clicked on view while animation

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-06-10T01:05:43.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sRelease 3.3.0, Release 3.4.0
ComponentsAndroid
Labelsmodule_animation, qe-3.3.0, qe-testadded
ReporterPragya Rastogi
AssigneeHieu Pham
Created2014-06-06T08:43:46.000+0000
Updated2014-07-02T08:23:47.000+0000

Description

Clicking on view continuously while animation, freezes the app. This is not regression as it occurred in SDK: 3.2.3.GA *Steps To Replicate* 1. Launch app using below code in app.js 2. Click on Red view to start animation 3. When Red view size increases during animation, click n number of times. Observe app freezes and Red view size remains larger and does not decrease on further click. 4. Now click blue view to generate animation and click n times when the view is rotated to a degree Actual: Observe the view freezes in that particular state only. Size does not decrease for red view and blue does not comes at its original position.[Screenshot attached] Expected: Animation should complete while clicking and app should not freeze.
var win = Ti.UI.createWindow({
    backgroundColor:'green'
});
  
var box = Ti.UI.createView({
                backgroundColor : 'red',
                height : '150dp',
                width : '100dp',
                top: '50dp'
            });
              
            box.addEventListener('click', function() {
                var matrix = Ti.UI.create2DMatrix().scale(1.5, 1.5);
                var a = Ti.UI.createAnimation({
                    transform : matrix,
                    duration : 500,
                    autoreverse : true,
                    repeat : 2
                });
                box.animate(a);
            });
            win.add(box);
              
            var box2 = Ti.UI.createView({
                backgroundColor: "blue",
                top: "285dp",
                height: "100dp",
                width: "100dp"
            });
              
            box2.addEventListener("click", function() {
                var matrix = Ti.UI.create2DMatrix().rotate(97);
                box2.animate({transform: matrix, duration: 500, autoreverse: true, repeat: 2});
            });
        win.add(box2);
win.open();
Note: Works fine on iOS. Verified using iPod touch2 (v7.1)

Attachments

FileDateSize
AnimationError.png2014-06-06T08:43:46.000+000025050

Comments

  1. Lokesh Choudhary 2014-06-06

    Verified the issue is reproducible. NOTE: The app does not freeze but the animation stops. There is no fixed value of "n". With the first tap animation starts. With second tap while the animation is running , the animation slows down little bit. With subsequent taps while animation is running, it reaches a point where the animation stops(due to consequent slowing of the animation). On IOS: IF we tap the view while the animation is running we get a warning:
    [WARN] :   New layout set while view [object TiUIView] animating: Will relayout after animation.
    So, I guess in android it does not wait for the current animation to complete when it receives the second or "n" th tap. Environment: Appc Studio : 3.3.0.201405271647 Ti SDK : 3.3.0.v20140605150555 Mac OSX : 10.8.5 Alloy : 1.4.0-beta2 CLI - 3.3.0-beta2 Code Processor: 1.1.1 Nexus 5 - android 4.4.2
  2. Hieu Pham 2014-06-10

    master PR: https://github.com/appcelerator/titanium_mobile/pull/5782 3.3.X PR: https://github.com/appcelerator/titanium_mobile/pull/5784
  3. Priya Agarwal 2014-06-11

    Verified with: Appcelerator-Studio: 3.3.0.201406061445 Sdk:3.3.0.v20140610102512 acs:1.0.14 alloy:1.4.0-rc npm:1.3.2 titanium:3.3.0-rc titanium-code-processor:1.1.1 xcode:5.1.1 OS:Maverick(10.9.3) Device:iPhone5c(v7.1.1),Nexus7(v4.4.2) App does not freeze on clicking animated box n number of times. Hence closing the issue.

JSON Source