merge in honeycomb-release history after reset to honeycomb
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index 64da1b4..fe7312d 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -288,7 +288,7 @@
endChoiceMode();
}
tearDownDragMode();
- mLauncher.getWorkspace().onDragStopped();
+ mLauncher.getWorkspace().onDragStopped(success);
mLauncher.unlockScreenOrientation();
}
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 3249724..49ae652 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -1342,9 +1342,7 @@
lp.isDragging = false;
lp.dropped = true;
lp.animateDrop = animate;
- if (animate) {
- child.setVisibility(View.INVISIBLE);
- }
+ child.setVisibility(animate ? View.INVISIBLE : View.VISIBLE);
child.requestLayout();
}
}
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index d9a6612..c74e5f4 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -327,7 +327,7 @@
@Override
public void onDropCompleted(View target, boolean success) {
resetCheckedGrandchildren();
- mLauncher.getWorkspace().onDragStopped();
+ mLauncher.getWorkspace().onDragStopped(success);
mLauncher.unlockScreenOrientation();
}
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index b456030..45b359d 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -399,6 +399,7 @@
*/
public void cancelDrag() {
if (mDragging) {
+ // Should we also be calling onDragExit() here?
mDragSource.onDropCompleted(null, false);
}
endDrag();
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index b248dd6..b9a2b62 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1458,6 +1458,7 @@
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 @@
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 @@
// 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);
}
@@ -2398,8 +2402,7 @@
}
}
- public void onDragExit(DragSource source, int x, int y, int xOffset,
- int yOffset, DragView dragView, Object dragInfo) {
+ private void doDragExit() {
mWasSpringLoadedOnDragExit = mShrinkState == ShrinkState.SPRING_LOADED;
if (mDragTargetLayout != null) {
mDragTargetLayout.onDragExit();
@@ -2413,6 +2416,11 @@
clearAllHovers();
}
+ public void onDragExit(DragSource source, int x, int y, int xOffset,
+ int yOffset, DragView dragView, Object dragInfo) {
+ doDragExit();
+ }
+
@Override
public void getHitRect(Rect outRect) {
// We want the workspace to have the whole area of the display (it will find the correct
@@ -2560,6 +2568,9 @@
mDragController = dragController;
}
+ /**
+ * Called at the end of a drag which originated on the workspace.
+ */
public void onDropCompleted(View target, boolean success) {
if (success) {
if (target != this && mDragInfo != null) {
@@ -2571,8 +2582,11 @@
// final Object tag = mDragInfo.cell.getTag();
}
} else if (mDragInfo != null) {
- boolean animateDrop = !mWasSpringLoadedOnDragExit;
- ((CellLayout) getChildAt(mDragInfo.screen)).onDropChild(mDragInfo.cell, animateDrop);
+ // NOTE: When 'success' is true, onDragExit is called by the DragController before
+ // calling onDropCompleted(). We call it ourselves here, but maybe this should be
+ // moved into DragController.cancelDrag().
+ doDragExit();
+ ((CellLayout) getChildAt(mDragInfo.screen)).onDropChild(mDragInfo.cell, false);
}
mLauncher.unlockScreenOrientation();
mDragOutline = null;