From ce50b8199ccba2348abe405d05db028e0566806d Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Sat, 24 May 2014 16:29:57 +0200 Subject: Fix intercept logic in NotificationPanelView. We need to make sure that we only block the disallow intercept request when interacting with the ScrollView. In the past, we also blocked the disallow intercept request for the brightness slider, for example. Bug: 15169261 Change-Id: I02dd1e399a527509d631fdde54249d57748b20f2 --- .../systemui/statusbar/phone/NotificationPanelView.java | 8 +++++--- .../systemui/statusbar/phone/ObservableScrollView.java | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'packages/SystemUI/src') 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 fe7546d..50ea4bc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -353,10 +353,12 @@ public class NotificationPanelView extends PanelView implements @Override public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) { - // Block request so we can still intercept the scrolling when QS is expanded. - if (!mQsExpanded) { - super.requestDisallowInterceptTouchEvent(disallowIntercept); + // Block request when interacting with the scroll view so we can still intercept the + // scrolling when QS is expanded. + if (mScrollView.isDispatchingTouchEvent()) { + return; } + super.requestDisallowInterceptTouchEvent(disallowIntercept); } private void flingWithCurrentVelocity() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ObservableScrollView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ObservableScrollView.java index ba0b66e..c4e61d0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ObservableScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ObservableScrollView.java @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone; import android.content.Context; import android.util.AttributeSet; +import android.view.MotionEvent; import android.view.View; import android.widget.ScrollView; @@ -28,6 +29,7 @@ public class ObservableScrollView extends ScrollView { private Listener mListener; private int mLastOverscrollAmount; + private boolean mDispatchingTouchEvent; public ObservableScrollView(Context context, AttributeSet attrs) { super(context, attrs); @@ -41,6 +43,10 @@ public class ObservableScrollView extends ScrollView { return getScrollY() == getMaxScrollY(); } + public boolean isDispatchingTouchEvent() { + return mDispatchingTouchEvent; + } + private int getMaxScrollY() { int scrollRange = 0; if (getChildCount() > 0) { @@ -52,6 +58,14 @@ public class ObservableScrollView extends ScrollView { } @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + mDispatchingTouchEvent = true; + boolean result = super.dispatchTouchEvent(ev); + mDispatchingTouchEvent = false; + return result; + } + + @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); if (mListener != null) { -- cgit v1.1