java - onFling only called when swiping Left -
hello stackoverflow community,
i have strange problem simpleongesturelistener:
public class onswipetouchlistener implements view.ontouchlistener { //constructor... @suppresswarnings("deprecation") private final gesturedetector gesturedetector = new gesturedetector(new gesturelistener());  public boolean ontouch(final view v, final motionevent event) {     return gesturedetector.ontouchevent(event); }  private final class gesturelistener extends gesturedetector.simpleongesturelistener {      private static final int swipe_threshold = 100;     private static final int swipe_velocity_threshold = 100;          @override     public boolean onfling(motionevent e1, motionevent e2, float velocityx, float velocityy) {         try {              float diffx = e2.getrawx() - e1.getrawx();              if (math.abs(diffx) > swipe_threshold && math.abs(velocityx) > swipe_velocity_threshold) {                     if (diffx > 0) {                         onswiperight();                     }                     if(diffx < 0) {                         onswipeleft();                     }                 }         } catch (exception exception) {             exception.printstacktrace();         }         return false;     } }  public void onswiperight() {     log.i("pptremote", "swiped right!");     main.previousslide(); }  public void onswipeleft() {     log.i("pptremote", "swiped left!");     main.nextslide();   } }   my problem strange. onfling called, when i'm swiping left ?!
theporenta
 
 
Comments
Post a Comment