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

Commit 305cfd26 authored by Mady Mellor's avatar Mady Mellor
Browse files

Fix dot & badge being on correct side for the first bubble added

* stackAnimationController#isStackOnLeftSide depends on the position
  being set which happens when a view gets added so we should add
  the view & then set mStackOnLeftOrWillBe
* removed unused code

Test: manual 1) have no bubbles
             2) add a bubble (needs to be on left side -- this is
                the default unless you've placed the stack on right
                side beforehand)
             => observe that the update dot & badge are on the right
                hand side of the bubble
Bug: 185438888
Change-Id: I6129aff7c352fad8d29a6c243549f0d3580d62c8
parent dd667403
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -1497,22 +1497,22 @@ public class BubbleStackView extends FrameLayout
            mStackAnimationController.setStackPosition(mPositioner.getDefaultStartPosition());
        }

        if (getBubbleCount() == 0) {
            mStackOnLeftOrWillBe = mStackAnimationController.isStackOnLeftSide();
        }

        if (bubble.getIconView() == null) {
            return;
        }

        mBubbleContainer.addView(bubble.getIconView(), 0,
                new FrameLayout.LayoutParams(mPositioner.getBubbleSize(),
                        mPositioner.getBubbleSize()));

        if (getBubbleCount() == 0) {
            mStackOnLeftOrWillBe = mStackAnimationController.isStackOnLeftSide();
        }
        // Set the dot position to the opposite of the side the stack is resting on, since the stack
        // resting slightly off-screen would result in the dot also being off-screen.
        bubble.getIconView().setDotBadgeOnLeft(!mStackOnLeftOrWillBe /* onLeft */);
        bubble.getIconView().setOnClickListener(mBubbleClickListener);
        bubble.getIconView().setOnTouchListener(mBubbleTouchListener);
        mBubbleContainer.addView(bubble.getIconView(), 0,
                new FrameLayout.LayoutParams(mPositioner.getBubbleSize(),
                        mPositioner.getBubbleSize()));
        updateBubbleShadows(false /* showForAllBubbles */);
        animateInFlyoutForBubble(bubble);
        requestUpdate();
+0 −3
Original line number Diff line number Diff line
@@ -124,9 +124,6 @@ public class StackAnimationController extends
     */
    private Rect mAnimatingToBounds = new Rect();

    /** Initial starting location for the stack. */
    @Nullable private BubbleStackView.RelativeStackPosition mStackStartPosition;

    /** Whether or not the stack's start position has been set. */
    private boolean mStackMovedToStartPosition = false;