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:
@@ -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())) {
|
||||
|
||||
Reference in New Issue
Block a user