Hello,
I have an app that contains a scrollableView with an array of views. I use a simple scroll event handler to capture user swiping action and display the next view after doing some processing.
I recently upgraded my Android app from sdk 1.8.2 to sdk 2.1.3 and changed the old scroll event to dragEnd as recommended by the docs when replication of the old behavior is desired on Android, but have run into problems. I also tried using scrollEnd and ran into other problems. On iOS, using scrollEnd works great, just like before, but on Android neither events work well for different reasons.
On Android, the dragEnd event is only being correctly updated with the active view if the physical drag event crosses the screen midpoint (I have to drag my finger all the way across the screen's midpoint to get the event to update itself properly). If I don't do a full drag like this and do just a quick flick, the scrollableView scrolls to the next screen, but the dragEnd event isn't updated, and my next view shows up blank.
I also tried using scrollEnd (although Titanium docs indicate that in Android we should use dragEnd to replicate the previous scroll event behavior). Using scrollEnd, the event gets updated with the correct view, but here I encounter a different problem. The Android scrollEnd event handler gets triggered by certain method calls and not only physical events (I'm not quite sure, but I think that the scrollToView method triggers it). This breaks my code's logic and doesn't actually seem correct. In fact, this doesn't happen in iOS where the scrollEnd event only gets triggered if I physically scroll. And the old scroll event implementation didn't cause this either.
Has anybody experienced this, is there a way to ensure that the Android dragEnd updates with the correct active view when used with scrollableView? And why is scrollEnd being triggered by non-physical actions on Android? It seems to me that the new scroll event implementation is somewhat broken on Android.
Details: Titanium studio: build 2.1.2.20120830612 SDK: 2.1.3GA (also tried with 2.1.4GA) OSX: 10.6.8 Happens on both physical device and emulator on all Android versions from 2.3 to 4.0.3
Any help would be much appreciated, this thing's been driving me nuts!
Thanks!