public class PhoneDragTabsEventHandler extends AbstractDragTabsEventHandler<PhoneDragTabsEventHandler.Callback>
Modifier and Type | Class and Description |
---|---|
static interface |
PhoneDragTabsEventHandler.Callback
Defines the interface, a class, which should be notified about the events of a drag handler,
must implement.
|
AbstractDragTabsEventHandler.DragState
MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
PhoneDragTabsEventHandler(TabSwitcher tabSwitcher,
Arithmetics arithmetics,
de.mrapp.android.util.view.AttachedViewRecycler<AbstractItem,?> viewRecycler)
Creates a new drag handler, which allows to calculate the position and state of tabs on touch
events, when using the smartphone layout.
|
Modifier and Type | Method and Description |
---|---|
protected AbstractItem |
getFocusedItem(float position)
The method, which is invoked on implementing subclasses in order to retrieve the item, which
corresponds to the view, which is focused when clicking/dragging at a specific position.
|
protected boolean |
isSwipeThresholdReached(TabItem swipedTabItem)
Returns, whether the threshold of a swiped tab item, which causes the corresponding tab to be
removed, has been reached, or not.
|
protected float |
onOvershootEnd(float dragPosition,
float overshootThreshold)
The method, which is invoked on implementing subclasses, when the tabs are overshooting at
the end.
|
protected void |
onOvershootReverted()
The method, which is invoked on implementing subclasses, when an overshoot has been reverted.
|
protected float |
onOvershootStart(float dragPosition,
float overshootThreshold)
The method, which is invoked on implementing subclasses, when the tabs are overshooting at
the start.
|
protected void |
onReset()
The method, which invoked on implementing subclasses, when the drag handler has been reset.
|
getArithmetics, getCallback, handleDrag, isDragging, isDraggingAllowed, onDown, onDrag, onTouchEvent, onUp, reset, setCallback, setDragState
compare, equals, getDragHelper, getPriority, getTabSwitcher, getTouchableArea, getVelocityTracker, handleTouchEvent, hashCode, isInsideTouchableArea, isReset, setPointerId
public PhoneDragTabsEventHandler(@NonNull TabSwitcher tabSwitcher, @NonNull Arithmetics arithmetics, @NonNull de.mrapp.android.util.view.AttachedViewRecycler<AbstractItem,?> viewRecycler)
tabSwitcher
- The tab switcher, whose tabs' positions and states should be calculated by the drag
handler, as an instance of the class TabSwitcher
. The tab switcher may not be
nullarithmetics
- The arithmetics, which should be used to calculate the position, size and rotation of
tabs, as an instance of the type Arithmetics
. The arithmetics may not be
nullviewRecycler
- The view recycler, which allows to inflate the views, which are used to visualize the
tabs, whose positions and states should be calculated by the tab switcher, as an
instance of the class AttachedViewRecycler. The view recycler may not be null@Nullable protected final AbstractItem getFocusedItem(float position)
AbstractDragTabsEventHandler
getFocusedItem
in class AbstractDragTabsEventHandler<PhoneDragTabsEventHandler.Callback>
position
- The position on the dragging axis in pixels as a Float
valueAbstractItem
or null, if no view is focusedprotected final float onOvershootStart(float dragPosition, float overshootThreshold)
AbstractDragTabsEventHandler
onOvershootStart
in class AbstractDragTabsEventHandler<PhoneDragTabsEventHandler.Callback>
dragPosition
- The position of the pointer on the dragging axis in pixels as a Float
valueovershootThreshold
- The position on the dragging axis, an overshoot at the start currently starts at, in
pixels as a Float
valueFloat
valueprotected final float onOvershootEnd(float dragPosition, float overshootThreshold)
AbstractDragTabsEventHandler
onOvershootEnd
in class AbstractDragTabsEventHandler<PhoneDragTabsEventHandler.Callback>
dragPosition
- The position of the pointer on the dragging axis in pixels as a Float
valueovershootThreshold
- The position on the dragging axis, an overshoot at the end currently starts at, in
pixels as a Float
valueFloat
valueprotected final void onOvershootReverted()
AbstractDragTabsEventHandler
onOvershootReverted
in class AbstractDragTabsEventHandler<PhoneDragTabsEventHandler.Callback>
protected final void onReset()
AbstractDragTabsEventHandler
onReset
in class AbstractDragTabsEventHandler<PhoneDragTabsEventHandler.Callback>
protected final boolean isSwipeThresholdReached(@NonNull TabItem swipedTabItem)
AbstractDragTabsEventHandler
isSwipeThresholdReached
in class AbstractDragTabsEventHandler<PhoneDragTabsEventHandler.Callback>
swipedTabItem
- The swiped tab item as an instance of the class TabItem
. The tab item may not
be null