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

Commit 15195ee5 authored by Brian Attwell's avatar Brian Attwell
Browse files

Don't pass invalid/infinite values into setScale()

Bug: 16779614
Change-Id: Ibdda90c1656e3e52ff23c84aeebd9ed32098bdb3
parent a153dba3
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -885,13 +885,18 @@ public class MultiShrinkScroller extends FrameLayout {
            return;
        }

        float ratio = (toolbarHeight  - mMinimumHeaderHeight)
        final float ratio = (toolbarHeight  - mMinimumHeaderHeight)
                / (float)(mMaximumHeaderHeight - mMinimumHeaderHeight);
        final float minimumSize = mInvisiblePlaceholderTextView.getHeight();
        final float bezierOutput = mTextSizePathInterpolator.getInterpolation(ratio);
        float bezierOutput = mTextSizePathInterpolator.getInterpolation(ratio);
        float scale = (minimumSize + (mMaximumHeaderTextSize - minimumSize) * bezierOutput)
                / mMaximumHeaderTextSize;

        // Clamp to reasonable/finite values before passing into framework. The values
        // can be wacky before the first pre-render.
        bezierOutput = (float) Math.min(bezierOutput, 1.0f);
        scale = (float) Math.min(scale, 1.0f);

        mLargeTextView.setScaleX(scale);
        mLargeTextView.setScaleY(scale);
        setInterpolatedTitleMargins(bezierOutput);