From df9f14746c41950a18a3ce02e7742a1764c264ff Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Fri, 9 Dec 2016 13:56:15 -0800 Subject: nav bar on all apps container should use light theme. b/33553066 Change-Id: Ic9eb796a01eaa8d00fbeedeb5456876b668e6db2 --- src/com/android/launcher3/Launcher.java | 18 +++++++++++++++--- .../launcher3/allapps/AllAppsContainerView.java | 4 ++++ .../launcher3/allapps/AllAppsTransitionController.java | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 9160a012e..ee8ddfd46 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -475,25 +475,37 @@ public class Launcher extends Activity mWorkspace.getPageIndicator().updateColor(mExtractedColors); // It's possible that All Apps is visible when this is run, // so always use light status bar in that case. - activateLightStatusBar(isAllAppsVisible()); + activateLightStatusBar(isAllAppsVisible(), false); } } + // TODO: use platform flag on API >= 26 + private static final int SYSTEM_UI_FLAG_LIGHT_NAV_BAR = 0x10; + /** * 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. */ - public void activateLightStatusBar(boolean activate) { + 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); int oldSystemUiFlags = getWindow().getDecorView().getSystemUiVisibility(); int newSystemUiFlags = oldSystemUiFlags; if (lightStatusBar) { - newSystemUiFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; + newSystemUiFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR ; } else { newSystemUiFlags &= ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); } + if (Utilities.isAtLeastO() && activate) { + if (changeNavBar) { + newSystemUiFlags |= SYSTEM_UI_FLAG_LIGHT_NAV_BAR; + } else { + newSystemUiFlags &= ~(SYSTEM_UI_FLAG_LIGHT_NAV_BAR); + } + } if (newSystemUiFlags != oldSystemUiFlags) { getWindow().getDecorView().setSystemUiVisibility(newSystemUiFlags); } diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 5fc1d972c..f98e0275f 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -489,6 +489,10 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc setLayoutParams(mlp); } else { View navBarBg = findViewById(R.id.nav_bar_bg); + if (Utilities.isAtLeastO()) { + navBarBg.setBackgroundColor(getResources().getColor( + R.color.all_apps_light_navbar_color)); + } ViewGroup.LayoutParams navBarBgLp = navBarBg.getLayoutParams(); navBarBgLp.height = insets.bottom; navBarBg.setLayoutParams(navBarBgLp); diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index adfad0813..42f1875d4 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -282,7 +282,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul // 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); + mLauncher.activateLightStatusBar(forceLight, forceLight); } /** -- cgit v1.2.3