Set drawable size in code

This commit is contained in:
Naveen 2023-08-22 14:27:40 +05:30
parent fead93ddf7
commit 8bc6659d71
No known key found for this signature in database
GPG Key ID: 0E155DAD31671DA3
2 changed files with 8 additions and 13 deletions

View File

@ -384,12 +384,16 @@ class ThreadAdapter(
if (message.isScheduled) { if (message.isScheduled) {
typeface = Typeface.create(Typeface.DEFAULT, Typeface.ITALIC) typeface = Typeface.create(Typeface.DEFAULT, Typeface.ITALIC)
val scheduledDrawable = AppCompatResources.getDrawable(activity, R.drawable.scheduled_message_icon) val scheduledDrawable = AppCompatResources.getDrawable(activity, R.drawable.ic_clock_vector)?.apply {
scheduledDrawable?.applyColorFilter(contrastColor) applyColorFilter(contrastColor)
setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, scheduledDrawable, null) val size = lineHeight
setBounds(0, 0, size, size)
}
setCompoundDrawables(null, null, scheduledDrawable, null)
} else { } else {
typeface = Typeface.DEFAULT typeface = Typeface.DEFAULT
setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, null, null) setCompoundDrawables(null, null, null, null)
} }
} }
} }

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:width="@dimen/small_icon_size"
android:height="@dimen/small_icon_size"
android:drawable="@drawable/ic_clock_vector" />
</layer-list>