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

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

Merge "Polish dismiss animations." into rvc-dev am: 92d5a67c am: e1100653...

Merge "Polish dismiss animations." into rvc-dev am: 92d5a67c am: e1100653 am: 90297e39 am: 0e67c7f4

Change-Id: I8d2fc0920b8e044ae7e2cbfc546d8b11d18acbf7
parents 2fb86a5b 0e67c7f4
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -374,8 +374,9 @@ public class BubbleStackView extends FrameLayout {
                @Override
                @Override
                public void onReleasedInTarget(@NonNull MagnetizedObject.MagneticTarget target) {
                public void onReleasedInTarget(@NonNull MagnetizedObject.MagneticTarget target) {
                    mExpandedAnimationController.dismissDraggedOutBubble(
                    mExpandedAnimationController.dismissDraggedOutBubble(
                            mExpandedAnimationController.getDraggedOutBubble(),
                            mExpandedAnimationController.getDraggedOutBubble() /* bubble */,
                            BubbleStackView.this::dismissMagnetizedObject);
                            mDismissTargetContainer.getHeight() /* translationYBy */,
                            BubbleStackView.this::dismissMagnetizedObject /* after */);
                    hideDismissTarget();
                    hideDismissTarget();
                }
                }
            };
            };
@@ -405,7 +406,8 @@ public class BubbleStackView extends FrameLayout {


                @Override
                @Override
                public void onReleasedInTarget(@NonNull MagnetizedObject.MagneticTarget target) {
                public void onReleasedInTarget(@NonNull MagnetizedObject.MagneticTarget target) {
                    mStackAnimationController.implodeStack(
                    mStackAnimationController.animateStackDismissal(
                            mDismissTargetContainer.getHeight() /* translationYBy */,
                            () -> {
                            () -> {
                                resetDesaturationAndDarken();
                                resetDesaturationAndDarken();
                                dismissMagnetizedObject();
                                dismissMagnetizedObject();
+2 −1
Original line number Original line Diff line number Diff line
@@ -329,7 +329,7 @@ public class ExpandedAnimationController
    }
    }


    /** Plays a dismiss animation on the dragged out bubble. */
    /** Plays a dismiss animation on the dragged out bubble. */
    public void dismissDraggedOutBubble(View bubble, Runnable after) {
    public void dismissDraggedOutBubble(View bubble, float translationYBy, Runnable after) {
        if (bubble == null) {
        if (bubble == null) {
            return;
            return;
        }
        }
@@ -337,6 +337,7 @@ public class ExpandedAnimationController
                .withStiffness(SpringForce.STIFFNESS_HIGH)
                .withStiffness(SpringForce.STIFFNESS_HIGH)
                .scaleX(1.1f)
                .scaleX(1.1f)
                .scaleY(1.1f)
                .scaleY(1.1f)
                .translationY(bubble.getTranslationY() + translationYBy)
                .alpha(0f, after)
                .alpha(0f, after)
                .start();
                .start();


+11 −12
Original line number Original line Diff line number Diff line
@@ -647,17 +647,18 @@ public class StackAnimationController extends
    }
    }


    /**
    /**
     * 'Implode' the stack by shrinking the bubbles via chained animations and fading them out.
     * 'Implode' the stack by shrinking the bubbles, fading them out, and translating them down.
     */
     */
    public void implodeStack(Runnable after) {
    public void animateStackDismissal(float translationYBy, Runnable after) {
        // Pop and fade the bubbles sequentially.
        animationsForChildrenFromIndex(0, (index, animation) ->
        animationForChildAtIndex(0)
                animation
                        .scaleX(0.5f)
                        .scaleX(0.5f)
                        .scaleY(0.5f)
                        .scaleY(0.5f)
                        .alpha(0f)
                        .alpha(0f)
                .withDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY)
                        .translationY(
                .withStiffness(SpringForce.STIFFNESS_HIGH)
                                mLayout.getChildAt(index).getTranslationY() + translationYBy)
                .start(after);
                        .withStiffness(SpringForce.STIFFNESS_HIGH))
                .startAll(after);
    }
    }


    /**
    /**
@@ -710,8 +711,6 @@ public class StackAnimationController extends
        if (property.equals(DynamicAnimation.TRANSLATION_X)
        if (property.equals(DynamicAnimation.TRANSLATION_X)
                || property.equals(DynamicAnimation.TRANSLATION_Y)) {
                || property.equals(DynamicAnimation.TRANSLATION_Y)) {
            return index + 1;
            return index + 1;
        } else if (isStackStuckToTarget()) {
            return index + 1; // Chain all animations in dismiss (scale, alpha, etc. are used).
        } else {
        } else {
            return NONE;
            return NONE;
        }
        }