EndlessScrollListener

class EndlessScrollListener(loadMoreThreshold: Int, loadMoreListener: () -> Unit) : RecyclerView.OnScrollListener

Regular scroll listener which checks the layout manager of a recycler view and based on if the layout is reversed or not, it listens for scrolling gestures and triggers pagination when reaching the end top or end bottom of the list.

Parameters

loadMoreThreshold

The number of items or positions ahead of the end of the list where we can trigger the pagination.

loadMoreListener

The handler which is called when pagination should be triggered.

Constructors

Link copied to clipboard
constructor(loadMoreThreshold: Int, loadMoreListener: () -> Unit)

Functions

Link copied to clipboard

Manually disables pagination in certain UI components and events.

Link copied to clipboard

Manually enables pagination in certain UI components and events.

Link copied to clipboard
open override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int)

Whenever we scroll, if the pagination is enabled, we check the scroll direction and validity.

Link copied to clipboard
open override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int)

Handles scroll state changes where it waits for a state reset and new scroll gestures.