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

Commit 0f083774 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Fix bubble translation x when bar is collapsed

Previously the translation x value for bubbles when the bar is
collapsed and on the right was 0 for the first bubble and some
fixed value for the rest of the bubbles. But if only 1 bubble
is visible when the bar is collapsed, as in the case when there
is only 1 bubble and the overflow, this ends up pushing the
overflow too far to the right.

This change updates the translation x value for bubbles when the
bar is collapsed and on the right, so that if only 1 bubble is
visible when collapsed, all bubbles have tx 0, otherwise if 2
bubbles are visible, the first has tx 0 and the rest have the same
tx value.

Flag: com.android.wm.shell.enable_bubble_bar
Fixes: 350962159
Test: manual
       - Add 1 bubble to the bubble bar
       - Make sure bubble bar is on the right
       - Expand and collapse the bar
       - Observe the overflow tx value is correct during the animation
Change-Id: I8401d70fa6f374ace58d9cdbe3302e39e7aedc70
parent 892d3583
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -979,8 +979,7 @@ public class BubbleBarView extends FrameLayout {
        return translationX - getScaleIconShift();
        return translationX - getScaleIconShift();
    }
    }


    private float getCollapsedBubbleTranslationX(int bubbleIndex, int bubbleCount,
    private float getCollapsedBubbleTranslationX(int bubbleIndex, int bubbleCount, boolean onLeft) {
            boolean onLeft) {
        if (bubbleIndex < 0 || bubbleIndex >= bubbleCount) {
        if (bubbleIndex < 0 || bubbleIndex >= bubbleCount) {
            return 0;
            return 0;
        }
        }
@@ -991,7 +990,9 @@ public class BubbleBarView extends FrameLayout {
                    bubbleIndex == 0 && bubbleCount > MAX_VISIBLE_BUBBLES_COLLAPSED
                    bubbleIndex == 0 && bubbleCount > MAX_VISIBLE_BUBBLES_COLLAPSED
                            ? mIconOverlapAmount : 0);
                            ? mIconOverlapAmount : 0);
        } else {
        } else {
            translationX = mBubbleBarPadding + (bubbleIndex == 0 ? 0 : mIconOverlapAmount);
            translationX = mBubbleBarPadding + (
                    bubbleIndex == 0 || bubbleCount <= MAX_VISIBLE_BUBBLES_COLLAPSED
                            ? 0 : mIconOverlapAmount);
        }
        }
        return translationX - getScaleIconShift();
        return translationX - getScaleIconShift();
    }
    }