SnapHelper

(SESL variant) Class intended to support snapping for a RecyclerView.

SnapHelper tries to handle fling as well but for this to work properly, the RecyclerView.LayoutManager must implement the RecyclerView.SmoothScroller.ScrollVectorProvider interface or you should override onFling and handle fling manually.

Inheritors

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun attachToRecyclerView(@Nullable recyclerView: RecyclerView)
Attaches the SnapHelper to the provided RecyclerView, by calling setOnFlingListener.
Link copied to clipboard
Override this method to snap to a particular point within the target view or the container view on any axis.
Link copied to clipboard
open fun calculateScrollDistance(velocityX: Int, velocityY: Int): Array<Int>
Calculated the estimated scroll distance in each direction given velocities on both axes.
Link copied to clipboard
Override this method to provide a particular target view for snapping.
Link copied to clipboard
abstract fun findTargetSnapPosition(layoutManager: RecyclerView.LayoutManager, velocityX: Int, velocityY: Int): Int
Override to provide a particular adapter target position for snapping.
Link copied to clipboard
open fun onFling(velocityX: Int, velocityY: Int): Boolean
Override this to handle a fling given the velocities in both x and y directions.
Link copied to clipboard
open fun seslCalculateScrollDistanceForLinear(velocityX: Int, velocityY: Int): Array<Int>