Use SRC_ATOP instead of SRC_IN for blending the NotificationExpandButton

Bug: 191969252
Bug: 193157438
Test: check for number of layers in the scene
Change-Id: I65bd80c71b55582347da1559cf707e9d023b7f13
This commit is contained in:
Jeff DeCew
2021-07-09 13:21:20 -04:00
parent 1dd6f20e3b
commit 8d6f3cc158
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);
}