fix attachments icon in dialogs

This commit is contained in:
2021-02-21 00:55:07 +03:00
parent 35c45fd34f
commit 34e5258241
2 changed files with 34 additions and 17 deletions
@@ -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())
+14 -3
View File
@@ -106,6 +106,17 @@
tools:src="?colorAccent"
tools:visibility="visible" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/conversationTextAttachment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginTop="1.5dp"
android:tint="?colorAccent"
android:visibility="gone"
tools:src="@drawable/ic_message_attachment_camera"
tools:visibility="visible" />
<TextView
android:id="@+id/conversationText"
android:layout_width="match_parent"
@@ -166,10 +177,10 @@
android:background="@drawable/ic_conversations_counter_background"
android:backgroundTint="?colorAccent"
android:backgroundTintMode="multiply"
android:gravity="center"
android:minWidth="25dp"
android:fontFamily="@font/google_sans_medium"
android:minHeight="20dp"
android:gravity="center"
android:minWidth="28dp"
android:minHeight="28dp"
android:padding="6dp"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="12sp"