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) {
typeface = Typeface.create(Typeface.DEFAULT, Typeface.ITALIC)
val scheduledDrawable = AppCompatResources.getDrawable(activity, R.drawable.scheduled_message_icon)
scheduledDrawable?.applyColorFilter(contrastColor)
setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, scheduledDrawable, null)
val scheduledDrawable = AppCompatResources.getDrawable(activity, R.drawable.ic_clock_vector)?.apply {
applyColorFilter(contrastColor)
val size = lineHeight
setBounds(0, 0, size, size)
}
setCompoundDrawables(null, null, scheduledDrawable, null)
} else {
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>