Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pagination in RecyclerView with GridLayoutManager
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