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:
@@ -644,7 +644,8 @@ public class BugleNotifications {
|
||||
notificationState.mNotificationBuilder
|
||||
.setSmallIcon(notificationState.getIcon())
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
||||
.setColor(context.getResources().getColor(R.color.notification_accent_color))
|
||||
.setColor(context.getResources().getColor(R.color.notification_accent_color,
|
||||
context.getTheme()))
|
||||
// .setPublicVersion(null) // TODO: when/if we ever support different
|
||||
// text on the lockscreen, instead of "contents hidden"
|
||||
.setCategory(CATEGORY_MESSAGE);
|
||||
@@ -729,7 +730,8 @@ public class BugleNotifications {
|
||||
|
||||
final NotificationCompat.Builder notifBuilder = notificationState.mNotificationBuilder;
|
||||
notifBuilder.setStyle(notificationState.mNotificationStyle);
|
||||
notifBuilder.setColor(context.getResources().getColor(R.color.notification_accent_color));
|
||||
notifBuilder.setColor(context.getResources().getColor(R.color.notification_accent_color,
|
||||
context.getTheme()));
|
||||
|
||||
final WearableExtender wearableExtender = new WearableExtender();
|
||||
setWearableGroupOptions(notifBuilder, notificationState);
|
||||
|
||||
@@ -1134,7 +1134,7 @@ public abstract class MessageNotificationState extends NotificationState {
|
||||
final SpannableStringBuilder spanBuilder = new SpannableStringBuilder();
|
||||
spanBuilder.append(text);
|
||||
spanBuilder.setSpan(new ForegroundColorSpan(context.getResources().getColor(
|
||||
R.color.notification_warning_color)), 0, text.length(),
|
||||
R.color.notification_warning_color, context.getTheme())), 0, text.length(),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
return spanBuilder;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.graphics.drawable.BitmapDrawable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.exifinterface.media.ExifInterface;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.util.Assert;
|
||||
@@ -81,8 +82,8 @@ public class SimSelectorAvatarRequest extends AvatarRequest {
|
||||
final Canvas canvas = new Canvas(bitmap);
|
||||
|
||||
if (sRegularSimIcon == null) {
|
||||
final BitmapDrawable regularSim = (BitmapDrawable) mContext.getResources()
|
||||
.getDrawable(R.drawable.ic_sim_card_send);
|
||||
final BitmapDrawable regularSim = (BitmapDrawable) ResourcesCompat.getDrawable(
|
||||
mContext.getResources(), R.drawable.ic_sim_card_send, mContext.getTheme());
|
||||
sRegularSimIcon = regularSim.getBitmap();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.messaging.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Path;
|
||||
@@ -32,6 +33,8 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.MessagePartData;
|
||||
@@ -350,11 +353,13 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
mChronometer.setVisibility(GONE);
|
||||
((MarginLayoutParams) mPlayPauseButton.getLayoutParams()).setMargins(0, 0, 0, 0);
|
||||
final ImageView playButton = (ImageView) findViewById(R.id.play_button);
|
||||
final Resources res = getResources();
|
||||
final Resources.Theme theme = getContext().getTheme();
|
||||
playButton.setImageDrawable(
|
||||
getResources().getDrawable(R.drawable.ic_preview_play));
|
||||
ResourcesCompat.getDrawable(res, R.drawable.ic_preview_play, theme));
|
||||
final ImageView pauseButton = (ImageView) findViewById(R.id.pause_button);
|
||||
pauseButton.setImageDrawable(
|
||||
getResources().getDrawable(R.drawable.ic_preview_pause));
|
||||
ResourcesCompat.getDrawable(res, R.drawable.ic_preview_pause, theme));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -76,7 +76,8 @@ public class ContactIconView extends AsyncImageView {
|
||||
mIconSize = 0;
|
||||
Assert.fail("Unsupported ContactIconView icon size attribute");
|
||||
}
|
||||
mColorPressedId = resources.getColor(R.color.contact_avatar_pressed_color);
|
||||
mColorPressedId = resources.getColor(R.color.contact_avatar_pressed_color,
|
||||
context.getTheme());
|
||||
|
||||
setImage(null);
|
||||
a.recycle();
|
||||
|
||||
@@ -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.
|
||||
@@ -20,6 +21,8 @@ import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.util.ImageUtils;
|
||||
@@ -71,33 +74,37 @@ public class ConversationDrawables {
|
||||
|
||||
public void updateDrawables() {
|
||||
final Resources resources = mContext.getResources();
|
||||
final Resources.Theme theme = mContext.getTheme();
|
||||
|
||||
mIncomingBubbleNoArrowDrawable =
|
||||
resources.getDrawable(R.drawable.message_bubble_incoming_no_arrow);
|
||||
mOutgoingBubbleNoArrowDrawable =
|
||||
resources.getDrawable(R.drawable.message_bubble_outgoing_no_arrow);
|
||||
mAudioPlayButtonDrawable = resources.getDrawable(R.drawable.ic_play_light);
|
||||
mAudioPauseButtonDrawable = resources.getDrawable(R.drawable.ic_pause_light);
|
||||
mIncomingAudioProgressBackgroundDrawable =
|
||||
resources.getDrawable(R.drawable.audio_progress_bar_background_incoming);
|
||||
mOutgoingAudioProgressBackgroundDrawable =
|
||||
resources.getDrawable(R.drawable.audio_progress_bar_background_outgoing);
|
||||
mAudioProgressForegroundDrawable =
|
||||
resources.getDrawable(R.drawable.audio_progress_bar_progress);
|
||||
mFastScrollThumbDrawable = resources.getDrawable(R.drawable.fastscroll_thumb);
|
||||
mFastScrollThumbPressedDrawable =
|
||||
resources.getDrawable(R.drawable.fastscroll_thumb_pressed);
|
||||
mFastScrollPreviewDrawableLeft =
|
||||
resources.getDrawable(R.drawable.fastscroll_preview_left);
|
||||
mFastScrollPreviewDrawableRight =
|
||||
resources.getDrawable(R.drawable.fastscroll_preview_right);
|
||||
mOutgoingBubbleColor = resources.getColor(R.color.message_bubble_color_outgoing);
|
||||
mIncomingBubbleNoArrowDrawable = ResourcesCompat.getDrawable(resources,
|
||||
R.drawable.message_bubble_incoming_no_arrow, theme);
|
||||
mOutgoingBubbleNoArrowDrawable = ResourcesCompat.getDrawable(resources,
|
||||
R.drawable.message_bubble_outgoing_no_arrow, theme);
|
||||
mAudioPlayButtonDrawable = ResourcesCompat.getDrawable(resources,
|
||||
R.drawable.ic_play_light, theme);
|
||||
mAudioPauseButtonDrawable = ResourcesCompat.getDrawable(resources,
|
||||
R.drawable.ic_pause_light, theme);
|
||||
mIncomingAudioProgressBackgroundDrawable = ResourcesCompat.getDrawable(resources,
|
||||
R.drawable.audio_progress_bar_background_incoming, theme);
|
||||
mOutgoingAudioProgressBackgroundDrawable = ResourcesCompat.getDrawable(resources,
|
||||
R.drawable.audio_progress_bar_background_outgoing, theme);
|
||||
mAudioProgressForegroundDrawable = ResourcesCompat.getDrawable(resources,
|
||||
R.drawable.audio_progress_bar_progress, theme);
|
||||
mFastScrollThumbDrawable = ResourcesCompat.getDrawable(resources,
|
||||
R.drawable.fastscroll_thumb, theme);
|
||||
mFastScrollThumbPressedDrawable = ResourcesCompat.getDrawable(resources,
|
||||
R.drawable.fastscroll_thumb_pressed, theme);
|
||||
mFastScrollPreviewDrawableLeft = ResourcesCompat.getDrawable(resources,
|
||||
R.drawable.fastscroll_preview_left, theme);
|
||||
mFastScrollPreviewDrawableRight = ResourcesCompat.getDrawable(resources,
|
||||
R.drawable.fastscroll_preview_right, theme);
|
||||
mOutgoingBubbleColor = resources.getColor(R.color.message_bubble_color_outgoing, theme);
|
||||
mIncomingErrorBubbleColor =
|
||||
resources.getColor(R.color.message_error_bubble_color_incoming);
|
||||
resources.getColor(R.color.message_error_bubble_color_incoming, theme);
|
||||
mIncomingAudioButtonColor =
|
||||
resources.getColor(R.color.message_audio_button_color_incoming);
|
||||
mSelectedBubbleColor = resources.getColor(R.color.message_bubble_color_selected);
|
||||
mThemeColor = resources.getColor(R.color.primary_color);
|
||||
resources.getColor(R.color.message_audio_button_color_incoming, theme);
|
||||
mSelectedBubbleColor = resources.getColor(R.color.message_bubble_color_selected, theme);
|
||||
mThemeColor = resources.getColor(R.color.primary_color, theme);
|
||||
mColors = resources.obtainTypedArray(R.array.letter_tile_colors);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,11 +42,12 @@ public class ViewPagerTabStrip extends LinearLayout {
|
||||
super(context, attrs);
|
||||
|
||||
final Resources res = context.getResources();
|
||||
final Resources.Theme theme = context.getTheme();
|
||||
|
||||
mSelectedUnderlineThickness =
|
||||
res.getDimensionPixelSize(R.dimen.pager_tab_underline_selected);
|
||||
int underlineColor = res.getColor(R.color.contact_picker_tab_underline);
|
||||
int backgroundColor = res.getColor(R.color.action_bar_background_color);
|
||||
int underlineColor = res.getColor(R.color.contact_picker_tab_underline, theme);
|
||||
int backgroundColor = res.getColor(R.color.action_bar_background_color, theme);
|
||||
|
||||
mSelectedUnderlinePaint = new Paint();
|
||||
mSelectedUnderlinePaint.setColor(underlineColor);
|
||||
|
||||
@@ -101,6 +101,7 @@ public class ViewGroupItemVerticalExplodeAnimation {
|
||||
public void startAnimation() {
|
||||
final Context context = mViewToAnimate.getContext();
|
||||
final Resources resources = context.getResources();
|
||||
final Resources.Theme theme = context.getTheme();
|
||||
final View decorView = ((Activity) context).getWindow().getDecorView();
|
||||
final ViewOverlay viewOverlay = decorView.getOverlay();
|
||||
if (viewOverlay instanceof ViewGroupOverlay) {
|
||||
@@ -119,7 +120,7 @@ public class ViewGroupItemVerticalExplodeAnimation {
|
||||
shadowContainerLayer.setBottom(containerRect.bottom);
|
||||
shadowContainerLayer.setRight(containerRect.right);
|
||||
shadowContainerLayer.setBackgroundColor(resources.getColor(
|
||||
R.color.open_conversation_animation_background_shadow));
|
||||
R.color.open_conversation_animation_background_shadow, theme));
|
||||
// Per design request, temporarily clear out the background of the item content
|
||||
// to not show any ripple effects during animation.
|
||||
if (!(oldBackground instanceof ColorDrawable)) {
|
||||
@@ -150,8 +151,8 @@ public class ViewGroupItemVerticalExplodeAnimation {
|
||||
expandLayer.setTop(viewRect.top);
|
||||
expandLayer.setBottom(viewRect.bottom);
|
||||
expandLayer.setRight(viewRect.right);
|
||||
expandLayer.setBackgroundColor(resources.getColor(
|
||||
R.color.conversation_background));
|
||||
expandLayer.setBackgroundColor(resources.getColor(R.color.conversation_background,
|
||||
theme));
|
||||
ViewCompat.setElevation(expandLayer, elevation);
|
||||
|
||||
// Conditionally stage the snapshot in the overlay.
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -441,7 +441,8 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
|
||||
subscriptionEntry.displayName;
|
||||
mSimNameView.setText(simNameText);
|
||||
mSimNameView.setTextColor(showSimIconAsIncoming ? getResources().getColor(
|
||||
R.color.timestamp_text_incoming) : subscriptionEntry.displayColor);
|
||||
R.color.timestamp_text_incoming, getContext().getTheme()) :
|
||||
subscriptionEntry.displayColor);
|
||||
mSimNameView.setVisibility(VISIBLE);
|
||||
} else {
|
||||
mSimNameView.setText(null);
|
||||
@@ -834,7 +835,8 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
|
||||
mMessageAttachmentsView.setGravity(gravity);
|
||||
|
||||
// Tint image/video attachments when selected
|
||||
final int selectedImageTint = getResources().getColor(R.color.message_image_selected_tint);
|
||||
final int selectedImageTint = getResources().getColor(R.color.message_image_selected_tint,
|
||||
getContext().getTheme());
|
||||
if (mMessageImageView.getVisibility() == View.VISIBLE) {
|
||||
if (isSelected()) {
|
||||
mMessageImageView.setColorFilter(selectedImageTint);
|
||||
@@ -947,24 +949,25 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
|
||||
break;
|
||||
}
|
||||
}
|
||||
final int messageColor = getResources().getColor(messageColorResId);
|
||||
final Resources.Theme theme = getContext().getTheme();
|
||||
final int messageColor = getResources().getColor(messageColorResId, theme);
|
||||
mMessageTextView.setTextColor(messageColor);
|
||||
mMessageTextView.setLinkTextColor(messageColor);
|
||||
mSubjectText.setTextColor(messageColor);
|
||||
if (statusColorResId >= 0) {
|
||||
mTitleTextView.setTextColor(getResources().getColor(statusColorResId));
|
||||
mTitleTextView.setTextColor(getResources().getColor(statusColorResId, theme));
|
||||
}
|
||||
if (infoColorResId >= 0) {
|
||||
mMmsInfoTextView.setTextColor(getResources().getColor(infoColorResId));
|
||||
mMmsInfoTextView.setTextColor(getResources().getColor(infoColorResId, theme));
|
||||
}
|
||||
if (timestampColorResId == R.color.timestamp_text_incoming &&
|
||||
mData.hasAttachments() && !shouldShowMessageTextBubble()) {
|
||||
timestampColorResId = R.color.timestamp_text_outgoing;
|
||||
}
|
||||
mStatusTextView.setTextColor(getResources().getColor(timestampColorResId));
|
||||
mStatusTextView.setTextColor(getResources().getColor(timestampColorResId, theme));
|
||||
|
||||
mSubjectLabel.setTextColor(getResources().getColor(subjectLabelColorResId));
|
||||
mSenderNameTextView.setTextColor(getResources().getColor(timestampColorResId));
|
||||
mSubjectLabel.setTextColor(getResources().getColor(subjectLabelColorResId, theme));
|
||||
mSenderNameTextView.setTextColor(getResources().getColor(timestampColorResId, theme));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1103,8 +1106,9 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
|
||||
detailsTextColorRes = mData.getIsIncoming() ? R.color.timestamp_text_incoming
|
||||
: R.color.timestamp_text_outgoing;
|
||||
}
|
||||
personView.setNameTextColor(getResources().getColor(nameTextColorRes));
|
||||
personView.setDetailsTextColor(getResources().getColor(detailsTextColorRes));
|
||||
Resources.Theme theme = getContext().getTheme();
|
||||
personView.setNameTextColor(getResources().getColor(nameTextColorRes, theme));
|
||||
personView.setDetailsTextColor(getResources().getColor(detailsTextColorRes, theme));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import androidx.core.text.BidiFormatter;
|
||||
import androidx.core.text.TextDirectionHeuristicsCompat;
|
||||
@@ -37,6 +38,8 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.annotation.VisibleForAnimation;
|
||||
@@ -162,8 +165,9 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
mSnippetTextView.addOnLayoutChangeListener(this);
|
||||
|
||||
final Resources resources = getContext().getResources();
|
||||
mListItemReadColor = resources.getColor(R.color.conversation_list_item_read);
|
||||
mListItemUnreadColor = resources.getColor(R.color.conversation_list_item_unread);
|
||||
final Resources.Theme theme = getContext().getTheme();
|
||||
mListItemReadColor = resources.getColor(R.color.conversation_list_item_read, theme);
|
||||
mListItemUnreadColor = resources.getColor(R.color.conversation_list_item_unread, theme);
|
||||
|
||||
mListItemReadTypeface = Typefaces.getRobotoNormal();
|
||||
mListItemUnreadTypeface = Typefaces.getRobotoBold();
|
||||
@@ -403,7 +407,8 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
final boolean isDefaultSmsApp = PhoneUtils.getDefault().isDefaultSmsApp();
|
||||
// don't show the error state unless we're the default sms app
|
||||
if (mData.getIsFailedStatus() && isDefaultSmsApp) {
|
||||
mTimestampTextView.setTextColor(resources.getColor(R.color.conversation_list_error));
|
||||
mTimestampTextView.setTextColor(resources.getColor(R.color.conversation_list_error,
|
||||
getContext().getTheme()));
|
||||
mTimestampTextView.setTypeface(mListItemReadTypeface, typefaceStyle);
|
||||
int failureMessageId = R.string.message_status_download_failed;
|
||||
if (mData.getIsMessageTypeOutgoing()) {
|
||||
@@ -499,16 +504,15 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
mAudioAttachmentView.setOnLongClickListener(this);
|
||||
mAudioAttachmentView.setVisibility(audioPreviewVisiblity);
|
||||
|
||||
Drawable archiveDrawable = ResourcesCompat.getDrawable(
|
||||
getResources(), R.drawable.ic_archive_small_dark, getContext().getTheme());
|
||||
if (PrefsUtils.isSwipeRightToDeleteEnabled()) {
|
||||
mCrossSwipeArchiveLeftImageView.setImageDrawable(getResources()
|
||||
.getDrawable(R.drawable.ic_delete_small_dark));
|
||||
mCrossSwipeArchiveRightImageView.setImageDrawable(getResources()
|
||||
.getDrawable(R.drawable.ic_archive_small_dark));
|
||||
mCrossSwipeArchiveLeftImageView.setImageDrawable(ResourcesCompat.getDrawable(
|
||||
getResources(), R.drawable.ic_delete_small_dark, getContext().getTheme()));
|
||||
mCrossSwipeArchiveRightImageView.setImageDrawable(archiveDrawable);
|
||||
} else {
|
||||
mCrossSwipeArchiveLeftImageView.setImageDrawable(getResources()
|
||||
.getDrawable(R.drawable.ic_archive_small_dark));
|
||||
mCrossSwipeArchiveRightImageView.setImageDrawable(getResources()
|
||||
.getDrawable(R.drawable.ic_archive_small_dark));
|
||||
mCrossSwipeArchiveLeftImageView.setImageDrawable(archiveDrawable);
|
||||
mCrossSwipeArchiveRightImageView.setImageDrawable(archiveDrawable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.messaging.ui.mediapicker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
@@ -32,6 +33,8 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.DraftMessageData.DraftMessageSubscriptionDataProvider;
|
||||
@@ -222,9 +225,12 @@ public class AudioRecordView extends FrameLayout implements
|
||||
}
|
||||
|
||||
private void updateRecordButtonAppearance() {
|
||||
final Drawable foregroundDrawable = getResources().getDrawable(R.drawable.ic_mp_audio_mic);
|
||||
final GradientDrawable backgroundDrawable = ((GradientDrawable) getResources()
|
||||
.getDrawable(R.drawable.audio_record_control_button_background));
|
||||
final Resources res = getResources();
|
||||
final Resources.Theme theme = getContext().getTheme();
|
||||
final Drawable foregroundDrawable = ResourcesCompat.getDrawable(res,
|
||||
R.drawable.ic_mp_audio_mic, theme);
|
||||
final GradientDrawable backgroundDrawable = ((GradientDrawable) ResourcesCompat.getDrawable(
|
||||
res, R.drawable.audio_record_control_button_background, theme));
|
||||
if (isRecording()) {
|
||||
foregroundDrawable.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
|
||||
backgroundDrawable.setColor(mThemeColor);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.messaging.ui.mediapicker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
@@ -161,9 +162,10 @@ public class GalleryGridItemView extends FrameLayout {
|
||||
mAdditionalInfo.setVisibility(VISIBLE);
|
||||
} else {
|
||||
final String contentType = mData.getContentType();
|
||||
Resources.Theme theme = getContext().getTheme();
|
||||
if (ContentType.isAudioType(contentType)) {
|
||||
setBackgroundColor(
|
||||
getResources().getColor(R.color.gallery_image_default_background));
|
||||
getResources().getColor(R.color.gallery_image_default_background, theme));
|
||||
mIcon.setImageResource(R.drawable.ic_music);
|
||||
mIcon.setColorFilter(
|
||||
ConversationDrawables.get().getConversationThemeColor(),
|
||||
@@ -178,7 +180,7 @@ public class GalleryGridItemView extends FrameLayout {
|
||||
} else { // For image and video types
|
||||
mImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
setBackgroundColor(
|
||||
getResources().getColor(R.color.gallery_image_default_background));
|
||||
getResources().getColor(R.color.gallery_image_default_background, theme));
|
||||
mImageView.setImageResourceId(mData.getImageRequestDescriptor());
|
||||
mImageView.setVisibility(VISIBLE);
|
||||
if (ContentType.isVideoType(mData.getContentType())) {
|
||||
|
||||
@@ -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.
|
||||
@@ -170,7 +171,8 @@ public class WidgetConversationListService extends RemoteViewsService {
|
||||
builder.setSpan(new StyleSpan(Typeface.ITALIC), 0, text.length(),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
builder.setSpan(new ForegroundColorSpan(
|
||||
resources.getColor(R.color.widget_text_color)),
|
||||
resources.getColor(R.color.widget_text_color,
|
||||
mContext.getTheme())),
|
||||
0, text.length(),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
remoteViews.setTextViewText(R.id.errorText, builder);
|
||||
|
||||
@@ -389,7 +389,8 @@ public class WidgetConversationService extends RemoteViewsService {
|
||||
final Spannable colorStr = new SpannableString(statusText);
|
||||
if (showInRed) {
|
||||
colorStr.setSpan(new ForegroundColorSpan(
|
||||
mContext.getResources().getColor(R.color.timestamp_text_failed)),
|
||||
mContext.getResources().getColor(R.color.timestamp_text_failed,
|
||||
mContext.getTheme())),
|
||||
0, statusText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
remoteViews.setTextViewText(R.id.date, colorStr);
|
||||
|
||||
Reference in New Issue
Block a user