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

Commit fe435ad4 authored by James O'Leary's avatar James O'Leary
Browse files

Update app icon shadows

Allow use of white shadow, set radius to 1.0 and offset to 0.
Use 100% and 20% alpha, instead of 70% and 50%.
(nets out to same effect)
Make ambient and key shadows equivalent: there are deterministic
formulas for what contrast a shadow will create, and those formulas
were used for the spec. Ad-hoc attempts to try to increase visibility
are no longer needed and don't align with design intent

Bug: 213314628
Test: Manual inspection at runtime
Change-Id: Ie12d3d05488e16fea94e91be16c25448f450a44d
parent 384b521d
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -44,9 +44,9 @@
        <item name="isMainColorDark">false</item>
        <item name="isWorkspaceDarkText">false</item>
        <item name="workspaceTextColor">@color/workspace_text_color_light</item>
        <item name="workspaceShadowColor">#B0000000</item>
        <item name="workspaceAmbientShadowColor">#40000000</item>
        <item name="workspaceKeyShadowColor">#89000000</item>
        <item name="workspaceShadowColor">#ff000000</item>
        <item name="workspaceAmbientShadowColor">#33000000</item>
        <item name="workspaceKeyShadowColor">#ff000000</item>
        <item name="workspaceStatusBarScrim">@drawable/workspace_bg</item>
        <item name="widgetsTheme">@style/WidgetContainerTheme</item>
        <item name="folderDotColor">@color/folder_dot_color</item>
@@ -82,9 +82,9 @@

    <style name="LauncherTheme.DarkText" parent="@style/LauncherTheme">
        <item name="workspaceTextColor">@color/workspace_text_color_dark</item>
        <item name="workspaceShadowColor">@android:color/transparent</item>
        <item name="workspaceAmbientShadowColor">@android:color/transparent</item>
        <item name="workspaceKeyShadowColor">@android:color/transparent</item>
        <item name="workspaceShadowColor">#ffffffff</item>
        <item name="workspaceAmbientShadowColor">#33ffffff</item>
        <item name="workspaceKeyShadowColor">#ffffffff</item>
        <item name="isWorkspaceDarkText">true</item>
        <item name="workspaceStatusBarScrim">@null</item>
        <item name="workspaceAccentColor">@color/workspace_accent_color_dark</item>
@@ -132,9 +132,9 @@
    <style name="LauncherTheme.Dark.DarkText" parent="@style/LauncherTheme.Dark">
        <item name="android:colorControlHighlight">#19212121</item>
        <item name="workspaceTextColor">@color/workspace_text_color_dark</item>
        <item name="workspaceShadowColor">@android:color/transparent</item>
        <item name="workspaceAmbientShadowColor">@android:color/transparent</item>
        <item name="workspaceKeyShadowColor">@android:color/transparent</item>
        <item name="workspaceShadowColor">#ffffffff</item>
        <item name="workspaceAmbientShadowColor">#33ffffff</item>
        <item name="workspaceKeyShadowColor">#ffffffff</item>
        <item name="isWorkspaceDarkText">true</item>
        <item name="workspaceStatusBarScrim">@null</item>
        <item name="workspaceAccentColor">@color/workspace_accent_color_dark</item>
@@ -250,14 +250,14 @@

    <!-- Icon displayed on the workspace -->
    <style name="BaseIcon.Workspace.Shadows" parent="BaseIcon">
        <item name="android:shadowRadius">2.0</item>
        <item name="android:shadowRadius">1.0</item>
        <item name="android:shadowColor">?attr/workspaceShadowColor</item>
        <item name="ambientShadowColor">?attr/workspaceAmbientShadowColor</item>
        <item name="ambientShadowBlur">1.5dp</item>
        <item name="ambientShadowBlur">1.0dp</item>
        <item name="keyShadowColor">?attr/workspaceKeyShadowColor</item>
        <item name="keyShadowBlur">.5dp</item>
        <item name="keyShadowOffsetX">.5dp</item>
        <item name="keyShadowOffsetY">.5dp</item>
        <item name="keyShadowBlur">1.0dp</item>
        <item name="keyShadowOffsetX">0dp</item>
        <item name="keyShadowOffsetY">0dp</item>
    </style>

    <!-- Intentionally empty so we can override -->
+4 −13
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.launcher3.views;

import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -56,11 +54,10 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
            super.onDraw(canvas);
            return;
        }
        int alpha = Color.alpha(getCurrentTextColor());

        // We enhance the shadow by drawing the shadow twice
        getPaint().setShadowLayer(mShadowInfo.ambientShadowBlur, 0, 0,
                getTextShadowColor(mShadowInfo.ambientShadowColor, alpha));
                mShadowInfo.ambientShadowColor);

        drawWithoutDot(canvas);
        canvas.save();
@@ -72,7 +69,7 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
                mShadowInfo.keyShadowBlur,
                mShadowInfo.keyShadowOffsetX,
                mShadowInfo.keyShadowOffsetY,
                getTextShadowColor(mShadowInfo.keyShadowColor, alpha));
                mShadowInfo.keyShadowColor);
        drawWithoutDot(canvas);
        canvas.restore();

@@ -113,24 +110,18 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
                return true;
            } else if (ambientShadowAlpha > 0 && keyShadowAlpha == 0) {
                textView.getPaint().setShadowLayer(ambientShadowBlur, 0, 0,
                        getTextShadowColor(ambientShadowColor, textAlpha));
                        ambientShadowColor);
                return true;
            } else if (keyShadowAlpha > 0 && ambientShadowAlpha == 0) {
                textView.getPaint().setShadowLayer(
                        keyShadowBlur,
                        keyShadowOffsetX,
                        keyShadowOffsetY,
                        getTextShadowColor(keyShadowColor, textAlpha));
                        keyShadowColor);
                return true;
            } else {
                return false;
            }
        }
    }

    // Multiplies the alpha of shadowColor by textAlpha.
    private static int getTextShadowColor(int shadowColor, int textAlpha) {
        return setColorAlphaBound(shadowColor,
                Math.round(Color.alpha(shadowColor) * textAlpha / 255f));
    }
}