Merge "Use SRC_ATOP instead of SRC_IN for blending the NotificationExpandButton" into sc-dev

This commit is contained in:
Jeff DeCew
2021-07-12 19:48:58 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 9 deletions

View File

@@ -5380,14 +5380,15 @@ public class Notification implements Parcelable
private void bindExpandButton(RemoteViews contentView, StandardTemplateParams p) {
// set default colors
int textColor = getPrimaryTextColor(p);
int pillColor = getColors(p).getProtectionColor();
int bgColor = getBackgroundColor(p);
int pillColor = Colors.flattenAlpha(getColors(p).getProtectionColor(), bgColor);
int textColor = Colors.flattenAlpha(getPrimaryTextColor(p), pillColor);
contentView.setInt(R.id.expand_button, "setDefaultTextColor", textColor);
contentView.setInt(R.id.expand_button, "setDefaultPillColor", pillColor);
// Use different highlighted colors for conversations' unread count
if (p.mHighlightExpander) {
textColor = getBackgroundColor(p);
pillColor = getPrimaryAccentColor(p);
pillColor = Colors.flattenAlpha(getPrimaryAccentColor(p), bgColor);
textColor = Colors.flattenAlpha(bgColor, pillColor);
}
contentView.setInt(R.id.expand_button, "setHighlightTextColor", textColor);
contentView.setInt(R.id.expand_button, "setHighlightPillColor", pillColor);

View File

@@ -20,7 +20,6 @@ import android.annotation.ColorInt;
import android.annotation.Nullable;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.RemotableViewMethod;
@@ -159,8 +158,7 @@ public class NotificationExpandButton extends FrameLayout {
if (mHighlightPillColor != 0) {
mPillView.setBackgroundTintList(ColorStateList.valueOf(mHighlightPillColor));
}
mPillView.setBackgroundTintMode(PorterDuff.Mode.SRC_IN);
mIconView.setColorFilter(mHighlightTextColor, PorterDuff.Mode.SRC_IN);
mIconView.setColorFilter(mHighlightTextColor);
if (mHighlightTextColor != 0) {
mNumberView.setTextColor(mHighlightTextColor);
}
@@ -168,8 +166,7 @@ public class NotificationExpandButton extends FrameLayout {
if (mDefaultPillColor != 0) {
mPillView.setBackgroundTintList(ColorStateList.valueOf(mDefaultPillColor));
}
mPillView.setBackgroundTintMode(PorterDuff.Mode.SRC_IN);
mIconView.setColorFilter(mDefaultTextColor, PorterDuff.Mode.SRC_IN);
mIconView.setColorFilter(mDefaultTextColor);
if (mDefaultTextColor != 0) {
mNumberView.setTextColor(mDefaultTextColor);
}