Borrowing Android's Touch Resampling Algorithm?


#1

In my search to find out how to make dragging and scrolling smooth on Android, I've come across an interesting article: http://www.masonchang.com/blog/2014/8/25/androids-touch-resampling-algorithm

It describes Android's technique for smoothing UI touch events, and points to some code here: http://androidxref.com/4.4.4_r1/xref/frameworks/native/libs/input/InputTransport.cpp#675

 

I've started trying to implement component position smoothing but its proving difficult. Cant see how to intercept and alter MouseEvents for a component. (Currently got smoothed position and MouseEvents fighting each other)

Perhaps we can borrow from Android here? 


#2

We are currently looking at a good way to achieve this together with more complete support for gestures. 


#3

After a couple days hacking and trying to mimic this with a ComponentListener ComponentAnimator, I've come to the conclusion that this is not what my issue is about.

Its something to do with heavy draw calls - if a drag is over component(s), or a scrolling viewport is over a certain size, then there is a noticeable lag (even with OpenGL rendering).  

You can see this in the Window part of the JUCE Demo. If the window is over empty space it is smooth; move it over another window or component and the whole UI slows down and becomes laggy. 

 

@fabian - thanks, glad you guys are looking at it as I feel this is an important issue for Android development with JUCE, and its been bugging me recently - hence spending time seeing if I can fix it myself! 

As long as I know its being looked at (along with gestures) then I can get back to focussing on the main functionality of my app.  

 

EDIT: I dont know if this is helpful or relevant as its quite old now, but seems to be a similar issue: https://groups.google.com/d/topic/android-developers/V6_lEgwkw3E