EndlessMessageListScrollListener

class EndlessMessageListScrollListener(loadMoreThreshold: Int, loadMoreAtTopListener: () -> Unit, loadMoreAtBottomListener: () -> Unit) : RecyclerView.OnScrollListener

Scroll listener which checks the layout manager of the MessageListView, listens for scrolling gestures and triggers pagination when reaching the end top of the list.

Parameters

loadMoreThreshold

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

loadMoreAtTopListener

The handler which is called when pagination should be triggered in the top direction.

loadMoreAtBottomListener

The handler which is called when pagination should be triggered in the bottom direction.

Constructors

Link copied to clipboard
constructor(loadMoreThreshold: Int, loadMoreAtTopListener: () -> Unit, loadMoreAtBottomListener: () -> 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
fun fetchAtBottom(shouldFetch: Boolean)
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.