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
This commit is contained in:
Chris Wren committed 2014-06-27 15:17:56 -04:00
1 parent 9041a98280
commit 40c5ed3039
7 files changed
+159 -25

No files matched your search

+38 -3
View File
@@ -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;