Commit fb9c397b authored by Kiryl Vashyla's avatar Kiryl Vashyla

PR #1615 minor change

parent 6df94252
...@@ -167,14 +167,13 @@ class ChatRoomAdapter( ...@@ -167,14 +167,13 @@ class ChatRoomAdapter(
} }
return@filter (matchedIndex < 0) return@filter (matchedIndex < 0)
} }
val minAdditionDate = dataSet.minBy { it.message.timestamp } ?: return val minAdditionDate = filteredDataSet.minBy { it.message.timestamp } ?: return
//---In the most cases we will just add new elements to the top of messages heap //---In the most cases we will just add new elements to the top of messages heap
if (minAdditionDate.message.timestamp > this.dataSet[0].message.timestamp) { if (minAdditionDate.message.timestamp > this.dataSet[0].message.timestamp) {
this.dataSet.addAll(0, dataSet) this.dataSet.addAll(0, filteredDataSet)
notifyItemRangeInserted(0, dataSet.size) notifyItemRangeInserted(0, filteredDataSet.size)
return return
} }
//---Else branch: merging messages--- //---Else branch: merging messages---
//---We are inserting new received elements into set. Sort them by time+type and show //---We are inserting new received elements into set. Sort them by time+type and show
if (filteredDataSet.isEmpty()) return if (filteredDataSet.isEmpty()) return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment