Messaging: Fix warnings about drawables and colors

* They need the theme provided now
* Follow the suggestion by AS
  (sometimes we use ResourcesCompat, sometimes not)

Change-Id: Ie3023fee13a6fc04bd4b912721ba19dcc08befba
This commit is contained in:
Michael W
2024-12-26 14:55:13 +01:00
parent fd63d5f125
commit d430161ca0
17 changed files with 116 additions and 71 deletions
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,11 +56,13 @@ public class AddContactsConfirmationDialog implements DialogInterface.OnClickLis
final Resources resources = mContext.getResources();
final Button cancelButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
if (cancelButton != null) {
cancelButton.setTextColor(resources.getColor(R.color.contact_picker_button_text_color));
cancelButton.setTextColor(resources.getColor(R.color.contact_picker_button_text_color,
mContext.getTheme()));
}
final Button addButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (addButton != null) {
addButton.setTextColor(resources.getColor(R.color.contact_picker_button_text_color));
addButton.setTextColor(resources.getColor(R.color.contact_picker_button_text_color,
mContext.getTheme()));
}
}
@@ -174,7 +174,7 @@ public class ContactPickerFragment extends Fragment implements ContactPickerData
mCustomHeaderViewPager.setViewHolders(viewHolders);
mCustomHeaderViewPager.setViewPagerTabHeight(CustomHeaderViewPager.DEFAULT_TAB_STRIP_SIZE);
mCustomHeaderViewPager.setBackgroundColor(getResources()
.getColor(R.color.contact_picker_background));
.getColor(R.color.contact_picker_background, getContext().getTheme()));
// The view pager defaults to the frequent contacts page.
mCustomHeaderViewPager.setCurrentItem(0);
@@ -554,7 +554,8 @@ public class ContactPickerFragment extends Fragment implements ContactPickerData
// etc. will take the spot of the action bar.
actionBar.hide();
UiUtils.setStatusBarColor(getActivity(),
getResources().getColor(R.color.compose_notification_bar_background));
getResources().getColor(R.color.compose_notification_bar_background,
getActivity().getTheme()));
}
private GetOrCreateConversationActionMonitor mMonitor;
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +30,8 @@ import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;
import androidx.core.content.res.ResourcesCompat;
import com.android.ex.chips.RecipientEditTextView;
import com.android.ex.chips.RecipientEntry;
import com.android.ex.chips.recipientchip.DrawableRecipientChip;
@@ -113,8 +116,9 @@ public class ContactRecipientAutoCompleteView extends RecipientEditTextView {
addTextChangedListener(new ContactChipsWatcher());
setOnFocusListShrinkRecipients(false);
setBackground(context.getResources().getDrawable(
androidx.appcompat.R.drawable.abc_textfield_search_default_mtrl_alpha));
setBackground(ResourcesCompat.getDrawable(context.getResources(),
androidx.appcompat.R.drawable.abc_textfield_search_default_mtrl_alpha,
context.getTheme()));
}
public void setContactChipsListener(final ContactChipsChangeListener listener) {