Class EndlessScrollListener

  • All Implemented Interfaces:

    
    public final class EndlessScrollListener
    extends 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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Unit onScrolled(RecyclerView recyclerView, Integer dx, Integer dy) Whenever we scroll, if the pagination is enabled, we check the scroll direction and validity.
      Unit onScrollStateChanged(RecyclerView recyclerView, Integer newState) Handles scroll state changes where it waits for a state reset and new scroll gestures.
      final Unit enablePagination() Manually enables pagination in certain UI components and events.
      final Unit disablePagination() Manually disables pagination in certain UI components and events.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EndlessScrollListener

        EndlessScrollListener(Integer loadMoreThreshold, Function0<Unit> loadMoreListener)
        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.