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

Commit a0bb02eb authored by Lyn Han's avatar Lyn Han
Browse files

Reuse existing paths to render overflow

Set expanded view visibility in one place
- Move logic from controller to stack view, which has access to overflow

Bug: 138116789
Test: manual - make 6 bubbles, overflow shows 1 bubble
Test: atest SystemUITests
Change-Id: I0dd832106303e5b4aa4621d6fdf6d2e949cbc155
parent a6983622
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -1074,12 +1074,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi

        @Override
        public void onSingleTaskDisplayDrawn(int displayId) {
            final Bubble expandedBubble = mStackView != null
                    ? mStackView.getExpandedBubble()
                    : null;
            if (expandedBubble != null && expandedBubble.getDisplayId() == displayId) {
                expandedBubble.setContentVisibility(true);
            if (mStackView == null) {
                return;
            }
            mStackView.showExpandedViewContents(displayId);
        }

        @Override
+27 −28
Original line number Diff line number Diff line
@@ -409,9 +409,13 @@ public class BubbleStackView extends FrameLayout {
                        .setStiffness(SpringForce.STIFFNESS_LOW)
                        .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY));
        mExpandedViewYAnim.addEndListener((anim, cancelled, value, velocity) -> {
            if (mIsExpanded && mExpandedBubble != null) {
            if (mIsExpanded) {
                if (mExpandedBubble == null) {
                    mOverflowExpandedView.updateView();
                } else {
                    mExpandedBubble.getExpandedView().updateView();
                }
            }
        });

        setClipChildren(false);
@@ -525,7 +529,7 @@ public class BubbleStackView extends FrameLayout {
        mInflater.inflate(R.layout.bubble_overflow_button, this);
        mOverflowBtn = findViewById(R.id.bubble_overflow_button);
        mOverflowBtn.setOnClickListener(v -> {
            showOverflow();
            setSelectedBubble(null);
        });

        TypedArray ta = mContext.obtainStyledAttributes(
@@ -540,26 +544,13 @@ public class BubbleStackView extends FrameLayout {
        mOverflowBtn.setVisibility(GONE);
    }

    void showOverflow() {
        if (DEBUG_BUBBLE_STACK_VIEW) {
            Log.d(TAG, "Show overflow.");
        }
        mExpandedViewContainer.setAlpha(0.0f);
        mSurfaceSynchronizer.syncSurfaceAndRun(() -> {
            if (mExpandedBubble != null) {
                mExpandedBubble.setContentVisibility(false);
                mExpandedBubble = null;
            }
            mExpandedViewContainer.removeAllViews();
            if (mIsExpanded) {
                mExpandedViewContainer.addView(mOverflowExpandedView);
                mOverflowExpandedView.populateExpandedView();
                mExpandedViewContainer.setVisibility(VISIBLE);
                mExpandedViewContainer.setAlpha(1.0f);
    void showExpandedViewContents(int displayId) {
        if (mOverflowExpandedView.getVirtualDisplayId() == displayId) {
            mOverflowExpandedView.setContentVisibility(true);
        } else if (mExpandedBubble != null
                && mExpandedBubble.getExpandedView().getVirtualDisplayId() == displayId) {
            mExpandedBubble.setContentVisibility(true);
        }
            requestUpdate();
        });
    }

    private void setUpFlyout() {
@@ -883,7 +874,9 @@ public class BubbleStackView extends FrameLayout {
            // expanded view becomes visible on the screen. See b/126856255
            mExpandedViewContainer.setAlpha(0.0f);
            mSurfaceSynchronizer.syncSurfaceAndRun(() -> {
                if (previouslySelected != null) {
                if (previouslySelected == null) {
                    mOverflowExpandedView.setContentVisibility(false);
                } else {
                    previouslySelected.setContentVisibility(false);
                }
                updateExpandedBubble();
@@ -1055,7 +1048,9 @@ public class BubbleStackView extends FrameLayout {
                () -> {
                    mBubbleContainer.setActiveController(mStackAnimationController);
                    afterExpandedViewAnimation();
                    if (previouslySelected != null) {
                    if (previouslySelected == null) {
                        mOverflowExpandedView.setContentVisibility(false);
                    } else {
                        previouslySelected.setContentVisibility(false);
                    }
                });
@@ -1625,10 +1620,14 @@ public class BubbleStackView extends FrameLayout {
            Log.d(TAG, "updateExpandedBubble()");
        }
        mExpandedViewContainer.removeAllViews();
        if (mExpandedBubble != null && mIsExpanded) {
            mExpandedViewContainer.addView(mExpandedBubble.getExpandedView());
            mExpandedBubble.getExpandedView().populateExpandedView();
            mExpandedViewContainer.setVisibility(mIsExpanded ? VISIBLE : GONE);
        if (mIsExpanded) {
            BubbleExpandedView bev = mOverflowExpandedView;
            if (mExpandedBubble != null) {
                bev = mExpandedBubble.getExpandedView();
            }
            mExpandedViewContainer.addView(bev);
            bev.populateExpandedView();
            mExpandedViewContainer.setVisibility(VISIBLE);
            mExpandedViewContainer.setAlpha(1.0f);
        }
    }