Fix message grouping for group chats

This commit is contained in:
Moez Bhatti
2018-01-14 19:15:57 -05:00
parent b9fb2ae798
commit 83d8256668
@@ -209,8 +209,9 @@ class MessagesAdapter @Inject constructor(
private fun canGroup(message: Message, other: Message?): Boolean {
if (other == null) return false
val samePerson = message.isMe() && other.isMe() || (!message.isMe() && !other.isMe() && message.address == other.address)
val diff = TimeUnit.MILLISECONDS.toMinutes(Math.abs(message.date - other.date))
return message.isMe() == other.isMe() && diff < TIMESTAMP_THRESHOLD
return samePerson && diff < TIMESTAMP_THRESHOLD
}
override fun getItemViewType(position: Int): Int {