Cleaning up some spring-loaded related dragging code. Allow cancel spring loaded mode.

Change-Id: Ie1f0468c563bed7abc1aa6416e222cdb0853c03a
This commit is contained in:
Winson Chung
2011-07-01 15:35:26 -07:00
parent d044526d82
commit c07918d005
9 changed files with 219 additions and 215 deletions
@@ -460,22 +460,21 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
protected boolean beginDragging(View v) {
if (!super.beginDragging(v)) return false;
// Go into spring loaded mode (must happen before we startDrag())
int currentPageIndex = mLauncher.getWorkspace().getCurrentPage();
CellLayout currentPage = (CellLayout) mLauncher.getWorkspace().getChildAt(currentPageIndex);
mLauncher.enterSpringLoadedDragMode(currentPage);
if (v instanceof PagedViewIcon) {
beginDraggingApplication(v);
} else if (v instanceof PagedViewWidget) {
beginDraggingWidget(v);
}
// Go into spring loaded mode
int currentPageIndex = mLauncher.getWorkspace().getCurrentPage();
CellLayout currentPage = (CellLayout) mLauncher.getWorkspace().getChildAt(currentPageIndex);
mLauncher.enterSpringLoadedDragMode(currentPage);
return true;
}
private void endDragging(boolean success) {
mLauncher.exitSpringLoadedDragMode();
mLauncher.getWorkspace().onDragStopped(success);
mLauncher.exitSpringLoadedDragMode();
mLauncher.unlockScreenOrientation();
}