app / sg.edu.ntu.scse.cz2006.gymbuddies.util / SwipeDeleteCallback / onSwiped

onSwiped

fun onSwiped(viewHolder: ViewHolder, direction: Int): Unit

Called when a ViewHolder is swiped by the user.

If you are returning relative directions ({@link #START} , {@link #END}) from the {@link #getMovementFlags(RecyclerView, ViewHolder)} method, this method will also use relative directions. Otherwise, it will use absolute directions.

If you don't support swiping, this method will never be called.

ItemTouchHelper will keep a reference to the View until it is detached from RecyclerView. As soon as it is detached, ItemTouchHelper will call {@link #clearView(RecyclerView, ViewHolder)}.

Parameters

viewHolder - The ViewHolder which has been swiped by the user.

direction - The direction to which the ViewHolder is swiped. It is one of {@link #UP}, {@link #DOWN}, {@link #LEFT} or {@link #RIGHT}. If your {@link #getMovementFlags(RecyclerView, ViewHolder)} method returned relative flags instead of {@link #LEFT} / {@link #RIGHT}; direction will be relative as well. ({@link #START} or {@link #END}).