Improved chat room scroll
This commit is contained in:
parent
21e500cad3
commit
6406eb9d7b
1 changed files with 5 additions and 8 deletions
|
@ -80,9 +80,7 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
||||||
// First time we fill the list with messages
|
// First time we fill the list with messages
|
||||||
Log.i("[Chat Room] History first $itemCount messages loaded")
|
Log.i("[Chat Room] History first $itemCount messages loaded")
|
||||||
} else {
|
} else {
|
||||||
// Scroll to newly added messages automatically
|
// Scroll to newly added messages automatically only if user hasn't initiated a scroll up in the messages history
|
||||||
if (positionStart == adapter.itemCount - itemCount) {
|
|
||||||
// But only if user hasn't initiated a scroll up in the messages history
|
|
||||||
if (viewModel.isUserScrollingUp.value == false) {
|
if (viewModel.isUserScrollingUp.value == false) {
|
||||||
scrollToFirstUnreadMessageOrBottom(false)
|
scrollToFirstUnreadMessageOrBottom(false)
|
||||||
} else {
|
} else {
|
||||||
|
@ -91,7 +89,6 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private lateinit var chatScrollListener: ChatScrollListener
|
private lateinit var chatScrollListener: ChatScrollListener
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue