summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-10-02 15:53:42 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-02 15:53:43 -0700
commit3ae48a6193e2bd70b8bab793ff4699ff6a502e7a (patch)
tree2a323e2eddd1ca2adaf9ef6f1cd093eb24458d29 /src
parent0c6cca8886e813fb533bcdbc6d738bc9f50d717b (diff)
parent1da18852b3cddf3e2f288636a9ef9d8d002f496b (diff)
downloadCamera-3ae48a6193e2bd70b8bab793ff4699ff6a502e7a.tar.gz
Merge "Only move one module on fling" into gb-ub-photos-arches
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