diff options
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index ae2b7eac2..c73a7a61d 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -280,7 +280,6 @@ public class Launcher extends Activity private boolean mVisible; private boolean mHasFocus; private boolean mAttached; - private boolean mIsLightStatusBar; /** Maps launcher activity components to their list of shortcut ids. */ private MultiHashMap<ComponentKey, String> mDeepShortcutMap = new MultiHashMap<>(); @@ -485,33 +484,34 @@ public class Launcher extends Activity private void loadExtractedColorsAndColorItems() { // TODO: do this in pre-N as well, once the extraction part is complete. - if (mExtractedColors != null && Utilities.isNycOrAbove()) { + if (Utilities.isNycOrAbove()) { mExtractedColors.load(this); mHotseat.updateColor(mExtractedColors, !mPaused); mWorkspace.getPageIndicator().updateColor(mExtractedColors); - setLightStatusBar(shouldBeLightStatusBar()); + // It's possible that All Apps is visible when this is run, + // so always use light status bar in that case. + activateLightStatusBar(isAllAppsVisible()); } } - /** Returns whether a light status bar (dark icons) should be used based on the wallpaper. */ - public boolean shouldBeLightStatusBar() { - return mExtractedColors.getColor(ExtractedColors.STATUS_BAR_INDEX, - ExtractedColors.DEFAULT_LIGHT) == ExtractedColors.DEFAULT_LIGHT; - } - - public void setLightStatusBar(boolean lightStatusBar) { - // Already set correctly - if (mIsLightStatusBar == lightStatusBar) { - return; - } - mIsLightStatusBar = lightStatusBar; - int systemUiFlags = getWindow().getDecorView().getSystemUiVisibility(); + /** + * 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. + */ + public void activateLightStatusBar(boolean activate) { + boolean lightStatusBar = activate + || mExtractedColors.getColor(ExtractedColors.STATUS_BAR_INDEX, + ExtractedColors.DEFAULT_DARK) == ExtractedColors.DEFAULT_LIGHT; + int oldSystemUiFlags = getWindow().getDecorView().getSystemUiVisibility(); + int newSystemUiFlags = oldSystemUiFlags; if (lightStatusBar) { - systemUiFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; + newSystemUiFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; } else { - systemUiFlags &= ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + newSystemUiFlags &= ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + if (newSystemUiFlags != oldSystemUiFlags) { + getWindow().getDecorView().setSystemUiVisibility(newSystemUiFlags); } - getWindow().getDecorView().setSystemUiVisibility(systemUiFlags); } private LauncherCallbacks mLauncherCallbacks; |