diff options
Diffstat (limited to 'src/com/android/launcher2/SpringLoadedDragController.java')
-rw-r--r-- | src/com/android/launcher2/SpringLoadedDragController.java | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/src/com/android/launcher2/SpringLoadedDragController.java b/src/com/android/launcher2/SpringLoadedDragController.java index 900758118..37a94d48f 100644 --- a/src/com/android/launcher2/SpringLoadedDragController.java +++ b/src/com/android/launcher2/SpringLoadedDragController.java @@ -26,8 +26,6 @@ public class SpringLoadedDragController implements OnAlarmListener { // the screen the user is currently hovering over, if any private CellLayout mScreen; private Launcher mLauncher; - boolean mFinishedAnimation = false; - boolean mWaitingToReenter = false; public SpringLoadedDragController(Launcher launcher) { mLauncher = launcher; @@ -35,35 +33,25 @@ public class SpringLoadedDragController implements OnAlarmListener { mAlarm.setOnAlarmListener(this); } - public void onDragEnter(CellLayout cl, boolean isSpringLoaded) { - mScreen = cl; - mAlarm.setAlarm(ENTER_SPRING_LOAD_HOVER_TIME); - mFinishedAnimation = isSpringLoaded; - mWaitingToReenter = false; - } - - public void onEnterSpringLoadedMode(boolean waitToReenter) { - mFinishedAnimation = true; - mWaitingToReenter = waitToReenter; + public void cancel() { + mAlarm.cancelAlarm(); } - public void onDragExit() { - if (mScreen != null) { - mScreen.onDragExit(); - } - mScreen = null; - if (mFinishedAnimation && !mWaitingToReenter) { - mAlarm.setAlarm(EXIT_SPRING_LOAD_HOVER_TIME); + // Set a new alarm to expire for the screen that we are hovering over now + public void setAlarm(CellLayout cl) { + if (mScreen != cl) { + mAlarm.setAlarm(ENTER_SPRING_LOAD_HOVER_TIME); } + mScreen = cl; } // this is called when our timer runs out public void onAlarm(Alarm alarm) { if (mScreen != null) { - // we're currently hovering over a screen - mLauncher.enterSpringLoadedDragMode(mScreen); - } else { - mLauncher.exitSpringLoadedDragMode(); + // Snap to the screen that we are hovering over now + Workspace w = mLauncher.getWorkspace(); + int page = w.indexOfChild(mScreen); + w.snapToPage(page); } } } |