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

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

Merge "Make actions bg transparent" into main

parents 9308e287 f0c40072
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@
            android:insetBottom="8dp">
            android:insetBottom="8dp">
            <shape android:shape="rectangle">
            <shape android:shape="rectangle">
                <corners android:radius="@dimen/notification_2025_smart_reply_button_corner_radius" />
                <corners android:radius="@dimen/notification_2025_smart_reply_button_corner_radius" />
                <!-- Note that the stroke and fill colors are being overridden in SmartReplyView. -->
                <stroke android:width="@dimen/smart_reply_button_stroke_width"
                <stroke android:width="@dimen/smart_reply_button_stroke_width"
                        android:color="@color/smart_reply_button_stroke" />
                        android:color="@color/smart_reply_button_stroke" />
                <solid android:color="@color/smart_reply_button_background"/>
                <solid android:color="@color/smart_reply_button_background"/>
+16 −2
Original line number Original line Diff line number Diff line
package com.android.systemui.statusbar.policy;
package com.android.systemui.statusbar.policy;


import static android.app.Flags.notificationsRedesignTemplates;

import static java.lang.Float.NaN;
import static java.lang.Float.NaN;
import com.android.systemui.Flags;

import android.annotation.ColorInt;
import android.annotation.ColorInt;
import android.app.Notification;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.PendingIntent;
@@ -32,6 +34,7 @@ import androidx.annotation.NonNull;


import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ContrastColorUtil;
import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.Flags;
import com.android.systemui.res.R;
import com.android.systemui.res.R;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.NotificationUtils;


@@ -82,6 +85,7 @@ public class SmartReplyView extends ViewGroup {


    @ColorInt private int mCurrentBackgroundColor;
    @ColorInt private int mCurrentBackgroundColor;
    @ColorInt private final int mDefaultBackgroundColor;
    @ColorInt private final int mDefaultBackgroundColor;
    @ColorInt private final int mTransparentBackgroundColor;
    @ColorInt private final int mDefaultStrokeColor;
    @ColorInt private final int mDefaultStrokeColor;
    @ColorInt private final int mDefaultTextColor;
    @ColorInt private final int mDefaultTextColor;
    @ColorInt private final int mDefaultTextColorDarkBg;
    @ColorInt private final int mDefaultTextColorDarkBg;
@@ -112,7 +116,13 @@ public class SmartReplyView extends ViewGroup {
        mHeightUpperLimit = NotificationUtils.getFontScaledHeight(mContext,
        mHeightUpperLimit = NotificationUtils.getFontScaledHeight(mContext,
            R.dimen.smart_reply_button_max_height);
            R.dimen.smart_reply_button_max_height);


        // The default color is white, as it helps us ensure ideal contrast. However, the actual
        // color will be based on the notification background (set in setBackgroundTintColor).
        // When notificationsRedesignTemplates is on, we use that color to calculate the colors of
        // the other elements, but we make the button transparent so that the translucent
        // background of the notification is visible.
        mDefaultBackgroundColor = context.getColor(R.color.smart_reply_button_background);
        mDefaultBackgroundColor = context.getColor(R.color.smart_reply_button_background);
        mTransparentBackgroundColor = context.getColor(R.color.transparent);
        mDefaultTextColor = mContext.getColor(R.color.smart_reply_button_text);
        mDefaultTextColor = mContext.getColor(R.color.smart_reply_button_text);
        mDefaultTextColorDarkBg = mContext.getColor(R.color.smart_reply_button_text_dark_bg);
        mDefaultTextColorDarkBg = mContext.getColor(R.color.smart_reply_button_text_dark_bg);
        mDefaultStrokeColor = mContext.getColor(R.color.smart_reply_button_stroke);
        mDefaultStrokeColor = mContext.getColor(R.color.smart_reply_button_stroke);
@@ -833,7 +843,11 @@ public class SmartReplyView extends ViewGroup {
                Drawable background = ((InsetDrawable) inset).getDrawable();
                Drawable background = ((InsetDrawable) inset).getDrawable();
                if (background instanceof GradientDrawable) {
                if (background instanceof GradientDrawable) {
                    GradientDrawable gradientDrawable = (GradientDrawable) background;
                    GradientDrawable gradientDrawable = (GradientDrawable) background;
                    gradientDrawable.setColor(mCurrentBackgroundColor);
                    // With the redesign, we let the background be transparent (so the notification
                    // surface gets through), but all other colors are calculated and applied
                    // as usual to ensure contrast.
                    gradientDrawable.setColor(notificationsRedesignTemplates()
                            ? mTransparentBackgroundColor : mCurrentBackgroundColor);
                    gradientDrawable.setStroke(mStrokeWidth, mCurrentStrokeColor);
                    gradientDrawable.setStroke(mStrokeWidth, mCurrentStrokeColor);
                }
                }
            }
            }