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

Commit cf7c1ae8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Protect against NaN in flyout collapses." into qt-r1-bubbles-dev

parents 32ba8ad5 8e05aab5
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -276,6 +276,13 @@ public class BubbleFlyoutView extends FrameLayout {

    /** Sets the percentage that the flyout should be collapsed into dot form. */
    void setCollapsePercent(float percentCollapsed) {
        // This is unlikely, but can happen in a race condition where the flyout view hasn't been
        // laid out and returns 0 for getWidth(). We check for this condition at the sites where
        // this method is called, but better safe than sorry.
        if (Float.isNaN(percentCollapsed)) {
            return;
        }

        mPercentTransitionedToDot = Math.max(0f, Math.min(percentCollapsed, 1f));
        mPercentStillFlyout = (1f - mPercentTransitionedToDot);

+6 −1
Original line number Diff line number Diff line
@@ -1084,6 +1084,12 @@ public class BubbleStackView extends FrameLayout {
    }

    void onFlyoutDragged(float deltaX) {
        // This shouldn't happen, but if it does, just wait until the flyout lays out. This method
        // is continually called.
        if (mFlyout.getWidth() <= 0) {
            return;
        }

        final boolean onLeft = mStackAnimationController.isStackOnLeftSide();
        mFlyoutDragDeltaX = deltaX;

@@ -1102,7 +1108,6 @@ public class BubbleStackView extends FrameLayout {
            // after it has already become the dot.
            final boolean overscrollingLeft =
                    (onLeft && collapsePercent > 1f) || (!onLeft && collapsePercent < 0f);

            overscrollTranslation =
                    (overscrollingPastDot ? collapsePercent - 1f : collapsePercent * -1)
                            * (overscrollingLeft ? -1 : 1)