Allow gestural nav to hide the bar and background
Bug: 181206743 Test: Manual Change-Id: I8a4caec4576b72c1deb029e5145456055ae0d31a
This commit is contained in:
@@ -588,4 +588,7 @@
|
||||
|
||||
<!-- Determines whether the shell features all run on another thread. -->
|
||||
<bool name="config_enableShellMainThread">false</bool>
|
||||
|
||||
<!-- Determines whether to allow the nav bar handle to be forced to be opaque. -->
|
||||
<bool name="allow_force_nav_bar_handle_opaque">true</bool>
|
||||
</resources>
|
||||
|
||||
@@ -62,16 +62,10 @@ interface ISystemUiProxy {
|
||||
*/
|
||||
Rect getNonMinimizedSplitScreenSecondaryBounds() = 7;
|
||||
|
||||
/**
|
||||
* Control the {@param alpha} of the back button in the navigation bar and {@param animate} if
|
||||
* needed from current value
|
||||
* @deprecated
|
||||
*/
|
||||
void setBackButtonAlpha(float alpha, boolean animate) = 8;
|
||||
|
||||
/**
|
||||
* Control the {@param alpha} of the option nav bar button (back-button in 2 button mode
|
||||
* and home bar in no-button mode) and {@param animate} if needed from current value
|
||||
* and home handle & background in gestural mode). The {@param animate} is currently only
|
||||
* supported for 2 button mode.
|
||||
*/
|
||||
void setNavBarButtonAlpha(float alpha, boolean animate) = 19;
|
||||
|
||||
|
||||
@@ -211,6 +211,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
||||
private Locale mLocale;
|
||||
private int mLayoutDirection;
|
||||
|
||||
private boolean mAllowForceNavBarHandleOpaque;
|
||||
private boolean mForceNavBarHandleOpaque;
|
||||
private boolean mIsCurrentUserSetup;
|
||||
|
||||
@@ -333,13 +334,23 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
||||
// If the current user is not yet setup, then don't update any button alphas
|
||||
return;
|
||||
}
|
||||
if (QuickStepContract.isLegacyMode(mNavBarMode)) {
|
||||
// Don't allow the bar buttons to be affected by the alpha
|
||||
return;
|
||||
}
|
||||
|
||||
ButtonDispatcher buttonDispatcher = null;
|
||||
boolean forceVisible = false;
|
||||
if (QuickStepContract.isSwipeUpMode(mNavBarMode)) {
|
||||
buttonDispatcher = mNavigationBarView.getBackButton();
|
||||
} else if (QuickStepContract.isGesturalMode(mNavBarMode)) {
|
||||
forceVisible = mForceNavBarHandleOpaque;
|
||||
if (QuickStepContract.isGesturalMode(mNavBarMode)) {
|
||||
// Disallow home handle animations when in gestural
|
||||
animate = false;
|
||||
forceVisible = mAllowForceNavBarHandleOpaque && mForceNavBarHandleOpaque;
|
||||
buttonDispatcher = mNavigationBarView.getHomeHandle();
|
||||
if (getBarTransitions() != null) {
|
||||
getBarTransitions().setBackgroundOverrideAlpha(alpha);
|
||||
}
|
||||
} else if (QuickStepContract.isSwipeUpMode(mNavBarMode)) {
|
||||
buttonDispatcher = mNavigationBarView.getBackButton();
|
||||
}
|
||||
if (buttonDispatcher != null) {
|
||||
buttonDispatcher.setVisibility(
|
||||
@@ -506,6 +517,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
||||
// Respect the latest disabled-flags.
|
||||
mCommandQueue.recomputeDisableFlags(mDisplayId, false);
|
||||
|
||||
mAllowForceNavBarHandleOpaque = mContext.getResources().getBoolean(
|
||||
R.bool.allow_force_nav_bar_handle_opaque);
|
||||
mForceNavBarHandleOpaque = DeviceConfig.getBoolean(
|
||||
DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
NAV_BAR_HANDLE_FORCE_OPAQUE,
|
||||
@@ -1468,6 +1481,12 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
||||
@Override
|
||||
public void onNavigationModeChanged(int mode) {
|
||||
mNavBarMode = mode;
|
||||
if (!QuickStepContract.isGesturalMode(mode)) {
|
||||
// Reset the override alpha
|
||||
if (getBarTransitions() != null) {
|
||||
getBarTransitions().setBackgroundOverrideAlpha(1f);
|
||||
}
|
||||
}
|
||||
updateScreenPinningGestures();
|
||||
|
||||
if (!canShowSecondaryHandle()) {
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.android.systemui.statusbar.CommandQueue;
|
||||
import com.android.systemui.statusbar.phone.BarTransitions;
|
||||
import com.android.systemui.statusbar.phone.LightBarTransitionsController;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -135,6 +136,10 @@ public final class NavigationBarTransitions extends BarTransitions implements
|
||||
mBarBackground.setFrame(frame);
|
||||
}
|
||||
|
||||
void setBackgroundOverrideAlpha(float alpha) {
|
||||
mBarBackground.setOverrideAlpha(alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isLightsOut(int mode) {
|
||||
return super.isLightsOut(mode) || (mAllowAutoDimWallpaperNotVisible && mAutoDim
|
||||
@@ -230,4 +235,17 @@ public final class NavigationBarTransitions extends BarTransitions implements
|
||||
public void removeDarkIntensityListener(DarkIntensityListener listener) {
|
||||
mDarkIntensityListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw) {
|
||||
pw.println("NavigationBarTransitions:");
|
||||
pw.println(" mMode: " + getMode());
|
||||
pw.println(" mAlwaysOpaque: " + isAlwaysOpaque());
|
||||
pw.println(" mAllowAutoDimWallpaperNotVisible: " + mAllowAutoDimWallpaperNotVisible);
|
||||
pw.println(" mWallpaperVisible: " + mWallpaperVisible);
|
||||
pw.println(" mLightsOut: " + mLightsOut);
|
||||
pw.println(" mAutoDim: " + mAutoDim);
|
||||
pw.println(" bg overrideAlpha: " + mBarBackground.getOverrideAlpha());
|
||||
pw.println(" bg color: " + mBarBackground.getColor());
|
||||
pw.println(" bg frame: " + mBarBackground.getFrame());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1158,6 +1158,8 @@ public class NavigationBarView extends FrameLayout implements
|
||||
int frameHeight = getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.navigation_bar_frame_height);
|
||||
mBarTransitions.setBackgroundFrame(new Rect(0, frameHeight - height, w, h));
|
||||
} else {
|
||||
mBarTransitions.setBackgroundFrame(null);
|
||||
}
|
||||
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
@@ -1331,6 +1333,7 @@ public class NavigationBarView extends FrameLayout implements
|
||||
if (mNavigationInflaterView != null) {
|
||||
mNavigationInflaterView.dump(pw);
|
||||
}
|
||||
mBarTransitions.dump(pw);
|
||||
mContextualButtonGroup.dump(pw);
|
||||
mRecentsOnboarding.dump(pw);
|
||||
mRegionSamplingHelper.dump(pw);
|
||||
|
||||
@@ -293,11 +293,6 @@ public class OverviewProxyService extends CurrentUserTracker implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackButtonAlpha(float alpha, boolean animate) {
|
||||
setNavBarButtonAlpha(alpha, animate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAssistantProgress(@FloatRange(from = 0.0, to = 1.0) float progress) {
|
||||
if (!verifyCaller("onAssistantProgress")) {
|
||||
|
||||
@@ -166,6 +166,7 @@ public class BarTransitions {
|
||||
|
||||
private int mGradientAlpha;
|
||||
private int mColor;
|
||||
private float mOverrideAlpha = 1f;
|
||||
private PorterDuffColorFilter mTintFilter;
|
||||
private Paint mPaint = new Paint();
|
||||
|
||||
@@ -195,6 +196,23 @@ public class BarTransitions {
|
||||
mFrame = frame;
|
||||
}
|
||||
|
||||
public void setOverrideAlpha(float overrideAlpha) {
|
||||
mOverrideAlpha = overrideAlpha;
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
public float getOverrideAlpha() {
|
||||
return mOverrideAlpha;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return mColor;
|
||||
}
|
||||
|
||||
public Rect getFrame() {
|
||||
return mFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
// noop
|
||||
@@ -296,11 +314,13 @@ public class BarTransitions {
|
||||
mGradient.setAlpha(mGradientAlpha);
|
||||
mGradient.draw(canvas);
|
||||
}
|
||||
|
||||
if (Color.alpha(mColor) > 0) {
|
||||
mPaint.setColor(mColor);
|
||||
if (mTintFilter != null) {
|
||||
mPaint.setColorFilter(mTintFilter);
|
||||
}
|
||||
mPaint.setAlpha((int) (Color.alpha(mColor) * mOverrideAlpha));
|
||||
if (mFrame != null) {
|
||||
canvas.drawRect(mFrame, mPaint);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user