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

Commit 010c2b10 authored by Joshua Tsuji's avatar Joshua Tsuji
Browse files

Use the new physics settings.

Test: manual
Change-Id: Ide94987c729af26daca69af61c41ff36c893ea42
parent 5f9cad60
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -95,6 +95,9 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
    /** Flag to position the header below the activity view */
    private static final String ENABLE_BUBBLE_FOOTER = "experiment_enable_bubble_footer";

    private static final String BUBBLE_STIFFNESS = "experiment_bubble_stiffness";
    private static final String BUBBLE_BOUNCINESS = "experiment_bubble_bounciness";

    private final Context mContext;
    private final NotificationEntryManager mNotificationEntryManager;
    private final IActivityTaskManager mActivityTaskManager;
@@ -569,6 +572,20 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
                ENABLE_BUBBLE_FOOTER, 0) != 0;
    }

    /** Default stiffness to use for bubble physics animations. */
    public static int getBubbleStiffness(Context context, int defaultStiffness) {
        return Settings.Secure.getInt(
                context.getContentResolver(), BUBBLE_STIFFNESS, defaultStiffness);
    }

    /** Default bounciness/damping ratio to use for bubble physics animations. */
    public static float getBubbleBounciness(Context context, float defaultBounciness) {
        return Settings.Secure.getInt(
                context.getContentResolver(),
                BUBBLE_BOUNCINESS,
                (int) (defaultBounciness * 100)) / 100f;
    }

    /** PinnedStackListener that dispatches IME visibility updates to the stack. */
    private class BubblesImeListener extends IPinnedStackListener.Stub {

+2 −2
Original line number Diff line number Diff line
@@ -268,8 +268,8 @@ public class ExpandedAnimationController
    @Override
    SpringForce getSpringForce(DynamicAnimation.ViewProperty property, View view) {
        return new SpringForce()
                .setStiffness(SpringForce.STIFFNESS_LOW)
                .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY);
                .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY)
                .setStiffness(SpringForce.STIFFNESS_LOW);
    }

    @Override
+5 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import androidx.dynamicanimation.animation.SpringAnimation;
import androidx.dynamicanimation.animation.SpringForce;

import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController;

import com.google.android.collect.Sets;

@@ -325,8 +326,10 @@ public class StackAnimationController extends
    @Override
    SpringForce getSpringForce(DynamicAnimation.ViewProperty property, View view) {
        return new SpringForce()
                .setDampingRatio(DEFAULT_BOUNCINESS)
                .setStiffness(DEFAULT_STIFFNESS);
                .setDampingRatio(BubbleController.getBubbleBounciness(
                        mLayout.getContext(), DEFAULT_BOUNCINESS))
                .setStiffness(BubbleController.getBubbleStiffness(
                        mLayout.getContext(), (int) (DEFAULT_STIFFNESS * 100f)));
    }

    @Override