getMovementFlags

Should return a composite flag which defines the enabled move directions in each state (idle, swiping, dragging).

Instead of composing this flag manually, you can use makeMovementFlags or makeFlag.

This flag is composed of 3 sets of 8 bits, where first 8 bits are for IDLE state, next 8 bits are for SWIPE state and third 8 bits are for DRAG state. Each 8 bit sections can be constructed by simply OR'ing direction flags defined in ItemTouchHelper.

For example, if you want it to allow swiping LEFT and RIGHT but only allow starting to swipe by swiping RIGHT, you can return:

     makeFlag(ACTION_STATE_IDLE, RIGHT) | makeFlag(ACTION_STATE_SWIPE, LEFT | RIGHT);
This means, allow right movement while IDLE and allow right and left movement while swiping.

Return

flags specifying which movements are allowed on this ViewHolder.

Parameters

recyclerView

The RecyclerView to which ItemTouchHelper is attached.

viewHolder

The ViewHolder for which the movement information is necessary.

See also