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

Commit 074972fd authored by Ats Jenk's avatar Ats Jenk
Browse files

Add bubbles API to update bubble bar bounds

New API to set the bubble bar bounds. The bounds is calculated in
launcher. Shell keeps track of the bounds for positioning and animating
the expanded view.
Update expanded view collapse animation to use current bubble bar bounds
for the scale pivot. This ensures that when the bubble bar bounds change
between expand and collapse animations, we collapse to the right
location.

Bug: 332423960
Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT
Test: drag expanded bubble from one side to the other, collapse it,
  observe that collapse animation collapses the view into the bar
Change-Id: If1bf31a04b8f134a1b055fddccd276e924ed98b6
parent c7b314bd
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2335,6 +2335,11 @@ public class BubbleController implements ConfigurationChangeListener,
            mMainExecutor.execute(() ->
                    mController.setBubbleBarLocation(location));
        }

        @Override
        public void setBubbleBarBounds(Rect bubbleBarBounds) {
            mMainExecutor.execute(() -> mBubblePositioner.setBubbleBarBounds(bubbleBarBounds));
        }
    }

    private class BubblesImpl implements Bubbles {
+2 −0
Original line number Diff line number Diff line
@@ -44,4 +44,6 @@ interface IBubbles {
    oneway void showUserEducation(in int positionX, in int positionY) = 8;

    oneway void setBubbleBarLocation(in BubbleBarLocation location) = 9;

    oneway void setBubbleBarBounds(in Rect bubbleBarBounds) = 10;
}
 No newline at end of file
+14 −9
Original line number Diff line number Diff line
@@ -166,13 +166,8 @@ public class BubbleBarAnimationHelper {
        bbev.setTaskViewAlpha(0f);
        bbev.setVisibility(VISIBLE);

        // Set the pivot point for the scale, so the view animates out from the bubble bar.
        Rect bubbleBarBounds = mPositioner.getBubbleBarBounds();
        mExpandedViewContainerMatrix.setScale(
                1f - EXPANDED_VIEW_ANIMATE_SCALE_AMOUNT,
                1f - EXPANDED_VIEW_ANIMATE_SCALE_AMOUNT,
                bubbleBarBounds.centerX(),
                bubbleBarBounds.top);
        setScaleFromBubbleBar(mExpandedViewContainerMatrix,
                1f - EXPANDED_VIEW_ANIMATE_SCALE_AMOUNT);

        bbev.setAnimationMatrix(mExpandedViewContainerMatrix);

@@ -214,8 +209,8 @@ public class BubbleBarAnimationHelper {
        }
        bbev.setScaleX(1f);
        bbev.setScaleY(1f);
        mExpandedViewContainerMatrix.setScaleX(1f);
        mExpandedViewContainerMatrix.setScaleY(1f);

        setScaleFromBubbleBar(mExpandedViewContainerMatrix, 1f);

        PhysicsAnimator.getInstance(mExpandedViewContainerMatrix).cancel();
        PhysicsAnimator.getInstance(mExpandedViewContainerMatrix)
@@ -240,6 +235,16 @@ public class BubbleBarAnimationHelper {
        mExpandedViewAlphaAnimator.reverse();
    }

    private void setScaleFromBubbleBar(AnimatableScaleMatrix matrix, float scale) {
        // Set the pivot point for the scale, so the view animates out from the bubble bar.
        Rect bubbleBarBounds = mPositioner.getBubbleBarBounds();
        matrix.setScale(
                scale,
                scale,
                bubbleBarBounds.centerX(),
                bubbleBarBounds.top);
    }

    /**
     * Animate the expanded bubble when it is being dragged
     */