summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-10-02 14:08:11 -0700
committerJohn Reck <jreck@google.com>2012-10-02 14:23:59 -0700
commit1da18852b3cddf3e2f288636a9ef9d8d002f496b (patch)
tree3836d1896ef2d662eb58af84b7c5228b1cd70b6b /src
parentea7e3512c0177bc53d5ab506416fe9d3d1f5df84 (diff)
downloadCamera-1da18852b3cddf3e2f288636a9ef9d8d002f496b.tar.gz
Only move one module on fling
Bug: 7265427 Change-Id: If5d6d8c1ada58df44d3f0a0d25e5febe721f69fd
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/ui/CameraSwitcher.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/camera/ui/CameraSwitcher.java b/src/com/android/camera/ui/CameraSwitcher.java
index 9cc891c7..338b926c 100644
--- a/src/com/android/camera/ui/CameraSwitcher.java
+++ b/src/com/android/camera/ui/CameraSwitcher.java
@@ -161,10 +161,19 @@ public class CameraSwitcher extends ScrollerView {
mListener = l;
}
+ private int clampModule(int index) {
+ index = Math.max(0, index);
+ return Math.min(index, mContent.getChildCount() - 1);
+ }
+
@Override
public void fling(int velocity) {
- super.fling(velocity);
- mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SNAP), FLING_DURATION);
+ if (velocity == 0) {
+ snap();
+ } else {
+ int newModule = clampModule(mCurrentModule + (velocity > 0 ? 1 : -1));
+ animateToModule(newModule);
+ }
}
@Override