diff options
| author | Jeff DeCew <jeffdq@google.com> | 2021-03-15 13:29:36 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-03-15 13:29:36 +0000 |
| commit | 2981ba6e75cab42db19d4bf224e04fd87b25fb0a (patch) | |
| tree | 55788dd37eb5dfd2f70564a954066bd96133bd8a /core/java | |
| parent | 3db9cfcd38d06296893ed09ab6cfd906b7599644 (diff) | |
| parent | 5c72acc45137fc7a87106ee4eb78a0548009d3df (diff) | |
Merge "Allow color in minimized notifications" into sc-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/Notification.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index b31048cafbd7..a3a8a5e6c651 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -5311,7 +5311,7 @@ public class Notification implements Parcelable contentView.setInt(R.id.expand_button, "setDefaultTextColor", textColor); contentView.setInt(R.id.expand_button, "setDefaultPillColor", pillColor); // Use different highlighted colors except when low-priority mode prevents that - if (!p.forceDefaultColor) { + if (!p.mReduceHighlights) { textColor = getBackgroundColor(p); pillColor = getAccentColor(p); } @@ -5952,7 +5952,7 @@ public class Notification implements Parcelable .viewType(StandardTemplateParams.VIEW_TYPE_PUBLIC) .fillTextsFrom(this); if (isLowPriority) { - params.forceDefaultColor(); + params.reduceHighlights(); } view = makeNotificationHeader(params); view.setBoolean(R.id.notification_header, "setExpandOnlyOnButton", true); @@ -5975,7 +5975,7 @@ public class Notification implements Parcelable public RemoteViews makeLowPriorityContentView(boolean useRegularSubtext) { StandardTemplateParams p = mParams.reset() .viewType(StandardTemplateParams.VIEW_TYPE_MINIMIZED) - .forceDefaultColor() + .reduceHighlights() .fillTextsFrom(this); if (!useRegularSubtext || TextUtils.isEmpty(mParams.summaryText)) { p.summaryText(createSummaryText()); @@ -6315,7 +6315,9 @@ public class Notification implements Parcelable * @param p the template params to inflate this with */ private @ColorInt int getRawColor(StandardTemplateParams p) { - if (p.forceDefaultColor) { + // When notifications are theme-tinted, the raw color is only used for the icon, so go + // ahead and keep that color instead of changing the color for minimized notifs. + if (p.mReduceHighlights && !mTintWithThemeAccent) { return COLOR_DEFAULT; } return mN.color; @@ -12182,7 +12184,7 @@ public class Notification implements Parcelable int maxRemoteInputHistory = Style.MAX_REMOTE_INPUT_HISTORY_LINES; boolean hideLargeIcon; boolean allowColorization = true; - boolean forceDefaultColor = false; + boolean mReduceHighlights = false; final StandardTemplateParams reset() { mViewType = VIEW_TYPE_UNSPECIFIED; @@ -12203,7 +12205,7 @@ public class Notification implements Parcelable headerTextSecondary = null; maxRemoteInputHistory = Style.MAX_REMOTE_INPUT_HISTORY_LINES; allowColorization = true; - forceDefaultColor = false; + mReduceHighlights = false; return this; } @@ -12301,8 +12303,8 @@ public class Notification implements Parcelable return this; } - final StandardTemplateParams forceDefaultColor() { - this.forceDefaultColor = true; + final StandardTemplateParams reduceHighlights() { + this.mReduceHighlights = true; return this; } |
