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

Commit 5e560296 authored by Rahul Banerjee's avatar Rahul Banerjee Committed by Android (Google) Code Review
Browse files

Merge "Update SurfaceEffect color tokens to allow use via Compose." into main

parents 48978e4e 149509dc
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -78,6 +78,10 @@ class AndroidColorScheme(
    val underSurface: Color,
    val weatherTemp: Color,
    val widgetBackground: Color,
    val surfaceEffect0: Color,
    val surfaceEffect1: Color,
    val surfaceEffect2: Color,
    val surfaceEffect3: Color,
) {
    companion object {
        internal fun color(context: Context, @ColorRes id: Int): Color {
@@ -123,6 +127,10 @@ class AndroidColorScheme(
                underSurface = color(context, R.color.customColorUnderSurface),
                weatherTemp = color(context, R.color.customColorWeatherTemp),
                widgetBackground = color(context, R.color.customColorWidgetBackground),
                surfaceEffect0 = color(context, R.color.surface_effect_0),
                surfaceEffect1 = color(context, R.color.surface_effect_1),
                surfaceEffect2 = color(context, R.color.surface_effect_2),
                surfaceEffect3 = color(context, R.color.surface_effect_3),
            )
        }
    }
+13 −9
Original line number Diff line number Diff line
@@ -16,23 +16,27 @@

package com.android.systemui.common.shared.colors

import android.content.res.Resources
import android.content.Context

object SurfaceEffectColors {
    @JvmStatic
    fun surfaceEffect0(r: Resources): Int {
        return r.getColor(com.android.internal.R.color.surface_effect_0)
    fun surfaceEffect0(context: Context): Int {
        return context.resources.getColor(
            com.android.internal.R.color.surface_effect_0, context.theme)
    }
    @JvmStatic
    fun surfaceEffect1(r: Resources): Int {
        return r.getColor(com.android.internal.R.color.surface_effect_1)
    fun surfaceEffect1(context: Context): Int {
        return context.resources.getColor(
            com.android.internal.R.color.surface_effect_1, context.theme)
    }
    @JvmStatic
    fun surfaceEffect2(r: Resources): Int {
        return r.getColor(com.android.internal.R.color.surface_effect_2)
    fun surfaceEffect2(context: Context): Int {
        return context.resources.getColor(
            com.android.internal.R.color.surface_effect_2, context.theme)
    }
    @JvmStatic
    fun surfaceEffect3(r: Resources): Int {
        return r.getColor(com.android.internal.R.color.surface_effect_3)
    fun surfaceEffect3(context: Context): Int {
        return context.resources.getColor(
            com.android.internal.R.color.surface_effect_3, context.theme)
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -391,7 +391,7 @@ public class FooterView extends StackScrollerDecorView {
        if (!notificationFooterBackgroundTintOptimization()) {
            if (notificationShadeBlur()) {
                Color backgroundColor = Color.valueOf(
                        SurfaceEffectColors.surfaceEffect1(getResources()));
                        SurfaceEffectColors.surfaceEffect1(getContext()));
                scHigh = ColorUtils.setAlphaComponent(backgroundColor.toArgb(), 0xFF);
                // Apply alpha on background drawables.
                int backgroundAlpha = (int) (backgroundColor.alpha() * 0xFF);
+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView

    private void updateColors() {
        if (notificationRowTransparency()) {
            mNormalColor = SurfaceEffectColors.surfaceEffect1(getResources());
            mNormalColor = SurfaceEffectColors.surfaceEffect1(getContext());
        } else {
            mNormalColor = mContext.getColor(
                    com.android.internal.R.color.materialColorSurfaceContainerHigh);
+2 −2
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ public class NotificationBackgroundView extends View implements Dumpable,
        mDarkColoredStatefulColors = getResources().getColorStateList(
                R.color.notification_state_color_dark);
        if (notificationRowTransparency()) {
            mNormalColor = SurfaceEffectColors.surfaceEffect1(getResources());
            mNormalColor = SurfaceEffectColors.surfaceEffect1(getContext());
        } else  {
            mNormalColor = mContext.getColor(
                    com.android.internal.R.color.materialColorSurfaceContainerHigh);
@@ -321,7 +321,7 @@ public class NotificationBackgroundView extends View implements Dumpable,
                new PorterDuffColorFilter(
                        isColorized()
                                ? ColorUtils.setAlphaComponent(mTintColor, (int) (255 * 0.9f))
                                : SurfaceEffectColors.surfaceEffect1(getResources()),
                                : SurfaceEffectColors.surfaceEffect1(getContext()),
                        PorterDuff.Mode.SRC)); // SRC operator discards the drawable's color+alpha
    }