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

Commit 6bf3af0b authored by Jagrut Desai's avatar Jagrut Desai
Browse files

Match Navigation Icon Colors Folded/unfolded

Recently we did color token migration for Taskbar which included navigation icon also, but phones and foldable device can't really adapt to new color tokens because of contrast issue with underlying wallpapers.

As a result, now home screen which default back to balck and white nav icon colors while all apps and in app navigation icon color will be themed to new GM3 Color tokens.

Test: Manual
Bug: 284408922
Flag: Not needed
Change-Id: I8c8ea11ebb7237885ae4673fda0409ab463b37db
parent af1932eb
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -25,6 +25,10 @@

    <!-- Taskbar -->
    <color name="taskbar_nav_icon_selection_ripple">#E0E0E0</color>
    <color name="taskbar_nav_icon_light_color_on_home">#ffffff</color>
    <!-- The dark navigation button color is only used in the rare cases that taskbar isn't drawing
    its background and the underlying app has requested dark buttons. -->
    <color name="taskbar_nav_icon_dark_color_on_home">#99000000</color>
    <color name="taskbar_stashed_handle_light_color">#EBffffff</color>
    <color name="taskbar_stashed_handle_dark_color">#99000000</color>

+2 −0
Original line number Diff line number Diff line
@@ -312,6 +312,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
                    .getTaskbarNavButtonTranslationYForInAppDisplay()
                    .updateValue(mLauncher.getDeviceProfile().getTaskbarOffsetY()
                            * mTaskbarInAppDisplayProgress.value);
            mControllers.navbarButtonsViewController
                    .getOnTaskbarBackgroundNavButtonColorOverride().updateValue(progress);
        }
    }

+21 −11
Original line number Diff line number Diff line
@@ -148,8 +148,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
    // Used for IME+A11Y buttons
    private final ViewGroup mEndContextualContainer;
    private final ViewGroup mStartContextualContainer;
    private final int mLightIconColor;
    private final int mDarkIconColor;
    private final int mLightIconColorOnHome;
    private final int mDarkIconColorOnHome;
    /** Color to use for navigation bar buttons, if they are on on a Taskbar surface background. */
    private final int mOnBackgroundIconColor;

@@ -205,9 +205,11 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
        mEndContextualContainer = mNavButtonsView.findViewById(R.id.end_contextual_buttons);
        mStartContextualContainer = mNavButtonsView.findViewById(R.id.start_contextual_buttons);

        mLightIconColor = context.getColor(R.color.taskbar_nav_icon_light_color);
        mDarkIconColor = context.getColor(R.color.taskbar_nav_icon_dark_color);
        mOnBackgroundIconColor = Utilities.isDarkTheme(context) ? mLightIconColor : mDarkIconColor;
        mLightIconColorOnHome = context.getColor(R.color.taskbar_nav_icon_light_color_on_home);
        mDarkIconColorOnHome = context.getColor(R.color.taskbar_nav_icon_dark_color_on_home);
        mOnBackgroundIconColor = Utilities.isDarkTheme(context)
                ? context.getColor(R.color.taskbar_nav_icon_light_color)
                : context.getColor(R.color.taskbar_nav_icon_dark_color);
    }

    /**
@@ -630,18 +632,20 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT

    private void updateNavButtonColor() {
        final ArgbEvaluator argbEvaluator = ArgbEvaluator.getInstance();
        final int sysUiNavButtonIconColor = (int) argbEvaluator.evaluate(
        final int sysUiNavButtonIconColorOnHome = (int) argbEvaluator.evaluate(
                mTaskbarNavButtonDarkIntensity.value,
                mLightIconColor,
                mDarkIconColor);
                mLightIconColorOnHome,
                mDarkIconColorOnHome);

        // Override the color from framework if nav buttons are over an opaque Taskbar surface.
        final int iconColor = (int) argbEvaluator.evaluate(
                mOnBackgroundNavButtonColorOverrideMultiplier.value
                        * Math.max(
                                mOnTaskbarBackgroundNavButtonColorOverride.value,
                                mSlideInViewVisibleNavButtonColorOverride.value),
                sysUiNavButtonIconColor,
                sysUiNavButtonIconColorOnHome,
                mOnBackgroundIconColor);

        for (ImageView button : mAllButtons) {
            button.setImageTintList(ColorStateList.valueOf(iconColor));
        }
@@ -928,8 +932,6 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
        pw.println(prefix + "NavbarButtonsViewController:");

        pw.println(prefix + "\tmState=" + getStateString(mState));
        pw.println(prefix + "\tmLightIconColor=" + Integer.toHexString(mLightIconColor));
        pw.println(prefix + "\tmDarkIconColor=" + Integer.toHexString(mDarkIconColor));
        pw.println(prefix + "\tmFloatingRotationButtonBounds=" + mFloatingRotationButtonBounds);
        pw.println(prefix + "\tmSysuiStateFlags=" + QuickStepContract.getSystemUiStateString(
                mSysuiStateFlags));
@@ -940,6 +942,14 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
                + mTaskbarNavButtonTranslationYForInAppDisplay.value);
        pw.println(prefix + "\t\tmTaskbarNavButtonTranslationYForIme="
                + mTaskbarNavButtonTranslationYForIme.value);
        pw.println(prefix + "\t\tmTaskbarNavButtonDarkIntensity="
                + mTaskbarNavButtonDarkIntensity.value);
        pw.println(prefix + "\t\tmSlideInViewVisibleNavButtonColorOverride="
                + mSlideInViewVisibleNavButtonColorOverride.value);
        pw.println(prefix + "\t\tmOnTaskbarBackgroundNavButtonColorOverride="
                + mOnTaskbarBackgroundNavButtonColorOverride.value);
        pw.println(prefix + "\t\tmOnBackgroundNavButtonColorOverrideMultiplier="
                + mOnBackgroundNavButtonColorOverrideMultiplier.value);
    }

    private static String getStateString(int flags) {