Small fix to properly scroll down in chat messages view when a new one is sent or received
This commit is contained in:
parent
f33709d77b
commit
b5aab5b417
1 changed files with 1 additions and 1 deletions
|
@ -66,7 +66,7 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
||||||
|
|
||||||
private val observer = object : RecyclerView.AdapterDataObserver() {
|
private val observer = object : RecyclerView.AdapterDataObserver() {
|
||||||
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
|
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
|
||||||
if (positionStart == adapter.itemCount - 1) {
|
if (itemCount == 1 && positionStart > 0) {
|
||||||
adapter.notifyItemChanged(positionStart - 1) // For grouping purposes
|
adapter.notifyItemChanged(positionStart - 1) // For grouping purposes
|
||||||
scrollToBottom()
|
scrollToBottom()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue