diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt index 7075ee0752..608cc50c57 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt @@ -791,15 +791,8 @@ class RoomDetailFragment @Inject constructor( private fun setupJumpToBottomView() { views.jumpToBottomView.visibility = View.INVISIBLE views.jumpToBottomView.debouncedClicks { - roomDetailViewModel.handle(RoomDetailAction.ExitTrackingUnreadMessagesState) views.jumpToBottomView.visibility = View.INVISIBLE - if (!roomDetailViewModel.timeline.isLive) { - scrollOnNewMessageCallback.forceScrollOnNextUpdate() - roomDetailViewModel.timeline.restartWithEventId(null) - } else { - roomDetailViewModel.timeline.setInitialEventId(null) - layoutManager.scrollToPositionWithOffset(0, 0) - } + doJumpToBottom() } jumpToBottomViewVisibilityManager = JumpToBottomViewVisibilityManager( @@ -810,6 +803,17 @@ class RoomDetailFragment @Inject constructor( ) } + private fun doJumpToBottom() { + roomDetailViewModel.handle(RoomDetailAction.ExitTrackingUnreadMessagesState) + if (!roomDetailViewModel.timeline.isLive) { + scrollOnNewMessageCallback.forceScrollOnNextUpdate() + roomDetailViewModel.timeline.restartWithEventId(null) + } else { + roomDetailViewModel.timeline.setInitialEventId(null) + layoutManager.scrollToPositionWithOffset(0, 0) + } + } + private fun setupJumpToReadMarkerView() { views.jumpToReadMarkerView.setOnClickListener { onJumpToReadMarkerClicked() @@ -1349,6 +1353,8 @@ class RoomDetailFragment @Inject constructor( lockSendButton = true roomDetailViewModel.handle(RoomDetailAction.SendMessage(text, vectorPreferences.isMarkdownEnabled())) emojiPopup.dismiss() + + doJumpToBottom() } }