use the main color at showing conversation participants

This commit is contained in:
tibbi 2021-02-16 13:19:12 +01:00
parent d6fdbc4271
commit 65ae360743
2 changed files with 17 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import android.app.Activity
import android.content.Intent import android.content.Intent
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.graphics.drawable.LayerDrawable
import android.media.MediaMetadataRetriever import android.media.MediaMetadataRetriever
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
@ -467,11 +468,19 @@ class ThreadActivity : SimpleActivity() {
} }
private fun showSelectedContacts() { private fun showSelectedContacts() {
val adjustedColor = getAdjustedPrimaryColor()
val selectedContactBg = resources.getDrawable(R.drawable.item_selected_contact_background)
(selectedContactBg as LayerDrawable).findDrawableByLayerId(R.id.selected_contact_bg).applyColorFilter(adjustedColor)
val views = ArrayList<View>() val views = ArrayList<View>()
participants.forEach { participants.forEach {
val contact = it val contact = it
layoutInflater.inflate(R.layout.item_selected_contact, null).apply { layoutInflater.inflate(R.layout.item_selected_contact, null).apply {
selected_contact_holder.background = selectedContactBg
selected_contact_name.text = contact.name selected_contact_name.text = contact.name
selected_contact_name.setTextColor(adjustedColor.getContrastColor())
selected_contact_remove.applyColorFilter(adjustedColor.getContrastColor())
selected_contact_remove.setOnClickListener { selected_contact_remove.setOnClickListener {
if (contact.rawId != participants.first().rawId) { if (contact.rawId != participants.first().rawId) {
removeSelectedContact(contact.rawId) removeSelectedContact(contact.rawId)

View File

@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
android:shape="rectangle"> <item android:id="@+id/selected_contact_bg">
<shape android:shape="rectangle">
<corners android:radius="@dimen/normal_margin" /> <corners android:radius="@dimen/normal_margin" />
<solid android:color="@color/activated_item_foreground" /> <solid android:color="@color/md_grey_white" />
</shape> </shape>
</item>
</layer-list>