getSwipeVelocityThreshold

open fun getSwipeVelocityThreshold(defaultValue: Float): Float(source)

Defines the maximum velocity ItemTouchHelper will ever calculate for pointer movements.

To consider a movement as swipe, ItemTouchHelper requires it to be larger than the perpendicular movement. If both directions reach to the max threshold, none of them will be considered as a swipe because it is usually an indication that user rather tried to scroll then swipe.

The velocity is calculated in pixels per second.

You can customize this behavior by changing this method. If you increase the value, it will be easier for the user to swipe diagonally and if you decrease the value, user will need to make a rather straight finger movement to trigger a swipe.

Return

The velocity cap for pointer movements. The default implementation returns the defaultValue parameter.

Parameters

defaultValue

The default value(in pixels per second) used by the ItemTouchHelper.

See also