Created
August 19, 2021 04:33
-
-
Save Priyansh-Kedia/a20c99d2b0ab37637ba3456576b01b65 to your computer and use it in GitHub Desktop.
Pagination in RecyclerView with GridLayoutManager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mediaRecycler.addOnScrollListener(object : RecyclerView.OnScrollListener() { | |
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { | |
if ((gridLayoutManager.findLastVisibleItemPosition() == localDocumentsAdapter.itemCount - DOCUMENT_BUFFER) && dy > 0) { | |
documentViewModel.getImages(DOCUMENTS_COUNT) | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment