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

Commit f03b7543 authored by Mihai Popa's avatar Mihai Popa
Browse files

Allow 0sp text size in xml for TextView

Before this CL, when TextView's textSize attribute was set to 0sp in
XML, the text would still be visible on the screen, as the actual
textSize set was non zero. On the other hand, if the text size was set
to 0sp programmatically, the text would not be visible. This was a P
regression, as on O the text would be invisible in both cases.

This CL fixes the attribute reading stage in TextView, allowing the
application of a 0 text size on the view.

Bug: 110251171
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I3798361e182f45a67cd0a69d40e09e559375aa20
parent ce774071
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3451,7 +3451,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        ColorStateList mTextColor = null;
        ColorStateList mTextColorHint = null;
        ColorStateList mTextColorLink = null;
        int mTextSize = 0;
        int mTextSize = -1;
        String mFontFamily = null;
        Typeface mFontTypeface = null;
        boolean mFontFamilyExplicit = false;
@@ -3662,7 +3662,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            setHighlightColor(attributes.mTextColorHighlight);
        }

        if (attributes.mTextSize != 0) {
        if (attributes.mTextSize != -1) {
            setRawTextSize(attributes.mTextSize, true /* shouldRequestLayout */);
        }