I implemented a SimpleOnGestureListener on this Android app and it's the basic implementation and it's all working as it should:
the class implements OnTouchListener
and I set it as TouchListener for the correct View, on the touch event I call my instance of SimpleOnGestureListener
@Override
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
and in my fling callback I'm logging the velocityY (the app is using some swipe-down gesture)
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY){
Log.d(TAG, "velocityY = " + velocityY);
... some code ...
}
the method is called and I see values on my Log.
The issue is that for the Nexus 4 and Nexus 10 for a downward fling the velocityY is a positive value and for the Nexus 7 it's a negative value.
I know someone will suggest to use e2.getY - e1.getY
(or the raw) but they are not totally reliable, because silly users might (and will) drag the view down and then fling it up, but the difference will still be positive.
So the question is: is there a way to query the system what's the direction of this thing?