diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 7c1fa2114d..5b4ff5a2bf 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -300,8 +300,10 @@ public class LauncherModel extends BroadcastReceiver { /** * Creates a new unique child id, for a given cell span across all layouts. */ - static int getCellLayoutChildId(int cellId, int screen, int localCellX, int localCellY, int spanX, int spanY) { - return ((cellId & 0xFF) << 16) | (localCellX & 0xFF) << 8 | (localCellY & 0xFF); + static int getCellLayoutChildId( + int cellId, int screen, int localCellX, int localCellY, int spanX, int spanY) { + return ((cellId & 0xFF) << 24) + | (screen & 0xFF) << 16 | (localCellX & 0xFF) << 8 | (localCellY & 0xFF); } static int getCellCountX() { diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 4d820cf80f..9ca71d9aa1 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -322,7 +322,7 @@ public class Workspace extends SmoothPagedView } // Get the canonical child id to uniquely represent this view in this screen - int childId = LauncherModel.getCellLayoutChildId(child.getId(), screen, x, y, spanX, spanY); + int childId = LauncherModel.getCellLayoutChildId(-1, screen, x, y, spanX, spanY); if (!group.addViewToCellLayout(child, insert ? 0 : -1, childId, lp)) { // TODO: This branch occurs when the workspace is adding views // outside of the defined grid @@ -799,6 +799,8 @@ public class Workspace extends SmoothPagedView cellLayout.onMove(cell, mTargetCell[0], mTargetCell[1]); lp.cellX = mTargetCell[0]; lp.cellY = mTargetCell[1]; + cell.setId(LauncherModel.getCellLayoutChildId(cell.getId(), mDragInfo.screen, + mTargetCell[0], mTargetCell[1], mDragInfo.spanX, mDragInfo.spanY)); LauncherModel.moveItemInDatabase(mLauncher, info, LauncherSettings.Favorites.CONTAINER_DESKTOP, index,