am aeedef55: am da0d6a6b: Merge "Correctly handle intercepted touch events in FastScroller" into mnc-dev

* commit 'aeedef552d64027d7de40d4cc13c182f97250b6e':
  Correctly handle intercepted touch events in FastScroller
This commit is contained in:
Alan Viverette
2015-05-01 18:48:46 +00:00
committed by Android Git Automerger
2 changed files with 15 additions and 6 deletions

View File

@@ -3638,11 +3638,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
startNestedScroll(SCROLL_AXIS_VERTICAL); startNestedScroll(SCROLL_AXIS_VERTICAL);
if (mFastScroll != null) { if (mFastScroll != null && mFastScroll.onTouchEvent(ev)) {
boolean intercepted = mFastScroll.onTouchEvent(ev); return true;
if (intercepted) {
return true;
}
} }
initVelocityTrackerIfNotExists(); initVelocityTrackerIfNotExists();

View File

@@ -1389,7 +1389,8 @@ class FastScroller {
// to intercept events. If it does, we will receive a CANCEL // to intercept events. If it does, we will receive a CANCEL
// event. // event.
if (!mList.isInScrollingContainer()) { if (!mList.isInScrollingContainer()) {
beginDrag(); // This will get dispatched to onTouchEvent(). Start
// dragging there.
return true; return true;
} }
@@ -1406,6 +1407,8 @@ class FastScroller {
final float pos = getPosFromMotionEvent(mInitialTouchY); final float pos = getPosFromMotionEvent(mInitialTouchY);
scrollTo(pos); 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); return onTouchEvent(ev);
} }
break; break;
@@ -1440,6 +1443,15 @@ class FastScroller {
} }
switch (me.getActionMasked()) { switch (me.getActionMasked()) {
case MotionEvent.ACTION_DOWN: {
if (isPointInside(me.getX(), me.getY())) {
if (!mList.isInScrollingContainer()) {
beginDrag();
return true;
}
}
} break;
case MotionEvent.ACTION_UP: { case MotionEvent.ACTION_UP: {
if (mPendingDrag >= 0) { if (mPendingDrag >= 0) {
// Allow a tap to scroll. // Allow a tap to scroll.