Fix 3514114: Dropping on mini-screens doesn't place items correctly

Change-Id: I7176562f1a62ca9973a256e53151aac1ff708144
This commit is contained in:
Patrick Dubroy
2011-03-08 18:47:40 -08:00
parent 1c3f8ecccc
commit bbaa75c8c4
3 changed files with 10 additions and 2 deletions
@@ -452,6 +452,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
dragLayer.removeView(view); dragLayer.removeView(view);
mLauncher.addExternalItemToScreen(info, layout); mLauncher.addExternalItemToScreen(info, layout);
info.dropPos = null;
} }
}); });
anim.start(); anim.start();
+5
View File
@@ -81,6 +81,11 @@ class ItemInfo {
*/ */
boolean isGesture = false; boolean isGesture = false;
/**
* The position of the item in a drag-and-drop operation.
*/
int[] dropPos = null;
ItemInfo() { ItemInfo() {
} }
+4 -2
View File
@@ -2296,12 +2296,14 @@ public class Workspace extends SmoothPagedView
} }
if (source != this) { if (source != this) {
final int[] touchXY = new int[] { originX, originY };
if ((mIsSmall || mIsInUnshrinkAnimation) && !mLauncher.isAllAppsVisible()) { if ((mIsSmall || mIsInUnshrinkAnimation) && !mLauncher.isAllAppsVisible()) {
// When the workspace is shrunk and the drop comes from customize, don't actually // When the workspace is shrunk and the drop comes from customize, don't actually
// add the item to the screen -- customize will do this itself // add the item to the screen -- customize will do this itself
((ItemInfo) dragInfo).dropPos = touchXY;
return; return;
} }
onDropExternal(new int[] { originX, originY }, dragInfo, mDragTargetLayout, false); onDropExternal(touchXY, dragInfo, mDragTargetLayout, false);
} else if (mDragInfo != null) { } else if (mDragInfo != null) {
final View cell = mDragInfo.cell; final View cell = mDragInfo.cell;
CellLayout dropTargetLayout = mDragTargetLayout; CellLayout dropTargetLayout = mDragTargetLayout;
@@ -2837,7 +2839,7 @@ public class Workspace extends SmoothPagedView
*/ */
public boolean addExternalItemToScreen(ItemInfo dragInfo, CellLayout layout) { public boolean addExternalItemToScreen(ItemInfo dragInfo, CellLayout layout) {
if (layout.findCellForSpan(mTempEstimate, dragInfo.spanX, dragInfo.spanY)) { if (layout.findCellForSpan(mTempEstimate, dragInfo.spanX, dragInfo.spanY)) {
onDropExternal(null, (ItemInfo) dragInfo, (CellLayout) layout, false); onDropExternal(dragInfo.dropPos, (ItemInfo) dragInfo, (CellLayout) layout, false);
return true; return true;
} }
mLauncher.showOutOfSpaceMessage(); mLauncher.showOutOfSpaceMessage();