Pagination-RecyclerView - Simple and easy way to Paginating a RecyclerView

Overview

Pagination-RecyclerView

Simple and easy way to Paginating a RecyclerView

Android library/module to make Recyclerview paginate

While scrolling we need to add page chnage listener so that we can detect the ending of list and can work as per our needs

recyclerView.setOnPageChangeListener(object : OnPageChangeListener {
        override fun onPageChange(page: Int) {
            //Page change listener for recycler view
            
            //TODO Add own code here to fetch data
        }
    })

This is how you can add the custom recycler view (chnage the tag as per your package name)

<com.rakshit.pagination_recyclerview.PaginationRecyclerView
    android:id="@+id/custom_recycler_view"
    android:layout_width="match_parent"
    app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
    app:spanCount="2"
    tools:listitem="@layout/item_photos"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"/>

Now you can initialize the Recyclerview like below

 val recyclerView: PaginationRecyclerView = findViewById(R.id.custom_recycler_view)

    recyclerView.adapter = //TODO Add your adapter here
    recyclerView.layoutManager = GridLayoutManager(this, 2)
    recyclerView.setOnPageChangeListener(object : OnPageChangeListener {
        override fun onPageChange(page: Int) {
            //Page change listener for recycler view
          
            //TODO Add own code here to fetch data
        }
    })

Note: You need to create your own Recyclerview's adapter as per your need, a sample is already added in code base

Like what I did buy me coffee maybe?

Buy Me a Coffee at ko-fi.com

or get in touch with me to discuss a project visit http://rakshit.tech/ to discuss with me more.

Happy Coding !! Cheers

You might also like...
TikTok-RecyclerView - This is a demo app built using 'Koin' a new dependency injection framework for Android along with RecyclerView and ExoPlayer2.
TikTok-RecyclerView - This is a demo app built using 'Koin' a new dependency injection framework for Android along with RecyclerView and ExoPlayer2.

TikTok-RecyclerView Demo About This is a demo app built using 'Koin' a new dependency injection framework for Android along with RecyclerView and ExoP

Easy RecyclerView Adapter

GenericAdapter Easy RecyclerView Adapter Getting started build.gradle allprojects { repositories { // ... maven { url 'https://jit

Just another one easy-to-use adapter for RecyclerView :rocket:
Just another one easy-to-use adapter for RecyclerView :rocket:

Elementary RecyclerView Adapter Another one easy-to-use adapter for RecyclerView 🚀 Features: DSL-like methods for building adapters similar to Jetpac

ANDROID. ChipsLayoutManager (SpanLayoutManager, FlowLayoutManager). A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features
ANDROID. ChipsLayoutManager (SpanLayoutManager, FlowLayoutManager). A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features

ChipsLayoutManager This is ChipsLayoutManager - custom Recycler View's LayoutManager which moves item to the next line when no space left on the curre

Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.
Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.

Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.

RecyclerView : SleepQualityTracker with RecyclerView app
RecyclerView : SleepQualityTracker with RecyclerView app

RecyclerView - SleepQualityTracker with RecyclerView app SleepQualityTracker with RecyclerView This app builds on the SleepQualityTracker developed pr

Simple plug and play custom RecyclerView
Simple plug and play custom RecyclerView

InfiniteScrollRecyclerView Pros: Simple plug and play custom RecyclerView. Easy to use Built on top of RecyclerView, hence it is performant as it work

Dividers is a simple Android library to create easy separators for your RecyclerViews
Dividers is a simple Android library to create easy separators for your RecyclerViews

Dividers Dividers is an Android library to easily create separators for your RecyclerViews. It supports a wide range of dividers from simple ones, tha

[] RecyclerView made simple
[] RecyclerView made simple

TwoWayView RecyclerView made simple. Features A LayoutManager base class that greatly simplifies the development of custom layouts for RecyclerView A

Releases(android)
Owner
Rakshit Nawani
Android Engineer My Website: rakshit.tech
Rakshit Nawani
Android pagination library (updated 01.05.2018)

NoPaginate Android pagination library, based on @MarkoMilos repository Paginate Loading Item Error Item Gradle implementation 'ru.alexbykov:nopaginate

Alexey Bykov 183 Nov 22, 2022
[] Super fast and easy way to create header for Android RecyclerView

DEPRECATED I created this library back in the day when I thought RecyclerView was all new and difficult. Writing an adapter that could inflate multipl

Bartek Lipinski 1.3k Dec 28, 2022
Android library providing simple way to control divider items (ItemDecoration) of RecyclerView

RecyclerView-FlexibleDivider Android library providing simple way to control divider items of RecyclerView Release Note [Release Note] (https://github

Yoshihito Ikeda 2.4k Dec 18, 2022
RecyclerView with DiffUtil is a way to improve the performance of your app

RecylerViewSamples RecyclerView with DiffUtil is a way to improve the performanc

Chhote Lal Pal 0 Dec 20, 2021
Square Cycler API allows you to easily configure an Android RecyclerView declaratively in a succinct way.

Square Cycler – a RecyclerView API The Square Cycler API allows you to easily configure an Android RecyclerView declaratively in a succinct way. Desig

Square 791 Dec 23, 2022
A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView.

RecyclerViewSwipeDismiss A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView. Preview How to use Add these lines to yo

xcodebuild 431 Nov 23, 2022
A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView.

RecyclerViewSwipeDismiss A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView. Preview How to use Add these lines to yo

xcodebuild 431 Nov 23, 2022
A RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView

XRecyclerView a RecyclerView that implements pullrefresh , loadingmore and header featrues.you can use it like a standard RecyclerView. you don't need

XRecyclerView 5.3k Dec 26, 2022
A RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView

XRecyclerView a RecyclerView that implements pullrefresh , loadingmore and header featrues.you can use it like a standard RecyclerView. you don't need

XRecyclerView 5.3k Dec 26, 2022