Package 

Class GestureFinder


  • 
    public abstract class GestureFinder
    
                        

    Base class for gesture finders. Gesture finders are passed down touch events to detect gestures.

    • Method Summary

      Modifier and Type Method Description
      void setActive(boolean active) Makes this instance active, which means, listening to events.
      boolean isActive() Whether this instance is active, which means, it is listeningto events and identifying new gestures.
      final boolean onTouchEvent(@NonNull() MotionEvent event) Called when new events are available.
      final Gesture getGesture() Returns the gesture that this instance is currently detecting.This is mutable - for instance, a scroll layout can detect bothhorizontal and vertical scroll gestures.
      final Array<PointF> getPoints() Returns an array of points that identify the currentlydetected gesture.
      final float computeValue(float currValue, float minValue, float maxValue) For CONTINUOUS gestures, returns the float value at the currentgesture state.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setActive

         void setActive(boolean active)

        Makes this instance active, which means, listening to events.

        Parameters:
        active - whether this should be active or not
      • isActive

         boolean isActive()

        Whether this instance is active, which means, it is listeningto events and identifying new gestures.

      • onTouchEvent

         final boolean onTouchEvent(@NonNull() MotionEvent event)

        Called when new events are available.If true is returned, users will call getGesture, getPoints and maybe getValue to know more about the gesture.

        Parameters:
        event - the new event
      • getGesture

        @NonNull() final Gesture getGesture()

        Returns the gesture that this instance is currently detecting.This is mutable - for instance, a scroll layout can detect bothhorizontal and vertical scroll gestures.

      • getPoints

        @NonNull() final Array<PointF> getPoints()

        Returns an array of points that identify the currentlydetected gesture. If no gesture was detected, this returnsan array of points with x and y set to 0.

      • computeValue

         final float computeValue(float currValue, float minValue, float maxValue)

        For CONTINUOUS gestures, returns the float value at the currentgesture state. This means, for example, scaling the old value with a pinch factor,taking into account the minimum and maximum values.

        Parameters:
        currValue - the last value
        minValue - the min possible value
        maxValue - the max possible value