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

Commit 0f2f074e authored by Ats Jenk's avatar Ats Jenk
Browse files

New switch animation for bubble bar bubbles

Create a new animation for switching between bubbles. Slide the expanded
view in from the edge of the screen, on top of the existing bubble.
Keep the existing animation for expanding/collapsing the bar.

Bug: 276747288
Test: manual
Flag: com.android.wm.shell.enable_bubble_bar
Change-Id: I7b2a1631bda01dfb53f47d6aac1ba01729e4c564
parent 18c9dc71
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -266,6 +266,8 @@
    <dimen name="bubble_bar_expanded_view_handle_height">4dp</dimen>
    <!-- Width of the expanded bubble bar view shown when the bubble is expanded. -->
    <dimen name="bubble_bar_expanded_view_width">412dp</dimen>
    <!-- Offset of the expanded view when it starts sliding in as part of the switch animation -->
    <dimen name="bubble_bar_expanded_view_switch_offset">48dp</dimen>
    <!-- Minimum width of the bubble bar manage menu. -->
    <dimen name="bubble_bar_manage_menu_min_width">200dp</dimen>
    <!-- Size of the dismiss icon in the bubble bar manage menu. -->
+247 −82

File changed.

Preview size limit exceeded, changes collapsed.

+16 −0
Original line number Diff line number Diff line
@@ -85,6 +85,22 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView
        }
    };

    /**
     * Property to set alpha for the task view
     */
    public static final FloatProperty<BubbleBarExpandedView> TASK_VIEW_ALPHA = new FloatProperty<>(
            "taskViewAlpha") {
        @Override
        public void setValue(BubbleBarExpandedView bbev, float alpha) {
            bbev.setTaskViewAlpha(alpha);
        }

        @Override
        public Float get(BubbleBarExpandedView bbev) {
            return bbev.mTaskView != null ? bbev.mTaskView.getAlpha() : bbev.getAlpha();
        }
    };

    private static final String TAG = BubbleBarExpandedView.class.getSimpleName();
    private static final int INVALID_TASK_ID = -1;

+22 −5
Original line number Diff line number Diff line
@@ -103,8 +103,7 @@ public class BubbleBarLayerView extends FrameLayout
        mPositioner = mBubbleController.getPositioner();
        mBubbleLogger = bubbleLogger;

        mAnimationHelper = new BubbleBarAnimationHelper(context,
                this, mPositioner);
        mAnimationHelper = new BubbleBarAnimationHelper(context, mPositioner);
        mEducationViewController = new BubbleEducationViewController(context, (boolean visible) -> {
            if (mExpandedView == null) return;
            mExpandedView.setObscured(visible);
@@ -183,8 +182,14 @@ public class BubbleBarLayerView extends FrameLayout
            // Already showing this bubble, skip animating
            return;
        }
        BubbleViewProvider previousBubble = null;
        if (mExpandedBubble != null && !b.getKey().equals(mExpandedBubble.getKey())) {
            if (mIsExpanded) {
                // Previous expanded view open, keep it visible to animate the switch
                previousBubble = mExpandedBubble;
            } else {
                removeView(mExpandedView);
            }
            mExpandedView = null;
        }
        if (mExpandedView == null) {
@@ -246,7 +251,8 @@ public class BubbleBarLayerView extends FrameLayout

        mIsExpanded = true;
        mBubbleController.getSysuiProxy().onStackExpandChanged(true);
        mAnimationHelper.animateExpansion(mExpandedBubble, () -> {

        final Runnable afterAnimation = () -> {
            if (mExpandedView == null) return;
            // Touch delegate for the menu
            BubbleBarHandleView view = mExpandedView.getHandleView();
@@ -256,7 +262,18 @@ public class BubbleBarLayerView extends FrameLayout
            mHandleTouchDelegate = new TouchDelegate(mHandleTouchBounds,
                    mExpandedView.getHandleView());
            setTouchDelegate(mHandleTouchDelegate);
        };

        if (previousBubble != null) {
            final BubbleBarExpandedView previousExpandedView =
                    previousBubble.getBubbleBarExpandedView();
            mAnimationHelper.animateSwitch(previousBubble, mExpandedBubble, () -> {
                removeView(previousExpandedView);
                afterAnimation.run();
            });
        } else {
            mAnimationHelper.animateExpansion(mExpandedBubble, afterAnimation);
        }

        showScrim(true);
    }