From e5f7ec0576a25abc7a9754c72d61d86a251347e2 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Wed, 3 Oct 2012 10:40:00 -0400 Subject: Allow QS to be closed via drag on background. This was already working fine for the area of the panel below the ScrollView, but intuitively it seems that dragging in the unused portion of a partially-filled row would behave the same way. Because it's part of the scrolling content, though, drags in that region are (correctly) interpreted by the ScrollView as scrolling requests. The new QuickSettingsScrollView works around this by ignoring touch events if its contents are too small to be scrolled. So in the common case (QS tiles on a phone) you will be able to drag in any empty area and have your taps interpreted by the PanelView (which hands them off to the handle to collapse the view). We don't handle drags in empty areas when there are too many tiles to show on-screen, and really, it's impossible to do so: this gesture should then definitely be interpreted as a scroll. Bug: 7203193 Change-Id: I4cfcb029481a88d3604c7105185e8bcb7dbde8a5 --- packages/SystemUI/res/layout/quick_settings.xml | 5 +- .../statusbar/phone/QuickSettingsScrollView.java | 59 ++++++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsScrollView.java (limited to 'packages/SystemUI') diff --git a/packages/SystemUI/res/layout/quick_settings.xml b/packages/SystemUI/res/layout/quick_settings.xml index c1bcdfe..d119cf5 100644 --- a/packages/SystemUI/res/layout/quick_settings.xml +++ b/packages/SystemUI/res/layout/quick_settings.xml @@ -22,10 +22,11 @@ android:background="@drawable/notification_panel_bg" > - - + 0) { + View child = getChildAt(0); + scrollRange = Math.max(0, + child.getHeight() - (getHeight() - mPaddingBottom - mPaddingTop)); + } + return scrollRange; + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + final int range = getScrollRange(); + if (range == 0) { + return false; + } + + return super.onTouchEvent(ev); + } +} -- cgit v1.1