CarouselSnapHelper
public
class
CarouselSnapHelper
extends SnapHelper
java.lang.Object
|
↳ |
androidx.recyclerview.widget.RecyclerView.OnFlingListener
|
|
↳ |
androidx.recyclerview.widget.SnapHelper
|
|
|
↳ |
com.google.android.material.carousel.CarouselSnapHelper
|
Implementation of the SnapHelper
that supports snapping items to the carousel keylines
according to the strategy.
Summary
Inherited methods |
From class
androidx.recyclerview.widget.SnapHelper
void
|
attachToRecyclerView(RecyclerView arg0)
|
abstract
int[]
|
calculateDistanceToFinalSnap(RecyclerView.LayoutManager arg0, View arg1)
|
int[]
|
calculateScrollDistance(int arg0, int arg1)
|
RecyclerView.SmoothScroller
|
createScroller(RecyclerView.LayoutManager arg0)
|
LinearSmoothScroller
|
createSnapScroller(RecyclerView.LayoutManager arg0)
|
abstract
View
|
findSnapView(RecyclerView.LayoutManager arg0)
|
abstract
int
|
findTargetSnapPosition(RecyclerView.LayoutManager arg0, int arg1, int arg2)
|
boolean
|
onFling(int arg0, int arg1)
|
|
From class
androidx.recyclerview.widget.RecyclerView.OnFlingListener
abstract
boolean
|
onFling(int arg0, int arg1)
|
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public constructors
CarouselSnapHelper
public CarouselSnapHelper ()
CarouselSnapHelper
public CarouselSnapHelper (boolean disableFling)
Parameters |
disableFling |
boolean |
Public methods
public void attachToRecyclerView (RecyclerView recyclerView)
Parameters |
recyclerView |
RecyclerView |
public int[] calculateDistanceToFinalSnap (RecyclerView.LayoutManager layoutManager,
View view)
Parameters |
layoutManager |
RecyclerView.LayoutManager |
view |
View |
public View findSnapView (RecyclerView.LayoutManager layoutManager)
Parameters |
layoutManager |
RecyclerView.LayoutManager |
public int findTargetSnapPosition (RecyclerView.LayoutManager layoutManager,
int velocityX,
int velocityY)
Parameters |
layoutManager |
RecyclerView.LayoutManager |
velocityX |
int |
velocityY |
int |
Protected methods
protected RecyclerView.SmoothScroller createScroller (RecyclerView.LayoutManager layoutManager)
This is mostly a copy of SnapHelper#createSnapScroller
with a slight adjustment to
call ERROR(/CarouselSnapHelper#calculateDistanceToSnap(LayoutManager, View, boolean))
(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.
Parameters |
layoutManager |
RecyclerView.LayoutManager |
Returns |
RecyclerView.SmoothScroller |
|