summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher2/Workspace.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index cb4ba1145..7a175164d 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -838,13 +838,20 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
final int screenWidth = getWidth();
final int whichScreen = (mScrollX + (screenWidth / 2)) / screenWidth;
+ final float scrolledPos = (float) mScrollX / screenWidth;
if (velocityX > SNAP_VELOCITY && mCurrentScreen > 0) {
- // Fling hard enough to move left
- snapToScreen(Math.min(whichScreen, mCurrentScreen - 1));
+ // Fling hard enough to move left.
+ // Don't fling across more than one screen at a time.
+ final int bound = scrolledPos < whichScreen ?
+ mCurrentScreen - 1 : mCurrentScreen;
+ snapToScreen(Math.min(whichScreen, bound));
} else if (velocityX < -SNAP_VELOCITY && mCurrentScreen < getChildCount() - 1) {
// Fling hard enough to move right
- snapToScreen(Math.max(whichScreen, mCurrentScreen + 1));
+ // Don't fling across more than one screen at a time.
+ final int bound = scrolledPos > whichScreen ?
+ mCurrentScreen + 1 : mCurrentScreen;
+ snapToScreen(Math.max(whichScreen, bound));
} else {
snapToDestination();
}