am cace67f7: am 6de1ba33: Merge "Fixing crash in empty folders. (Bug 11627191)" into jb-ub-now-jolly-elf

* commit 'cace67f7ddf467e649604a8b08aa582ce5c33532':
  Fixing crash in empty folders. (Bug 11627191)
This commit is contained in:
Winson Chung
2014-02-14 20:38:33 +00:00
committed by Android Git Automerger
3 changed files with 18 additions and 6 deletions
+13 -2
View File
@@ -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();
}
}
});
}
/**
@@ -826,7 +835,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);
}
}
@@ -1075,7 +1084,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);
@@ -1105,6 +1114,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;
}
+2 -2
View File
@@ -16,10 +16,10 @@
package com.android.launcher3;
import java.util.ArrayList;
import android.content.ContentValues;
import java.util.ArrayList;
/**
* Represents a folder containing shortcuts or apps.
*/
+3 -2
View File
@@ -584,8 +584,9 @@ public class LauncherModel extends BroadcastReceiver {
// as in Workspace.onDrop. Here, we just add/remove them from the list of items
// that are on the desktop, as appropriate
ItemInfo modelItem = sBgItemsIdMap.get(itemId);
if (modelItem.container == LauncherSettings.Favorites.CONTAINER_DESKTOP ||
modelItem.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
if (modelItem != null &&
(modelItem.container == LauncherSettings.Favorites.CONTAINER_DESKTOP ||
modelItem.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT)) {
switch (modelItem.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT: