summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2010-04-13 12:40:24 -0700
committerAdam Powell <adamp@google.com>2010-04-13 12:40:24 -0700
commita588b878b91ee817e3c78411ab0e08e2342acbd8 (patch)
tree479b4a2d0490c52aa473f301a11252c15f271d2d /src
parent55dcedfcc33658d14c04b4a1bced05c783becc2a (diff)
downloadandroid_packages_apps_Trebuchet-a588b878b91ee817e3c78411ab0e08e2342acbd8.tar.gz
android_packages_apps_Trebuchet-a588b878b91ee817e3c78411ab0e08e2342acbd8.tar.bz2
android_packages_apps_Trebuchet-a588b878b91ee817e3c78411ab0e08e2342acbd8.zip
Revised workspace fling physics
Change-Id: Ia14ff132e49390bf3bc4ac6ebf1b3eded8d39caf
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/Workspace.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 7a175164d..8f5bd29a0 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -60,7 +60,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
/**
* The velocity at which a fling gesture will cause us to snap to the next screen
*/
- private static final int SNAP_VELOCITY = 1000;
+ private static final int SNAP_VELOCITY = 600;
private final WallpaperManager mWallpaperManager;
@@ -600,6 +600,11 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
return true;
}
+ if (mVelocityTracker == null) {
+ mVelocityTracker = VelocityTracker.obtain();
+ }
+ mVelocityTracker.addMovement(ev);
+
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE: {
/*
@@ -682,6 +687,11 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
mTouchState = TOUCH_STATE_REST;
mActivePointerId = INVALID_POINTER;
mAllowLongPress = false;
+
+ if (mVelocityTracker != null) {
+ mVelocityTracker.recycle();
+ mVelocityTracker = null;
+ }
break;