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

Commit 7b8636fd authored by Lucas Dupin's avatar Lucas Dupin
Browse files

1/N The road to Material NEXT (bouncer and shade)

Styling bouncer and shade so they have solid backgrounds and read colors
from themes instead of named resources.

Scrim now fetches colorBackgroundFloating, and views get their background
from colorBackground.
Switching from light to dark theme will make bouncer colors update without
re-inflating any views.

Bug: 173561906
Bug: 173561901
Test: atest ScrimControllerTest
Test: atest KeyguardSecurityContainerControllerTest
Test: manual, switching to dark theme annd showing notif guts
Change-Id: I372e8b688d7bbddd698381accd074b7655788cd0
parent 60797526
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -5932,8 +5932,7 @@ public class Notification implements Parcelable
            }

            int color;
            int background = mContext.getColor(
                    com.android.internal.R.color.notification_material_background_color);
            int background = obtainBackgroundColor();
            if (rawColor == COLOR_DEFAULT) {
                ensureColors(p);
                color = ContrastColorUtil.resolveDefaultColor(mContext, background, mInNightMode);
@@ -5966,8 +5965,7 @@ public class Notification implements Parcelable
            if (mNeutralColor != COLOR_INVALID) {
                return mNeutralColor;
            }
            int background = mContext.getColor(
                    com.android.internal.R.color.notification_material_background_color);
            int background = obtainBackgroundColor();
            mNeutralColor = ContrastColorUtil.resolveDefaultColor(mContext, background,
                    mInNightMode);
            if (Color.alpha(mNeutralColor) < 255) {
@@ -6118,6 +6116,21 @@ public class Notification implements Parcelable
            return mN;
        }

        private @ColorInt int obtainBackgroundColor() {
            int defaultColor = mInNightMode ? Color.BLACK : Color.WHITE;
            Resources.Theme theme = mContext.getTheme();
            if (theme == null) {
                return defaultColor;
            }
            TypedArray ta = theme.obtainStyledAttributes(new int[]{R.attr.colorBackground});
            if (ta == null) {
                return defaultColor;
            }
            int background = ta.getColor(0, defaultColor);
            ta.recycle();
            return background;
        }

        /**
         * Apply this Builder to an existing {@link Notification} object.
         *
@@ -6251,8 +6264,7 @@ public class Notification implements Parcelable
        private int resolveBackgroundColor(StandardTemplateParams p) {
            int backgroundColor = getBackgroundColor(p);
            if (backgroundColor == COLOR_DEFAULT) {
                backgroundColor = mContext.getColor(
                        com.android.internal.R.color.notification_material_background_color);
                backgroundColor = obtainBackgroundColor();
            }
            return backgroundColor;
        }
+14 −0
Original line number Diff line number Diff line
@@ -1090,6 +1090,20 @@ public class LockPatternView extends View {
        }
    }

    /**
     * Change theme colors
     * @param regularColor The dot color
     * @param successColor Color used when pattern is correct
     * @param errorColor Color used when authentication fails
     */
    public void setColors(int regularColor, int successColor, int errorColor) {
        mRegularColor = regularColor;
        mErrorColor = errorColor;
        mSuccessColor = successColor;
        mPathPaint.setColor(regularColor);
        invalidate();
    }

    private float getCenterXForColumn(int column) {
        return mPaddingLeft + column * mSquareWidth + mSquareWidth / 2f;
    }
+0 −3
Original line number Diff line number Diff line
@@ -26,9 +26,6 @@

    <color name="notification_default_color_dark">#ddffffff</color>

    <!-- The background color of a notification card. -->
    <color name="notification_material_background_color">@color/black</color>

    <color name="chooser_row_divider">@color/list_divider_color_dark</color>
    <color name="chooser_gradient_background">@color/loading_gradient_background_color_dark</color>
    <color name="chooser_gradient_highlight">@color/loading_gradient_highlight_color_dark</color>
+0 −2
Original line number Diff line number Diff line
@@ -143,8 +143,6 @@
    <color name="notification_default_color_dark">@color/primary_text_default_material_light</color>
    <color name="notification_default_color_light">#a3202124</color>

    <color name="notification_material_background_color">#ffffffff</color>

    <color name="notification_default_color">#757575</color> <!-- Gray 600 -->

    <color name="notification_action_button_text_color">@color/notification_default_color</color>
+4 −4
Original line number Diff line number Diff line
@@ -37,10 +37,10 @@
    <color name="accent_device_default_dark">@color/accent_material_dark</color>
    <color name="accent_device_default">@color/accent_device_default_light</color>

    <color name="background_device_default_dark">@color/background_material_dark</color>
    <color name="background_device_default_light">@color/background_material_light</color>
    <color name="background_floating_device_default_dark">@color/background_floating_material_dark</color>
    <color name="background_floating_device_default_light">@color/background_floating_material_light</color>
    <color name="background_device_default_dark">#1A1A1A</color>
    <color name="background_device_default_light">#F2F2F2</color>
    <color name="background_floating_device_default_dark">#0D0D0D</color>
    <color name="background_floating_device_default_light">#CCCCCC</color>

    <!-- Error color -->
    <color name="error_color_device_default_dark">@color/error_color_material_dark</color>
Loading