mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-01-01 02:57:27 +01:00
tweak the way adapters are updated
This commit is contained in:
parent
9c0ef0fbe9
commit
b02b54b055
@ -209,10 +209,11 @@ class ConversationsAdapter(
|
||||
}
|
||||
|
||||
fun updateConversations(newConversations: ArrayList<Conversation>) {
|
||||
val latestConversations = newConversations.clone() as ArrayList<Conversation>
|
||||
val oldHashCode = conversations.hashCode()
|
||||
val newHashCode = newConversations.hashCode()
|
||||
val newHashCode = latestConversations.hashCode()
|
||||
if (newHashCode != oldHashCode) {
|
||||
conversations = newConversations
|
||||
conversations = latestConversations
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
@ -201,10 +201,11 @@ class ThreadAdapter(
|
||||
private fun isThreadDateTime(position: Int) = messages.getOrNull(position) is ThreadDateTime
|
||||
|
||||
fun updateMessages(newMessages: ArrayList<ThreadItem>) {
|
||||
val latestMessages = newMessages.clone() as ArrayList<ThreadItem>
|
||||
val oldHashCode = messages.hashCode()
|
||||
val newHashCode = newMessages.hashCode()
|
||||
val newHashCode = latestMessages.hashCode()
|
||||
if (newHashCode != oldHashCode) {
|
||||
messages = newMessages
|
||||
messages = latestMessages
|
||||
notifyDataSetChanged()
|
||||
recyclerView.scrollToPosition(messages.size - 1)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user