summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2016-09-28 15:34:51 -0700
committerTony Wickham <twickham@google.com>2016-09-28 16:53:17 -0700
commit345bff3ce671c62094a8afb5958a361db645f3cf (patch)
tree98d435c16e3c3d5f0b973c91d753290e00b03579
parent9311387a227d7bd894d880b897fb80ca34b39405 (diff)
downloadandroid_packages_apps_Trebuchet-345bff3ce671c62094a8afb5958a361db645f3cf.tar.gz
android_packages_apps_Trebuchet-345bff3ce671c62094a8afb5958a361db645f3cf.tar.bz2
android_packages_apps_Trebuchet-345bff3ce671c62094a8afb5958a361db645f3cf.zip
Some minor fixes for extracted status bar.
- setLightStatusBar() is now updateStatusBar(), with a forceLight parameter. We set the status bar to be light if forceLight or shouldBeLightStatusBar() (based on wallpaper). - Force status bar to be light if all apps is open. - Default to dark status bar, not light (light == dark icons) Bug: 29452834 Change-Id: I7b102ceff2f1ef2ab8defd4a46c698df4feaf2a5
-rw-r--r--src/com/android/launcher3/Launcher.java38
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java4
2 files changed, 21 insertions, 21 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index d059da2e5..245cd7159 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;
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index fb15afecd..8bbb29b4b 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -277,8 +277,8 @@ 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 enable = shift <= mStatusBarHeight / 2 || mLauncher.shouldBeLightStatusBar();
- mLauncher.setLightStatusBar(enable);
+ boolean forceLight = shift <= mStatusBarHeight / 2;
+ mLauncher.activateLightStatusBar(forceLight);
}
/**