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

Commit d946b24e authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Inflate bubble promoted from overflow"

parents 29aa0e81 1e19d7fe
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -226,6 +226,10 @@ class Bubble {
        mIconView.update(this);
    }

    void setInflated(boolean inflated) {
        mInflated = inflated;
    }

    /**
     * Set visibility of bubble in the expanded state.
     *
+2 −1
Original line number Diff line number Diff line
@@ -749,7 +749,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
    }

    void promoteBubbleFromOverflow(Bubble bubble) {
        mBubbleData.promoteBubbleFromOverflow(bubble);
        bubble.setInflateSynchronously(mInflateSynchronously);
        mBubbleData.promoteBubbleFromOverflow(bubble, mStackView, mBubbleIconFactory);
    }

    /**
+15 −6
Original line number Diff line number Diff line
@@ -199,16 +199,21 @@ public class BubbleData {
        dispatchPendingChanges();
    }

    public void promoteBubbleFromOverflow(Bubble bubble) {
    public void promoteBubbleFromOverflow(Bubble bubble, BubbleStackView stack,
            BubbleIconFactory factory) {
        if (DEBUG_BUBBLE_DATA) {
            Log.d(TAG, "promoteBubbleFromOverflow: " + bubble);
        }
        mOverflowBubbles.remove(bubble);
        doAdd(bubble);
        setSelectedBubbleInternal(bubble);

        // Preserve new order for next repack, which sorts by last updated time.
        bubble.markUpdatedAt(mTimeSource.currentTimeMillis());
        trim();
        setSelectedBubbleInternal(bubble);
        mOverflowBubbles.remove(bubble);

        bubble.inflate(
                b -> notificationEntryUpdated(bubble, /* suppressFlyout */
                        false, /* showInShade */ true),
                mContext, stack, factory);
        dispatchPendingChanges();
    }

@@ -445,6 +450,10 @@ public class BubbleData {
            mOverflowBubbles.add(0, bubbleToRemove);
            if (mOverflowBubbles.size() == mMaxOverflowBubbles + 1) {
                // Remove oldest bubble.
                if (DEBUG_BUBBLE_DATA) {
                    Log.d(TAG, "Overflow full. Remove bubble: " + mOverflowBubbles.get(
                            mOverflowBubbles.size() - 1));
                }
                mOverflowBubbles.remove(mOverflowBubbles.size() - 1);
            }
        }
@@ -511,7 +520,7 @@ public class BubbleData {
        if (Objects.equals(bubble, mSelectedBubble)) {
            return;
        }
        if (bubble != null && !mBubbles.contains(bubble)) {
        if (bubble != null && !mBubbles.contains(bubble) && !mOverflowBubbles.contains(bubble)) {
            Log.e(TAG, "Cannot select bubble which doesn't exist!"
                    + " (" + bubble + ") bubbles=" + mBubbles);
            return;
+1 −0
Original line number Diff line number Diff line
@@ -795,6 +795,7 @@ public class BubbleStackView extends FrameLayout {
        if (removedIndex >= 0) {
            mBubbleContainer.removeViewAt(removedIndex);
            bubble.cleanupExpandedState();
            bubble.setInflated(false);
            logBubbleEvent(bubble, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED);
        } else {
            Log.d(TAG, "was asked to remove Bubble, but didn't find the view! " + bubble);