am 7bccb42f: Fix 3373059: Crash when drag cancelled in spring-loaded state

* commit '7bccb42f88cbbaf8cf180a876e8c5d5e306ce62a':
  Fix 3373059: Crash when drag cancelled in spring-loaded state
This commit is contained in:
Patrick Dubroy
2011-01-20 17:07:37 -08:00
committed by Android Git Automerger
3 changed files with 9 additions and 5 deletions
@@ -288,7 +288,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
endChoiceMode();
}
tearDownDragMode();
mLauncher.getWorkspace().onDragStopped();
mLauncher.getWorkspace().onDragStopped(success);
mLauncher.unlockScreenOrientation();
}
@@ -327,7 +327,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
@Override
public void onDropCompleted(View target, boolean success) {
resetCheckedGrandchildren();
mLauncher.getWorkspace().onDragStopped();
mLauncher.getWorkspace().onDragStopped(success);
mLauncher.unlockScreenOrientation();
}
+7 -3
View File
@@ -1458,6 +1458,7 @@ public class Workspace extends SmoothPagedView
cl.setIsDefaultDropTarget(i == mCurrentPage);
case BOTTOM_HIDDEN:
case BOTTOM_VISIBLE:
case SPRING_LOADED:
if (!isDragHappening) {
// even if a drag isn't happening, we don't want to show a screen as
// accepting drops if it doesn't have at least one free cell
@@ -1468,8 +1469,7 @@ public class Workspace extends SmoothPagedView
cl.setAcceptsDrops(cl.findCellForSpan(null, spanX, spanY));
break;
default:
throw new RuntimeException(
"updateWhichPagesAcceptDropsHelper passed an unhandled ShrinkState");
throw new RuntimeException("Unhandled ShrinkState " + state);
}
}
}
@@ -1499,7 +1499,11 @@ public class Workspace extends SmoothPagedView
// we call this method whenever a drag and drop in Launcher finishes, even if Workspace was
// never dragged over
public void onDragStopped() {
public void onDragStopped(boolean success) {
// In the success case, DragController has already called onDragExit()
if (!success) {
doDragExit();
}
mIsDragInProcess = false;
updateWhichPagesAcceptDrops(mShrinkState);
}