summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-09-04 15:17:18 +0800
committerOwen Lin <owenlin@google.com>2012-09-04 15:19:20 +0800
commitbcca048557ff3637b7d1cce2893cfc095111ebdd (patch)
treedc955c05f6a3ccab4c5a304d0d6c96895ef0273f /src
parent38e7740b7c363a993390f53a70a6e5c0536825e8 (diff)
downloadandroid_packages_apps_Gallery2-bcca048557ff3637b7d1cce2893cfc095111ebdd.tar.gz
android_packages_apps_Gallery2-bcca048557ff3637b7d1cce2893cfc095111ebdd.tar.bz2
android_packages_apps_Gallery2-bcca048557ff3637b7d1cce2893cfc095111ebdd.zip
Make a time jump when user clicks outsides the scrubber.
bug: 7080593 Change-Id: I913aee6e416c10d68403d7f9d4102d4dcc41e1d4
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/TimeBar.java46
1 files changed, 21 insertions, 25 deletions
diff --git a/src/com/android/gallery3d/app/TimeBar.java b/src/com/android/gallery3d/app/TimeBar.java
index 1f3630622..f52879732 100644
--- a/src/com/android/gallery3d/app/TimeBar.java
+++ b/src/com/android/gallery3d/app/TimeBar.java
@@ -237,32 +237,28 @@ public class TimeBar extends View {
int y = (int) event.getY();
switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- if (inScrubber(x, y)) {
- scrubbing = true;
- scrubberCorrection = x - scrubberLeft;
- listener.onScrubbingStart();
- return true;
- }
- break;
- case MotionEvent.ACTION_MOVE:
- if (scrubbing) {
- scrubberLeft = x - scrubberCorrection;
- clampScrubber();
- currentTime = getScrubberTime();
- listener.onScrubbingMove(currentTime);
- invalidate();
- return true;
- }
- break;
+ case MotionEvent.ACTION_DOWN: {
+ scrubberCorrection = inScrubber(x, y)
+ ? x - scrubberLeft
+ : scrubber.getWidth() / 2;
+ scrubbing = true;
+ listener.onScrubbingStart();
+ }
+ // fall-through
+ case MotionEvent.ACTION_MOVE: {
+ scrubberLeft = x - scrubberCorrection;
+ clampScrubber();
+ currentTime = getScrubberTime();
+ listener.onScrubbingMove(currentTime);
+ invalidate();
+ return true;
+ }
case MotionEvent.ACTION_CANCEL:
- case MotionEvent.ACTION_UP:
- if (scrubbing) {
- listener.onScrubbingEnd(getScrubberTime());
- scrubbing = false;
- return true;
- }
- break;
+ case MotionEvent.ACTION_UP: {
+ listener.onScrubbingEnd(getScrubberTime());
+ scrubbing = false;
+ return true;
+ }
}
}
return false;