* commit '192ca56d7a0c8a1a776bd8f9539c49f4b8ce3372': Prevent overlap of color views in landscape
This commit is contained in:
@@ -2907,13 +2907,18 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
mLastHasRightStableInset = hasRightStableInset;
|
mLastHasRightStableInset = hasRightStableInset;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateColorViewInt(mStatusColorViewState, sysUiVisibility, mStatusBarColor,
|
|
||||||
mLastTopInset, false /* matchVertical */, animate && !disallowAnimate);
|
|
||||||
|
|
||||||
boolean navBarToRightEdge = mLastBottomInset == 0 && mLastRightInset > 0;
|
boolean navBarToRightEdge = mLastBottomInset == 0 && mLastRightInset > 0;
|
||||||
int navBarSize = navBarToRightEdge ? mLastRightInset : mLastBottomInset;
|
int navBarSize = navBarToRightEdge ? mLastRightInset : mLastBottomInset;
|
||||||
updateColorViewInt(mNavigationColorViewState, sysUiVisibility, mNavigationBarColor,
|
updateColorViewInt(mNavigationColorViewState, sysUiVisibility, mNavigationBarColor,
|
||||||
navBarSize, navBarToRightEdge, animate && !disallowAnimate);
|
navBarSize, navBarToRightEdge, 0 /* rightInset */,
|
||||||
|
animate && !disallowAnimate);
|
||||||
|
|
||||||
|
boolean statusBarNeedsRightInset = navBarToRightEdge
|
||||||
|
&& mNavigationColorViewState.present;
|
||||||
|
int statusBarRightInset = statusBarNeedsRightInset ? mLastRightInset : 0;
|
||||||
|
updateColorViewInt(mStatusColorViewState, sysUiVisibility, mStatusBarColor,
|
||||||
|
mLastTopInset, false /* matchVertical */, statusBarRightInset,
|
||||||
|
animate && !disallowAnimate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When we expand the window with FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, we still need
|
// When we expand the window with FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, we still need
|
||||||
@@ -2966,15 +2971,17 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
* @param size the current size in the non-parent-matching dimension.
|
* @param size the current size in the non-parent-matching dimension.
|
||||||
* @param verticalBar if true the view is attached to a vertical edge, otherwise to a
|
* @param verticalBar if true the view is attached to a vertical edge, otherwise to a
|
||||||
* horizontal edge,
|
* horizontal edge,
|
||||||
|
* @param rightMargin rightMargin for the color view.
|
||||||
* @param animate if true, the change will be animated.
|
* @param animate if true, the change will be animated.
|
||||||
*/
|
*/
|
||||||
private void updateColorViewInt(final ColorViewState state, int sysUiVis, int color,
|
private void updateColorViewInt(final ColorViewState state, int sysUiVis, int color,
|
||||||
int size, boolean verticalBar, boolean animate) {
|
int size, boolean verticalBar, int rightMargin, boolean animate) {
|
||||||
boolean show = size > 0 && (sysUiVis & state.systemUiHideFlag) == 0
|
state.present = size > 0 && (sysUiVis & state.systemUiHideFlag) == 0
|
||||||
&& (getAttributes().flags & state.hideWindowFlag) == 0
|
&& (getAttributes().flags & state.hideWindowFlag) == 0
|
||||||
&& (getAttributes().flags & state.translucentFlag) == 0
|
|
||||||
&& (color & Color.BLACK) != 0
|
|
||||||
&& (getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0;
|
&& (getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0;
|
||||||
|
boolean show = state.present
|
||||||
|
&& (color & Color.BLACK) != 0
|
||||||
|
&& (getAttributes().flags & state.translucentFlag) == 0;
|
||||||
|
|
||||||
boolean visibilityChanged = false;
|
boolean visibilityChanged = false;
|
||||||
View view = state.view;
|
View view = state.view;
|
||||||
@@ -2993,7 +3000,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
view.setVisibility(INVISIBLE);
|
view.setVisibility(INVISIBLE);
|
||||||
state.targetVisibility = VISIBLE;
|
state.targetVisibility = VISIBLE;
|
||||||
|
|
||||||
addView(view, new LayoutParams(resolvedWidth, resolvedHeight, resolvedGravity));
|
LayoutParams lp = new LayoutParams(resolvedWidth, resolvedHeight,
|
||||||
|
resolvedGravity);
|
||||||
|
lp.rightMargin = rightMargin;
|
||||||
|
addView(view, lp);
|
||||||
updateColorViewTranslations();
|
updateColorViewTranslations();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -3003,10 +3013,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
if (show) {
|
if (show) {
|
||||||
LayoutParams lp = (LayoutParams) view.getLayoutParams();
|
LayoutParams lp = (LayoutParams) view.getLayoutParams();
|
||||||
if (lp.height != resolvedHeight || lp.width != resolvedWidth
|
if (lp.height != resolvedHeight || lp.width != resolvedWidth
|
||||||
|| lp.gravity != resolvedGravity) {
|
|| lp.gravity != resolvedGravity || lp.rightMargin != rightMargin) {
|
||||||
lp.height = resolvedHeight;
|
lp.height = resolvedHeight;
|
||||||
lp.width = resolvedWidth;
|
lp.width = resolvedWidth;
|
||||||
lp.gravity = resolvedGravity;
|
lp.gravity = resolvedGravity;
|
||||||
|
lp.rightMargin = rightMargin;
|
||||||
view.setLayoutParams(lp);
|
view.setLayoutParams(lp);
|
||||||
}
|
}
|
||||||
view.setBackgroundColor(color);
|
view.setBackgroundColor(color);
|
||||||
@@ -5022,6 +5033,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
private static class ColorViewState {
|
private static class ColorViewState {
|
||||||
View view = null;
|
View view = null;
|
||||||
int targetVisibility = View.INVISIBLE;
|
int targetVisibility = View.INVISIBLE;
|
||||||
|
boolean present = false;
|
||||||
|
|
||||||
final int id;
|
final int id;
|
||||||
final int systemUiHideFlag;
|
final int systemUiHideFlag;
|
||||||
|
|||||||
@@ -3617,7 +3617,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
// We currently want to hide the navigation UI.
|
// We currently want to hide the navigation UI.
|
||||||
mNavigationBarController.setBarShowingLw(false);
|
mNavigationBarController.setBarShowingLw(false);
|
||||||
}
|
}
|
||||||
if (navVisible && !navTranslucent && !mNavigationBar.isAnimatingLw()
|
if (navVisible && !navTranslucent && !navAllowedHidden
|
||||||
|
&& !mNavigationBar.isAnimatingLw()
|
||||||
&& !mNavigationBarController.wasRecentlyTranslucent()) {
|
&& !mNavigationBarController.wasRecentlyTranslucent()) {
|
||||||
// If the nav bar is currently requested to be visible,
|
// If the nav bar is currently requested to be visible,
|
||||||
// and not in the process of animating on or off, then
|
// and not in the process of animating on or off, then
|
||||||
|
|||||||
Reference in New Issue
Block a user