onSwiped

abstract fun onSwiped(@NonNull viewHolder: RecyclerView.ViewHolder, direction: Int)(source)

Called when a ViewHolder is swiped by the user.

If you are returning relative directions (START , END) from the getMovementFlags 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 clearView.

Parameters

viewHolder

The ViewHolder which has been swiped by the user.

direction

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