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

Commit 549482bf authored by Andrei Stingaceanu's avatar Andrei Stingaceanu
Browse files

AutoSize TextView - fix measurements

The BoringLayout measurements for auto-size are
incorrect. Removed those and kept the StaticLayout
measurements.

Bug: 36940118
Test: cts-tradefed run cts-dev -m CtsWidgetTestCases -t\
      android.widget.cts.TextViewTest

Change-Id: I772ade08ed26efac05ca56cb7df8cfec0327633b
parent eca0d421
Loading
Loading
Loading
Loading
+22 −28
Original line number Diff line number Diff line
@@ -8148,11 +8148,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        mTempTextPaint.set(getPaint());
        mTempTextPaint.setTextSize(suggestedSizeInPx);

        if ((mLayout instanceof BoringLayout) && BoringLayout.isBoring(
                text, mTempTextPaint, getTextDirectionHeuristic(), mBoring) != null) {
            return mTempTextPaint.getFontSpacing() <= availableSpace.bottom
                    && mTempTextPaint.measureText(text, 0, text.length()) <= availableSpace.right;
        } else {
        final StaticLayout.Builder layoutBuilder = StaticLayout.Builder.obtain(
                text, 0, text.length(),  mTempTextPaint,
                getMeasuredWidth() - getTotalPaddingLeft() - getTotalPaddingRight());
@@ -8177,7 +8172,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        if (layout.getHeight() > availableSpace.bottom) {
            return false;
        }
        }

        return true;
    }