am c0f0a747: Fix low profile bar mode for Material themed apps
* commit 'c0f0a74762f7b3651d0fcd8371e9eb0c84779b1a': Fix low profile bar mode for Material themed apps
This commit is contained in:
@@ -45,6 +45,7 @@ public class BarTransitions {
|
|||||||
public static final int MODE_LIGHTS_OUT = 3;
|
public static final int MODE_LIGHTS_OUT = 3;
|
||||||
public static final int MODE_TRANSPARENT = 4;
|
public static final int MODE_TRANSPARENT = 4;
|
||||||
public static final int MODE_WARNING = 5;
|
public static final int MODE_WARNING = 5;
|
||||||
|
public static final int MODE_LIGHTS_OUT_TRANSPARENT = 6;
|
||||||
|
|
||||||
public static final int LIGHTS_IN_DURATION = 250;
|
public static final int LIGHTS_IN_DURATION = 250;
|
||||||
public static final int LIGHTS_OUT_DURATION = 750;
|
public static final int LIGHTS_OUT_DURATION = 750;
|
||||||
@@ -75,6 +76,9 @@ public class BarTransitions {
|
|||||||
|| mode == MODE_TRANSPARENT)) {
|
|| mode == MODE_TRANSPARENT)) {
|
||||||
mode = MODE_OPAQUE;
|
mode = MODE_OPAQUE;
|
||||||
}
|
}
|
||||||
|
if (!HIGH_END && (mode == MODE_LIGHTS_OUT_TRANSPARENT)) {
|
||||||
|
mode = MODE_LIGHTS_OUT;
|
||||||
|
}
|
||||||
if (mMode == mode) return;
|
if (mMode == mode) return;
|
||||||
int oldMode = mMode;
|
int oldMode = mMode;
|
||||||
mMode = mode;
|
mMode = mode;
|
||||||
@@ -102,6 +106,7 @@ public class BarTransitions {
|
|||||||
if (mode == MODE_LIGHTS_OUT) return "MODE_LIGHTS_OUT";
|
if (mode == MODE_LIGHTS_OUT) return "MODE_LIGHTS_OUT";
|
||||||
if (mode == MODE_TRANSPARENT) return "MODE_TRANSPARENT";
|
if (mode == MODE_TRANSPARENT) return "MODE_TRANSPARENT";
|
||||||
if (mode == MODE_WARNING) return "MODE_WARNING";
|
if (mode == MODE_WARNING) return "MODE_WARNING";
|
||||||
|
if (mode == MODE_LIGHTS_OUT_TRANSPARENT) return "MODE_LIGHTS_OUT_TRANSPARENT";
|
||||||
throw new IllegalArgumentException("Unknown mode " + mode);
|
throw new IllegalArgumentException("Unknown mode " + mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,6 +114,10 @@ public class BarTransitions {
|
|||||||
mBarBackground.finishAnimation();
|
mBarBackground.finishAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isLightsOut(int mode) {
|
||||||
|
return mode == MODE_LIGHTS_OUT || mode == MODE_LIGHTS_OUT_TRANSPARENT;
|
||||||
|
}
|
||||||
|
|
||||||
private static class BarBackgroundDrawable extends Drawable {
|
private static class BarBackgroundDrawable extends Drawable {
|
||||||
private final int mOpaque;
|
private final int mOpaque;
|
||||||
private final int mSemiTransparent;
|
private final int mSemiTransparent;
|
||||||
@@ -196,7 +205,7 @@ public class BarTransitions {
|
|||||||
targetColor = mSemiTransparent;
|
targetColor = mSemiTransparent;
|
||||||
} else if (mMode == MODE_SEMI_TRANSPARENT) {
|
} else if (mMode == MODE_SEMI_TRANSPARENT) {
|
||||||
targetColor = mSemiTransparent;
|
targetColor = mSemiTransparent;
|
||||||
} else if (mMode == MODE_TRANSPARENT) {
|
} else if (mMode == MODE_TRANSPARENT || mMode == MODE_LIGHTS_OUT_TRANSPARENT) {
|
||||||
targetColor = mTransparent;
|
targetColor = mTransparent;
|
||||||
} else {
|
} else {
|
||||||
targetColor = mOpaque;
|
targetColor = mOpaque;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public final class NavigationBarTransitions extends BarTransitions {
|
|||||||
applyBackButtonQuiescentAlpha(mode, animate);
|
applyBackButtonQuiescentAlpha(mode, animate);
|
||||||
|
|
||||||
// apply to lights out
|
// apply to lights out
|
||||||
applyLightsOut(mode == MODE_LIGHTS_OUT, animate, force);
|
applyLightsOut(isLightsOut(mode), animate, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float alphaForMode(int mode) {
|
private float alphaForMode(int mode) {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN;
|
|||||||
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
|
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
|
||||||
import static android.app.StatusBarManager.windowStateToString;
|
import static android.app.StatusBarManager.windowStateToString;
|
||||||
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT;
|
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT;
|
||||||
|
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT_TRANSPARENT;
|
||||||
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_OPAQUE;
|
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_OPAQUE;
|
||||||
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_SEMI_TRANSPARENT;
|
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_SEMI_TRANSPARENT;
|
||||||
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_TRANSLUCENT;
|
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_TRANSLUCENT;
|
||||||
@@ -2600,8 +2601,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int barMode(int vis, int transientFlag, int translucentFlag) {
|
private int barMode(int vis, int transientFlag, int translucentFlag) {
|
||||||
|
int lightsOutTransparent = View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_TRANSPARENT;
|
||||||
return (vis & transientFlag) != 0 ? MODE_SEMI_TRANSPARENT
|
return (vis & transientFlag) != 0 ? MODE_SEMI_TRANSPARENT
|
||||||
: (vis & translucentFlag) != 0 ? MODE_TRANSLUCENT
|
: (vis & translucentFlag) != 0 ? MODE_TRANSLUCENT
|
||||||
|
: (vis & lightsOutTransparent) == lightsOutTransparent ? MODE_LIGHTS_OUT_TRANSPARENT
|
||||||
: (vis & View.SYSTEM_UI_TRANSPARENT) != 0 ? MODE_TRANSPARENT
|
: (vis & View.SYSTEM_UI_TRANSPARENT) != 0 ? MODE_TRANSPARENT
|
||||||
: (vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0 ? MODE_LIGHTS_OUT
|
: (vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0 ? MODE_LIGHTS_OUT
|
||||||
: MODE_OPAQUE;
|
: MODE_OPAQUE;
|
||||||
|
|||||||
@@ -57,19 +57,19 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float getNonBatteryClockAlphaFor(int mode) {
|
private float getNonBatteryClockAlphaFor(int mode) {
|
||||||
return mode == MODE_LIGHTS_OUT ? ICON_ALPHA_WHEN_LIGHTS_OUT_NON_BATTERY_CLOCK
|
return isLightsOut(mode) ? ICON_ALPHA_WHEN_LIGHTS_OUT_NON_BATTERY_CLOCK
|
||||||
: !isOpaque(mode) ? ICON_ALPHA_WHEN_NOT_OPAQUE
|
: !isOpaque(mode) ? ICON_ALPHA_WHEN_NOT_OPAQUE
|
||||||
: mIconAlphaWhenOpaque;
|
: mIconAlphaWhenOpaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getBatteryClockAlpha(int mode) {
|
private float getBatteryClockAlpha(int mode) {
|
||||||
return mode == MODE_LIGHTS_OUT ? ICON_ALPHA_WHEN_LIGHTS_OUT_BATTERY_CLOCK
|
return isLightsOut(mode) ? ICON_ALPHA_WHEN_LIGHTS_OUT_BATTERY_CLOCK
|
||||||
: getNonBatteryClockAlphaFor(mode);
|
: getNonBatteryClockAlphaFor(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isOpaque(int mode) {
|
private boolean isOpaque(int mode) {
|
||||||
return !(mode == MODE_SEMI_TRANSPARENT || mode == MODE_TRANSLUCENT
|
return !(mode == MODE_SEMI_TRANSPARENT || mode == MODE_TRANSLUCENT
|
||||||
|| mode == MODE_TRANSPARENT);
|
|| mode == MODE_TRANSPARENT || mode == MODE_LIGHTS_OUT_TRANSPARENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -94,7 +94,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
|
|||||||
animateTransitionTo(mBattery, newAlphaBC),
|
animateTransitionTo(mBattery, newAlphaBC),
|
||||||
animateTransitionTo(mClock, newAlphaBC)
|
animateTransitionTo(mClock, newAlphaBC)
|
||||||
);
|
);
|
||||||
if (mode == MODE_LIGHTS_OUT) {
|
if (isLightsOut(mode)) {
|
||||||
anims.setDuration(LIGHTS_OUT_DURATION);
|
anims.setDuration(LIGHTS_OUT_DURATION);
|
||||||
}
|
}
|
||||||
anims.start();
|
anims.start();
|
||||||
|
|||||||
Reference in New Issue
Block a user