Class EndlessMessageListScrollListener
-
- All Implemented Interfaces:
public final class EndlessMessageListScrollListener extends 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.
-
-
Constructor Summary
Constructors Constructor Description EndlessMessageListScrollListener(Integer loadMoreThreshold, Function0<Unit> loadMoreAtTopListener, Function0<Unit> loadMoreAtBottomListener)
-
Method Summary
Modifier and Type Method Description final UnitfetchAtBottom(Boolean shouldFetch)UnitonScrolled(RecyclerView recyclerView, Integer dx, Integer dy)Whenever we scroll, if the pagination is enabled, we check the scroll direction and validity. UnitonScrollStateChanged(RecyclerView recyclerView, Integer newState)Handles scroll state changes where it waits for a state reset and new scroll gestures. final UnitenablePagination()Manually enables pagination in certain UI components and events. final UnitdisablePagination()Manually disables pagination in certain UI components and events. -
-
Constructor Detail
-
EndlessMessageListScrollListener
EndlessMessageListScrollListener(Integer loadMoreThreshold, Function0<Unit> loadMoreAtTopListener, Function0<Unit> loadMoreAtBottomListener)
- 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.
-
-
Method Detail
-
fetchAtBottom
final Unit fetchAtBottom(Boolean shouldFetch)
-
onScrolled
Unit onScrolled(RecyclerView recyclerView, Integer dx, Integer dy)
Whenever we scroll, if the pagination is enabled, we check the scroll direction and validity.
-
onScrollStateChanged
Unit onScrollStateChanged(RecyclerView recyclerView, Integer newState)
Handles scroll state changes where it waits for a state reset and new scroll gestures.
-
enablePagination
final Unit enablePagination()
Manually enables pagination in certain UI components and events.
-
disablePagination
final Unit disablePagination()
Manually disables pagination in certain UI components and events.
-
-
-
-