From fe8ba6078e483efa988745489111554767448d0b Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Sun, 30 Jan 2011 22:05:47 +0000 Subject: [PATCH] Propagate the ACTION_DOWN event to the ScrollView so we can stop scrolling after a fling. Fixes issue 2892. --- src/com/fsck/k9/view/ToggleScrollView.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/com/fsck/k9/view/ToggleScrollView.java b/src/com/fsck/k9/view/ToggleScrollView.java index ed70d55bc..54757684b 100644 --- a/src/com/fsck/k9/view/ToggleScrollView.java +++ b/src/com/fsck/k9/view/ToggleScrollView.java @@ -40,7 +40,8 @@ public class ToggleScrollView extends ScrollView // currently got. This is based on // http://stackoverflow.com/questions/2646028/android-horizontalscrollview-within-scrollview-touch-handling boolean result = super.onInterceptTouchEvent(ev); - if (mDetector.onTouchEvent(ev)) + // Let the original ScrollView handle ACTION_DOWN so we can stop the scroll when someone touches the screen. + if (ev.getAction() == MotionEvent.ACTION_DOWN || mDetector.onTouchEvent(ev)) { return result; } @@ -48,7 +49,8 @@ public class ToggleScrollView extends ScrollView return false; } - // Return false if we're scrolling in the x direction + // Return false if we're scrolling in the x direction. That is, decline to consume the event and + // let the parent class take a stab at it. class YScrollDetector extends GestureDetector.SimpleOnGestureListener { @Override