diff options
author | Chris Wren <cwren@android.com> | 2014-06-24 18:24:23 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2014-06-27 15:17:56 -0400 |
commit | 40c5ed303909c4df71037be3429aa1423e59585f (patch) | |
tree | ef0d2211280e8539bbd91ec1389ae64525cc450c /src/com/android/launcher3/Workspace.java | |
parent | 9041a98280252abfa1a81065c103ee9a70943af5 (diff) | |
download | android_packages_apps_Trebuchet-40c5ed303909c4df71037be3429aa1423e59585f.tar.gz android_packages_apps_Trebuchet-40c5ed303909c4df71037be3429aa1423e59585f.tar.bz2 android_packages_apps_Trebuchet-40c5ed303909c4df71037be3429aa1423e59585f.zip |
Offer to delete broken promise icons.
Track state of promise in the info, not the view.
Fix bugs around moving promises to folders.
Fix bugs around filterign and removing promises.
Bug: 12764789
Change-Id: If5e8b6d315e463154b5bafe8aef7ef4f9889bb95
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 6afea8268..74ef1d46b 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -98,8 +98,8 @@ public class Workspace extends SmoothPagedView private static final float ALPHA_CUTOFF_THRESHOLD = 0.01f; - private static final boolean MAP_NO_RECURSE = false; - private static final boolean MAP_RECURSE = true; + static final boolean MAP_NO_RECURSE = false; + static final boolean MAP_RECURSE = true; // These animators are used to fade the children's outlines private ObjectAnimator mChildrenOutlineFadeInAnimation; @@ -4857,6 +4857,40 @@ public class Workspace extends SmoothPagedView }); } + ArrayList<BubbleTextView> getAbandonedPromises(final ArrayList<BubbleTextView> 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<BubbleTextView> views = new ArrayList<BubbleTextView>(1); + views.add(view); + removeAbandonedPromises(views, user); + } + + public void removeAbandonedPromises(ArrayList<BubbleTextView> views, UserHandleCompat user) { + HashSet<ComponentName> cns = new HashSet<ComponentName>(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); + } + } + } + removeItemsByComponentName(cns, user); + } + public void updatePackageState(final String pkgName, final int state) { mapOverShortcuts(MAP_RECURSE, new ShortcutOperator() { @Override @@ -4864,7 +4898,8 @@ public class Workspace extends SmoothPagedView if (info instanceof ShortcutInfo && ((ShortcutInfo) info).isPromiseFor(pkgName) && v instanceof BubbleTextView) { - ((BubbleTextView)v).setState(state); + ((ShortcutInfo) info).setState(state); + ((BubbleTextView)v).applyState(); } // process all the shortcuts return false; |