Nav bar should change to light theme in sync with the status bar
b/33708486
Nav bar should be in sync with status bar in all apps screen.
Nave bar should not change with status bar when in workspace mode.
Change-Id: Ib5a0d33d3e38f1b3ffa9693657ba7de3b6e01fed
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 8aa4158..08f56d1 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -475,9 +475,13 @@
mExtractedColors.load(this);
mHotseat.updateColor(mExtractedColors, !mPaused);
mWorkspace.getPageIndicator().updateColor(mExtractedColors);
+ boolean lightStatusBar = (FeatureFlags.LIGHT_STATUS_BAR
+ && mExtractedColors.getColor(ExtractedColors.STATUS_BAR_INDEX,
+ ExtractedColors.DEFAULT_DARK) == ExtractedColors.DEFAULT_LIGHT);
// It's possible that All Apps is visible when this is run,
- // so always use light status bar in that case.
- activateLightStatusBar(isAllAppsVisible(), false);
+ // so always use light status bar in that case. Only change nav bar color to status bar
+ // color when All Apps is visible.
+ activateLightStatusBar(lightStatusBar || isAllAppsVisible(), isAllAppsVisible());
}
}
@@ -486,28 +490,24 @@
/**
* Sets the status bar to be light or not. Light status bar means dark icons.
- * @param activate if true, make sure the status bar is light, otherwise base on wallpaper.
- * @param changeNavBar make sure the nav bar is light only if this param and {@param activate}
- * is also true.
+ * @param lightStatusBar make sure the status bar is light
+ * @param changeNavBar if true, make the nav bar theme in sync with status bar.
*/
- public void activateLightStatusBar(boolean activate, boolean changeNavBar) {
- boolean lightStatusBar = activate || (FeatureFlags.LIGHT_STATUS_BAR
- && mExtractedColors.getColor(ExtractedColors.STATUS_BAR_INDEX,
- ExtractedColors.DEFAULT_DARK) == ExtractedColors.DEFAULT_LIGHT);
+ public void activateLightStatusBar(boolean lightStatusBar, boolean changeNavBar) {
int oldSystemUiFlags = getWindow().getDecorView().getSystemUiVisibility();
int newSystemUiFlags = oldSystemUiFlags;
if (lightStatusBar) {
newSystemUiFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR ;
+ if (changeNavBar && Utilities.isAtLeastO()) {
+ newSystemUiFlags |= SYSTEM_UI_FLAG_LIGHT_NAV_BAR;
+ }
} else {
newSystemUiFlags &= ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
- }
- if (Utilities.isAtLeastO() && activate) {
- if (changeNavBar) {
- newSystemUiFlags |= SYSTEM_UI_FLAG_LIGHT_NAV_BAR;
- } else {
+ if (changeNavBar && Utilities.isAtLeastO()) {
newSystemUiFlags &= ~(SYSTEM_UI_FLAG_LIGHT_NAV_BAR);
}
}
+
if (newSystemUiFlags != oldSystemUiFlags) {
getWindow().getDecorView().setSystemUiVisibility(newSystemUiFlags);
}
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 99cac41..c199fef 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -288,7 +288,7 @@
// Use a light status bar (dark icons) if all apps is behind at least half of the status
// bar. If the status bar is already light due to wallpaper extraction, keep it that way.
boolean forceLight = shift <= mStatusBarHeight / 2;
- mLauncher.activateLightStatusBar(forceLight, forceLight);
+ mLauncher.activateLightStatusBar(forceLight, true);
}
/**