[TIMOB-15951] Android: Animating a child view in vertical layout no longer works correctly
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-01-22T00:19:53.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 26, 2013 Sprint 26 API, 2014 Sprint 01, 2014 Sprint 01 API, Release 3.2.3, Release 3.3.0 |
Components | Android |
Labels | 3.2.0, Alloy, android, animation, module_animation, qe-closed-3.2.3, qe-testadded, regression, triage |
Reporter | John Liddell |
Assignee | Ping Wang |
Created | 2013-12-05T22:34:50.000+0000 |
Updated | 2014-03-21T03:44:21.000+0000 |
Description
Animating a child view contained in a view with a vertical layout no longer adjusts the other children as it used to. Now the views just stay stationary while the animation happens.
the following snippet shows the issue, the second square should be moving up and down to compensate for the animation but it doesn't now.
Sample Code:
*index.xml*
<Alloy>
<Window class="container">
</Window>
</Alloy>
*index.js*
var bBig = false;
var btn = Ti.UI.createButton( {
width : '90%',
height : '40dp',
title : 'Start Test',
top: 0
} );
var parent = Ti.UI.createView({
height: 100,
width: 100,
layout: 'vertical'
});
var v1 = Ti.UI.createView({
height: 50,
width: 50,
top: 5,
backgroundColor: 'red'
});
var v2 = Ti.UI.createView({
height: 50,
width: 50,
top: 20,
backgroundColor: 'blue'
});
btn.addEventListener( 'click', function( e ) {
if( !bBig ){
bBig = true;
v1.animate( Ti.UI.createAnimation({
height:100,
duration: 300
}));
} else {
bBig = false;
v1.animate( Ti.UI.createAnimation({
height:50,
duration: 300
}));
}
} );
$.index.add( btn );
$.index.add( parent );
parent.add( v1 );
parent.add( v2 );
$.index.open();
I was able to reproduce this issue. In 3.2.0, when the "Start Test" button is clicked the red box moves down and overlaps the blue box. In 3.1.2, when the "Start Test" button is clicked the red box moves down and the blue box shrinks out of the way. The blue box does not animate properly in SDK 3.2.0.
Test case
In 3.2.0 (TIMOB-11811), we start to use the new animation mechanism - [Property Animation](http://android-developers.blogspot.com/2011/02/animation-in-honeycomb.html). The size/location animation inside a vertical/horizontal layout is broken under the property animation mechanism right now. Here is a temporary workaround for the above test case:
Extended test case:
PR: https://github.com/appcelerator/titanium_mobile/pull/5128 For FR: 1. Run the above test case in Hieu's comment and the test case below on 2.3, 3.x and 4.x devices.
2. Run KS for a sanity check. 3. Run Anvil. Should be 429 passed / 42 failed.
Re-open the ticket since found an issue regarding the 2DMatrix animation introduced by the above PR. To reproduce the issue, run the code below. The view is scaled but the anchor point is not the center of the view.
PR: https://github.com/appcelerator/titanium_mobile/pull/5226 (in this PR I reverted the previous [PR#5128](https://github.com/appcelerator/titanium_mobile/pull/5128)). 3_2_X PR: https://github.com/appcelerator/titanium_mobile/pull/5245 For FR, please follow the testing steps in TIMOB-15951, TIMOB-16087, TIMOB-15719, TIMOB-2373, TIMOB-13536.
Verified with: Appc Studio:3.2.3.201403190645 Sdk:3.2.3.v20140319174101 alloy:1.3.1 titanium:3.2.1 titanium-code-processor:1.1.0 Osx: Maverick(10.9.2) Device:iPad(v6.1.3),LG-970(V4.0.4) xCode:5.1 Followed the last test Code. Verified animations works fine. Hence closing the issue.