Merge "Some minor fixes for extracted status bar." into ub-launcher3-calgary-polish

This commit is contained in:
Tony Wickham 2016-09-29 01:27:07 +00:00 committed by Android (Google) Code Review
commit f0fc3c4674
2 changed files with 21 additions and 21 deletions

View File

@ -280,7 +280,6 @@ public class Launcher extends Activity
private boolean mVisible; private boolean mVisible;
private boolean mHasFocus; private boolean mHasFocus;
private boolean mAttached; private boolean mAttached;
private boolean mIsLightStatusBar;
/** Maps launcher activity components to their list of shortcut ids. */ /** Maps launcher activity components to their list of shortcut ids. */
private MultiHashMap<ComponentKey, String> mDeepShortcutMap = new MultiHashMap<>(); private MultiHashMap<ComponentKey, String> mDeepShortcutMap = new MultiHashMap<>();
@ -485,33 +484,34 @@ public class Launcher extends Activity
private void loadExtractedColorsAndColorItems() { private void loadExtractedColorsAndColorItems() {
// TODO: do this in pre-N as well, once the extraction part is complete. // 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); mExtractedColors.load(this);
mHotseat.updateColor(mExtractedColors, !mPaused); mHotseat.updateColor(mExtractedColors, !mPaused);
mWorkspace.getPageIndicator().updateColor(mExtractedColors); 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() { * Sets the status bar to be light or not. Light status bar means dark icons.
return mExtractedColors.getColor(ExtractedColors.STATUS_BAR_INDEX, * @param activate if true, make sure the status bar is light, otherwise base on wallpaper.
ExtractedColors.DEFAULT_LIGHT) == ExtractedColors.DEFAULT_LIGHT; */
} public void activateLightStatusBar(boolean activate) {
boolean lightStatusBar = activate
public void setLightStatusBar(boolean lightStatusBar) { || mExtractedColors.getColor(ExtractedColors.STATUS_BAR_INDEX,
// Already set correctly ExtractedColors.DEFAULT_DARK) == ExtractedColors.DEFAULT_LIGHT;
if (mIsLightStatusBar == lightStatusBar) { int oldSystemUiFlags = getWindow().getDecorView().getSystemUiVisibility();
return; int newSystemUiFlags = oldSystemUiFlags;
}
mIsLightStatusBar = lightStatusBar;
int systemUiFlags = getWindow().getDecorView().getSystemUiVisibility();
if (lightStatusBar) { if (lightStatusBar) {
systemUiFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; newSystemUiFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
} else { } 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; private LauncherCallbacks mLauncherCallbacks;

View File

@ -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 // 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. // bar. If the status bar is already light due to wallpaper extraction, keep it that way.
boolean enable = shift <= mStatusBarHeight / 2 || mLauncher.shouldBeLightStatusBar(); boolean forceLight = shift <= mStatusBarHeight / 2;
mLauncher.setLightStatusBar(enable); mLauncher.activateLightStatusBar(forceLight);
} }
/** /**