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

Commit ab839825 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Only check X velocity for max stick-to-target velocity." into rvc-dev am: 6275fcfb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11811824

Change-Id: Ia80b44e7465874e80171d85f9dc19548845cd00d
parents dce73ab8 6275fcfb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1034,13 +1034,13 @@ public class StackAnimationController extends
                mMagnetizedStack.getFlingToTargetMinVelocity() /* default */);
        final float maxVelocity = Settings.Secure.getFloat(contentResolver,
                "bubble_dismiss_stick_max_velocity",
                mMagnetizedStack.getStickToTargetMaxVelocity() /* default */);
                mMagnetizedStack.getStickToTargetMaxXVelocity() /* default */);
        final float targetWidth = Settings.Secure.getFloat(contentResolver,
                "bubble_dismiss_target_width_percent",
                mMagnetizedStack.getFlingToTargetWidthPercent() /* default */);

        mMagnetizedStack.setFlingToTargetMinVelocity(minVelocity);
        mMagnetizedStack.setStickToTargetMaxVelocity(maxVelocity);
        mMagnetizedStack.setStickToTargetMaxXVelocity(maxVelocity);
        mMagnetizedStack.setFlingToTargetWidthPercent(targetWidth);

        return mMagnetizedStack;
+5 −4
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import androidx.dynamicanimation.animation.DynamicAnimation
import androidx.dynamicanimation.animation.FloatPropertyCompat
import androidx.dynamicanimation.animation.SpringForce
import com.android.systemui.util.animation.PhysicsAnimator
import kotlin.math.abs
import kotlin.math.hypot

/**
@@ -231,11 +232,11 @@ abstract class MagnetizedObject<T : Any>(
    var flingUnstuckFromTargetMinVelocity = 1000f

    /**
     * Sets the maximum velocity above which the object will not stick to the target. Even if the
     * Sets the maximum X velocity above which the object will not stick to the target. Even if the
     * object is dragged through the magnetic field, it will not stick to the target until the
     * velocity is below this value.
     * horizontal velocity is below this value.
     */
    var stickToTargetMaxVelocity = 2000f
    var stickToTargetMaxXVelocity = 2000f

    /**
     * Enable or disable haptic vibration effects when the object interacts with the magnetic field.
@@ -363,7 +364,7 @@ abstract class MagnetizedObject<T : Any>(
            // If the object is moving too quickly within the magnetic field, do not stick it. This
            // only applies to objects newly stuck to a target. If the object is moved into a new
            // target, it wasn't moving at all (since it was stuck to the previous one).
            if (objectNewlyStuckToTarget && hypot(velX, velY) > stickToTargetMaxVelocity) {
            if (objectNewlyStuckToTarget && abs(velX) > stickToTargetMaxXVelocity) {
                return false
            }