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

Commit 40ad015e authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Add methods to animate expansion to the expanded view controller" into main

parents 2af900b4 684fb96e
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -2474,11 +2474,12 @@ public class BubbleStackView extends FrameLayout
        // Let the expanded animation controller know that it shouldn't animate child adds/reorders
        // since we're about to animate collapsed.
        mExpandedAnimationController.notifyPreparingToCollapse();

        final PointF collapsePosition = mStackAnimationController
                .getStackPositionAlongNearestHorizontalEdge();
        updateOverflowDotVisibility(false /* expanding */);
        final Runnable collapseBackToStack = () ->
                mExpandedAnimationController.collapseBackToStack(
                        mStackAnimationController.getStackPositionAlongNearestHorizontalEdge(),
                        collapsePosition,
                        /* fadeBubblesDuringCollapse= */ mRemovingLastBubbleWhileExpanded,
                        () -> {
                            mBubbleContainer.setActiveController(mStackAnimationController);
@@ -2501,7 +2502,8 @@ public class BubbleStackView extends FrameLayout
            }
            mExpandedViewAnimationController.reset();
        };
        mExpandedViewAnimationController.animateCollapse(collapseBackToStack, after);
        mExpandedViewAnimationController.animateCollapse(collapseBackToStack, after,
                collapsePosition);
        if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) {
            // When the animation completes, we should no longer be showing the content.
            // This won't actually update content visibility immediately, if we are currently
+20 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.wm.shell.bubbles.animation;

import android.graphics.PointF;

import com.android.wm.shell.bubbles.BubbleExpandedView;

/**
@@ -55,8 +57,9 @@ public interface ExpandedViewAnimationController {
     * @param startStackCollapse runnable that is triggered when bubbles can start moving back to
     *                           their collapsed location
     * @param after              runnable to run after animation is complete
     * @param collapsePosition the position on screen the stack will collapse to
     */
    void animateCollapse(Runnable startStackCollapse, Runnable after);
    void animateCollapse(Runnable startStackCollapse, Runnable after, PointF collapsePosition);

    /**
     * Animate the view back to fully expanded state.
@@ -68,6 +71,22 @@ public interface ExpandedViewAnimationController {
     */
    void animateForImeVisibilityChange(boolean visible);

    /**
     * Whether this controller should also animate the expansion for the bubble
     */
    boolean shouldAnimateExpansion();

    /**
     * Animate the expansion of the bubble.
     *
     * @param startDelayMillis how long to delay starting the expansion animation
     * @param after runnable to run after the animation is complete
     * @param collapsePosition the position on screen the stack will collapse to (and expand from)
     * @param bubblePosition the position of the bubble on screen that the view is associated with
     */
    void animateExpansion(long startDelayMillis, Runnable after, PointF collapsePosition,
            PointF bubblePosition);

    /**
     * Reset the view to fully expanded state
     */
+17 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.PointF;
import android.view.HapticFeedbackConstants;
import android.view.ViewConfiguration;

@@ -187,9 +188,11 @@ public class ExpandedViewAnimationControllerImpl implements ExpandedViewAnimatio
    }

    @Override
    public void animateCollapse(Runnable startStackCollapse, Runnable after) {
        ProtoLog.d(WM_SHELL_BUBBLES, "expandedView animate collapse swipeVel=%f minFlingVel=%d",
                mSwipeUpVelocity,  mMinFlingVelocity);
    public void animateCollapse(Runnable startStackCollapse, Runnable after,
            PointF collapsePosition) {
        ProtoLog.d(WM_SHELL_BUBBLES, "expandedView animate collapse swipeVel=%f minFlingVel=%d"
                        + " collapsePosition=%f,%f", mSwipeUpVelocity, mMinFlingVelocity,
                collapsePosition.x, collapsePosition.y);
        if (mExpandedView != null) {
            // Mark it as animating immediately to avoid updates to the view before animation starts
            mExpandedView.setAnimating(true);
@@ -273,6 +276,17 @@ public class ExpandedViewAnimationControllerImpl implements ExpandedViewAnimatio
        }
    }

    @Override
    public boolean shouldAnimateExpansion() {
        return false;
    }

    @Override
    public void animateExpansion(long startDelayMillis, Runnable after, PointF collapsePosition,
            PointF bubblePosition) {
        // TODO - animate
    }

    @Override
    public void reset() {
        ProtoLog.d(WM_SHELL_BUBBLES, "reset expandedView collapsed state");