Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abf60bb2 authored by Selim Cinek's avatar Selim Cinek
Browse files

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
parent 379ff8f6
Loading
Loading
Loading
Loading
+25 −14
Original line number Diff line number Diff line
@@ -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;
        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;
                }
        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));
                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) {