diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index f93917f1f5..27a55c3ff3 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -25,11 +25,8 @@ import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.INSTANT; -import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.anim.Interpolators.LINEAR_TELEPORT; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; import android.view.MotionEvent; @@ -140,7 +137,6 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(ACCEL, ALL_APPS_SCRIM_VISIBLE_THRESHOLD, ALL_APPS_SCRIM_OPAQUE_THRESHOLD)); - builder.setInterpolator(ANIM_VERTICAL_PROGRESS, isTablet ? LINEAR_TELEPORT : LINEAR); return builder; } @@ -155,7 +151,6 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL, 1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD, 1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD)); - builder.setInterpolator(ANIM_VERTICAL_PROGRESS, isTablet ? LINEAR_TELEPORT : LINEAR); return builder; } diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java index c43172cc56..4f3ae59992 100644 --- a/src/com/android/launcher3/LauncherAnimUtils.java +++ b/src/com/android/launcher3/LauncherAnimUtils.java @@ -38,6 +38,7 @@ public class LauncherAnimUtils { // Progress after which the transition is assumed to be a success public static final float SUCCESS_TRANSITION_PROGRESS = 0.5f; + public static final float TABLET_BOTTOM_SHEET_SUCCESS_TRANSITION_PROGRESS = 0.3f; public static final IntProperty DRAWABLE_ALPHA = new IntProperty("drawableAlpha") { diff --git a/src/com/android/launcher3/anim/Interpolators.java b/src/com/android/launcher3/anim/Interpolators.java index 9c12abdf4e..1e7b2247b8 100644 --- a/src/com/android/launcher3/anim/Interpolators.java +++ b/src/com/android/launcher3/anim/Interpolators.java @@ -130,23 +130,6 @@ public class Interpolators { } }; - public static final Interpolator LINEAR_TELEPORT = t -> { - float startTeleport = 0.2f; - float endTeleport = 0.4f; - float teleportProgress = 0.5f; - float v; - if (t < startTeleport) { - v = LINEAR.getInterpolation(t); - } else if (t < endTeleport) { - v = Utilities.mapToRange(t, startTeleport, endTeleport, startTeleport, - endTeleport + teleportProgress, ACCEL_DEACCEL); - } else { - v = LINEAR.getInterpolation(t) + teleportProgress; - } - v = Utilities.boundToRange(v, 0f, 1f); - return v; - }; - private static final float FAST_FLING_PX_MS = 10; public static Interpolator scrollInterpolatorForVelocity(float velocity) { diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index c00e174920..a125fbe8be 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -16,6 +16,7 @@ package com.android.launcher3.touch; import static com.android.launcher3.LauncherAnimUtils.SUCCESS_TRANSITION_PROGRESS; +import static com.android.launcher3.LauncherAnimUtils.TABLET_BOTTOM_SHEET_SUCCESS_TRANSITION_PROGRESS; import static com.android.launcher3.LauncherAnimUtils.newCancelListener; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; @@ -285,8 +286,13 @@ public abstract class AbstractStateChangeTouchController ? mToState : mFromState; // snap to top or bottom using the release velocity } else { + float successTransitionProgress = + mLauncher.getDeviceProfile().isTablet + && (mToState == ALL_APPS || mFromState == ALL_APPS) + ? TABLET_BOTTOM_SHEET_SUCCESS_TRANSITION_PROGRESS + : SUCCESS_TRANSITION_PROGRESS; targetState = - (interpolatedProgress > SUCCESS_TRANSITION_PROGRESS) ? mToState : mFromState; + (interpolatedProgress > successTransitionProgress) ? mToState : mFromState; } final float endProgress; diff --git a/src/com/android/launcher3/touch/AllAppsSwipeController.java b/src/com/android/launcher3/touch/AllAppsSwipeController.java index f7d34921d3..5aac3f3a82 100644 --- a/src/com/android/launcher3/touch/AllAppsSwipeController.java +++ b/src/com/android/launcher3/touch/AllAppsSwipeController.java @@ -20,10 +20,8 @@ import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.anim.Interpolators.LINEAR_TELEPORT; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; import android.view.MotionEvent; import android.view.animation.Interpolator; @@ -113,7 +111,6 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { config.setInterpolator(ANIM_SCRIM_FADE, ALLAPPS_STAGGERED_FADE_LATE_RESPONDER); config.setInterpolator(ANIM_ALL_APPS_FADE, isTablet ? FINAL_FRAME : ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER); - config.setInterpolator(ANIM_VERTICAL_PROGRESS, isTablet ? LINEAR_TELEPORT : LINEAR); } /** @@ -125,7 +122,6 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { config.setInterpolator(ANIM_SCRIM_FADE, ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER); config.setInterpolator(ANIM_ALL_APPS_FADE, isTablet ? INSTANT : ALLAPPS_STAGGERED_FADE_LATE_RESPONDER); - config.setInterpolator(ANIM_VERTICAL_PROGRESS, isTablet ? LINEAR_TELEPORT : LINEAR); } diff --git a/src/com/android/launcher3/views/AbstractSlideInView.java b/src/com/android/launcher3/views/AbstractSlideInView.java index 5d888846a8..ed31e8d130 100644 --- a/src/com/android/launcher3/views/AbstractSlideInView.java +++ b/src/com/android/launcher3/views/AbstractSlideInView.java @@ -17,6 +17,8 @@ package com.android.launcher3.views; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; +import static com.android.launcher3.LauncherAnimUtils.SUCCESS_TRANSITION_PROGRESS; +import static com.android.launcher3.LauncherAnimUtils.TABLET_BOTTOM_SHEET_SUCCESS_TRANSITION_PROGRESS; import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity; import android.animation.Animator; @@ -184,7 +186,10 @@ public abstract class AbstractSlideInView @Override public void onDragEnd(float velocity) { - if ((mSwipeDetector.isFling(velocity) && velocity > 0) || mTranslationShift > 0.5f) { + float successfulShiftThreshold = mActivityContext.getDeviceProfile().isTablet + ? TABLET_BOTTOM_SHEET_SUCCESS_TRANSITION_PROGRESS : SUCCESS_TRANSITION_PROGRESS; + if ((mSwipeDetector.isFling(velocity) && velocity > 0) + || mTranslationShift > successfulShiftThreshold) { mScrollInterpolator = scrollInterpolatorForVelocity(velocity); mOpenCloseAnimator.setDuration(BaseSwipeDetector.calculateDuration( velocity, TRANSLATION_SHIFT_CLOSED - mTranslationShift));