From 34e5258241d2c2c515436b6c16462b4d2f47735e Mon Sep 17 00:00:00 2001 From: Danil Nikolaev Date: Sun, 21 Feb 2021 00:55:07 +0300 Subject: [PATCH] fix attachments icon in dialogs --- .../fast/adapter/ConversationsAdapter.kt | 34 +++++++++++-------- app/src/main/res/layout/item_conversation.xml | 17 ++++++++-- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/meloda/fast/adapter/ConversationsAdapter.kt b/app/src/main/java/com/meloda/fast/adapter/ConversationsAdapter.kt index 41d75e0c..b02d1737 100644 --- a/app/src/main/java/com/meloda/fast/adapter/ConversationsAdapter.kt +++ b/app/src/main/java/com/meloda/fast/adapter/ConversationsAdapter.kt @@ -107,6 +107,7 @@ class ConversationsAdapter( inner class ConversationHolder(v: View) : BaseHolder(v) { + private var attachments: ImageView = v.findViewById(R.id.conversationTextAttachment) private var text: TextView = v.findViewById(R.id.conversationText) private var title: TextView = v.findViewById(R.id.conversationTitle) private var avatar: ImageView = v.findViewById(R.id.conversationAvatar) @@ -317,10 +318,11 @@ class ConversationsAdapter( } private fun prepareAttachments(lastMessage: VKMessage) { - text.apply { - compoundDrawablePadding = 0 - setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, null, null) - } +// text.apply { +// compoundDrawablePadding = 0 +// setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, null, null) +// } + attachments.isVisible = false if (lastMessage.action == null) { when { @@ -345,17 +347,21 @@ class ConversationsAdapter( val attachmentDrawable = VKUtil.getAttachmentDrawable(context, lastMessage.attachments) + text.text = span - text.apply { - text = span - setCompoundDrawablesRelativeWithIntrinsicBounds( - attachmentDrawable, - null, - null, - null - ) - compoundDrawablePadding = 8 - } + attachments.isVisible = true + attachments.setImageDrawable(attachmentDrawable) + +// text.apply { +// text = span +// setCompoundDrawablesRelativeWithIntrinsicBounds( +// attachmentDrawable, +// null, +// null, +// null +// ) +// compoundDrawablePadding = 8 +// } } lastMessage.fwdMessages.isNotEmpty() -> { val fwdText = VKUtil.getFwdText(context, lastMessage.getForwardedMessages()) diff --git a/app/src/main/res/layout/item_conversation.xml b/app/src/main/res/layout/item_conversation.xml index 0cb8b32c..c53d99bc 100644 --- a/app/src/main/res/layout/item_conversation.xml +++ b/app/src/main/res/layout/item_conversation.xml @@ -106,6 +106,17 @@ tools:src="?colorAccent" tools:visibility="visible" /> + +