Messaging: Tint recipient field properly

We need to tint the underline ourselves, reyling on forceDarkAllowed
does nothing here

Change-Id: I2c390a76df5aef6e16512295521d073dbe25d5fc
This commit is contained in:
Michael W
2024-12-26 17:43:06 +01:00
parent 8ae38097b0
commit 6cdd458b69
2 changed files with 11 additions and 2 deletions

View File

@@ -36,6 +36,7 @@
android:maxHeight="@dimen/compose_message_chips_view_max_height">
<com.android.messaging.ui.contact.ContactRecipientAutoCompleteView
android:forceDarkAllowed="false"
android:id="@+id/recipient_text_view"
style="@style/RecipientEditTextView"
android:layout_width="match_parent"

View File

@@ -18,7 +18,9 @@ package com.android.messaging.ui.contact;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.text.Editable;
import android.text.TextPaint;
@@ -30,7 +32,9 @@ import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import com.android.ex.chips.RecipientEditTextView;
import com.android.ex.chips.RecipientEntry;
@@ -114,9 +118,13 @@ public class ContactRecipientAutoCompleteView extends RecipientEditTextView {
addTextChangedListener(new ContactChipsWatcher());
setOnFocusListShrinkRecipients(false);
setBackground(ResourcesCompat.getDrawable(context.getResources(),
Drawable drawable = ResourcesCompat.getDrawable(context.getResources(),
androidx.appcompat.R.drawable.abc_textfield_search_default_mtrl_alpha,
context.getTheme()));
context.getTheme());
int drawableColor = ContextCompat.getColor(context, android.R.color.white);
DrawableCompat.setTint(drawable.mutate(), drawableColor);
setBackground(drawable);
}
public void setContactChipsListener(final ContactChipsChangeListener listener) {