From 02af41efe54eb2cc8fde7311e4cf5f0e5ff2373c Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Tue, 14 Oct 2014 15:46:43 +0200 Subject: [PATCH] Fixed a bug when double tapping a notification in the normal shade This fixes that sometimes holes where created when grabbing the panel while closing the shade (eg. double tapping) or the notifications did not disappear. It could also happen when using the clear all button. Bug: 17969040 Bug: 17899136 Bug: 17961295 Bug: 17551216 Change-Id: Id7aa37bbcbae504039f90686e2bc364d18685205 --- .../systemui/statusbar/phone/PanelView.java | 1 + .../statusbar/stack/StackScrollAlgorithm.java | 14 ++++++++++---- .../statusbar/stack/StackStateAnimator.java | 18 +++++++++++++++++- 3 files changed, 28 insertions(+), 5 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 d8c99f83ec286..a7ff0bde678bf 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -372,6 +372,7 @@ public abstract class PanelView extends FrameLayout { } protected void onTrackingStarted() { + mClosing = false; mTracking = true; mCollapseAfterPeek = false; mBar.onTrackingStarted(PanelView.this); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java index e4a1c27471e1c..853628eaf6b79 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java @@ -738,8 +738,9 @@ public class StackScrollAlgorithm { if (mExpandedOnStart) { // We are collapsing the shade, so the first child can get as most as high as the - // current height. - mFirstChildMaxHeight = mFirstChildWhileExpanding.getActualHeight(); + // current height or the end value of the animation. + mFirstChildMaxHeight = StackStateAnimator.getFinalActualHeight( + mFirstChildWhileExpanding); } else { updateFirstChildMaxSizeToMaxHeight(); } @@ -801,9 +802,14 @@ public class StackScrollAlgorithm { this.mIsExpanded = isExpanded; } - public void notifyChildrenChanged(ViewGroup hostView) { + public void notifyChildrenChanged(final ViewGroup hostView) { if (mIsExpansionChanging) { - updateFirstChildHeightWhileExpanding(hostView); + hostView.post(new Runnable() { + @Override + public void run() { + updateFirstChildHeightWhileExpanding(hostView); + } + }); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java index a69390ef0f898..433357ecb9349 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java @@ -709,7 +709,7 @@ public class StackStateAnimator { }; } - private T getChildTag(View child, int tag) { + private static T getChildTag(View child, int tag) { return (T) child.getTag(tag); } @@ -848,4 +848,20 @@ public class StackStateAnimator { currentAnimator.cancel(); } } + + /** + * Get the end value of the height animation running on a view or the actualHeight + * if no animation is running. + */ + public static int getFinalActualHeight(ExpandableView view) { + if (view == null) { + return 0; + } + ValueAnimator heightAnimator = getChildTag(view, TAG_ANIMATOR_HEIGHT); + if (heightAnimator == null) { + return view.getActualHeight(); + } else { + return getChildTag(view, TAG_END_HEIGHT); + } + } }