Ensure we don't stick-to-bottom while paginating

Change-Id: I7e8a434ed1699ac238c0711c52499f0a124f60ab
This commit is contained in:
SpiritCroc 2022-07-22 19:16:44 +02:00
parent 1785e09e5a
commit fe599576b5

View file

@ -3014,7 +3014,11 @@ class TimelineFragment @Inject constructor(
}
private fun setInitialForceScrollEnabled(enabled: Boolean, stickToBottom: Boolean = false) {
val shouldStickToBottom = stickToBottom || (!enabled && !views.timelineRecyclerView.canScrollVertically(1))
val shouldStickToBottom = stickToBottom ||
(!enabled &&
!views.timelineRecyclerView.canScrollVertically(1) &&
!timelineViewModel.timeline.hasMoreToLoad(Timeline.Direction.FORWARDS)
)
scrollOnNewMessageCallback.initialForceScroll = enabled
if (shouldStickToBottom) {
layoutManager.disablePreferredAnchorPlacement()