OSDN Git Service

Fix tap to focus, back button to camera on Manta
authorDoris Liu <tianliu@google.com>
Thu, 6 Sep 2012 02:51:58 +0000 (19:51 -0700)
committerDoris Liu <tianliu@google.com>
Thu, 6 Sep 2012 02:51:58 +0000 (19:51 -0700)
Changed the move threshold from a hard coded value to be proportional to the size of the view.

Bug: 7080033
Bug: 7066859
Change-Id: Id7b81fb3da1783951886d43fe9a3df35186af985

src/com/android/gallery3d/ui/PhotoView.java

index 9a0fe9d..0952cfc 100644 (file)
@@ -149,7 +149,6 @@ public class PhotoView extends GLView {
     private static final int MSG_UNDO_BAR_TIMEOUT = 7;
     private static final int MSG_UNDO_BAR_FULL_CAMERA = 8;
 
-    private static final int MOVE_THRESHOLD = 256;
     private static final float SWIPE_THRESHOLD = 300f;
 
     private static final float DEFAULT_TEXT_SIZE = 20;
@@ -1532,7 +1531,9 @@ public class PhotoView extends GLView {
 
         Rect r = mPositionController.getPosition(0);
         int viewW = getWidth();
-        int threshold = MOVE_THRESHOLD + gapToSide(r.width(), viewW);
+        // Setting the move threshold proportional to the width of the view
+        int moveThreshold = viewW / 5 ;
+        int threshold = moveThreshold + gapToSide(r.width(), viewW);
 
         // If we have moved the picture a lot, switching.
         if (viewW - r.right > threshold) {