From 4d47b3472cccf84e8c71d8fb389a79bc83b321ee Mon Sep 17 00:00:00 2001 From: Hung-ying Tyan Date: Wed, 29 Aug 2012 14:15:32 +0800 Subject: Fix pinch out gesture for film strip mode on gingerbread. On crespo running Android 2.3.6, a pinch out gesture results in the following call sequence: onDown(), onUp() and then onSingleTapUp(). The correct sequence for a single-tap-up gesture should be: onDown(), onSingleTapUp() and onUp(). The call sequence for a pinch out gesture in JB is: onDown() and then onUp(). Base on these observations, a condition is added in onSingleTapUp() to filter out the false alarm where onSingleTapUp() is called within a pinch out gesture. Bug: 7023717 Change-Id: I010b87f95c3197a299a7d907ce32e93a1d5e958f --- src/com/android/gallery3d/ui/PhotoView.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java index 25d3154a9..5c4c1e970 100644 --- a/src/com/android/gallery3d/ui/PhotoView.java +++ b/src/com/android/gallery3d/ui/PhotoView.java @@ -21,6 +21,7 @@ import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.Rect; +import android.os.Build; import android.os.Message; import android.util.FloatMath; import android.view.MotionEvent; @@ -29,6 +30,7 @@ import android.view.animation.AccelerateInterpolator; import com.android.gallery3d.R; import com.android.gallery3d.app.AbstractGalleryActivity; +import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; @@ -945,6 +947,19 @@ public class PhotoView extends GLView { @Override public boolean onSingleTapUp(float x, float y) { + // On crespo running Android 2.3.6 (gingerbread), a pinch out gesture results in the + // following call sequence: onDown(), onUp() and then onSingleTapUp(). The correct + // sequence for a single-tap-up gesture should be: onDown(), onSingleTapUp() and onUp(). + // The call sequence for a pinch out gesture in JB is: onDown(), then onUp() and there's + // no onSingleTapUp(). Base on these observations, the following condition is added to + // filter out the false alarm where onSingleTapUp() is called within a pinch out + // gesture. The framework fix went into ICS. Refer to b/4588114. + if (Build.VERSION.SDK_INT < ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) { + if ((mHolding & HOLD_TOUCH_DOWN) == 0) { + return true; + } + } + // We do this in addition to onUp() because we want the snapback of // setFilmMode to happen. mHolding &= ~HOLD_TOUCH_DOWN; -- cgit v1.2.3