mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
Fix to scroll to first unread message
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
255b5f63a1
commit
c34e656eca
@ -2523,7 +2523,16 @@ class ChatActivity :
|
||||
addMessagesToAdapter(shouldAddNewMessagesNotice, chatMessageList)
|
||||
|
||||
if (shouldAddNewMessagesNotice && adapter != null) {
|
||||
layoutManager?.scrollToPosition(0)
|
||||
scrollToFirstUnreadMessage()
|
||||
}
|
||||
}
|
||||
|
||||
private fun scrollToFirstUnreadMessage() {
|
||||
adapter?.let {
|
||||
layoutManager?.scrollToPositionWithOffset(
|
||||
it.getMessagePositionByIdInReverse("-1"),
|
||||
binding.messagesListView.height / 2
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user