Merge "Prevent overlap of color views in landscape" into mnc-dev

This commit is contained in:
Adrian Roos
2015-08-12 18:06:42 +00:00
committed by Android (Google) Code Review
2 changed files with 24 additions and 11 deletions

View File

@ -2907,13 +2907,18 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
mLastHasRightStableInset = hasRightStableInset;
}
updateColorViewInt(mStatusColorViewState, sysUiVisibility, mStatusBarColor,
mLastTopInset, false /* matchVertical */, animate && !disallowAnimate);
boolean navBarToRightEdge = mLastBottomInset == 0 && mLastRightInset > 0;
int navBarSize = navBarToRightEdge ? mLastRightInset : mLastBottomInset;
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
@ -2966,15 +2971,17 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
* @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
* horizontal edge,
* @param rightMargin rightMargin for the color view.
* @param animate if true, the change will be animated.
*/
private void updateColorViewInt(final ColorViewState state, int sysUiVis, int color,
int size, boolean verticalBar, boolean animate) {
boolean show = size > 0 && (sysUiVis & state.systemUiHideFlag) == 0
int size, boolean verticalBar, int rightMargin, boolean animate) {
state.present = size > 0 && (sysUiVis & state.systemUiHideFlag) == 0
&& (getAttributes().flags & state.hideWindowFlag) == 0
&& (getAttributes().flags & state.translucentFlag) == 0
&& (color & Color.BLACK) != 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;
View view = state.view;
@ -2993,7 +3000,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
view.setVisibility(INVISIBLE);
state.targetVisibility = VISIBLE;
addView(view, new LayoutParams(resolvedWidth, resolvedHeight, resolvedGravity));
LayoutParams lp = new LayoutParams(resolvedWidth, resolvedHeight,
resolvedGravity);
lp.rightMargin = rightMargin;
addView(view, lp);
updateColorViewTranslations();
}
} else {
@ -3003,10 +3013,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if (show) {
LayoutParams lp = (LayoutParams) view.getLayoutParams();
if (lp.height != resolvedHeight || lp.width != resolvedWidth
|| lp.gravity != resolvedGravity) {
|| lp.gravity != resolvedGravity || lp.rightMargin != rightMargin) {
lp.height = resolvedHeight;
lp.width = resolvedWidth;
lp.gravity = resolvedGravity;
lp.rightMargin = rightMargin;
view.setLayoutParams(lp);
}
view.setBackgroundColor(color);
@ -5022,6 +5033,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
private static class ColorViewState {
View view = null;
int targetVisibility = View.INVISIBLE;
boolean present = false;
final int id;
final int systemUiHideFlag;

View File

@ -3617,7 +3617,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// We currently want to hide the navigation UI.
mNavigationBarController.setBarShowingLw(false);
}
if (navVisible && !navTranslucent && !mNavigationBar.isAnimatingLw()
if (navVisible && !navTranslucent && !navAllowedHidden
&& !mNavigationBar.isAnimatingLw()
&& !mNavigationBarController.wasRecentlyTranslucent()) {
// If the nav bar is currently requested to be visible,
// and not in the process of animating on or off, then