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

Commit 3a120b7c authored by chihhangchuang's avatar chihhangchuang
Browse files

Set theme preview text shadow color to transparent when text is dark

There's still black shadow for dark text: https://screenshot.googleplex.com/2CA5jmCf9ms.png
Launcher sets transparent shadow for the dark text: https://screenshot.googleplex.com/Y4L0isk8dp4.png

After:
Dark text: https://screenshot.googleplex.com/mqQ6DhJpQtj.png
Light text: https://screenshot.googleplex.com/hasi7K964Ew.png

Test: Manually
Fixes: 157617856
Change-Id: I9b50b124c7eb1e7bbf488ee3c299a51417727f90
parent e6c8fa86
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@
    <color name="switch_track_tint">#171717</color>
    <color name="switch_thumb_tint">#bdbdbd</color>

    <color name="theme_preview_workspace_shadow_color">@android:color/transparent</color>

    <color name="tile_enabled_icon_color">#2d2d2d</color>
    <color name="tile_disabled_icon_color">@color/light_grey</color>
    <color name="tile_disabled_background_color">#353535</color>
+2 −1
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@
    <color name="clockface_preview_background">@android:color/black</color>

    <color name="theme_preview_icon_color">@color/google_grey700</color>
    <color name="theme_preview_workspace_shadow_color">#B0000000</color>
    <color name="theme_preview_workspace_shadow_color_dark">#B0000000</color>
    <color name="theme_preview_workspace_shadow_color_transparent">@android:color/transparent</color>

    <color name="text_color_dark">#2d2d2d</color>
    <color name="text_color_light">@color/material_white_text</color>
+26 −20
Original line number Diff line number Diff line
@@ -174,23 +174,41 @@ class ThemeOptionPreviewer implements LifecycleObserver {
     * text) which will change its content color according to different wallpapers.
     */
    public void updateColorForLauncherWidgets(WallpaperColors colors) {
        int color = mContext.getColor(
                (colors.getColorHints() & WallpaperColors.HINT_SUPPORTS_DARK_TEXT) == 0
        boolean useLightTextColor =
                (colors.getColorHints() & WallpaperColors.HINT_SUPPORTS_DARK_TEXT) == 0;
        int textColor = mContext.getColor(useLightTextColor
                ? R.color.text_color_light
                : R.color.text_color_dark);
        int textShadowColor = mContext.getColor(useLightTextColor
                ? R.color.theme_preview_workspace_shadow_color_dark
                : R.color.theme_preview_workspace_shadow_color_transparent);
        // Update the top status bar clock text color.
        mStatusBarClock.setTextColor(color);
        mStatusBarClock.setTextColor(textColor);
        // Update the top status bar icon color.
        ViewGroup iconsContainer = mContentView.findViewById(R.id.theme_preview_top_bar_icons);
        for (int i = 0; i < iconsContainer.getChildCount(); i++) {
            ((ImageView) iconsContainer.getChildAt(i))
                    .setImageTintList(ColorStateList.valueOf(color));
                    .setImageTintList(ColorStateList.valueOf(textColor));
        }
        // Update smart space date color.
        ((TextView) mContentView.findViewById(R.id.smart_space_date)).setTextColor(color);
        mSmartSpaceDate.setTextColor(textColor);
        mSmartSpaceDate.setShadowLayer(
                mContext.getResources().getDimension(
                        R.dimen.preview_theme_smartspace_key_ambient_shadow_blur),
                /* dx = */ 0,
                /* dy = */ 0,
                textShadowColor);

        // Update shape app icon name text color.
        for (int id : mShapeIconAppNameIds) {
            ((TextView) mContentView.findViewById(id)).setTextColor(color);
            TextView appName = mContentView.findViewById(id);
            appName.setTextColor(textColor);
            appName.setShadowLayer(
                    mContext.getResources().getDimension(
                            R.dimen.preview_theme_app_name_key_ambient_shadow_blur),
                    /* dx = */ 0,
                    /* dy = */ 0,
                    textShadowColor);
        }

        mHasWallpaperColorSet = true;
@@ -229,23 +247,11 @@ class ThemeOptionPreviewer implements LifecycleObserver {
    private void setHeadlineFont(Typeface headlineFont) {
        mStatusBarClock.setTypeface(headlineFont);
        mSmartSpaceDate.setTypeface(headlineFont);
        mSmartSpaceDate.setShadowLayer(
                mContext.getResources().getDimension(
                        R.dimen.preview_theme_smartspace_key_ambient_shadow_blur),
                /* dx = */ 0,
                /* dy = */ 0,
                mContext.getColor(R.color.theme_preview_workspace_shadow_color));

        // Update font of app names.
        for (int id : mShapeIconAppNameIds) {
            TextView appName = mContentView.findViewById(id);
            appName.setTypeface(headlineFont);
            appName.setShadowLayer(
                    mContext.getResources().getDimension(
                            R.dimen.preview_theme_app_name_key_ambient_shadow_blur),
                    /* dx = */ 0,
                    /* dy = */ 0,
                    mContext.getColor(R.color.theme_preview_workspace_shadow_color));
        }

        // Update font of color/icons section title.