From 803a4bec0fe4f291b5e131f0a4fcb6ca8ecd2ec3 Mon Sep 17 00:00:00 2001 From: Chris Wren Date: Tue, 1 Jul 2014 16:52:49 -0400 Subject: [PATCH] Drop support for remove all dead promises. Bug: 12764789 Change-Id: Id876b66cf8da4388cb3ed5670a0bbdcf73f2982d --- res/values/strings.xml | 12 +++------- src/com/android/launcher3/Launcher.java | 15 +------------ src/com/android/launcher3/Workspace.java | 38 +++++++------------------------- 3 files changed, 12 insertions(+), 53 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index ee835fd59..3bf6c8d6e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -288,13 +288,7 @@ s --> This app is not installed - - The app for this icon isn\'t installed. - You can remove it, or search for the app and install it manually. - - The app for this icon isn\'t installed. - You can remove all such broken icons, remove only this one, - or search for the app and install it manually. - - + The app for this icon isn\'t installed. + You can remove it, or search for the app and install it manually. + diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 4ca3c5092..1f798341e 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2545,12 +2545,9 @@ public class Launcher extends Activity // Check for abandoned promise if (shortcut.isAbandoned() && v instanceof BubbleTextView) { - final ArrayList abandoned = - mWorkspace.getAbandonedPromises(new ArrayList()); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.abandoned_promises_title); - builder.setMessage(getResources().getQuantityString( - R.plurals.abandoned_promises_explanation, abandoned.size())); + builder.setMessage(R.string.abandoned_promise_explanation); builder.setPositiveButton(R.string.abandoned_search, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { @@ -2558,16 +2555,6 @@ public class Launcher extends Activity } } ); - if (abandoned.size() > 1) { - builder.setNegativeButton(R.string.abandoned_clean_all, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - final UserHandleCompat user = UserHandleCompat.myUserHandle(); - mWorkspace.removeAbandonedPromises(abandoned, user); - } - } - ); - } builder.setNeutralButton(R.string.abandoned_clean_this, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 74ef1d46b..78454e963 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -4857,38 +4857,16 @@ public class Workspace extends SmoothPagedView }); } - ArrayList getAbandonedPromises(final ArrayList abandoned) { - mapOverShortcuts(Workspace.MAP_RECURSE, new Workspace.ShortcutOperator() { - @Override - public boolean evaluate(ItemInfo info, View view, View parent) { - if (info instanceof ShortcutInfo - && ((ShortcutInfo) info).isAbandoned() - && view instanceof BubbleTextView) { - abandoned.add((BubbleTextView) view); - } - return false; - } - }); - return abandoned; - } - public void removeAbandonedPromise(BubbleTextView view, UserHandleCompat user) { - ArrayList views = new ArrayList(1); - views.add(view); - removeAbandonedPromises(views, user); - } - - public void removeAbandonedPromises(ArrayList views, UserHandleCompat user) { - HashSet cns = new HashSet(views.size()); - for (final BubbleTextView bubble : views) { - if (bubble.getTag() != null && bubble.getTag() instanceof ShortcutInfo) { - final ShortcutInfo shortcut = (ShortcutInfo) bubble.getTag(); - if (shortcut.isAbandoned()) { - cns.add(shortcut.getRestoredIntent().getComponent()); - LauncherModel.deleteItemFromDatabase(mLauncher, shortcut); - } + public void removeAbandonedPromise(BubbleTextView abandonedIcon, UserHandleCompat user) { + if (abandonedIcon.getTag() != null && abandonedIcon.getTag() instanceof ShortcutInfo) { + final ShortcutInfo shortcut = (ShortcutInfo) abandonedIcon.getTag(); + if (shortcut.isAbandoned()) { + HashSet cns = new HashSet(1); + cns.add(shortcut.getRestoredIntent().getComponent()); + LauncherModel.deleteItemFromDatabase(mLauncher, shortcut); + removeItemsByComponentName(cns, user); } } - removeItemsByComponentName(cns, user); } public void updatePackageState(final String pkgName, final int state) { -- 2.11.0