Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e9dd8fa authored by Alex Chau's avatar Alex Chau Committed by Android (Google) Code Review
Browse files

Merge "Make AllApps bottom sheet follow finger and snap after 30% progress" into tm-dev

parents e633cca3 c83ea5f8
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -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;
    }

+1 −0
Original line number Diff line number Diff line
@@ -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> DRAWABLE_ALPHA =
            new IntProperty<Drawable>("drawableAlpha") {
+0 −17
Original line number Diff line number Diff line
@@ -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) {
+7 −1
Original line number Diff line number Diff line
@@ -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;
+0 −4
Original line number Diff line number Diff line
@@ -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);
    }


Loading