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

onChildDraw

fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean): Unit

Called by ItemTouchHelper on RecyclerView's onDraw callback.

If you would like to customize how your View's respond to user interactions, this is a good place to override.

Default implementation translates the child by the given dX, dY. ItemTouchHelper also takes care of drawing the child after other children if it is being dragged. This is done using child re-ordering mechanism. On platforms prior to L, this is achieved via {@link android.view.ViewGroup#getChildDrawingOrder(int, int)} and on L and after, it changes View's elevation value to be greater than all other children.)

Parameters

c - The canvas which RecyclerView is drawing its children

recyclerView - The RecyclerView to which ItemTouchHelper is attached to

viewHolder - The ViewHolder which is being interacted by the User or it was interacted and simply animating to its original position

dX - The amount of horizontal displacement caused by user's action

dY - The amount of vertical displacement caused by user's action

actionState - The type of interaction on the View. Is either {@link #ACTION_STATE_DRAG} or {@link #ACTION_STATE_SWIPE}.

isCurrentlyActive - True if this view is currently being controlled by the user or false it is simply animating back to its original state.