From 6bf3af0b8163db5390d5fdce93be143051ea0b08 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Wed, 7 Jun 2023 18:23:33 -0700 Subject: [PATCH] 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 --- quickstep/res/values/colors.xml | 4 +++ .../taskbar/LauncherTaskbarUIController.java | 2 ++ .../taskbar/NavbarButtonsViewController.java | 32 ++++++++++++------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/quickstep/res/values/colors.xml b/quickstep/res/values/colors.xml index 63f192c099..b28341a6f3 100644 --- a/quickstep/res/values/colors.xml +++ b/quickstep/res/values/colors.xml @@ -25,6 +25,10 @@ #E0E0E0 + #ffffff + + #99000000 #EBffffff #99000000 diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index ba6f1651ed..35b9957ab8 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -312,6 +312,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController { .getTaskbarNavButtonTranslationYForInAppDisplay() .updateValue(mLauncher.getDeviceProfile().getTaskbarOffsetY() * mTaskbarInAppDisplayProgress.value); + mControllers.navbarButtonsViewController + .getOnTaskbarBackgroundNavButtonColorOverride().updateValue(progress); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 9a9e0ba70c..10ae97b822 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -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) {