diff options
| author | Alan Viverette <alanv@google.com> | 2015-05-01 18:30:25 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-01 18:30:26 +0000 |
| commit | da0d6a6b8ac0a3feaf276d462ed5121df37da2aa (patch) | |
| tree | b5a7dc977d9e4e11f2513001c91256e2953d12f0 /core/java/android/widget | |
| parent | 0f2be13dc691ff087d1705b7ea632654cc06c383 (diff) | |
| parent | fb99ba895e9921f46af38d5fe8c27c88676f7a65 (diff) | |
| download | frameworks_base-da0d6a6b8ac0a3feaf276d462ed5121df37da2aa.zip frameworks_base-da0d6a6b8ac0a3feaf276d462ed5121df37da2aa.tar.gz frameworks_base-da0d6a6b8ac0a3feaf276d462ed5121df37da2aa.tar.bz2 | |
Merge "Correctly handle intercepted touch events in FastScroller" into mnc-dev
Diffstat (limited to 'core/java/android/widget')
| -rw-r--r-- | core/java/android/widget/AbsListView.java | 7 | ||||
| -rw-r--r-- | core/java/android/widget/FastScroller.java | 14 |
2 files changed, 15 insertions, 6 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index c9d9a8c..1df43d0 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -3638,11 +3638,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te startNestedScroll(SCROLL_AXIS_VERTICAL); - if (mFastScroll != null) { - boolean intercepted = mFastScroll.onTouchEvent(ev); - if (intercepted) { - return true; - } + if (mFastScroll != null && mFastScroll.onTouchEvent(ev)) { + return true; } initVelocityTrackerIfNotExists(); diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java index 552b274..f06f3c2 100644 --- a/core/java/android/widget/FastScroller.java +++ b/core/java/android/widget/FastScroller.java @@ -1389,7 +1389,8 @@ class FastScroller { // to intercept events. If it does, we will receive a CANCEL // event. if (!mList.isInScrollingContainer()) { - beginDrag(); + // This will get dispatched to onTouchEvent(). Start + // dragging there. return true; } @@ -1406,6 +1407,8 @@ class FastScroller { final float pos = getPosFromMotionEvent(mInitialTouchY); scrollTo(pos); + // This may get dispatched to onTouchEvent(), but it + // doesn't really matter since we'll already be in a drag. return onTouchEvent(ev); } break; @@ -1440,6 +1443,15 @@ class FastScroller { } switch (me.getActionMasked()) { + case MotionEvent.ACTION_DOWN: { + if (isPointInside(me.getX(), me.getY())) { + if (!mList.isInScrollingContainer()) { + beginDrag(); + return true; + } + } + } break; + case MotionEvent.ACTION_UP: { if (mPendingDrag >= 0) { // Allow a tap to scroll. |
