From 197823da52a44422890667e21c17c28ab76e64b7 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Thu, 24 Mar 2016 13:06:00 -0700 Subject: [PATCH] Fixed a bug where longpress was not possible in landscape The clause used there was using a reused value of a motion event and therefore not trigger, even if it should have. Also added a clause which this was actually used for to remove the long press callback when using the inline settings slider. Bug: 27352426 Change-Id: I9c432eeb354d7d5e72b375cfc5ead9e04a4e6c81 --- .../SystemUI/src/com/android/systemui/SwipeHelper.java | 5 +---- .../statusbar/stack/NotificationStackScrollLayout.java | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index a08b2c1198d81..8f79bdabedc90 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -274,10 +274,7 @@ public class SwipeHelper implements Gefingerpoken { mWatchLongPress = new Runnable() { @Override public void run() { - float pos = getPos(ev); - float delta = pos - mInitialTouchPos; - if (mCurrView != null && !mLongPressSent - && Math.abs(delta) < mPagingTouchSlop) { + if (mCurrView != null && !mLongPressSent) { mLongPressSent = true; mCurrView.sendAccessibilityEvent( AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); 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 632ce2141573b..b5030e66e9c5b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -2063,6 +2063,14 @@ public class NotificationStackScrollLayout extends ViewGroup } } + @Override + public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) { + super.requestDisallowInterceptTouchEvent(disallowIntercept); + if (disallowIntercept) { + mSwipeHelper.removeLongPressCallback(); + } + } + private void onViewRemovedInternal(View child) { if (mChangePositionInProgress) { // This is only a position change, don't do anything special