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

Commit 6c1c754c authored by Liran Binyamin's avatar Liran Binyamin Committed by Android (Google) Code Review
Browse files

Merge "Fix bubble expanded view width after rotation" into main

parents 56ca2ed6 458dd721
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -412,6 +412,23 @@ public class BubbleExpandedView extends LinearLayout {
        setLayoutDirection(LAYOUT_DIRECTION_LOCALE);
    }


    /** Updates the width of the task view if it changed. */
    void updateTaskViewContentWidth() {
        if (mTaskView != null) {
            int width = getContentWidth();
            if (mTaskView.getWidth() != width) {
                FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(width, MATCH_PARENT);
                mTaskView.setLayoutParams(lp);
            }
        }
    }

    private int getContentWidth() {
        boolean isStackOnLeft = mPositioner.isStackOnLeft(mStackView.getStackPosition());
        return mPositioner.getTaskViewContentWidth(isStackOnLeft);
    }

    /**
     * Initialize {@link BubbleController} and {@link BubbleStackView} here, this method must need
     * to be called after view inflate.
@@ -438,7 +455,12 @@ public class BubbleExpandedView extends LinearLayout {
                    mController.getTaskViewTransitions(), mController.getSyncTransactionQueue());
            mTaskView = new TaskView(mContext, mTaskViewTaskController);
            mTaskView.setListener(mController.getMainExecutor(), mTaskViewListener);
            mExpandedViewContainer.addView(mTaskView);

            // set a fixed width so it is not recalculated as part of a rotation. the width will be
            // updated manually after the rotation.
            FrameLayout.LayoutParams lp =
                    new FrameLayout.LayoutParams(getContentWidth(), MATCH_PARENT);
            mExpandedViewContainer.addView(mTaskView, lp);
            bringChildToFront(mTaskView);
        }
    }
+7 −0
Original line number Diff line number Diff line
@@ -375,6 +375,13 @@ public class BubblePositioner {
        }
    }

    /** Returns the width of the task view content. */
    public int getTaskViewContentWidth(boolean onLeft) {
        int[] paddings = getExpandedViewContainerPadding(onLeft, /* isOverflow = */ false);
        int pointerOffset = showBubblesVertically() ? getPointerSize() : 0;
        return mPositionRect.width() - paddings[0] - paddings[2] - pointerOffset;
    }

    /** Gets the y position of the expanded view if it was top-aligned. */
    public float getExpandedViewYTopAligned() {
        final int top = getAvailableRect().top;
+1 −0
Original line number Diff line number Diff line
@@ -3288,6 +3288,7 @@ public class BubbleStackView extends FrameLayout
            mExpandedViewContainer.setTranslationY(mPositioner.getExpandedViewY(mExpandedBubble,
                    mPositioner.showBubblesVertically() ? p.y : p.x));
            mExpandedViewContainer.setTranslationX(0f);
            mExpandedBubble.getExpandedView().updateTaskViewContentWidth();
            mExpandedBubble.getExpandedView().updateView(
                    mExpandedViewContainer.getLocationOnScreen());
            updatePointerPosition(false /* forIme */);