Animate PredictedAppIcon when its icon changes

Reuses the slot machine animation to slide in the new icon. Additionally, staggers based on other icons changing before it.

Test: open apps, watch predictions change
Bug: 197780290
Change-Id: Ib2bc84193a9e350c915dd3486b6c98c6c88d3f83
This commit is contained in:
Tony Wickham
2021-08-25 09:18:41 -07:00
parent 31f787d352
commit 175d152f76
4 changed files with 86 additions and 7 deletions

View File

@@ -256,9 +256,27 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
@UiThread
public void applyFromWorkspaceItem(WorkspaceItemInfo info) {
applyFromWorkspaceItem(info, /* animate = */ false, /* staggerIndex = */ 0);
}
@UiThread
public void applyFromWorkspaceItem(WorkspaceItemInfo info, boolean animate, int staggerIndex) {
applyFromWorkspaceItem(info, false);
}
/**
* Returns whether the newInfo differs from the current getTag().
*/
public boolean shouldAnimateIconChange(WorkspaceItemInfo newInfo) {
WorkspaceItemInfo oldInfo = getTag() instanceof WorkspaceItemInfo
? (WorkspaceItemInfo) getTag()
: null;
boolean changedIcons = oldInfo != null && oldInfo.getTargetComponent() != null
&& newInfo.getTargetComponent() != null
&& !oldInfo.getTargetComponent().equals(newInfo.getTargetComponent());
return changedIcons && isShown();
}
@Override
public void setAccessibilityDelegate(AccessibilityDelegate delegate) {
if (delegate instanceof LauncherAccessibilityDelegate) {