diff options
author | Winson Chung <winsonc@google.com> | 2013-12-10 01:14:30 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-12-10 01:14:30 +0000 |
commit | 6de1ba3377dd407e83f682edf9ae742416302772 (patch) | |
tree | 2a95ca1c89d39e9526b9789b21010073e22d01b2 /src/com/android/launcher3/Folder.java | |
parent | a67d1ea0db5f536ca4a954a5f958211ec6c99992 (diff) | |
parent | 68b667848ef7c6f69b24a40d780e4088a5f2a1fb (diff) | |
download | android_packages_apps_Trebuchet-6de1ba3377dd407e83f682edf9ae742416302772.tar.gz android_packages_apps_Trebuchet-6de1ba3377dd407e83f682edf9ae742416302772.tar.bz2 android_packages_apps_Trebuchet-6de1ba3377dd407e83f682edf9ae742416302772.zip |
Merge "Fixing crash in empty folders. (Bug 11627191)" into jb-ub-now-jolly-elf
Diffstat (limited to 'src/com/android/launcher3/Folder.java')
-rw-r--r-- | src/com/android/launcher3/Folder.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java index 1d234ff8a..2fb8f9256 100644 --- a/src/com/android/launcher3/Folder.java +++ b/src/com/android/launcher3/Folder.java @@ -408,6 +408,15 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mFolderName.setText(""); } updateItemLocationsInDatabase(); + + // In case any children didn't come across during loading, clean up the folder accordingly + mFolderIcon.post(new Runnable() { + public void run() { + if (getItemCount() <= 1) { + replaceFolderWithFinalItem(); + } + } + }); } /** @@ -816,7 +825,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList View v = list.get(i); ItemInfo info = (ItemInfo) v.getTag(); LauncherModel.moveItemInDatabase(mLauncher, info, mInfo.id, 0, - info.cellX, info.cellY); + info.cellX, info.cellY); } } @@ -1065,7 +1074,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList public void run() { CellLayout cellLayout = mLauncher.getCellLayout(mInfo.container, mInfo.screenId); - View child = null; + 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); @@ -1095,6 +1104,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList View finalChild = getItemAt(0); if (finalChild != null) { mFolderIcon.performDestroyAnimation(finalChild, onCompleteRunnable); + } else { + onCompleteRunnable.run(); } mDestroyed = true; } |