resolve merge conflicts of 9311387
to ub-launcher3-master
Change-Id: I449cd2c91c2906f04ebf844eab2d02befaeb2f4d
This commit is contained in:
commit
0bc9e98d78
|
@ -184,4 +184,9 @@
|
|||
|
||||
<!-- Touch handling -->
|
||||
<dimen name="edge_of_screen_threshold">8dp</dimen>
|
||||
|
||||
<!-- Other -->
|
||||
<!-- Approximates the system status bar height. Not guaranteed to be always be correct. -->
|
||||
<dimen name="status_bar_height">24dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -276,9 +276,10 @@ public class Launcher extends Activity
|
|||
private LauncherAccessibilityDelegate mAccessibilityDelegate;
|
||||
private boolean mIsResumeFromActionScreenOff;
|
||||
@Thunk boolean mUserPresent = true;
|
||||
private boolean mVisible = false;
|
||||
private boolean mHasFocus = false;
|
||||
private boolean mAttached = false;
|
||||
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<>();
|
||||
|
@ -499,9 +500,31 @@ public class Launcher extends Activity
|
|||
mExtractedColors.load(this);
|
||||
mHotseat.updateColor(mExtractedColors, !mPaused);
|
||||
mWorkspace.getPageIndicator().updateColor(mExtractedColors);
|
||||
setLightStatusBar(shouldBeLightStatusBar());
|
||||
}
|
||||
}
|
||||
|
||||
/** 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();
|
||||
if (lightStatusBar) {
|
||||
systemUiFlags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
} else {
|
||||
systemUiFlags &= ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
getWindow().getDecorView().setSystemUiVisibility(systemUiFlags);
|
||||
}
|
||||
|
||||
private LauncherCallbacks mLauncherCallbacks;
|
||||
|
||||
public void onPostCreate(Bundle savedInstanceState) {
|
||||
|
|
|
@ -86,8 +86,6 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
|||
private AnimatorSet mCurrentAnimation;
|
||||
private boolean mNoIntercept;
|
||||
|
||||
private boolean mLightStatusBar;
|
||||
|
||||
// Used in discovery bounce animation to provide the transition without workspace changing.
|
||||
private boolean mIsTranslateWithoutWorkspace = false;
|
||||
private AnimatorSet mDiscoBounceAnimation;
|
||||
|
@ -273,26 +271,14 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
|||
}
|
||||
|
||||
private void updateLightStatusBar(float shift) {
|
||||
boolean enable = shift <= mStatusBarHeight / 2;
|
||||
// Do not modify status bar on landscape as all apps is not full bleed.
|
||||
if (mLauncher.getDeviceProfile().isVerticalBarLayout()) {
|
||||
return;
|
||||
}
|
||||
// Already set correctly
|
||||
if (mLightStatusBar == enable) {
|
||||
return;
|
||||
}
|
||||
int systemUiFlags = mLauncher.getWindow().getDecorView().getSystemUiVisibility();
|
||||
if (enable) {
|
||||
mLauncher.getWindow().getDecorView().setSystemUiVisibility(systemUiFlags
|
||||
| View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
|
||||
} else {
|
||||
mLauncher.getWindow().getDecorView().setSystemUiVisibility(systemUiFlags
|
||||
& ~(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR));
|
||||
|
||||
}
|
||||
mLightStatusBar = enable;
|
||||
// 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.support.v7.graphics.Palette;
|
|||
|
||||
import com.android.launcher3.LauncherProvider;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.R;
|
||||
|
||||
/**
|
||||
* Extracts colors from the wallpaper, and saves results to {@link LauncherProvider}.
|
||||
|
@ -52,16 +53,21 @@ public class ColorExtractionService extends IntentService {
|
|||
Bitmap wallpaper = ((BitmapDrawable) wallpaperManager.getDrawable()).getBitmap();
|
||||
Palette palette = Palette.from(wallpaper).generate();
|
||||
extractedColors.updatePalette(palette);
|
||||
// We extract colors for the hotseat separately,
|
||||
// since it only considers the lower part of the wallpaper.
|
||||
// TODO(twickham): update Palette library to 23.3.1 or higher,
|
||||
// which fixes a bug with using regions (b/28349435).
|
||||
// We extract colors for the hotseat and status bar separately,
|
||||
// since they only consider part of the wallpaper.
|
||||
Palette hotseatPalette = Palette.from(wallpaper)
|
||||
.setRegion(0, (int) (wallpaper.getHeight() * (1f - HOTSEAT_FRACTION)),
|
||||
wallpaper.getWidth(), wallpaper.getHeight())
|
||||
.clearFilters()
|
||||
.generate();
|
||||
extractedColors.updateHotseatPalette(hotseatPalette);
|
||||
|
||||
int statusBarHeight = getResources().getDimensionPixelSize(R.dimen.status_bar_height);
|
||||
Palette statusBarPalette = Palette.from(wallpaper)
|
||||
.setRegion(0, 0, wallpaper.getWidth(), statusBarHeight)
|
||||
.clearFilters()
|
||||
.generate();
|
||||
extractedColors.updateStatusBarPalette(statusBarPalette);
|
||||
}
|
||||
|
||||
// Save the extracted colors and wallpaper id to LauncherProvider.
|
||||
|
|
|
@ -38,6 +38,7 @@ public class ExtractedColors {
|
|||
// loading extracted colors. New colors should always be added at the end.
|
||||
public static final int VERSION_INDEX = 0;
|
||||
public static final int HOTSEAT_INDEX = 1;
|
||||
public static final int STATUS_BAR_INDEX = 2;
|
||||
// public static final int VIBRANT_INDEX = 2;
|
||||
// public static final int VIBRANT_DARK_INDEX = 3;
|
||||
// public static final int VIBRANT_LIGHT_INDEX = 4;
|
||||
|
@ -45,8 +46,8 @@ public class ExtractedColors {
|
|||
// public static final int MUTED_DARK_INDEX = 6;
|
||||
// public static final int MUTED_LIGHT_INDEX = 7;
|
||||
|
||||
public static final int NUM_COLOR_PROFILES = 1;
|
||||
private static final int VERSION = 1;
|
||||
public static final int NUM_COLOR_PROFILES = 2;
|
||||
private static final int VERSION = 2;
|
||||
|
||||
private static final String COLOR_SEPARATOR = ",";
|
||||
|
||||
|
@ -156,4 +157,9 @@ public class ExtractedColors {
|
|||
}
|
||||
setColorAtIndex(HOTSEAT_INDEX, hotseatColor);
|
||||
}
|
||||
|
||||
public void updateStatusBarPalette(Palette statusBarPalette) {
|
||||
setColorAtIndex(STATUS_BAR_INDEX, ExtractionUtils.isSuperLight(statusBarPalette) ?
|
||||
DEFAULT_LIGHT : DEFAULT_DARK);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue