mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-12 10:32:36 +00:00
Merge pull request #2927 from nextcloud/bugfix/2926/fixScrollToFirstUnreadMessage
Fix to scroll to first unread message
This commit is contained in:
commit
0695c811df
@ -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