-
public class FastScroller.DelegateThis class links the FastScroller to the RecyclerView.To use FastScroller in your existing adapter (Not FlexibleAdapter), follow the steps below:
- In your layout, include @layout/fast_scroller after the RecyclerView.
- Implement FastScroller.AdapterInterface in your adapter.
- In your adapter, create a FastScroller.Delegate and call the delegate methods:
{@code onAttachedToRecyclerView},{@code onDetachedFromRecyclerView}and{@code setFastScroller}. - If
{@code fastScrollerBubbleEnabled}is true, in your adapter, implement BubbleTextCreatorand add the logic to display the label in{@code onCreateBubbleText}. - In the fragment/activity call the adapter's
{@code setFastScroller}after setting theRecyclerView's adapter.
-
-
Method Summary
Modifier and Type Method Description voidonAttachedToRecyclerView(RecyclerView recyclerView)voidonDetachedFromRecyclerView(RecyclerView recyclerView)voidtoggleFastScroller()Displays or Hides the FastScroller if previously configured. booleanisFastScrollerEnabled()FastScrollergetFastScroller()voidsetFastScroller(@Nullable() FastScroller fastScroller)Sets up the FastScroller with automatic fetch of accent color. -
-
Method Detail
-
onAttachedToRecyclerView
void onAttachedToRecyclerView(RecyclerView recyclerView)
-
onDetachedFromRecyclerView
void onDetachedFromRecyclerView(RecyclerView recyclerView)
-
toggleFastScroller
void toggleFastScroller()
Displays or Hides the FastScroller if previously configured.The action is animated.
-
isFastScrollerEnabled
boolean isFastScrollerEnabled()
-
getFastScroller
@Nullable() FastScroller getFastScroller()
-
setFastScroller
void setFastScroller(@Nullable() FastScroller fastScroller)
Sets up the FastScroller with automatic fetch of accent color.
IMPORTANT: Call this method after the adapter is added to the RecyclerView.
NOTE: If the device has at least Lollipop, the Accent color is fetched, otherwisefor previous version, the default value is used.- Parameters:
fastScroller- instance of FastScroller
-
-
-
-