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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user