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

Commit adb6d81b authored by Mady Mellor's avatar Mady Mellor
Browse files

Only reorder bubbles if the position is different

This was be run needlessly during an insets change event while
bubbles were being collapsed, this causes a jump in the animation.

To fix, let's skip the reorder if it's not necessary.

Additionally, the reorder code path would trigger updating the bubble
positions -- this is needed after an orientation change, and was
happening after the overflow was reordered as a side effect. Now
that we're skipping needless reorders, this doesn't happen so a call
is added to explicitly update the positions of the bubbles after
the orientation change to fix it.

Bug: 318704215
Test: manual - have a bubble that hides the nav bar when its opened
             - move the bubble to a non-default location
             - expand and collapse the bubble
             => observe when collapsing the animation looks fine
             - have multiple bubbles, expand them, rotate the device
             => observe that the positions are correct
Change-Id: I6c2d83d54d05260bc221c5d24622cdaaa1f7f467
parent 723bced5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1025,6 +1025,7 @@ public class BubbleStackView extends FrameLayout
                            WindowManager.class)));
                    onDisplaySizeChanged();
                    mExpandedAnimationController.updateResources();
                    mExpandedAnimationController.onOrientationChanged();
                    mStackAnimationController.updateResources();
                    mBubbleOverflow.updateResources();

+8 −0
Original line number Diff line number Diff line
@@ -614,6 +614,14 @@ public class ExpandedAnimationController
        }
    }

    /**
     * Call to update the bubble positions after an orientation change.
     */
    public void onOrientationChanged() {
        if (mLayout == null) return;
        updateBubblePositions();
    }

    private void updateBubblePositions() {
        if (mAnimatingExpand || mAnimatingCollapse) {
            return;
+2 −0
Original line number Diff line number Diff line
@@ -378,6 +378,8 @@ public class PhysicsAnimationLayout extends FrameLayout {
        }
        final int oldIndex = indexOfChild(view);

        if (oldIndex == index) return;

        super.removeView(view);
        if (view.getParent() != null) {
            // View still has a parent. This could have been added as a transient view.