fix to hide avatars in one to one conversations.

follow up to commit 7464e6994b673d2b575903a76752bf39bed9d622

the problem was that the "super" methods also contain logic to show/hide the avatar. So this result must be overwritten again after calling the super method.

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-01-17 15:35:56 +01:00
parent 90d3d7d217
commit ffcd56375e
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -108,28 +108,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
image.minimumHeight = DisplayUtils.convertDpToPixel(MIN_IMAGE_HEIGHT, context).toInt()
time.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp)
if (userAvatar != null) {
if (message.isGrouped || message.isOneToOneConversation) {
if (message.isOneToOneConversation) {
userAvatar.visibility = View.GONE
} else {
userAvatar.visibility = View.INVISIBLE
}
} else {
userAvatar.visibility = View.VISIBLE
userAvatar.setOnClickListener { v: View ->
if (payload is MessagePayload) {
(payload as MessagePayload).profileBottomSheet.showFor(
message.actorId!!,
v.context
)
}
}
if (ACTOR_TYPE_BOTS == message.actorType && ACTOR_ID_CHANGELOG == message.actorId) {
userAvatar.loadChangelogBotAvatar()
}
}
}
viewThemeUtils!!.platform.colorCircularProgressBar(progressBar!!)
clickView = image
messageText.visibility = View.VISIBLE
@ -139,7 +118,6 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
messageText.text = fileName
if (message.selectedIndividualHashMap!!.containsKey(KEY_CONTACT_NAME)) {
previewContainer.visibility = View.GONE
previewContactContainer.visibility = View.VISIBLE
previewContactName.text = message.selectedIndividualHashMap!![KEY_CONTACT_NAME]
progressBar = previewContactProgressBar
messageText.visibility = View.INVISIBLE
@ -237,7 +215,34 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
viewThemeUtils!!
)
// super.onBind is at this position, because:
// - it needs to be called after "placeholder" is set (otherwise placeholders are initially not loaded)
// - it needs to be before the show/hide logic is set (because super methods also have logic for this, which
// needs to be overwritten again)
super.onBind(message)
if (userAvatar != null) {
if (message.isGrouped || message.isOneToOneConversation) {
if (message.isOneToOneConversation) {
userAvatar.visibility = View.GONE
} else {
userAvatar.visibility = View.INVISIBLE
}
} else {
userAvatar.visibility = View.VISIBLE
userAvatar.setOnClickListener { v: View ->
if (payload is MessagePayload) {
(payload as MessagePayload).profileBottomSheet.showFor(
message.actorId!!,
v.context
)
}
}
if (ACTOR_TYPE_BOTS == message.actorType && ACTOR_ID_CHANGELOG == message.actorId) {
userAvatar.loadChangelogBotAvatar()
}
}
}
}
private fun longClickOnReaction(chatMessage: ChatMessage) {