diff options
author | Michael Jurka <mikejurka@google.com> | 2010-10-20 17:08:24 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2010-10-21 11:30:28 -0700 |
commit | f3ca3ab6958b104cbf2c2fa04add97d372a94d1c (patch) | |
tree | 8287909c516f812f0e9339364102cae95776f2a2 /src/com | |
parent | 89308226981b9ff95d779e73a5d6140eca1d2fd9 (diff) | |
download | android_packages_apps_Trebuchet-f3ca3ab6958b104cbf2c2fa04add97d372a94d1c.tar.gz android_packages_apps_Trebuchet-f3ca3ab6958b104cbf2c2fa04add97d372a94d1c.tar.bz2 android_packages_apps_Trebuchet-f3ca3ab6958b104cbf2c2fa04add97d372a94d1c.zip |
Fix bug that allowed multiple items in one cell
Fixed issue where opening a folder allowed items to be placed on any cell, even if it was occupied.
Bug: 3094164
Change-Id: I392e7236f9cd7ea0b09f36e249d2a57c9934dc8e
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 11 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 3 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index d94bacfbf..98aad14ce 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -456,6 +456,11 @@ public class CellLayout extends ViewGroup implements Dimmable { } public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params) { + return addViewToCellLayout(child, index, childId, params, true); + } + + public boolean addViewToCellLayout( + View child, int index, int childId, LayoutParams params, boolean markCells) { final LayoutParams lp = params; // Generate an id for each view, this assumes we have at most 256x256 cells @@ -473,7 +478,7 @@ public class CellLayout extends ViewGroup implements Dimmable { child.setAlpha(getAlpha()); addView(child, index, lp); - markCellsAsOccupiedForView(child); + if (markCells) markCellsAsOccupiedForView(child); return true; } @@ -500,6 +505,10 @@ public class CellLayout extends ViewGroup implements Dimmable { clearOccupiedCells(); } + public void removeViewWithoutMarkingCells(View view) { + super.removeView(view); + } + @Override public void removeView(View view) { markCellsAsUnoccupiedForView(view); diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 2688e54a3..471cb3ee8 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -1696,7 +1696,8 @@ public final class Launcher extends Activity folder.getInfo().opened = false; ViewGroup parent = (ViewGroup) folder.getParent(); if (parent != null) { - parent.removeView(folder); + CellLayout cl = (CellLayout) parent; + cl.removeViewWithoutMarkingCells(folder); if (folder instanceof DropTarget) { // Live folders aren't DropTargets. mDragController.removeDropTarget((DropTarget)folder); diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 42a6f1b70..44127fef7 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -364,7 +364,8 @@ public class Workspace extends SmoothPagedView // Get the canonical child id to uniquely represent this view in this screen int childId = LauncherModel.getCellLayoutChildId(-1, screen, x, y, spanX, spanY); - if (!group.addViewToCellLayout(child, insert ? 0 : -1, childId, lp)) { + boolean markCellsAsOccupied = !(child instanceof Folder); + if (!group.addViewToCellLayout(child, insert ? 0 : -1, childId, lp, markCellsAsOccupied)) { // TODO: This branch occurs when the workspace is adding views // outside of the defined grid // maybe we should be deleting these items from the LauncherModel? |