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

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

Merge "Show the overflow expanded view in bubble bar" into udc-qpr-dev

parents 44d6eed2 174ef424
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -780,7 +780,7 @@ public class BubbleController implements ConfigurationChangeListener,
        try {
            mAddedToWindowManager = true;
            registerBroadcastReceiver();
            mBubbleData.getOverflow().initialize(this);
            mBubbleData.getOverflow().initialize(this, isShowingAsBubbleBar());
            // (TODO: b/273314541) some duplication in the inset listener
            if (isShowingAsBubbleBar()) {
                mWindowManager.addView(mLayerView, mWmLayoutParams);
@@ -1077,6 +1077,13 @@ public class BubbleController implements ConfigurationChangeListener,
    @VisibleForTesting
    public void expandStackAndSelectBubbleFromLauncher(String key, boolean onLauncherHome) {
        mBubblePositioner.setShowingInBubbleBar(onLauncherHome);

        if (BubbleOverflow.KEY.equals(key)) {
            mBubbleData.setSelectedBubbleFromLauncher(mBubbleData.getOverflow());
            mLayerView.showExpandedView(mBubbleData.getOverflow());
            return;
        }

        Bubble b = mBubbleData.getAnyBubbleWithkey(key);
        if (b == null) {
            return;
+3 −3
Original line number Diff line number Diff line
@@ -948,9 +948,9 @@ public class BubbleExpandedView extends LinearLayout {
            mTaskView.onLocationChanged();
        }
        if (mIsOverflow) {
            post(() -> {
                mOverflowView.show();
            });
            // post this to the looper so that the view has a chance to be laid out before it can
            // calculate row and column sizes correctly.
            post(() -> mOverflowView.show());
        }
    }

+30 −9
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ class BubbleOverflow(private val context: Context, private val positioner: Bubbl

    private val inflater: LayoutInflater = LayoutInflater.from(context)
    private var expandedView: BubbleExpandedView?
    private var bubbleBarExpandedView: BubbleBarExpandedView? = null
    private var overflowBtn: BadgedImageView?

    init {
@@ -53,19 +54,26 @@ class BubbleOverflow(private val context: Context, private val positioner: Bubbl
    }

    /** Call before use and again if cleanUpExpandedState was called. */
    fun initialize(controller: BubbleController) {
    fun initialize(controller: BubbleController, forBubbleBar: Boolean) {
        if (forBubbleBar) {
            createBubbleBarExpandedView().initialize(controller, true /* isOverflow */)
        } else {
            createExpandedView()
        getExpandedView()?.initialize(controller, controller.stackView, true /* isOverflow */)
                .initialize(controller, controller.stackView, true /* isOverflow */)
        }
    }

    fun cleanUpExpandedState() {
        expandedView?.cleanUpExpandedState()
        expandedView = null
        bubbleBarExpandedView?.cleanUpExpandedState()
        bubbleBarExpandedView = null
    }

    fun update() {
        updateResources()
        getExpandedView()?.applyThemeAttrs()
        getBubbleBarExpandedView()?.applyThemeAttrs()
        // Apply inset and new style to fresh icon drawable.
        getIconView()?.setIconImageResource(R.drawable.bubble_ic_overflow_button)
        updateBtnTheme()
@@ -151,26 +159,39 @@ class BubbleOverflow(private val context: Context, private val positioner: Bubbl
        overflowBtn?.updateDotVisibility(true /* animate */)
    }

    fun createExpandedView(): BubbleExpandedView? {
        expandedView =
    /** Creates the expanded view for bubbles showing in the stack view. */
    private fun createExpandedView(): BubbleExpandedView {
        val view =
            inflater.inflate(
                R.layout.bubble_expanded_view,
                null /* root */,
                false /* attachToRoot */
            ) as BubbleExpandedView
        expandedView?.applyThemeAttrs()
        view.applyThemeAttrs()
        expandedView = view
        updateResources()
        return expandedView
        return view
    }

    override fun getExpandedView(): BubbleExpandedView? {
        return expandedView
    }

    override fun getBubbleBarExpandedView(): BubbleBarExpandedView? {
        return null
    /** Creates the expanded view for bubbles showing in the bubble bar. */
    private fun createBubbleBarExpandedView(): BubbleBarExpandedView {
        val view =
            inflater.inflate(
                R.layout.bubble_bar_expanded_view,
                null, /* root */
                false /* attachToRoot*/
            ) as BubbleBarExpandedView
        view.applyThemeAttrs()
        bubbleBarExpandedView = view
        return view
    }

    override fun getBubbleBarExpandedView(): BubbleBarExpandedView? = bubbleBarExpandedView

    override fun getDotColor(): Int {
        return dotColor
    }
+12 −4
Original line number Diff line number Diff line
@@ -732,17 +732,25 @@ public class BubblePositioner {
    /**
     * How wide the expanded view should be when showing from the bubble bar.
     */
    public int getExpandedViewWidthForBubbleBar() {
        return mExpandedViewLargeScreenWidth;
    public int getExpandedViewWidthForBubbleBar(boolean isOverflow) {
        return isOverflow ? mOverflowWidth : mExpandedViewLargeScreenWidth;
    }

    /**
     * How tall the expanded view should be when showing from the bubble bar.
     */
    public int getExpandedViewHeightForBubbleBar() {
    public int getExpandedViewHeightForBubbleBar(boolean isOverflow) {
        return isOverflow
                ? mOverflowHeight
                : getExpandedViewBottomForBubbleBar() - mInsets.top - mExpandedViewPadding;
    }

    /** The bottom position of the expanded view when showing above the bubble bar. */
    public int getExpandedViewBottomForBubbleBar() {
        return getAvailableRect().height()
                + mInsets.top
                - mBubbleBarSize
                - mExpandedViewPadding * 2
                - mExpandedViewPadding
                - getBubbleBarHomeAdjustment();
    }

+0 −3
Original line number Diff line number Diff line
@@ -1500,9 +1500,6 @@ public class BubbleStackView extends FrameLayout
        getViewTreeObserver().removeOnPreDrawListener(mViewUpdater);
        getViewTreeObserver().removeOnDrawListener(mSystemGestureExcludeUpdater);
        getViewTreeObserver().removeOnComputeInternalInsetsListener(this);
        if (mBubbleOverflow != null) {
            mBubbleOverflow.cleanUpExpandedState();
        }
    }

    @Override
Loading