Don't rely on ViewHolder.unbindView() being called when an item is updated
This commit is contained in:
parent
4e639256e4
commit
d7d221ebbf
2 changed files with 9 additions and 7 deletions
|
@ -37,7 +37,9 @@ internal class CryptoStatusItem(val cryptoDetails: CryptoDetails) : AbstractItem
|
|||
descriptionTextView.text = context.getString(stringResId)
|
||||
}
|
||||
|
||||
if (!cryptoDetails.isClickable) {
|
||||
if (cryptoDetails.isClickable) {
|
||||
itemView.background = originalBackground
|
||||
} else {
|
||||
itemView.background = null
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +48,6 @@ internal class CryptoStatusItem(val cryptoDetails: CryptoDetails) : AbstractItem
|
|||
imageView.setImageDrawable(null)
|
||||
titleTextView.text = null
|
||||
descriptionTextView.text = null
|
||||
itemView.background = originalBackground
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ internal class ParticipantItem(
|
|||
|
||||
if (participant.displayName != null) {
|
||||
name.text = participant.displayName
|
||||
name.isVisible = true
|
||||
} else {
|
||||
name.isVisible = false
|
||||
}
|
||||
|
@ -48,12 +49,16 @@ internal class ParticipantItem(
|
|||
menuAddContact.isVisible = !item.alwaysHideAddContactsButton && !participant.isInContacts
|
||||
|
||||
if (item.showContactsPicture) {
|
||||
contactPicture.isVisible = true
|
||||
item.contactPictureLoader.setContactPicture(contactPicture, participant.address)
|
||||
} else {
|
||||
contactPicture.isVisible = false
|
||||
}
|
||||
|
||||
if (!item.participant.isInContacts) {
|
||||
if (item.participant.isInContacts) {
|
||||
itemView.isClickable = true
|
||||
itemView.background = originalBackground
|
||||
} else {
|
||||
itemView.isClickable = false
|
||||
itemView.background = null
|
||||
}
|
||||
|
@ -61,11 +66,7 @@ internal class ParticipantItem(
|
|||
|
||||
override fun unbindView(item: ParticipantItem) {
|
||||
name.text = null
|
||||
name.isVisible = true
|
||||
email.text = null
|
||||
contactPicture.isVisible = true
|
||||
itemView.background = originalBackground
|
||||
itemView.isClickable = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue