Class PlaneGestureDetector

  • All Implemented Interfaces:
    android.view.GestureDetector.OnGestureListener, Touchable

    public class PlaneGestureDetector
    extends java.lang.Object
    implements android.view.GestureDetector.OnGestureListener, Touchable
    Convenience class to detect gestures from a specific view.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isLongpressEnabled()  
      boolean onDown​(android.view.MotionEvent e)
      boolean onFling​(android.view.MotionEvent e1, android.view.MotionEvent e2, float velocityX, float velocityY)
      void onLongPress​(android.view.MotionEvent e)
      boolean onScroll​(android.view.MotionEvent e1, android.view.MotionEvent e2, float distanceX, float distanceY)
      void onShowPress​(android.view.MotionEvent e)
      boolean onSingleTapUp​(android.view.MotionEvent e)
      boolean onTouchEvent​(double time, android.view.MotionEvent event, int surfaceHeight)
      Analyzes the given motion event and if applicable triggers the appropriate callbacks on the PlaneGestureListener supplied.
      void setIsLongpressEnabled​(boolean isLongpressEnabled)
      Set whether longpress is enabled, if this is enabled when a user presses and holds down you get a longpress event and nothing further.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PlaneGestureDetector

        public PlaneGestureDetector​(android.content.Context context,
                                    PlaneGestureListener listener)
        PlaneGestureDetector constructor.
        Parameters:
        context - the context
        listener - the listener for gesture events
    • Method Detail

      • setIsLongpressEnabled

        public void setIsLongpressEnabled​(boolean isLongpressEnabled)
        Set whether longpress is enabled, if this is enabled when a user presses and holds down you get a longpress event and nothing further. If it's disabled the user can press and hold down and then later moved their finger and you will get scroll events. By default longpress is enabled.
        Parameters:
        isLongpressEnabled - whether longpress should be enabled.
      • isLongpressEnabled

        public boolean isLongpressEnabled()
        Returns:
        true if longpress is enabled, else false.
      • onTouchEvent

        public boolean onTouchEvent​(double time,
                                    android.view.MotionEvent event,
                                    int surfaceHeight)
        Analyzes the given motion event and if applicable triggers the appropriate callbacks on the PlaneGestureListener supplied.
        Specified by:
        onTouchEvent in interface Touchable
        Parameters:
        event - the current motion event.
        Returns:
        true if the PlaneGestureListener consumed the event, otherwise false.
      • onDown

        public boolean onDown​(android.view.MotionEvent e)
        Specified by:
        onDown in interface android.view.GestureDetector.OnGestureListener
      • onShowPress

        public void onShowPress​(android.view.MotionEvent e)
        Specified by:
        onShowPress in interface android.view.GestureDetector.OnGestureListener
      • onSingleTapUp

        public boolean onSingleTapUp​(android.view.MotionEvent e)
        Specified by:
        onSingleTapUp in interface android.view.GestureDetector.OnGestureListener
      • onScroll

        public boolean onScroll​(android.view.MotionEvent e1,
                                android.view.MotionEvent e2,
                                float distanceX,
                                float distanceY)
        Specified by:
        onScroll in interface android.view.GestureDetector.OnGestureListener
      • onLongPress

        public void onLongPress​(android.view.MotionEvent e)
        Specified by:
        onLongPress in interface android.view.GestureDetector.OnGestureListener
      • onFling

        public boolean onFling​(android.view.MotionEvent e1,
                               android.view.MotionEvent e2,
                               float velocityX,
                               float velocityY)
        Specified by:
        onFling in interface android.view.GestureDetector.OnGestureListener