Loading quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +2 −3 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ import static com.android.app.animation.Interpolators.DECELERATE_3; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL_APPS_EDU; import static com.android.launcher3.LauncherAnimUtils.SUCCESS_TRANSITION_PROGRESS; import static com.android.launcher3.LauncherAnimUtils.newCancelListener; import static com.android.launcher3.LauncherAnimUtils.newSingleUseCancelListener; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.MotionEventsUtils.isTrackpadMotionEvent; Loading Loading @@ -47,7 +47,6 @@ import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.touch.SingleAxisSwipeDetector; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.TouchController; import com.android.quickstep.TaskUtils; Loading Loading @@ -166,7 +165,7 @@ public class NavBarToHomeTouchController implements TouchController, topView.addHintCloseAnim(mPullbackDistance, PULLBACK_INTERPOLATOR, builder); } mCurrentAnimation = builder.createPlaybackController(); mCurrentAnimation.getTarget().addListener(newCancelListener(this::clearState)); mCurrentAnimation.getTarget().addListener(newSingleUseCancelListener(this::clearState)); } private void clearState() { Loading quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +2 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package com.android.launcher3.uioverrides.touchcontrollers; import static com.android.app.animation.Interpolators.ACCELERATE_DECELERATE; import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR; import static com.android.launcher3.LauncherAnimUtils.newCancelListener; import static com.android.launcher3.LauncherAnimUtils.newSingleUseCancelListener; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.NORMAL; Loading Loading @@ -226,7 +226,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch return; } mNormalToHintOverviewScrimAnimator = null; mCurrentAnimation.getTarget().addListener(newCancelListener(() -> mCurrentAnimation.getTarget().addListener(newSingleUseCancelListener(() -> mLauncher.getStateManager().goToState(OVERVIEW, true, forSuccessCallback(() -> { mOverviewResistYAnim = AnimatorControllerWithResistance .createRecentsResistanceFromOverviewAnim(mLauncher, null) Loading quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +1 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, private final float mMotionPauseMinDisplacement; private final RecentsView mRecentsView; protected final AnimatorListener mClearStateOnCancelListener = newCancelListener(this::clearState); newCancelListener(this::clearState, /* isSingleUse = */ false); private boolean mNoIntercept; private LauncherState mStartState; Loading src/com/android/launcher3/LauncherAnimUtils.java +14 −3 Original line number Diff line number Diff line Loading @@ -218,19 +218,30 @@ public class LauncherAnimUtils { } }; /** * Utility method to create an {@link AnimatorListener} which executes a callback on animation * cancel. Once the cancel has been dispatched, this listener will no longer be called. */ public static AnimatorListener newSingleUseCancelListener(Runnable callback) { return newCancelListener(callback, true); } /** * Utility method to create an {@link AnimatorListener} which executes a callback on animation * cancel. * * @param isSingleUse {@code true} means the callback will be called at most once */ public static AnimatorListener newCancelListener(Runnable callback) { public static AnimatorListener newCancelListener(Runnable callback, boolean isSingleUse) { return new AnimatorListenerAdapter() { boolean mDispatched = false; @Override public void onAnimationCancel(Animator animation) { if (!mDispatched) { if (isSingleUse) { mDispatched = true; } callback.run(); } } Loading src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +1 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ public abstract class AbstractStateChangeTouchController protected final SingleAxisSwipeDetector.Direction mSwipeDirection; protected final AnimatorListener mClearStateOnCancelListener = newCancelListener(this::clearState); newCancelListener(this::clearState, /* isSingleUse = */ false); private final FlingBlockCheck mFlingBlockCheck = new FlingBlockCheck(); protected int mStartContainerType; Loading Loading
quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +2 −3 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ import static com.android.app.animation.Interpolators.DECELERATE_3; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL_APPS_EDU; import static com.android.launcher3.LauncherAnimUtils.SUCCESS_TRANSITION_PROGRESS; import static com.android.launcher3.LauncherAnimUtils.newCancelListener; import static com.android.launcher3.LauncherAnimUtils.newSingleUseCancelListener; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.MotionEventsUtils.isTrackpadMotionEvent; Loading Loading @@ -47,7 +47,6 @@ import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.touch.SingleAxisSwipeDetector; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.TouchController; import com.android.quickstep.TaskUtils; Loading Loading @@ -166,7 +165,7 @@ public class NavBarToHomeTouchController implements TouchController, topView.addHintCloseAnim(mPullbackDistance, PULLBACK_INTERPOLATOR, builder); } mCurrentAnimation = builder.createPlaybackController(); mCurrentAnimation.getTarget().addListener(newCancelListener(this::clearState)); mCurrentAnimation.getTarget().addListener(newSingleUseCancelListener(this::clearState)); } private void clearState() { Loading
quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +2 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package com.android.launcher3.uioverrides.touchcontrollers; import static com.android.app.animation.Interpolators.ACCELERATE_DECELERATE; import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR; import static com.android.launcher3.LauncherAnimUtils.newCancelListener; import static com.android.launcher3.LauncherAnimUtils.newSingleUseCancelListener; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.NORMAL; Loading Loading @@ -226,7 +226,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch return; } mNormalToHintOverviewScrimAnimator = null; mCurrentAnimation.getTarget().addListener(newCancelListener(() -> mCurrentAnimation.getTarget().addListener(newSingleUseCancelListener(() -> mLauncher.getStateManager().goToState(OVERVIEW, true, forSuccessCallback(() -> { mOverviewResistYAnim = AnimatorControllerWithResistance .createRecentsResistanceFromOverviewAnim(mLauncher, null) Loading
quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +1 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, private final float mMotionPauseMinDisplacement; private final RecentsView mRecentsView; protected final AnimatorListener mClearStateOnCancelListener = newCancelListener(this::clearState); newCancelListener(this::clearState, /* isSingleUse = */ false); private boolean mNoIntercept; private LauncherState mStartState; Loading
src/com/android/launcher3/LauncherAnimUtils.java +14 −3 Original line number Diff line number Diff line Loading @@ -218,19 +218,30 @@ public class LauncherAnimUtils { } }; /** * Utility method to create an {@link AnimatorListener} which executes a callback on animation * cancel. Once the cancel has been dispatched, this listener will no longer be called. */ public static AnimatorListener newSingleUseCancelListener(Runnable callback) { return newCancelListener(callback, true); } /** * Utility method to create an {@link AnimatorListener} which executes a callback on animation * cancel. * * @param isSingleUse {@code true} means the callback will be called at most once */ public static AnimatorListener newCancelListener(Runnable callback) { public static AnimatorListener newCancelListener(Runnable callback, boolean isSingleUse) { return new AnimatorListenerAdapter() { boolean mDispatched = false; @Override public void onAnimationCancel(Animator animation) { if (!mDispatched) { if (isSingleUse) { mDispatched = true; } callback.run(); } } Loading
src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +1 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ public abstract class AbstractStateChangeTouchController protected final SingleAxisSwipeDetector.Direction mSwipeDirection; protected final AnimatorListener mClearStateOnCancelListener = newCancelListener(this::clearState); newCancelListener(this::clearState, /* isSingleUse = */ false); private final FlingBlockCheck mFlingBlockCheck = new FlingBlockCheck(); protected int mStartContainerType; Loading