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
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