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

Commit 61d7f809 authored by Ioana Alexandru's avatar Ioana Alexandru Committed by Android (Google) Code Review
Browse files

Merge "Revert "[Notif redesign] Expander: highlight unopened groups"" into main

parents 54bd6475 04259e01
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -6207,7 +6207,7 @@ public class Notification implements Parcelable
            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 e.g. unopened groups
            // Use different highlighted colors for conversations' unread count
            if (p.mHighlightExpander) {
                pillColor = Colors.flattenAlpha(
                        getColors(p).getTertiaryFixedDimAccentColor(), bgColor);
@@ -6807,8 +6807,6 @@ public class Notification implements Parcelable
        public RemoteViews makeNotificationGroupHeader() {
            return makeNotificationHeader(mParams.reset()
                    .viewType(StandardTemplateParams.VIEW_TYPE_GROUP_HEADER)
                    // Highlight group expander until the group is first opened
                    .highlightExpander(Flags.notificationsRedesignTemplates())
                    .fillTextsFrom(this));
        }
@@ -6984,14 +6982,12 @@ public class Notification implements Parcelable
         * @param useRegularSubtext uses the normal subtext set if there is one available. Otherwise
         *                          a new subtext is created consisting of the content of the
         *                          notification.
         * @param highlightExpander whether the expander should use the highlighted colors
         * @hide
         */
        public RemoteViews makeLowPriorityContentView(boolean useRegularSubtext,
                boolean highlightExpander) {
        public RemoteViews makeLowPriorityContentView(boolean useRegularSubtext) {
            StandardTemplateParams p = mParams.reset()
                    .viewType(StandardTemplateParams.VIEW_TYPE_MINIMIZED)
                    .highlightExpander(highlightExpander)
                    .highlightExpander(false)
                    .fillTextsFrom(this);
            if (!useRegularSubtext || TextUtils.isEmpty(p.mSubText)) {
                p.summaryText(createSummaryText());
+11 −37
Original line number Diff line number Diff line
@@ -56,8 +56,6 @@ public class NotificationExpandButton extends FrameLayout {
    private int mDefaultTextColor;
    private int mHighlightPillColor;
    private int mHighlightTextColor;
    // Track whether this ever had mExpanded = true, so that we don't highlight it anymore.
    private boolean mWasExpanded = false;

    public NotificationExpandButton(Context context) {
        this(context, null, 0, 0);
@@ -136,7 +134,6 @@ public class NotificationExpandButton extends FrameLayout {
        int contentDescriptionId;
        if (mExpanded) {
            if (notificationsRedesignTemplates()) {
                mWasExpanded = true;
                drawableId = R.drawable.ic_notification_2025_collapse;
            } else {
                drawableId = R.drawable.ic_collapse_notification;
@@ -156,8 +153,6 @@ public class NotificationExpandButton extends FrameLayout {
        if (!notificationsRedesignTemplates()) {
            // changing the expanded state can affect the number display
            updateNumber();
        } else {
            updateColors();
        }
    }

@@ -197,27 +192,7 @@ public class NotificationExpandButton extends FrameLayout {
        );
    }

    /**
     * Use highlight colors for the expander for groups (when the number is showing) that haven't
     * been opened before, as long as the colors are available.
     */
    private boolean shouldBeHighlighted() {
        return !mWasExpanded && shouldShowNumber()
                && mHighlightPillColor != 0 && mHighlightTextColor != 0;
    }

    private void updateColors() {
        if (notificationsRedesignTemplates()) {
            if (shouldBeHighlighted()) {
                mPillDrawable.setTintList(ColorStateList.valueOf(mHighlightPillColor));
                mIconView.setColorFilter(mHighlightTextColor);
                mNumberView.setTextColor(mHighlightTextColor);
            } else {
                mPillDrawable.setTintList(ColorStateList.valueOf(mDefaultPillColor));
                mIconView.setColorFilter(mDefaultTextColor);
                mNumberView.setTextColor(mDefaultTextColor);
            }
        } else {
        if (shouldShowNumber()) {
            if (mHighlightPillColor != 0) {
                mPillDrawable.setTintList(ColorStateList.valueOf(mHighlightPillColor));
@@ -236,7 +211,6 @@ public class NotificationExpandButton extends FrameLayout {
            }
        }
    }
    }

    private boolean shouldShowNumber() {
        if (notificationsRedesignTemplates()) {
+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
                notification);
        RemoteViews headerRemoteViews;
        if (lowPriority) {
            headerRemoteViews = builder.makeLowPriorityContentView(true, false);
            headerRemoteViews = builder.makeLowPriorityContentView(true);
        } else {
            headerRemoteViews = builder.makeNotificationGroupHeader();
        }
+4 −8
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.systemui.statusbar.notification.row;

import static android.app.Flags.notificationsRedesignTemplates;

import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE;
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_SENSITIVE_CONTENT;
import static com.android.systemui.statusbar.notification.row.NotificationContentView.VISIBLE_TYPE_CONTRACTED;
@@ -481,16 +479,15 @@ public class NotificationContentInflater implements NotificationRowContentBinder
                    logger.logAsyncTaskProgress(entryForLogging,
                            "creating low-priority group summary remote view");
                    result.mNewMinimizedGroupHeaderView =
                            builder.makeLowPriorityContentView(/* useRegularSubtext = */ true,
                                    /* highlightExpander = */ notificationsRedesignTemplates());
                            builder.makeLowPriorityContentView(true /* useRegularSubtext */);
                }
            }
            setNotifsViewsInflaterFactory(result, row, notifLayoutInflaterFactoryProvider);
            result.packageContext = packageContext;
            result.headsUpStatusBarText = builder.getHeadsUpStatusBarText(
                    /* showingPublic = */ false);
                    false /* showingPublic */);
            result.headsUpStatusBarTextPublic = builder.getHeadsUpStatusBarText(
                    /* showingPublic = */ true);
                    true /* showingPublic */);

            return result;
        });
@@ -1139,8 +1136,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder
    private static RemoteViews createContentView(Notification.Builder builder,
            boolean isMinimized, boolean useLarge) {
        if (isMinimized) {
            return builder.makeLowPriorityContentView(/* useRegularSubtext = */ false,
                    /* highlightExpander = */ false);
            return builder.makeLowPriorityContentView(false /* useRegularSubtext */);
        }
        return builder.createContentView(useLarge);
    }
+2 −9
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
package com.android.systemui.statusbar.notification.row

import android.annotation.SuppressLint
import android.app.Flags.notificationsRedesignTemplates
import android.app.Notification
import android.app.Notification.MessagingStyle
import android.content.Context
@@ -888,10 +887,7 @@ constructor(
                            entryForLogging,
                            "creating low-priority group summary remote view",
                        )
                        builder.makeLowPriorityContentView(
                            /* useRegularSubtext = */ true,
                            /* highlightExpander = */ notificationsRedesignTemplates(),
                        )
                        builder.makeLowPriorityContentView(true /* useRegularSubtext */)
                    } else null
                NewRemoteViews(
                        contracted = contracted,
@@ -1661,10 +1657,7 @@ constructor(
            useLarge: Boolean,
        ): RemoteViews {
            return if (isMinimized) {
                builder.makeLowPriorityContentView(
                    /* useRegularSubtext = */ false,
                    /* highlightExpander = */ false,
                )
                builder.makeLowPriorityContentView(false /* useRegularSubtext */)
            } else builder.createContentView(useLarge)
        }

Loading