@@ -222,6 +222,7 @@ public boolean onPreDraw() {
222222 private int [] mTempInt2 = new int [2 ];
223223 private boolean mGenerateChildOrderChangedEvent ;
224224 private HashSet <Runnable > mAnimationFinishedRunnables = new HashSet <>();
225+ private HashSet <View > mClearOverlayViewsWhenFinished = new HashSet <>();
225226 private HashSet <Pair <ExpandableNotificationRow , Boolean >> mHeadsUpChangeAnimations
226227 = new HashSet <>();
227228 private HeadsUpManager mHeadsUpManager ;
@@ -1656,6 +1657,11 @@ private boolean generateRemoveAnimation(View child) {
16561657 mAddedHeadsUpChildren .remove (child );
16571658 return false ;
16581659 }
1660+ if (isClickedHeadsUp (child )) {
1661+ // An animation is already running, add it to the Overlay
1662+ mClearOverlayViewsWhenFinished .add (child );
1663+ return true ;
1664+ }
16591665 if (mIsExpanded && mAnimationsEnabled && !isChildInInvisibleGroup (child )) {
16601666 if (!mChildrenToAddAnimated .contains (child )) {
16611667 // Generate Animations
@@ -1671,6 +1677,10 @@ private boolean generateRemoveAnimation(View child) {
16711677 return false ;
16721678 }
16731679
1680+ private boolean isClickedHeadsUp (View child ) {
1681+ return HeadsUpManager .isClickedHeadsUpNotification (child );
1682+ }
1683+
16741684 /**
16751685 * Remove a removed child view from the heads up animations if it was just added there
16761686 *
@@ -2327,6 +2337,13 @@ public void setOnEmptySpaceClickListener(OnEmptySpaceClickListener listener) {
23272337 public void onChildAnimationFinished () {
23282338 requestChildrenUpdate ();
23292339 runAnimationFinishedRunnables ();
2340+ clearViewOverlays ();
2341+ }
2342+
2343+ private void clearViewOverlays () {
2344+ for (View view : mClearOverlayViewsWhenFinished ) {
2345+ getOverlay ().remove (view );
2346+ }
23302347 }
23312348
23322349 private void runAnimationFinishedRunnables () {
0 commit comments