From 9282059e44604330763340e6c37ffb653b8ef187 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 2 Mar 2015 11:31:35 -0800 Subject: [PATCH] Fixing wrong check to determine the drag source > target it the drop target, i.e., the InfoDropTarget or DeleteDropTarget Change-Id: If4a9f8eb72ee6afb4d80c7df6f0f2ada4bc35b22 --- src/com/android/launcher3/Launcher.java | 2 +- src/com/android/launcher3/Workspace.java | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 1ad8b274da..ab6ebd3b60 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -3206,7 +3206,7 @@ public class Launcher extends Activity /** * Returns the CellLayout of the specified container at the specified screen. */ - CellLayout getCellLayout(long container, long screenId) { + public CellLayout getCellLayout(long container, long screenId) { if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { if (mHotseat != null) { return mHotseat.getLayout(); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index b9c1f4d3de..60457fd7cb 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -4169,23 +4169,18 @@ public class Workspace extends SmoothPagedView boolean beingCalledAfterUninstall = mDeferredAction != null; if (success && !(beingCalledAfterUninstall && !mUninstallSuccessful)) { - if (target != this && mDragInfo != null) { + if (mDragInfo != null) { removeWorkspaceItem(mDragInfo.cell); } } else if (mDragInfo != null) { - CellLayout cellLayout; - if (mLauncher.isHotseatLayout(target)) { - cellLayout = mLauncher.getHotseat().getLayout(); - } else { - cellLayout = getScreenWithId(mDragInfo.screenId); - } - if (cellLayout == null && LauncherAppState.isDogfoodBuild()) { - throw new RuntimeException("Invalid state: cellLayout == null in " - + "Workspace#onDropCompleted. Please file a bug. "); - } + final CellLayout cellLayout = mLauncher.getCellLayout( + mDragInfo.container, mDragInfo.screenId); if (cellLayout != null) { cellLayout.onDropChild(mDragInfo.cell); - } + } else if (LauncherAppState.isDogfoodBuild()) { + throw new RuntimeException("Invalid state: cellLayout == null in " + + "Workspace#onDropCompleted. Please file a bug. "); + }; } if ((d.cancelled || (beingCalledAfterUninstall && !mUninstallSuccessful)) && mDragInfo.cell != null) {