diff options
author | Selim Cinek <cinek@google.com> | 2015-03-13 21:45:22 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-03-13 21:45:39 +0000 |
commit | 0a826bf5ab23f3a9e2cfbc301fa7137ccd6987e3 (patch) | |
tree | 9717e464c40c85bcae902232ee7fcb31bd5fab16 /packages/SystemUI | |
parent | 4562845599b9584ddff04300c2e32455ea6dc017 (diff) | |
parent | abf60bb20f5e84574b91747effcd675f596cbb1e (diff) | |
download | frameworks_base-0a826bf5ab23f3a9e2cfbc301fa7137ccd6987e3.zip frameworks_base-0a826bf5ab23f3a9e2cfbc301fa7137ccd6987e3.tar.gz frameworks_base-0a826bf5ab23f3a9e2cfbc301fa7137ccd6987e3.tar.bz2 |
Merge "Fixed a bug when clicking below notifications."
Diffstat (limited to 'packages/SystemUI')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index d4fef9a..8c1f9bb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -2410,21 +2410,32 @@ public class NotificationStackScrollLayout extends ViewGroup } private boolean isBelowLastNotification(float touchX, float touchY) { - ExpandableView lastChildNotGone = (ExpandableView) getLastChildNotGone(); - if (lastChildNotGone == null) { - return touchY > mIntrinsicPadding; - } - if (lastChildNotGone != mDismissView && lastChildNotGone != mEmptyShadeView) { - return touchY > lastChildNotGone.getY() + lastChildNotGone.getActualHeight(); - } else if (lastChildNotGone == mEmptyShadeView) { - return touchY > mEmptyShadeView.getY(); - } else { - float dismissY = mDismissView.getY(); - boolean belowDismissView = touchY > dismissY + mDismissView.getActualHeight(); - return belowDismissView || (touchY > dismissY - && mDismissView.isOnEmptySpace(touchX - mDismissView.getX(), - touchY - dismissY)); + int childCount = getChildCount(); + for (int i = childCount - 1; i >= 0; i--) { + ExpandableView child = (ExpandableView) getChildAt(i); + if (child.getVisibility() != View.GONE) { + float childTop = child.getY(); + if (childTop > touchY) { + // we are above a notification entirely let's abort + return false; + } + boolean belowChild = touchY > childTop + child.getActualHeight(); + if (child == mDismissView) { + if(!belowChild && !mDismissView.isOnEmptySpace(touchX - mDismissView.getX(), + touchY - childTop)) { + // We clicked on the dismiss button + return false; + } + } else if (child == mEmptyShadeView) { + // We arrived at the empty shade view, for which we accept all clicks + return true; + } else if (!belowChild){ + // We are on a child + return false; + } + } } + return touchY > mIntrinsicPadding; } public void setRemoveAnimationEnabled(boolean enabled) { |