diff options
author | Selim Cinek <cinek@google.com> | 2014-10-30 20:20:29 +0100 |
---|---|---|
committer | Selim Cinek <cinek@google.com> | 2014-10-31 15:19:14 +0100 |
commit | ab1dc954b2b97b59f868c96921f2daabc3336034 (patch) | |
tree | 4e8ca683e358887296835a6c8ecc4b1f5a95f83c /packages/SystemUI/src/com/android/systemui/statusbar | |
parent | 1b7f51ebc66fbb2cbe8a468790bbbfd397d66964 (diff) | |
download | frameworks_base-ab1dc954b2b97b59f868c96921f2daabc3336034.zip frameworks_base-ab1dc954b2b97b59f868c96921f2daabc3336034.tar.gz frameworks_base-ab1dc954b2b97b59f868c96921f2daabc3336034.tar.bz2 |
Fixed a bug that the panel was not closable in the locked shade
This happened when draging on the active lock icon.
Bug: 18185875
Change-Id: I27917fad000bc89f37b82fc8be978d867356904e
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar')
3 files changed, 24 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index aacfa6e..074a44e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -536,6 +536,14 @@ public class NotificationPanelView extends PanelView implements } } + @Override + protected boolean isInContentBounds(float x, float y) { + float yTransformed = y - mNotificationStackScroller.getY(); + float stackScrollerX = mNotificationStackScroller.getX(); + return mNotificationStackScroller.isInContentBounds(yTransformed) && stackScrollerX < x + && x < stackScrollerX + mNotificationStackScroller.getWidth(); + } + private void resetDownStates(MotionEvent event) { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { mOnlyAffordanceInThisMotion = false; 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 e416d93..d6c6152 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -70,6 +70,7 @@ public abstract class PanelView extends FrameLayout { private boolean mOverExpandedBeforeFling; private boolean mTouchAboveFalsingThreshold; private int mUnlockFalsingThreshold; + private boolean mTouchStartedInEmptyArea; private ValueAnimator mHeightAnimator; private ObjectAnimator mPeekAnimator; @@ -409,6 +410,7 @@ public abstract class PanelView extends FrameLayout { } mInitialTouchY = y; mInitialTouchX = x; + mTouchStartedInEmptyArea = !isInContentBounds(x, y); mTouchSlopExceeded = false; mJustPeeked = false; mPanelClosedOnDown = mExpandedHeight == 0.0f; @@ -432,7 +434,7 @@ public abstract class PanelView extends FrameLayout { case MotionEvent.ACTION_MOVE: final float h = y - mInitialTouchY; trackMovement(event); - if (scrolledToBottom) { + if (scrolledToBottom || mTouchStartedInEmptyArea) { if (h < -mTouchSlop && h < -Math.abs(x - mInitialTouchX)) { cancelHeightAnimator(); mInitialOffsetOnTouch = mExpandedHeight; @@ -452,6 +454,11 @@ public abstract class PanelView extends FrameLayout { return false; } + /** + * @return Whether a pair of coordinates are inside the visible view content bounds. + */ + protected abstract boolean isInContentBounds(float x, float y); + private void cancelHeightAnimator() { if (mHeightAnimator != null) { mHeightAnimator.cancel(); 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 8b3d714..92094f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -1915,7 +1915,14 @@ public class NotificationStackScrollLayout extends ViewGroup * @return Whether the specified motion event is actually happening over the content. */ private boolean isInContentBounds(MotionEvent event) { - return event.getY() < getHeight() - getEmptyBottomMargin(); + return isInContentBounds(event.getY()); + } + + /** + * @return Whether a y coordinate is inside the content. + */ + public boolean isInContentBounds(float y) { + return y < getHeight() - getEmptyBottomMargin(); } private void setIsBeingDragged(boolean isDragged) { |