Fixed loading more items when scrolling up in chat messages history not working sometimes
This commit is contained in:
parent
db45a2bb78
commit
137177d619
1 changed files with 5 additions and 1 deletions
|
@ -67,7 +67,11 @@ internal abstract class ChatScrollListener(private val mLayoutManager: LinearLay
|
||||||
// the mVisibleThreshold and need to reload more data.
|
// the mVisibleThreshold and need to reload more data.
|
||||||
// If we do need to reload some more data, we execute onLoadMore to fetch the data.
|
// If we do need to reload some more data, we execute onLoadMore to fetch the data.
|
||||||
// threshold should reflect how many total columns there are too
|
// threshold should reflect how many total columns there are too
|
||||||
if (!loading && firstVisibleItemPosition < mVisibleThreshold && firstVisibleItemPosition > 0 && lastVisibleItemPosition < totalItemCount - mVisibleThreshold) {
|
if (!loading &&
|
||||||
|
firstVisibleItemPosition < mVisibleThreshold &&
|
||||||
|
firstVisibleItemPosition >= 0 &&
|
||||||
|
lastVisibleItemPosition < totalItemCount - mVisibleThreshold
|
||||||
|
) {
|
||||||
onLoadMore(totalItemCount)
|
onLoadMore(totalItemCount)
|
||||||
loading = true
|
loading = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue