summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml4
-rw-r--r--src/com/android/launcher3/InstallShortcutReceiver.java2
-rw-r--r--src/com/android/launcher3/Launcher.java28
-rw-r--r--src/com/android/launcher3/LauncherModel.java43
-rw-r--r--src/com/android/launcher3/UninstallShortcutReceiver.java2
5 files changed, 45 insertions, 34 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c6263fb87..901b63838 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -26,13 +26,13 @@
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="system|signature" />
<permission
- android:name="com.android.launcher3.permission.INSTALL_SHORTCUT"
+ android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="dangerous"
android:label="@string/permlab_install_shortcut"
android:description="@string/permdesc_install_shortcut" />
<permission
- android:name="com.android.launcher3.permission.UNINSTALL_SHORTCUT"
+ android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="dangerous"
android:label="@string/permlab_uninstall_shortcut"
diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java
index b31f45d57..fd580081b 100644
--- a/src/com/android/launcher3/InstallShortcutReceiver.java
+++ b/src/com/android/launcher3/InstallShortcutReceiver.java
@@ -37,7 +37,7 @@ import org.json.*;
public class InstallShortcutReceiver extends BroadcastReceiver {
public static final String ACTION_INSTALL_SHORTCUT =
- "com.android.launcher3.action.INSTALL_SHORTCUT";
+ "com.android.launcher.action.INSTALL_SHORTCUT";
public static final String DATA_INTENT_KEY = "intent.data";
public static final String LAUNCH_INTENT_KEY = "intent.launch";
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 84d5a09f7..102f4c272 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -209,7 +209,8 @@ public class Launcher extends Activity
private static int sScreen = DEFAULT_SCREEN;
// How long to wait before the new-shortcut animation automatically pans the workspace
- private static int NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS = 10;
+ private static int NEW_APPS_PAGE_MOVE_DELAY = 500;
+ private static int NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS = 5;
private static int NEW_APPS_ANIMATION_DELAY = 500;
private final BroadcastReceiver mCloseSystemDialogsReceiver
@@ -3694,20 +3695,23 @@ public class Launcher extends Activity
// Animate to the correct page
if (newShortcutsScreenId > -1) {
long currentScreenId = mWorkspace.getScreenIdForPageIndex(mWorkspace.getNextPage());
- int newScreenIndex = mWorkspace.getPageIndexForScreenId(newShortcutsScreenId);
+ final int newScreenIndex = mWorkspace.getPageIndexForScreenId(newShortcutsScreenId);
if (newShortcutsScreenId != currentScreenId) {
- mWorkspace.snapToPage(newScreenIndex);
+ // We post the animation slightly delayed to prevent slowdowns
+ // when we are loading right after we return to launcher.
+ mWorkspace.postDelayed(new Runnable() {
+ public void run() {
+ mWorkspace.snapToPage(newScreenIndex);
+ mWorkspace.postDelayed(new Runnable() {
+ public void run() {
+ anim.playTogether(bounceAnims);
+ anim.start();
+ }
+ }, NEW_APPS_ANIMATION_DELAY);
+ }
+ }, NEW_APPS_PAGE_MOVE_DELAY);
}
}
-
- // We post the animation slightly delayed to prevent slowdowns when we are loading
- // right after we return to launcher.
- mWorkspace.postDelayed(new Runnable() {
- public void run() {
- anim.playTogether(bounceAnims);
- anim.start();
- }
- }, NEW_APPS_ANIMATION_DELAY);
}
workspace.requestLayout();
}
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 1d264aa55..eead0855e 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -281,14 +281,14 @@ public class LauncherModel extends BroadcastReceiver {
return null;
}
- public void addAndBindAddedApps(final Context context, final ArrayList<ItemInfo> added,
- final ArrayList<AppInfo> addedApps) {
+ public void addAndBindAddedApps(final Context context, final ArrayList<ItemInfo> workspaceApps,
+ final ArrayList<AppInfo> allAppsApps) {
Callbacks cb = mCallbacks != null ? mCallbacks.get() : null;
- addAndBindAddedApps(context, added, cb, addedApps);
+ addAndBindAddedApps(context, workspaceApps, cb, allAppsApps);
}
- public void addAndBindAddedApps(final Context context, final ArrayList<ItemInfo> added,
- final Callbacks callbacks, final ArrayList<AppInfo> addedApps) {
- if (added.isEmpty()) {
+ public void addAndBindAddedApps(final Context context, final ArrayList<ItemInfo> workspaceApps,
+ final Callbacks callbacks, final ArrayList<AppInfo> allAppsApps) {
+ if (workspaceApps.isEmpty() && allAppsApps.isEmpty()) {
return;
}
// Process the newly added applications and add them to the database first
@@ -308,7 +308,7 @@ public class LauncherModel extends BroadcastReceiver {
}
synchronized(sBgLock) {
- Iterator<ItemInfo> iter = added.iterator();
+ Iterator<ItemInfo> iter = workspaceApps.iterator();
while (iter.hasNext()) {
ItemInfo a = iter.next();
final String name = a.title.toString();
@@ -356,6 +356,7 @@ public class LauncherModel extends BroadcastReceiver {
} else {
throw new RuntimeException("Unexpected info type");
}
+
// Add the shortcut to the db
addItemToDatabase(context, shortcutInfo,
LauncherSettings.Favorites.CONTAINER_DESKTOP,
@@ -368,24 +369,26 @@ public class LauncherModel extends BroadcastReceiver {
// Update the workspace screens
updateWorkspaceScreenOrder(context, workspaceScreens);
- if (!addedShortcutsFinal.isEmpty()) {
+ if (!addedShortcutsFinal.isEmpty() || !allAppsApps.isEmpty()) {
runOnMainThread(new Runnable() {
public void run() {
Callbacks cb = mCallbacks != null ? mCallbacks.get() : null;
if (callbacks == cb && cb != null) {
- ItemInfo info = addedShortcutsFinal.get(addedShortcutsFinal.size() - 1);
- long lastScreenId = info.screenId;
final ArrayList<ItemInfo> addAnimated = new ArrayList<ItemInfo>();
final ArrayList<ItemInfo> addNotAnimated = new ArrayList<ItemInfo>();
- for (ItemInfo i : addedShortcutsFinal) {
- if (i.screenId == lastScreenId) {
- addAnimated.add(i);
- } else {
- addNotAnimated.add(i);
+ if (!addedShortcutsFinal.isEmpty()) {
+ ItemInfo info = addedShortcutsFinal.get(addedShortcutsFinal.size() - 1);
+ long lastScreenId = info.screenId;
+ for (ItemInfo i : addedShortcutsFinal) {
+ if (i.screenId == lastScreenId) {
+ addAnimated.add(i);
+ } else {
+ addNotAnimated.add(i);
+ }
}
}
callbacks.bindAppsAdded(addedWorkspaceScreensFinal,
- addNotAnimated, addAnimated, addedApps);
+ addNotAnimated, addAnimated, allAppsApps);
}
}
});
@@ -2514,9 +2517,13 @@ public class LauncherModel extends BroadcastReceiver {
if (added != null) {
// Ensure that we add all the workspace applications to the db
- final ArrayList<ItemInfo> addedInfos = new ArrayList<ItemInfo>(added);
Callbacks cb = mCallbacks != null ? mCallbacks.get() : null;
- addAndBindAddedApps(context, addedInfos, cb, added);
+ if (!AppsCustomizePagedView.DISABLE_ALL_APPS) {
+ addAndBindAddedApps(context, new ArrayList<ItemInfo>(), cb, added);
+ } else {
+ final ArrayList<ItemInfo> addedInfos = new ArrayList<ItemInfo>(added);
+ addAndBindAddedApps(context, addedInfos, cb, added);
+ }
}
if (modified != null) {
final ArrayList<AppInfo> modifiedFinal = modified;
diff --git a/src/com/android/launcher3/UninstallShortcutReceiver.java b/src/com/android/launcher3/UninstallShortcutReceiver.java
index d92963abe..00fa631bc 100644
--- a/src/com/android/launcher3/UninstallShortcutReceiver.java
+++ b/src/com/android/launcher3/UninstallShortcutReceiver.java
@@ -30,7 +30,7 @@ import java.util.Iterator;
public class UninstallShortcutReceiver extends BroadcastReceiver {
private static final String ACTION_UNINSTALL_SHORTCUT =
- "com.android.launcher3.action.UNINSTALL_SHORTCUT";
+ "com.android.launcher.action.UNINSTALL_SHORTCUT";
// The set of shortcuts that are pending uninstall
private static ArrayList<PendingUninstallShortcutInfo> mUninstallQueue =