Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c72acc4 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Allow color in minimized notifications

* This prevents the color change problem when expanding minimized notifications.
* The expander for minimized groups will use the non-highlight colors.

Fixes: 176899982
Test: manual
Change-Id: I592ebc1edc18075537c81bfa8d36dee9b6d011d1
parent 0ec8d259
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -5307,7 +5307,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);
            }
@@ -5943,7 +5943,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);
@@ -5966,7 +5966,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());
@@ -6306,7 +6306,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;
@@ -12163,7 +12165,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;
@@ -12182,7 +12184,7 @@ public class Notification implements Parcelable
            headerTextSecondary = null;
            maxRemoteInputHistory = Style.MAX_REMOTE_INPUT_HISTORY_LINES;
            allowColorization = true;
            forceDefaultColor = false;
            mReduceHighlights = false;
            return this;
        }

@@ -12270,8 +12272,8 @@ public class Notification implements Parcelable
            return this;
        }

        final StandardTemplateParams forceDefaultColor() {
            this.forceDefaultColor = true;
        final StandardTemplateParams reduceHighlights() {
            this.mReduceHighlights = true;
            return this;
        }