diff options
author | Selim Cinek <cinek@google.com> | 2014-05-15 19:10:18 +0200 |
---|---|---|
committer | Selim Cinek <cinek@google.com> | 2014-05-15 19:10:18 +0200 |
commit | b84a1074b34f64174d9451234fa7c684f8283b6c (patch) | |
tree | 41c435aa047c3ff066e0bcb213490a91562135b3 /packages/SystemUI/src | |
parent | 9dbbca879ecab36c4bb0982c1499b30a33228aed (diff) | |
download | frameworks_base-b84a1074b34f64174d9451234fa7c684f8283b6c.zip frameworks_base-b84a1074b34f64174d9451234fa7c684f8283b6c.tar.gz frameworks_base-b84a1074b34f64174d9451234fa7c684f8283b6c.tar.bz2 |
Improved Notification Panel height logic
Due to a racecondition, the mMaxPanelheight of the PanelView could
get too small in certain cases, leading to an empty shade.
Change-Id: Ib1d7b5245cbb25a853698e1985b1e4bbf617505f
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index 8c70517..dde2ebb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -20,6 +20,7 @@ import android.animation.ObjectAnimator; import android.animation.TimeAnimator; import android.animation.TimeAnimator.TimeListener; import android.content.Context; +import android.content.res.Configuration; import android.content.res.Resources; import android.util.AttributeSet; import android.util.Log; @@ -218,7 +219,7 @@ public class PanelView extends FrameLayout { }; private float mVel, mAccel; - protected int mMaxPanelHeight = 0; + protected int mMaxPanelHeight = -1; private String mViewName; private float mInitialTouchY; private float mInitialTouchX; @@ -617,7 +618,8 @@ public class PanelView extends FrameLayout { // Did one of our children change size? int newHeight = getMeasuredHeight(); - if (newHeight != mMaxPanelHeight) { + if (newHeight > mMaxPanelHeight) { + // we only adapt the max height if it's bigger mMaxPanelHeight = newHeight; // If the user isn't actively poking us, let's rubberband to the content if (!mTracking && !mTimeAnimator.isStarted() @@ -695,6 +697,12 @@ public class PanelView extends FrameLayout { mExpandedFraction = Math.min(1f, (fh == 0) ? 0 : h / fh); } + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + mMaxPanelHeight = -1; + } + protected void onHeightUpdated(float expandedHeight) { requestLayout(); } @@ -706,6 +714,7 @@ public class PanelView extends FrameLayout { * @return the default implementation simply returns the maximum height. */ protected int getMaxPanelHeight() { + mMaxPanelHeight = Math.max(mMaxPanelHeight, getHeight()); return mMaxPanelHeight; } |