Small fix to properly scroll down in chat messages view when a new one is sent or received

This commit is contained in:
Sylvain Berfini 2021-03-11 16:22:08 +01:00
parent f33709d77b
commit b5aab5b417

View file

@ -66,7 +66,7 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
private val observer = object : RecyclerView.AdapterDataObserver() {
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
if (positionStart == adapter.itemCount - 1) {
if (itemCount == 1 && positionStart > 0) {
adapter.notifyItemChanged(positionStart - 1) // For grouping purposes
scrollToBottom()
}