From 22cdb6544d6cb35b64d634834f0a2999b8181ece Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Wed, 27 Oct 2021 17:49:24 +0200 Subject: [PATCH] [TEST] Initial force scroll only once Change-Id: I6f5580be02fbdb13b56c5a180c124076bddcd52a --- .../app/features/home/room/detail/ScrollOnNewMessageCallback.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnNewMessageCallback.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnNewMessageCallback.kt index 884ef1812e..d4e4a51d81 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnNewMessageCallback.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnNewMessageCallback.kt @@ -70,6 +70,7 @@ class ScrollOnNewMessageCallback(private val layoutManager: BetterLinearLayoutMa } if (scrollToEvent == null) { layoutManager.scrollToPositionWithOffset(0, 0) + initialForceScroll = false layoutManager.setPreferredAnchorPosition(0) } else { timelineEventController.searchPositionOfEvent(scrollToEvent)?.let { @@ -78,6 +79,7 @@ class ScrollOnNewMessageCallback(private val layoutManager: BetterLinearLayoutMa // from the bottom of the view, not the top). val scrollToPosition = max(it + scrollOffset + 1, 0) layoutManager.scrollToPositionWithOffset(scrollToPosition, (parentView.measuredHeight * RoomDetailFragment.TARGET_SCROLL_OUT_FACTOR).toInt()) + initialForceScroll = false layoutManager.setPreferredAnchorPosition(scrollToPosition) } }