Fixed a bug when clicking below notifications.

When clicking on the bottom stack in the locked shade,
a click might have triggered a returning to the keyguard
instead of being catched by the notification if the
dismissview was present.

Change-Id: I7c6c74c8c98bd8e67ac882f92c90e25ac50c008c
This commit is contained in:
Selim Cinek
2015-02-20 17:36:10 +01:00
parent 379ff8f6b1
commit abf60bb20f

View File

@@ -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) {