Using edge effect to trigger spring animation for all apps.
Bug: 72811152 Bug: 72059944 Change-Id: Ied7b51caa2fb48a2fda126d59e4eaf6a35edded3
This commit is contained in:
1 parent
865ee02d20
commit
14a89262f1
10 files changed
+166
-694
No files matched your search
@@ -19,7 +19,6 @@ import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
|
||||
import static com.android.launcher3.anim.SpringAnimationHandler.Y_DIRECTION;
|
||||
import static com.android.quickstep.TouchInteractionService.EDGE_NAV_BAR;
|
||||
|
||||
import android.animation.Animator;
|
||||
@@ -27,7 +26,6 @@ import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.animation.ValueAnimator.AnimatorUpdateListener;
|
||||
import android.support.animation.SpringAnimation;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
@@ -38,11 +36,9 @@ import com.android.launcher3.LauncherStateManager;
|
||||
import com.android.launcher3.LauncherStateManager.AnimationConfig;
|
||||
import com.android.launcher3.LauncherStateManager.StateHandler;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.allapps.AllAppsContainerView;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.anim.AnimatorSetBuilder;
|
||||
import com.android.launcher3.anim.SpringAnimationHandler;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.touch.SwipeDetector;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
|
||||
@@ -52,8 +48,6 @@ import com.android.launcher3.util.FloatRange;
|
||||
import com.android.launcher3.util.TouchController;
|
||||
import com.android.quickstep.TouchInteractionService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Handles vertical touch gesture on the DragLayer
|
||||
*/
|
||||
@@ -112,8 +106,6 @@ public class TwoStepSwipeController extends AnimatorListenerAdapter
|
||||
// Ratio of transition process [0, 1] to drag displacement (px)
|
||||
private float mProgressMultiplier;
|
||||
|
||||
private SpringAnimationHandler[] mSpringHandlers;
|
||||
|
||||
public TwoStepSwipeController(Launcher l) {
|
||||
mLauncher = l;
|
||||
mDetector = new SwipeDetector(l, this, SwipeDetector.VERTICAL);
|
||||
@@ -156,29 +148,6 @@ public class TwoStepSwipeController extends AnimatorListenerAdapter
|
||||
}
|
||||
}
|
||||
|
||||
private void initSprings() {
|
||||
AllAppsContainerView appsView = mLauncher.getAppsView();
|
||||
|
||||
SpringAnimationHandler handler = appsView.getSpringAnimationHandler();
|
||||
if (handler == null) {
|
||||
mSpringHandlers = new SpringAnimationHandler[0];
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<SpringAnimationHandler> handlers = new ArrayList<>();
|
||||
handlers.add(handler);
|
||||
|
||||
SpringAnimation searchSpring = appsView.getSearchUiManager().getSpringForFling();
|
||||
if (searchSpring != null) {
|
||||
SpringAnimationHandler searchHandler =
|
||||
new SpringAnimationHandler(Y_DIRECTION, handler.getFactory());
|
||||
searchHandler.add(searchSpring, true /* setDefaultValues */);
|
||||
handlers.add(searchHandler);
|
||||
}
|
||||
|
||||
mSpringHandlers = handlers.toArray(new SpringAnimationHandler[handlers.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
|
||||
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
@@ -214,10 +183,6 @@ public class TwoStepSwipeController extends AnimatorListenerAdapter
|
||||
|
||||
mDetector.setDetectableScrollConditions(
|
||||
directionsToDetectScroll, ignoreSlopWhenSettling);
|
||||
|
||||
if (mSpringHandlers == null) {
|
||||
initSprings();
|
||||
}
|
||||
}
|
||||
|
||||
if (mNoIntercept) {
|
||||
@@ -230,9 +195,6 @@ public class TwoStepSwipeController extends AnimatorListenerAdapter
|
||||
|
||||
@Override
|
||||
public boolean onControllerTouchEvent(MotionEvent ev) {
|
||||
for (SpringAnimationHandler h : mSpringHandlers) {
|
||||
h.addMovement(ev);
|
||||
}
|
||||
return mDetector.onTouchEvent(ev);
|
||||
}
|
||||
|
||||
@@ -283,10 +245,6 @@ public class TwoStepSwipeController extends AnimatorListenerAdapter
|
||||
mDragPauseDetector.clearDisabledFlags(FLAG_OVERVIEW_DISABLED_FLING);
|
||||
updatePauseDetectorRangeFlag();
|
||||
}
|
||||
|
||||
for (SpringAnimationHandler h : mSpringHandlers) {
|
||||
h.skipToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
private float getShiftRange() {
|
||||
@@ -329,13 +287,6 @@ public class TwoStepSwipeController extends AnimatorListenerAdapter
|
||||
targetState = (progress > SUCCESS_TRANSITION_PROGRESS) ? mToState : mFromState;
|
||||
}
|
||||
|
||||
if (fling && targetState == ALL_APPS) {
|
||||
for (SpringAnimationHandler h : mSpringHandlers) {
|
||||
// The icons are moving upwards, so we go to 0 from 1. (y-axis 1 is below 0.)
|
||||
h.animateToFinalPosition(0 /* pos */, 1 /* startValue */);
|
||||
}
|
||||
}
|
||||
|
||||
float endProgress;
|
||||
|
||||
if (mDragPauseDetector.isTriggered() && targetState == NORMAL) {
|
||||
|
||||
Reference in new issue
Block a user