Sorry that I am not very versed in myself and actually trying to work on this issue myself ... I use titanium api for programming, so I am not familiar with the syntax of your code, although I get a general idea ... (Still on two week study period for my internship)
POINT OF THOUGHT, I see the following lines of code quite early
//right to left swipe if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { isRightToLeft = true; return true; } // left to right swipe else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { isRightToLeft = false; return true; }
It looks like your equation
if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX)
will work to detect swipe ... However, the ABS() function in your code will only interpret the swipe value and will not be able to determine the difference in direction. Hope this helps!
Mojo1 source share