OSDN Git Service

in secure camera, prevent swiping to filmstrip when no photo has been taken.
authorSpike Sprague <spikuru@google.com>
Thu, 5 Feb 2015 21:42:49 +0000 (13:42 -0800)
committerSpike Sprague <spikuru@google.com>
Thu, 5 Feb 2015 22:10:58 +0000 (14:10 -0800)
bug: 19279388
Change-Id: I92c23dd5546aa31166df2ce40d19e374808d83d3

src/com/android/camera/widget/FilmstripLayout.java

index 1429884..d30c1c2 100644 (file)
@@ -402,8 +402,15 @@ public class FilmstripLayout extends FrameLayout implements FilmstripContentPane
             return false;
         }
 
+        /**
+         * @param velocityX The fling velocity in the X direction.
+         * @return Whether the filmstrip should be opened,
+         * given velocityX and mSwipeTrend.
+         */
         private boolean flingShouldOpenFilmstrip(float velocityX) {
-            return (velocityX < 0.0f) && (Math.abs(velocityX / 1000.0f) > FLING_VELOCITY_THRESHOLD);
+            return (mSwipeTrend > 0) &&
+                    (velocityX < 0.0f) &&
+                    (Math.abs(velocityX / 1000.0f) > FLING_VELOCITY_THRESHOLD);
         }
 
         @Override