Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1011] Android: Animations Cause the location of touch events to be incorrect

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-07-20T18:30:35.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.2.0
ComponentsAndroid
Labelsallen-review, core, insight, merge, qe-testadded
ReporterDasher
AssigneeAllen Yeung
Created2011-04-15T02:41:29.000+0000
Updated2014-03-11T08:20:40.000+0000

Description

Android 2.2, Ti SDK 1.3, Horizontal Orientation Applying an animation to a view with a tableview child doesn't translate the tableview touch events. The touch events happen at the old location - rather than the new location. In the below example, clicking on an item in the tableview won't trigger an event - but clicking on the place where the item was before the animation happened - will trigger the event. Test case:
var win = Ti.UI.createWindow({backgroundColor: 'white'});

var vInv = Titanium.UI.createView({
   borderRadius:12,
   backgroundColor:'black',
   width:300,
   height:500,
   top: 10,
   opacity: 1,
   anchorPoint: {x:0,y:0},
   touchEnabled:true
});

win.add(vInv);

var tableData = [ {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'} ];
var tv = Ti.UI.createTableView({
	data: tableData
});


tv.addEventListener('click', function(e) {
	Ti.API.debug("***************** TableView Click");
});


vInv.add(tv);

vInv.show();

win.open();

var start = Ti.UI.create2DMatrix().translate(0,150);
vInv.animate({transform:start,delay:100,duration:1500});

Comments

  1. Junaid Younus 2012-08-13

    Tested with a Samsung Galaxy S3 using TiSDK 2.2.0v20120810194112, issue still exists.
  2. Ingo Muschenetz 2012-12-20

    Comment from Bill Dawson: In iOS, when you animate a view such as by changing its size (scale animation) or location (translate animation), iOS is kind enough to adjust the touch target. Android'sold animation -- which Ti uses since the new one came about in Honeycomb -- does not do this. So in Ti one has to re-layout the view, which (I believe) is often the source of blips and artifacts seen on older devices. Also it makes the code ugly.
  3. Matt Langston 2013-04-26

    TIMOB-12842 has a reproducible project the demonstrates the issue, and may actually be a duplicate of this bug.
  4. Allen Yeung 2013-07-20

    Resolving as a part of https://github.com/appcelerator/titanium_mobile/pull/4398. Please note that this is a "won't fix" for versions lower than Honeycomb. This is a native Android limitation that we can't work around.
  5. Priya Agarwal 2013-10-21

    Verified the fix with: Appc-Studio: 3.2.0.201310181700 Sdk:3.2.0.v20131018154951 alloy:1.2.2 npm:1.3.2 titanium:3.2.0 titanium-code-processor:1.0.3 Device:Google Nexus 7(v4.3),iPhone5(v 7) Xcode: 5 Touch Events working fine while and after animation.

JSON Source