diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e205fea9ed..fa9938fde5 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -56,6 +56,8 @@
+
+
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index df55f048d4..7faa706fd5 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -1565,13 +1565,13 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
}
}
-
public void addApps(ArrayList list) {
if (!DISABLE_ALL_APPS) {
addAppsWithoutInvalidate(list);
updatePageCountsAndInvalidateData();
} else {
// TODO: Maybe put them somewhere else?
+ mLauncher.getHotseat().addAppsToAllAppsFolder(list);
}
}
private int findAppByComponent(List list, ApplicationInfo item) {
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 121480627c..07c94007fc 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -841,6 +841,16 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
LauncherModel.moveItemsInDatabase(mLauncher, items, mInfo.id, 0);
}
+ public void addItemLocationsInDatabase() {
+ ArrayList list = getItemsInReadingOrder();
+ for (int i = 0; i < list.size(); i++) {
+ View v = list.get(i);
+ ItemInfo info = (ItemInfo) v.getTag();
+ LauncherModel.addItemToDatabase(mLauncher, info, mInfo.id, 0,
+ info.cellX, info.cellY, false);
+ }
+ }
+
public void notifyDrop() {
if (mDragInProgress) {
mItemAddedBackToSelfViaIcon = true;
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index 6a625eb955..50f7efd202 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -16,7 +16,9 @@
package com.android.launcher3;
+import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -28,6 +30,8 @@ import android.widget.FrameLayout;
import com.android.launcher3.R;
+import java.util.ArrayList;
+
public class Hotseat extends FrameLayout {
@SuppressWarnings("unused")
private static final String TAG = "Hotseat";
@@ -108,4 +112,52 @@ public class Hotseat extends FrameLayout {
void resetLayout() {
mContent.removeAllViewsInLayout();
}
+
+ void addAllAppsFolder(IconCache iconCache, ArrayList allApps,
+ ArrayList onWorkspace, Launcher launcher) {
+ FolderInfo fi = new FolderInfo();
+
+ fi.cellX = getCellXFromOrder(mAllAppsButtonRank);
+ fi.cellY = getCellYFromOrder(mAllAppsButtonRank);
+ fi.spanX = 1;
+ fi.spanY = 1;
+ fi.container = LauncherSettings.Favorites.CONTAINER_HOTSEAT;
+ fi.screen = mAllAppsButtonRank;
+ fi.itemType = LauncherSettings.Favorites.ITEM_TYPE_FOLDER;
+ fi.title = "All Apps";
+ LauncherModel.addItemToDatabase(launcher, fi, fi.container, fi.screen, fi.cellX,
+ fi.cellY, false);
+ FolderIcon folder = FolderIcon.fromXml(R.layout.folder_icon, launcher,
+ getLayout(), fi, iconCache);
+
+ CellLayout.LayoutParams lp = new CellLayout.LayoutParams(fi.cellX,fi.cellY,1,1);
+ mContent.addViewToCellLayout(folder, -1, 0, lp, true);
+
+ for (ApplicationInfo info: allApps) {
+ ComponentName cn = info.intent.getComponent();
+ if (!onWorkspace.contains(cn)) {
+ System.out.println("Adding to all apps: " + info.intent);
+ ShortcutInfo si = info.makeShortcut();
+ fi.add(si);
+ }
+ }
+ }
+
+ void addAppsToAllAppsFolder(ArrayList apps) {
+ View v = mContent.getChildAt(getCellXFromOrder(mAllAppsButtonRank), getCellYFromOrder(mAllAppsButtonRank));
+ FolderIcon fi = null;
+
+ if (v instanceof FolderIcon) {
+ fi = (FolderIcon) v;
+ } else {
+ return;
+ }
+
+ FolderInfo info = fi.getFolderInfo();
+ for (ApplicationInfo a: apps) {
+ ComponentName cn = a.intent.getComponent();
+ ShortcutInfo si = a.makeShortcut();
+ info.add(si);
+ }
+ }
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 664b763232..8526905c59 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -296,6 +296,8 @@ public final class Launcher extends Activity
// it from the context.
private SharedPreferences mSharedPrefs;
+ private static ArrayList mIntentsOnWorkspaceFromUpgradePath = null;
+
// Holds the page that we need to animate to, and the icon views that we need to animate up
// when we scroll to that page on resume.
private int mNewShortcutAnimatePage = -1;
@@ -3535,10 +3537,10 @@ public final class Launcher extends Activity
*
* Implementation of the method from LauncherModel.Callbacks.
*/
- public void finishBindingItems() {
+ public void finishBindingItems(final boolean upgradePath) {
if (waitUntilResume(new Runnable() {
public void run() {
- finishBindingItems();
+ finishBindingItems(upgradePath);
}
})) {
return;
@@ -3590,6 +3592,13 @@ public final class Launcher extends Activity
}
mWorkspaceLoading = false;
+ if (upgradePath) {
+ mWorkspace.saveWorkspaceToDb();
+
+ // Run through this twice... a little hackleberry, but the right solution is complex.
+ mWorkspace.stripDuplicateApps();
+ mIntentsOnWorkspaceFromUpgradePath = mWorkspace.stripDuplicateApps();
+ }
}
private boolean canRunNewAppsAnimation() {
@@ -3681,6 +3690,12 @@ public final class Launcher extends Activity
public void run() {
if (mAppsCustomizeContent != null) {
mAppsCustomizeContent.setApps(apps);
+
+ if (mIntentsOnWorkspaceFromUpgradePath != null) {
+ getHotseat().addAllAppsFolder(mIconCache, apps,
+ mIntentsOnWorkspaceFromUpgradePath, Launcher.this);
+ mIntentsOnWorkspaceFromUpgradePath = null;
+ }
}
}
};
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index bbdff9e864..bde4f7cdbf 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -154,7 +154,7 @@ public class LauncherModel extends BroadcastReceiver {
public void startBinding();
public void bindItems(ArrayList shortcuts, int start, int end);
public void bindFolders(HashMap folders);
- public void finishBindingItems();
+ public void finishBindingItems(boolean upgradePath);
public void bindAppWidget(LauncherAppWidgetInfo info);
public void bindAllApplications(ArrayList apps);
public void bindAppsAdded(ArrayList apps);
@@ -306,7 +306,8 @@ public class LauncherModel extends BroadcastReceiver {
if (stackTrace != null) {
e.setStackTrace(stackTrace);
}
- throw e;
+ // TODO: something breaks this in the upgrade path
+ //throw e;
}
}
@@ -1050,6 +1051,7 @@ public class LauncherModel extends BroadcastReceiver {
private boolean mIsLoadingAndBindingWorkspace;
private boolean mStopped;
private boolean mLoadAndBindStepFinished;
+ private boolean mIsUpgradePath;
private HashMap