mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-23 06:08:52 +01:00
Fix auto scroll to top in conversation list
This commit is contained in:
@@ -36,11 +36,19 @@ fun RecyclerView.Adapter<*>.autoScrollToStart(recyclerView: RecyclerView) {
|
|||||||
recyclerView.scrollToPosition(positionStart)
|
recyclerView.scrollToPosition(positionStart)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val firstVisiblePosition = layoutManager.findFirstCompletelyVisibleItemPosition()
|
val firstVisiblePosition = layoutManager.findFirstVisibleItemPosition()
|
||||||
if (firstVisiblePosition == 0) {
|
if (firstVisiblePosition == 0) {
|
||||||
recyclerView.scrollToPosition(positionStart)
|
recyclerView.scrollToPosition(positionStart)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onItemRangeChanged(positionStart: Int, itemCount: Int) {
|
||||||
|
val layoutManager = recyclerView.layoutManager as? LinearLayoutManager ?: return
|
||||||
|
|
||||||
|
if (!layoutManager.stackFromEnd) {
|
||||||
|
onItemRangeInserted(positionStart, itemCount)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user