Scroll to bottom of chat after sending a message
Change-Id: I54f71bfe5e5b9f0bbeeafa1b0faa3e9992da442c
This commit is contained in:
parent
586f565c23
commit
eadc990675
|
@ -791,15 +791,8 @@ class RoomDetailFragment @Inject constructor(
|
||||||
private fun setupJumpToBottomView() {
|
private fun setupJumpToBottomView() {
|
||||||
views.jumpToBottomView.visibility = View.INVISIBLE
|
views.jumpToBottomView.visibility = View.INVISIBLE
|
||||||
views.jumpToBottomView.debouncedClicks {
|
views.jumpToBottomView.debouncedClicks {
|
||||||
roomDetailViewModel.handle(RoomDetailAction.ExitTrackingUnreadMessagesState)
|
|
||||||
views.jumpToBottomView.visibility = View.INVISIBLE
|
views.jumpToBottomView.visibility = View.INVISIBLE
|
||||||
if (!roomDetailViewModel.timeline.isLive) {
|
doJumpToBottom()
|
||||||
scrollOnNewMessageCallback.forceScrollOnNextUpdate()
|
|
||||||
roomDetailViewModel.timeline.restartWithEventId(null)
|
|
||||||
} else {
|
|
||||||
roomDetailViewModel.timeline.setInitialEventId(null)
|
|
||||||
layoutManager.scrollToPositionWithOffset(0, 0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jumpToBottomViewVisibilityManager = JumpToBottomViewVisibilityManager(
|
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() {
|
private fun setupJumpToReadMarkerView() {
|
||||||
views.jumpToReadMarkerView.setOnClickListener {
|
views.jumpToReadMarkerView.setOnClickListener {
|
||||||
onJumpToReadMarkerClicked()
|
onJumpToReadMarkerClicked()
|
||||||
|
@ -1349,6 +1353,8 @@ class RoomDetailFragment @Inject constructor(
|
||||||
lockSendButton = true
|
lockSendButton = true
|
||||||
roomDetailViewModel.handle(RoomDetailAction.SendMessage(text, vectorPreferences.isMarkdownEnabled()))
|
roomDetailViewModel.handle(RoomDetailAction.SendMessage(text, vectorPreferences.isMarkdownEnabled()))
|
||||||
emojiPopup.dismiss()
|
emojiPopup.dismiss()
|
||||||
|
|
||||||
|
doJumpToBottom()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue