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

Commit 36325fd9 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Check that a bubble exists before reordering it

This avoids re-adding bubbles that have already been removed
after dismissing multiple bubbles at once.

Fixes: 291738088
Test: Manual
      - Add 2 bubbles A and B to the bubble bar
      - Expand the bubble bar
      - Tap 3 dot menu and dismiss
      - Repeat for the next bubble
      - Observe that bubble bar is gone
      - Add a new bubble C
      - Observe that the bubble bar contains only bubble C
Change-Id: Id53811a103d245647489ab8d442cbb2004e0e700
parent f351e515
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -306,7 +306,10 @@ public class BubbleBarView extends FrameLayout {
        if (!isExpanded()) {
            for (int i = 0; i < viewOrder.size(); i++) {
                View child = viewOrder.get(i);
                if (child != null) {
                // this child view may have already been removed so verify that it still exists
                // before reordering it, otherwise it will be re-added.
                int indexOfChild = indexOfChild(child);
                if (child != null && indexOfChild >= 0) {
                    removeViewInLayout(child);
                    addViewInLayout(child, i, child.getLayoutParams());
                }