diff --git a/src/com/android/messaging/datamodel/BugleNotifications.java b/src/com/android/messaging/datamodel/BugleNotifications.java index c1af8a2..80db602 100644 --- a/src/com/android/messaging/datamodel/BugleNotifications.java +++ b/src/com/android/messaging/datamodel/BugleNotifications.java @@ -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); diff --git a/src/com/android/messaging/datamodel/MessageNotificationState.java b/src/com/android/messaging/datamodel/MessageNotificationState.java index 08fef19..1f04bc5 100644 --- a/src/com/android/messaging/datamodel/MessageNotificationState.java +++ b/src/com/android/messaging/datamodel/MessageNotificationState.java @@ -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; } diff --git a/src/com/android/messaging/datamodel/media/SimSelectorAvatarRequest.java b/src/com/android/messaging/datamodel/media/SimSelectorAvatarRequest.java index 6d61bab..b95f582 100644 --- a/src/com/android/messaging/datamodel/media/SimSelectorAvatarRequest.java +++ b/src/com/android/messaging/datamodel/media/SimSelectorAvatarRequest.java @@ -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(); } diff --git a/src/com/android/messaging/ui/AudioAttachmentView.java b/src/com/android/messaging/ui/AudioAttachmentView.java index d2a69d2..14a641b 100644 --- a/src/com/android/messaging/ui/AudioAttachmentView.java +++ b/src/com/android/messaging/ui/AudioAttachmentView.java @@ -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: diff --git a/src/com/android/messaging/ui/ContactIconView.java b/src/com/android/messaging/ui/ContactIconView.java index db15d20..3817e11 100644 --- a/src/com/android/messaging/ui/ContactIconView.java +++ b/src/com/android/messaging/ui/ContactIconView.java @@ -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(); diff --git a/src/com/android/messaging/ui/ConversationDrawables.java b/src/com/android/messaging/ui/ConversationDrawables.java index 60a3db5..a9f30c4 100644 --- a/src/com/android/messaging/ui/ConversationDrawables.java +++ b/src/com/android/messaging/ui/ConversationDrawables.java @@ -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); } diff --git a/src/com/android/messaging/ui/ViewPagerTabStrip.java b/src/com/android/messaging/ui/ViewPagerTabStrip.java index 52cc2d5..8636cf9 100644 --- a/src/com/android/messaging/ui/ViewPagerTabStrip.java +++ b/src/com/android/messaging/ui/ViewPagerTabStrip.java @@ -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); diff --git a/src/com/android/messaging/ui/animation/ViewGroupItemVerticalExplodeAnimation.java b/src/com/android/messaging/ui/animation/ViewGroupItemVerticalExplodeAnimation.java index 83dc31f..18747b2 100644 --- a/src/com/android/messaging/ui/animation/ViewGroupItemVerticalExplodeAnimation.java +++ b/src/com/android/messaging/ui/animation/ViewGroupItemVerticalExplodeAnimation.java @@ -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. diff --git a/src/com/android/messaging/ui/contact/AddContactsConfirmationDialog.java b/src/com/android/messaging/ui/contact/AddContactsConfirmationDialog.java index 9c1393d..86d7391 100644 --- a/src/com/android/messaging/ui/contact/AddContactsConfirmationDialog.java +++ b/src/com/android/messaging/ui/contact/AddContactsConfirmationDialog.java @@ -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())); } } diff --git a/src/com/android/messaging/ui/contact/ContactPickerFragment.java b/src/com/android/messaging/ui/contact/ContactPickerFragment.java index 7c41f7a..b57edcb 100644 --- a/src/com/android/messaging/ui/contact/ContactPickerFragment.java +++ b/src/com/android/messaging/ui/contact/ContactPickerFragment.java @@ -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; diff --git a/src/com/android/messaging/ui/contact/ContactRecipientAutoCompleteView.java b/src/com/android/messaging/ui/contact/ContactRecipientAutoCompleteView.java index 17128c1..a2ef296 100644 --- a/src/com/android/messaging/ui/contact/ContactRecipientAutoCompleteView.java +++ b/src/com/android/messaging/ui/contact/ContactRecipientAutoCompleteView.java @@ -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) { diff --git a/src/com/android/messaging/ui/conversation/ConversationMessageView.java b/src/com/android/messaging/ui/conversation/ConversationMessageView.java index bb2ceef..7408e88 100644 --- a/src/com/android/messaging/ui/conversation/ConversationMessageView.java +++ b/src/com/android/messaging/ui/conversation/ConversationMessageView.java @@ -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 diff --git a/src/com/android/messaging/ui/conversationlist/ConversationListItemView.java b/src/com/android/messaging/ui/conversationlist/ConversationListItemView.java index 50ca829..65d47f1 100644 --- a/src/com/android/messaging/ui/conversationlist/ConversationListItemView.java +++ b/src/com/android/messaging/ui/conversationlist/ConversationListItemView.java @@ -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); } } diff --git a/src/com/android/messaging/ui/mediapicker/AudioRecordView.java b/src/com/android/messaging/ui/mediapicker/AudioRecordView.java index 7c5c980..1897cbd 100644 --- a/src/com/android/messaging/ui/mediapicker/AudioRecordView.java +++ b/src/com/android/messaging/ui/mediapicker/AudioRecordView.java @@ -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); diff --git a/src/com/android/messaging/ui/mediapicker/GalleryGridItemView.java b/src/com/android/messaging/ui/mediapicker/GalleryGridItemView.java index c336c01..08e8925 100644 --- a/src/com/android/messaging/ui/mediapicker/GalleryGridItemView.java +++ b/src/com/android/messaging/ui/mediapicker/GalleryGridItemView.java @@ -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())) { diff --git a/src/com/android/messaging/widget/WidgetConversationListService.java b/src/com/android/messaging/widget/WidgetConversationListService.java index 1eb646b..8b1dd17 100644 --- a/src/com/android/messaging/widget/WidgetConversationListService.java +++ b/src/com/android/messaging/widget/WidgetConversationListService.java @@ -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); diff --git a/src/com/android/messaging/widget/WidgetConversationService.java b/src/com/android/messaging/widget/WidgetConversationService.java index eee073c..e480da5 100644 --- a/src/com/android/messaging/widget/WidgetConversationService.java +++ b/src/com/android/messaging/widget/WidgetConversationService.java @@ -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);