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

Commit 937f04cc authored by Shan Huang's avatar Shan Huang
Browse files

Add transparency to notication footer buttons.

Bug: 388891868
Test: atest FooterViewTest
Change-Id: I4f23196619892b8d0ed55e30eae6d0224748b164
Flag: com.android.systemui.notification_shade_blur
parent 3f4ab0a7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@
                <padding
                    android:left="20dp"
                    android:right="20dp" />
                <!-- TODO(b/294830092): Update to the blur surface effect color token when
                                        the resource workaround is resolved and
                                        notification_shade_blur is enabled. -->
                <solid android:color="@androidprv:color/materialColorSurfaceContainerHigh" />
            </shape>
        </inset>
+20 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.footer.ui.view;
import static android.graphics.PorterDuff.Mode.SRC_ATOP;

import static com.android.systemui.Flags.notificationFooterBackgroundTintOptimization;
import static com.android.systemui.Flags.notificationShadeBlur;
import static com.android.systemui.util.ColorUtilKt.hexColorString;

import android.annotation.ColorInt;
@@ -29,6 +30,7 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
@@ -39,6 +41,8 @@ import android.widget.TextView;

import androidx.annotation.NonNull;

import com.android.internal.graphics.ColorUtils;
import com.android.systemui.common.shared.colors.SurfaceEffectColors;
import com.android.systemui.res.R;
import com.android.systemui.scene.shared.flag.SceneContainerFlag;
import com.android.systemui.statusbar.notification.ColorUpdateLogger;
@@ -383,9 +387,23 @@ public class FooterView extends StackScrollerDecorView {
        final Drawable historyBg = NotifRedesignFooter.isEnabled()
                ? theme.getDrawable(R.drawable.notif_footer_btn_background) : null;
        final @ColorInt int scHigh;

        if (!notificationFooterBackgroundTintOptimization()) {
            if (notificationShadeBlur()) {
                Color backgroundColor = Color.valueOf(
                        SurfaceEffectColors.surfaceEffect0(getResources()));
                scHigh = ColorUtils.setAlphaComponent(backgroundColor.toArgb(), 0xFF);
                // Apply alpha on background drawables.
                int backgroundAlpha = (int) (backgroundColor.alpha() * 0xFF);
                clearAllBg.setAlpha(backgroundAlpha);
                settingsBg.setAlpha(backgroundAlpha);
                if (historyBg != null) {
                    historyBg.setAlpha(backgroundAlpha);
                }
            } else {
                scHigh = mContext.getColor(
                        com.android.internal.R.color.materialColorSurfaceContainerHigh);
            }
            if (scHigh != 0) {
                final ColorFilter bgColorFilter = new PorterDuffColorFilter(scHigh, SRC_ATOP);
                clearAllBg.setColorFilter(bgColorFilter);