public static class NacCardTouchHelper.Callback
extends androidx.recyclerview.widget.ItemTouchHelper.Callback
| Constructor and Description |
|---|
Callback(NacCardTouchHelper.Adapter adapter) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearView(androidx.recyclerview.widget.RecyclerView rv,
androidx.recyclerview.widget.RecyclerView.ViewHolder vh)
Clear the view.
|
int |
convertToAbsoluteDirection(int flags,
int dir)
Convert the movement of the card to an absolute direction.
|
int |
getMovementFlags(androidx.recyclerview.widget.RecyclerView rv,
androidx.recyclerview.widget.RecyclerView.ViewHolder vh)
Set te movement flags for the card, to allow it to be swiped left and
right.
|
float |
getSwipeEscapeVelocity(float defaultValue) |
float |
getSwipeThreshold(androidx.recyclerview.widget.RecyclerView.ViewHolder vh) |
boolean |
isCollapsed()
Check if card is collapsed.
|
boolean |
isItemViewSwipeEnabled()
Allow the card to be swiped.
|
boolean |
isLongPressDragEnabled()
Do not allow the card to be dragged.
|
void |
onChildDraw(android.graphics.Canvas c,
androidx.recyclerview.widget.RecyclerView rv,
androidx.recyclerview.widget.RecyclerView.ViewHolder vh,
float dx,
float dy,
int action,
boolean active)
Called when the child is drawn.
|
boolean |
onMove(androidx.recyclerview.widget.RecyclerView rv,
androidx.recyclerview.widget.RecyclerView.ViewHolder vh,
androidx.recyclerview.widget.RecyclerView.ViewHolder target)
Do not allow movement of cards.
|
void |
onSwiped(androidx.recyclerview.widget.RecyclerView.ViewHolder vh,
int dir)
Called when item is swiped.
|
canDropOver, chooseDropTarget, convertToRelativeDirection, getAnimationDuration, getBoundingBoxMargin, getDefaultUIUtil, getMoveThreshold, getSwipeVelocityThreshold, interpolateOutOfBoundsScroll, makeFlag, makeMovementFlags, onChildDrawOver, onMoved, onSelectedChangedpublic Callback(NacCardTouchHelper.Adapter adapter)
adapter - The object that overrides the event methods.public void clearView(@NonNull
androidx.recyclerview.widget.RecyclerView rv,
@NonNull
androidx.recyclerview.widget.RecyclerView.ViewHolder vh)
clearView in class androidx.recyclerview.widget.ItemTouchHelper.Callbackrv - The recycler view.vh - The view holder.public int convertToAbsoluteDirection(int flags,
int dir)
convertToAbsoluteDirection in class androidx.recyclerview.widget.ItemTouchHelper.Callbackflags - Movement flags.dir - The direction information.public int getMovementFlags(@NonNull
androidx.recyclerview.widget.RecyclerView rv,
@NonNull
androidx.recyclerview.widget.RecyclerView.ViewHolder vh)
getMovementFlags in class androidx.recyclerview.widget.ItemTouchHelper.Callbackrv - The recycler view.vh - The view holder.public float getSwipeEscapeVelocity(float defaultValue)
getSwipeEscapeVelocity in class androidx.recyclerview.widget.ItemTouchHelper.Callbackpublic float getSwipeThreshold(@NonNull
androidx.recyclerview.widget.RecyclerView.ViewHolder vh)
getSwipeThreshold in class androidx.recyclerview.widget.ItemTouchHelper.Callbackpublic boolean isCollapsed()
public boolean isItemViewSwipeEnabled()
isItemViewSwipeEnabled in class androidx.recyclerview.widget.ItemTouchHelper.Callbackpublic boolean isLongPressDragEnabled()
isLongPressDragEnabled in class androidx.recyclerview.widget.ItemTouchHelper.Callbackpublic void onChildDraw(@NonNull
android.graphics.Canvas c,
@NonNull
androidx.recyclerview.widget.RecyclerView rv,
@NonNull
androidx.recyclerview.widget.RecyclerView.ViewHolder vh,
float dx,
float dy,
int action,
boolean active)
onChildDraw in class androidx.recyclerview.widget.ItemTouchHelper.Callbackc - The canvas.rv - The recycler view.vh - The view holder.dx - The amount the card has been swiped in the x-direction.dy - The amount the card has been swiped in the y-direction.action - The action that was done on the card.active - Whether the card is being used by the user or not.public boolean onMove(@NonNull
androidx.recyclerview.widget.RecyclerView rv,
@NonNull
androidx.recyclerview.widget.RecyclerView.ViewHolder vh,
@NonNull
androidx.recyclerview.widget.RecyclerView.ViewHolder target)
onMove in class androidx.recyclerview.widget.ItemTouchHelper.Callbackrv - The recycler view.vh - The view holder.target - The target view holder.public void onSwiped(@NonNull
androidx.recyclerview.widget.RecyclerView.ViewHolder vh,
int dir)
onSwiped in class androidx.recyclerview.widget.ItemTouchHelper.Callbackvh - The view holder.dir - The direction that the item was swiped.