diff options
author | Patrick Dubroy <dubroy@google.com> | 2011-03-09 10:29:24 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-03-09 10:29:24 -0800 |
commit | be929e6500465ce69eb6b2a1613b0ee1abbeba4c (patch) | |
tree | 02af5086249b391bee21d364c48070fc0c7d948e | |
parent | 890c34a89c58d009999811e09b15b6a31b515c03 (diff) | |
parent | bbaa75c8c432c46c00ee2eb836e438b3774d6709 (diff) | |
download | android_packages_apps_Trebuchet-be929e6500465ce69eb6b2a1613b0ee1abbeba4c.tar.gz android_packages_apps_Trebuchet-be929e6500465ce69eb6b2a1613b0ee1abbeba4c.tar.bz2 android_packages_apps_Trebuchet-be929e6500465ce69eb6b2a1613b0ee1abbeba4c.zip |
am bbaa75c8: Fix 3514114: Dropping on mini-screens doesn\'t place items correctly
* commit 'bbaa75c8c432c46c00ee2eb836e438b3774d6709':
Fix 3514114: Dropping on mini-screens doesn't place items correctly
-rw-r--r-- | src/com/android/launcher2/CustomizePagedView.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher2/ItemInfo.java | 5 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 6 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java index e80eda3a7..5c61b0b4a 100644 --- a/src/com/android/launcher2/CustomizePagedView.java +++ b/src/com/android/launcher2/CustomizePagedView.java @@ -452,6 +452,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems public void onAnimationEnd(Animator animation) { dragLayer.removeView(view); mLauncher.addExternalItemToScreen(info, layout); + info.dropPos = null; } }); anim.start(); diff --git a/src/com/android/launcher2/ItemInfo.java b/src/com/android/launcher2/ItemInfo.java index dc4575062..b3612140d 100644 --- a/src/com/android/launcher2/ItemInfo.java +++ b/src/com/android/launcher2/ItemInfo.java @@ -81,6 +81,11 @@ class ItemInfo { */ boolean isGesture = false; + /** + * The position of the item in a drag-and-drop operation. + */ + int[] dropPos = null; + ItemInfo() { } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index fe40fc1e1..5a230eb90 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -2296,12 +2296,14 @@ public class Workspace extends SmoothPagedView } if (source != this) { + final int[] touchXY = new int[] { originX, originY }; if ((mIsSmall || mIsInUnshrinkAnimation) && !mLauncher.isAllAppsVisible()) { // 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 + ((ItemInfo) dragInfo).dropPos = touchXY; return; } - onDropExternal(new int[] { originX, originY }, dragInfo, mDragTargetLayout, false); + onDropExternal(touchXY, dragInfo, mDragTargetLayout, false); } else if (mDragInfo != null) { final View cell = mDragInfo.cell; CellLayout dropTargetLayout = mDragTargetLayout; @@ -2837,7 +2839,7 @@ public class Workspace extends SmoothPagedView */ public boolean addExternalItemToScreen(ItemInfo dragInfo, CellLayout layout) { 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; } mLauncher.showOutOfSpaceMessage(); |