From bd61a5f21b390631ee68a8bd3d3a674e37910093 Mon Sep 17 00:00:00 2001 From: Matt Holgate Date: Tue, 8 Jul 2014 11:16:48 +0100 Subject: Fix #693228 - Android has counter intuitive finger dragging behaviour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch from Michaƫl Cadilhac. Continue to pass events to panning GestureDetector when zooming (but do not act on the reported gesture). Previously we just stopped sending events to the GestureDetector until the start of the next gesture. --- platform/android/src/com/artifex/mupdfdemo/ReaderView.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'platform/android') diff --git a/platform/android/src/com/artifex/mupdfdemo/ReaderView.java b/platform/android/src/com/artifex/mupdfdemo/ReaderView.java index 2552e928..7cfcf4d1 100644 --- a/platform/android/src/com/artifex/mupdfdemo/ReaderView.java +++ b/platform/android/src/com/artifex/mupdfdemo/ReaderView.java @@ -56,7 +56,6 @@ public class ReaderView private final Stepper mStepper; private int mScrollerLastX; private int mScrollerLastY; - private boolean mScrollDisabled; static abstract class ViewMapper { abstract void applyToView(View view); @@ -366,7 +365,7 @@ public class ReaderView public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { - if (mScrollDisabled) + if (mScaling) return true; View v = mChildViews.get(mCurrent); @@ -424,7 +423,7 @@ public class ReaderView public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { - if (!mScrollDisabled) { + if (!mScaling) { mXScroll -= distanceX; mYScroll -= distanceY; requestLayout(); @@ -473,9 +472,6 @@ public class ReaderView // screen is not showing the effect of them, so they can // only confuse the user mXScroll = mYScroll = 0; - // Avoid jump at end of scaling by disabling scrolling - // until the next start of gesture - mScrollDisabled = true; return true; } @@ -494,15 +490,12 @@ public class ReaderView @Override public boolean onTouchEvent(MotionEvent event) { mScaleGestureDetector.onTouchEvent(event); - - if (!mScaling) - mGestureDetector.onTouchEvent(event); + mGestureDetector.onTouchEvent(event); if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) { mUserInteracting = true; } if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP) { - mScrollDisabled = false; mUserInteracting = false; View v = mChildViews.get(mCurrent); -- cgit v1.2.3