From 7a25a9e39a13df706daeb0a4a82273f3c5151997 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Sun, 30 Jan 2011 13:33:56 -0800 Subject: [PATCH] Calling removeItems() should mark the item's previous cell as unoccupied. (3405806) Change-Id: I99de0149dea5b487ed75e2469478e2346cd5b5df --- src/com/android/launcher2/CellLayout.java | 4 ---- src/com/android/launcher2/CellLayoutChildren.java | 2 +- src/com/android/launcher2/Launcher.java | 4 ++-- src/com/android/launcher2/Workspace.java | 7 +++++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 448b76604..b92aab25b 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -491,10 +491,6 @@ public class CellLayout extends ViewGroup { return mCountY; } - 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; diff --git a/src/com/android/launcher2/CellLayoutChildren.java b/src/com/android/launcher2/CellLayoutChildren.java index 09ab26688..782db73aa 100644 --- a/src/com/android/launcher2/CellLayoutChildren.java +++ b/src/com/android/launcher2/CellLayoutChildren.java @@ -167,4 +167,4 @@ public class CellLayoutChildren extends CachedViewGroup { protected void setChildrenDrawnWithCacheEnabled(boolean enabled) { super.setChildrenDrawnWithCacheEnabled(enabled); } -} \ No newline at end of file +} diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index a592f208e..8e73f589c 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -3331,8 +3331,8 @@ public final class Launcher extends Activity int count = workspace.getChildCount(); for (int i = 0; i < count; i++) { // Use removeAllViewsInLayout() to avoid an extra requestLayout() and invalidate(). - final ViewGroup layout = ((CellLayout) workspace.getChildAt(i)).getChildrenLayout(); - layout.removeAllViewsInLayout(); + final CellLayout layoutParent = (CellLayout) workspace.getChildAt(i); + layoutParent.removeAllViewsInLayout(); } if (DEBUG_USER_INTERFACE) { diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 004de3ae1..9d72c1964 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -2824,7 +2824,8 @@ public class Workspace extends SmoothPagedView } for (int i = 0; i < screenCount; i++) { - final ViewGroup layout = ((CellLayout) getChildAt(i)).getChildrenLayout(); + final CellLayout layoutParent = (CellLayout) getChildAt(i); + final ViewGroup layout = layoutParent.getChildrenLayout(); // Avoid ANRs by treating each screen separately post(new Runnable() { @@ -2911,7 +2912,9 @@ public class Workspace extends SmoothPagedView childCount = childrenToRemove.size(); for (int j = 0; j < childCount; j++) { View child = childrenToRemove.get(j); - layout.removeViewInLayout(child); + // Note: We can not remove the view directly from CellLayoutChildren as this + // does not re-mark the spaces as unoccupied. + layoutParent.removeViewInLayout(child); if (child instanceof DropTarget) { mDragController.removeDropTarget((DropTarget)child); } -- 2.11.0