From 68fb416b1abb405e4aa57a89240111752e7bdf19 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Thu, 16 Sep 2021 13:24:01 -0700 Subject: [PATCH] Allow icon add animations when user touches the screen. Fixes: 199483081 Test: manual, repeatedly tapped screen until and while app icon was added, repeatedly changed pages until and while app icon was added Change-Id: I286b52527dfe6e5bfdfedbbbf1eed72061fb5599 --- src/com/android/launcher3/Launcher.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index ed9f0449b9..b886bbac9d 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2273,7 +2273,7 @@ public class Launcher extends StatefulActivity implements Launche final boolean focusFirstItemForAccessibility) { // Get the list of added items and intersect them with the set of items here final Collection bounceAnims = new ArrayList<>(); - final boolean animateIcons = forceAnimateIcons && canRunNewAppsAnimation(); + boolean canAnimatePageChange = canAnimatePageChange(); Workspace workspace = mWorkspace; int newItemsScreenId = -1; int end = items.size(); @@ -2334,7 +2334,7 @@ public class Launcher extends StatefulActivity implements Launche } } workspace.addInScreenFromBind(view, item); - if (animateIcons) { + if (forceAnimateIcons) { // Animate all the applications up now view.setAlpha(0f); view.setScaleX(0f); @@ -2350,7 +2350,7 @@ public class Launcher extends StatefulActivity implements Launche View viewToFocus = newView; // Animate to the correct pager - if (animateIcons && newItemsScreenId > -1) { + if (forceAnimateIcons && newItemsScreenId > -1) { AnimatorSet anim = new AnimatorSet(); anim.playTogether(bounceAnims); if (focusFirstItemForAccessibility && viewToFocus != null) { @@ -2366,7 +2366,7 @@ public class Launcher extends StatefulActivity implements Launche final int newScreenIndex = mWorkspace.getPageIndexForScreenId(newItemsScreenId); final Runnable startBounceAnimRunnable = anim::start; - if (newItemsScreenId != currentScreenId) { + if (canAnimatePageChange && newItemsScreenId != currentScreenId) { // We post the animation slightly delayed to prevent slowdowns // when we are loading right after we return to launcher. mWorkspace.postDelayed(new Runnable() { @@ -2642,7 +2642,7 @@ public class Launcher extends StatefulActivity implements Launche TraceHelper.INSTANCE.endSection(traceToken); } - private boolean canRunNewAppsAnimation() { + private boolean canAnimatePageChange() { if (mDragController.isDragging()) { return false; } else {