diff options
author | Adam Cohen <adamcohen@google.com> | 2012-07-12 16:16:57 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2012-07-12 16:17:41 -0700 |
commit | c5e63f3dc7f19d0da8380e425894450302700ab9 (patch) | |
tree | 00cffc642209367ea30d8bd3ca72e0c5e8c4b462 /src | |
parent | c4890611ffb79a064fb722de3a704ff82ec35f1f (diff) | |
download | android_packages_apps_Trebuchet-c5e63f3dc7f19d0da8380e425894450302700ab9.tar.gz android_packages_apps_Trebuchet-c5e63f3dc7f19d0da8380e425894450302700ab9.tar.bz2 android_packages_apps_Trebuchet-c5e63f3dc7f19d0da8380e425894450302700ab9.zip |
Fix occupied issue when switching from folder icon to its final item
Change-Id: I445156ed8f99f0489776043440faa45399fb3888
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/Folder.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java index ae7ee6e62..8aa6e2f62 100644 --- a/src/com/android/launcher2/Folder.java +++ b/src/com/android/launcher2/Folder.java @@ -951,18 +951,15 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList public void run() { CellLayout cellLayout = mLauncher.getCellLayout(mInfo.container, mInfo.screen); + View child = null; // Move the item from the folder to the workspace, in the position of the folder if (getItemCount() == 1) { ShortcutInfo finalItem = mInfo.contents.get(0); - - final View child = mLauncher.createShortcut(R.layout.application, cellLayout, + child = mLauncher.createShortcut(R.layout.application, cellLayout, finalItem); LauncherModel.addOrMoveItemInDatabase(mLauncher, finalItem, mInfo.container, mInfo.screen, mInfo.cellX, mInfo.cellY); - mLauncher.getWorkspace().addInScreen(child, mInfo.container, mInfo.screen, - mInfo.cellX, mInfo.cellY, mInfo.spanX, mInfo.spanY); } - if (getItemCount() <= 1) { // Remove the folder LauncherModel.deleteItemFromDatabase(mLauncher, mInfo); @@ -972,6 +969,12 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList } mLauncher.removeFolder(mInfo); } + // We add the child after removing the folder to prevent both from existing at + // the same time in the CellLayout. + if (child != null) { + mLauncher.getWorkspace().addInScreen(child, mInfo.container, mInfo.screen, + mInfo.cellX, mInfo.cellY, mInfo.spanX, mInfo.spanY); + } } }; View finalChild = getItemAt(0); |