public static interface ItemTouchHelperCallback.AdapterCallback
ItemTouchHelperCallback.| Modifier and Type | Method and Description |
|---|---|
void |
onActionStateChanged(RecyclerView.ViewHolder viewHolder,
int actionState)
Called when the
ItemTouchHelper first registers an item as being moved or swiped
or when has been released. |
boolean |
onItemMove(int fromPosition,
int toPosition)
Called when an item has been dragged far enough to trigger a move.
|
void |
onItemSwiped(int position,
int direction)
Called when an item has been dismissed by a swipe.
|
boolean |
shouldMove(int fromPosition,
int toPosition)
Evaluate if positions are compatible for swapping.
|
void onActionStateChanged(RecyclerView.ViewHolder viewHolder,
int actionState)
ItemTouchHelper first registers an item as being moved or swiped
or when has been released.
Override this method to receive touch events with its state.
viewHolder - the viewHolder touchedactionState - one of ItemTouchHelper#ACTION_STATE_SWIPE or
ItemTouchHelper#ACTION_STATE_DRAG or
ItemTouchHelper#ACTION_STATE_IDLE.boolean shouldMove(int fromPosition,
int toPosition)
fromPosition - the start position of the moving itemtoPosition - the potential target position of the moving itemboolean onItemMove(int fromPosition,
int toPosition)
Implementations should call Adapter#notifyItemMoved(int, int)
after adjusting the underlying data to reflect this move.
fromPosition - the start position of the moved itemtoPosition - the resolved position of the moved itemvoid onItemSwiped(int position,
int direction)
Implementations should decide to call or not Adapter#notifyItemRemoved(int)
after adjusting the underlying data to reflect this removal.
position - the position of the item dismisseddirection - the direction to which the ViewHolder is swiped