Revised workspace fling physics
Change-Id: Ia14ff132e49390bf3bc4ac6ebf1b3eded8d39caf
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 7a17516..8f5bd29 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -60,7 +60,7 @@
/**
* 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 @@
return true;
}
+ if (mVelocityTracker == null) {
+ mVelocityTracker = VelocityTracker.obtain();
+ }
+ mVelocityTracker.addMovement(ev);
+
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE: {
/*
@@ -682,6 +687,11 @@
mTouchState = TOUCH_STATE_REST;
mActivePointerId = INVALID_POINTER;
mAllowLongPress = false;
+
+ if (mVelocityTracker != null) {
+ mVelocityTracker.recycle();
+ mVelocityTracker = null;
+ }
break;