CarouselSnapHelper

public class CarouselSnapHelper


Implementation of the SnapHelper that supports snapping items to the carousel keylines according to the strategy.

Summary

Public constructors

CarouselSnapHelper(boolean disableFling)

Public methods

void
attachToRecyclerView(RecyclerView recyclerView)
int[]
calculateDistanceToFinalSnap(LayoutManager layoutManager, View view)
View
findSnapView(LayoutManager layoutManager)
int
findTargetSnapPosition(
    LayoutManager layoutManager,
    int velocityX,
    int velocityY
)

Protected methods

SmoothScroller
createScroller(LayoutManager layoutManager)

This is mostly a copy of SnapHelper#createSnapScroller with a slight adjustment to call calculateDistanceToSnap (LayoutManager, View)}.

Public constructors

CarouselSnapHelper

public CarouselSnapHelper()

CarouselSnapHelper

public CarouselSnapHelper(boolean disableFling)

Public methods

attachToRecyclerView

public void attachToRecyclerView(RecyclerView recyclerView)

calculateDistanceToFinalSnap

public int[] calculateDistanceToFinalSnap(LayoutManager layoutManager, View view)

findSnapView

public View findSnapView(LayoutManager layoutManager)

findTargetSnapPosition

public int findTargetSnapPosition(
    LayoutManager layoutManager,
    int velocityX,
    int velocityY
)

Protected methods

createScroller

protected SmoothScroller createScroller(LayoutManager layoutManager)

This is mostly a copy of SnapHelper#createSnapScroller with a slight adjustment to call calculateDistanceToSnap (LayoutManager, View)}. We want to do a partial snap since the correct target keyline state may not have updated yet since this gets called before the keylines shift.