Created
October 11, 2020 15:57
-
-
Save mbakgun/6ce1a7213cf857738df53b7e0ec2aba5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| package com.dolap.events.helper.util | |
| import androidx.recyclerview.widget.LinearLayoutManager | |
| import androidx.recyclerview.widget.RecyclerView | |
| import com.dolap.events.helper.visibleitem.VisibleState | |
| abstract class EndlessRecyclerViewScrollListener(private val mLinearLayoutManager: LinearLayoutManager) : | |
| RecyclerView.OnScrollListener() { | |
| override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { | |
| super.onScrolled(recyclerView, dx, dy) | |
| val firstCompletelyVisibleItemPosition = | |
| mLinearLayoutManager.findFirstCompletelyVisibleItemPosition() | |
| val lastCompletelyVisibleItemPosition = | |
| mLinearLayoutManager.findLastCompletelyVisibleItemPosition() | |
| onVisibleItemChanged(VisibleState(firstCompletelyVisibleItemPosition, | |
| lastCompletelyVisibleItemPosition)) | |
| } | |
| abstract fun onVisibleItemChanged(state: VisibleState) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment