Make AllApps bottom sheet follow finger and snap after 30% progress

Bug: 220336617
Test: manual
Change-Id: I0b6296cf5abf0f0a5f34fc2a0b5be93dc93ebf3f
This commit is contained in:
Alex Chau
2022-03-31 14:47:56 +01:00
parent d5d06190a7
commit c83ea5f8fb
6 changed files with 14 additions and 28 deletions

View File

@@ -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<T extends Context & ActivityContext>
@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));