public class SwipeGestureEventHandler extends AbstractDragGestureEventHandler
Modifier and Type | Class and Description |
---|---|
static interface |
SwipeGestureEventHandler.Callback
Defines the interface, a class, which should be notified about the events of a
SwipeGestureEventHandler , must implement. |
MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
SwipeGestureEventHandler(TabSwitcher tabSwitcher,
int dragThreshold,
android.graphics.RectF touchableArea,
long animationDuration)
Creates a new event handler, which allows to handle swipe gestures, which can be used to
switch between tabs.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
isDraggingAllowed()
Returns, whether performing a drag gesture is currently allowed, or not.
|
protected void |
onDown(android.view.MotionEvent event)
The method, which is invoked on implementing subclasses in order to handle, when a drag
gesture has been started.
|
protected void |
onDrag(android.view.MotionEvent event)
The method, which is invoked on implementing subclasses in order to handle, when a drag
gesture is performed.
|
protected void |
onTouchEvent()
The method, which is invoked on implementing subclasses, when a touch event is about to be
handled.
|
protected void |
onUp(android.view.MotionEvent event)
Handles, when a drag gesture has been ended.
|
void |
setCallback(SwipeGestureEventHandler.Callback callback)
Sets the callback, which should be notified about the event handler's events.
|
getTouchableArea
compare, equals, getDragHelper, getPriority, getTabSwitcher, getVelocityTracker, handleTouchEvent, hashCode, isDragging, isInsideTouchableArea, isReset, reset, setPointerId
public SwipeGestureEventHandler(@NonNull TabSwitcher tabSwitcher, int dragThreshold, @Nullable android.graphics.RectF touchableArea, long animationDuration)
tabSwitcher
- The tab switcher, the event handler belongs to, as an instance of the class TabSwitcher
. The tab switcher may not be nulldragThreshold
- The drag threshold in pixels as an Integer
value. The drag threshold must be
at least 0touchableArea
- The bounds of the onscreen area, the handler should take into consideration for
handling touch events, as an instance of the class RectF
or null, if the are
should not be restrictedanimationDuration
- The duration of the swipe animation in milliseconds as a Long
value or -1, if
the default duration should be usedpublic final void setCallback(@Nullable SwipeGestureEventHandler.Callback callback)
callback
- The callback, which should be set, as an instance of the type SwipeGestureEventHandler.Callback
or
null, if no callback should be notifiedprotected final boolean isDraggingAllowed()
AbstractTouchEventHandler
isDraggingAllowed
in class AbstractTouchEventHandler
protected final void onTouchEvent()
AbstractTouchEventHandler
onTouchEvent
in class AbstractTouchEventHandler
protected final void onDown(@NonNull android.view.MotionEvent event)
AbstractTouchEventHandler
onDown
in class AbstractTouchEventHandler
event
- The touch event, which started the drag gesture, as an instance of the class MotionEvent
. The touch event may not be nullprotected final void onDrag(@NonNull android.view.MotionEvent event)
AbstractTouchEventHandler
onDrag
in class AbstractTouchEventHandler
event
- The last touch event of the drag gesture as an instance of the class MotionEvent
. The touch event may not be nullprotected final void onUp(@Nullable android.view.MotionEvent event)
AbstractTouchEventHandler
onUp
in class AbstractTouchEventHandler
event
- The touch event, which ended the drag gesture, as an instance of the class MotionEvent
or null, if no fling animation should be triggered