diff options
author | Adrian Roos <roosa@google.com> | 2015-08-11 17:36:43 -0700 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2015-08-11 17:36:43 -0700 |
commit | fe836fabd9c6d3a3a7aaa51db7bb9bd6c9239833 (patch) | |
tree | 51363dfaa2c21a20503955fc08e79576362961cf /core | |
parent | b4eb06402fba62f94bb16cbe433fe99a8df7cb18 (diff) | |
download | frameworks_base-fe836fabd9c6d3a3a7aaa51db7bb9bd6c9239833.zip frameworks_base-fe836fabd9c6d3a3a7aaa51db7bb9bd6c9239833.tar.gz frameworks_base-fe836fabd9c6d3a3a7aaa51db7bb9bd6c9239833.tar.bz2 |
Prevent overlap of color views in landscape
Removes overlap from the color views which resulted in subotimal looks
when both color views were translucent and the nav bar was on the right
edge.
Also fixes a bug introduced in I2df7092a91eceeb815367ef917dd7289f4f2b27e
where the navigation-bar-on-right-side case got forgotten and caused
flickering in landscape when IMMERSIVE_STICKY was set but the navigation bar
was visible.
Bug: 22876533
Change-Id: I449a82eb3dc3f7b5051f26b37b362a196b4ff63a
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/internal/policy/PhoneWindow.java | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index dd7ea45..a7bdbe0 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -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; |