@Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { /*boolean res = super.onFling(e1, e2, velocityX, velocityY); Log.i("OF","onFLing" + res); return res;*/ final float xDistance = Math.abs(e1.getX() - e2.getX()); final float yDistance = Math.abs(e1.getY() - e2.getY()); if (xDistance > OFGestureListener.swipe_Max_Distance || yDistance > OFGestureListener.swipe_Max_Distance) return false; velocityX = Math.abs(velocityX); velocityY = Math.abs(velocityY); boolean result = false; if (velocityX > OFGestureListener.swipe_Min_Velocity && xDistance > OFGestureListener.swipe_Min_Distance) { if (e1.getX() > e2.getX()) // right to left OFAndroid.onSwipe(e1.getPointerId(0), SWIPE_LEFT); else OFAndroid.onSwipe(e1.getPointerId(0), SWIPE_RIGHT); result = true; } else if (velocityY > OFGestureListener.swipe_Min_Velocity && yDistance > OFGestureListener.swipe_Min_Distance) { if (e1.getY() > e2.getY()) // bottom to up OFAndroid.onSwipe(e1.getPointerId(0), SWIPE_UP); else OFAndroid.onSwipe(e1.getPointerId(0), SWIPE_DOWN); result = true; } return result; }