diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index b485780dee..470a75c611 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -1270,6 +1270,11 @@ public class ActivityAllAppsContainerView rv.addOnScrollListener(mScrollListener); } + /** Returns the instance of @{code SearchTransitionController}. */ + public SearchTransitionController getSearchTransitionController() { + return mSearchTransitionController; + } + /** Holds a {@link BaseAllAppsAdapter} and related fields. */ public class AdapterHolder { public static final int MAIN = 0; diff --git a/src/com/android/launcher3/allapps/SearchTransitionController.java b/src/com/android/launcher3/allapps/SearchTransitionController.java index de653023cd..b01ea53621 100644 --- a/src/com/android/launcher3/allapps/SearchTransitionController.java +++ b/src/com/android/launcher3/allapps/SearchTransitionController.java @@ -28,6 +28,7 @@ import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.clampToProgress; import android.animation.ObjectAnimator; +import android.animation.TimeInterpolator; import android.graphics.drawable.Drawable; import android.util.FloatProperty; import android.util.Log; @@ -79,6 +80,7 @@ public class SearchTransitionController { private ObjectAnimator mSearchToAzAnimator = null; private float mSearchToAzProgress = 1f; + private boolean mSkipNextAnimationWithinAllApps; public SearchTransitionController(ActivityAllAppsContainerView allAppsContainerView) { mAllAppsContainerView = allAppsContainerView; @@ -108,11 +110,16 @@ public class SearchTransitionController { mSearchToAzAnimator = ObjectAnimator.ofFloat(this, SEARCH_TO_AZ_PROGRESS, targetProgress); boolean inAllApps = mAllAppsContainerView.isInAllApps(); - if (!inAllApps) { + TimeInterpolator timeInterpolator = + inAllApps ? INTERPOLATOR_WITHIN_ALL_APPS : INTERPOLATOR_TRANSITIONING_TO_ALL_APPS; + if (mSkipNextAnimationWithinAllApps) { + timeInterpolator = INSTANT; + mSkipNextAnimationWithinAllApps = false; + } + if (timeInterpolator == INSTANT) { duration = 0; // Don't want to animate when coming from QSB. } - mSearchToAzAnimator.setDuration(duration).setInterpolator( - inAllApps ? INTERPOLATOR_WITHIN_ALL_APPS : INTERPOLATOR_TRANSITIONING_TO_ALL_APPS); + mSearchToAzAnimator.setDuration(duration).setInterpolator(timeInterpolator); mSearchToAzAnimator.addListener(forEndCallback(() -> mSearchToAzAnimator = null)); if (!goingToSearch) { mSearchToAzAnimator.addListener(forSuccessCallback(() -> { @@ -338,4 +345,12 @@ public class SearchTransitionController { private float getSearchToAzProgress() { return mSearchToAzProgress; } + + /** + * This should only be called from {@code LauncherSearchSessionManager} when app restarts due to + * theme changes. + */ + public void setSkipAnimationWithinAllApps(boolean skip) { + mSkipNextAnimationWithinAllApps = skip; + } }