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

Commit 96e6b8bf authored by Gilles Debunne's avatar Gilles Debunne
Browse files

Remove line height attribute from TextView.

This attribute was introduced in HC and is only partially supported. It should
actually also be used by the layout to be meaningful.

Bug 3223987

Change-Id: Idb47be319a236326f7624fd865466356c19bc342
parent 21534cfc
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -192,12 +192,6 @@ public class Switch extends CompoundButton {

        setSwitchTypefaceByIndex(typefaceIndex, styleIndex);

        int lineHeight = appearance.getDimensionPixelSize(
                com.android.internal.R.styleable.TextAppearance_textLineHeight, 0);
        if (lineHeight != 0) {
            setLineHeight(lineHeight);
        }

        appearance.recycle();
    }

+1 −31
Original line number Diff line number Diff line
@@ -766,13 +766,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                mEditTextMultilineBackground = a.getDrawable(attr);
                break;

            case com.android.internal.R.styleable.TextView_textLineHeight:
                int lineHeight = a.getDimensionPixelSize(attr, 0);
                if (lineHeight != 0) {
                    setLineHeight(lineHeight);
                }
                break;

            case com.android.internal.R.styleable.TextView_textIsSelectable:
                mTextIsSelectable = a.getBoolean(attr, false);
                break;
@@ -1133,15 +1126,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
     * within the text can cause individual lines to be taller or shorter
     * than this height, and the layout may contain additional first-
     * or last-line padding.
     *
     * @attr ref android.R.styleable#TextView_textLineHeight
     */
    public int getLineHeight() {
        if (mLineHeight != 0) {
            return mLineHeight;
        }
        return FastMath.round(mTextPaint.getFontMetricsInt(null) * mSpacingMult
                          + mSpacingAdd);
        return FastMath.round(mTextPaint.getFontMetricsInt(null) * mSpacingMult + mSpacingAdd);
    }

    /**
@@ -1728,25 +1715,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

        setTypefaceByIndex(typefaceIndex, styleIndex);
        
        int lineHeight = appearance.getDimensionPixelSize(
                com.android.internal.R.styleable.TextAppearance_textLineHeight, 0);
        if (lineHeight != 0) {
            setLineHeight(lineHeight);
        }

        appearance.recycle();
    }

    /**
     * Set the height of a line of text in pixels. This value will override line height
     * values stored in the font modified by lineSpacingExtra and lineSpacingMultiplier.
     *
     * @param lineHeight Desired height of a single line of text in pixels
     */
    public void setLineHeight(int lineHeight) {
        mLineHeight = lineHeight;
    }

    /**
     * @return the size (in pixels) of the default text size in this TextView.
     */
@@ -9393,7 +9364,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

    private float                   mSpacingMult = 1;
    private float                   mSpacingAdd = 0;
    private int                     mLineHeight = 0;
    private boolean                 mTextIsSelectable = false;

    private static final int        LINES = 1;
+1 −9
Original line number Diff line number Diff line
@@ -722,9 +722,6 @@
    <!-- Color of link text (URLs). -->
    <attr name="textColorLink" format="reference|color" />

    <!-- Height of a line of text. -->
    <attr name="textLineHeight" format="dimension" />

    <!-- Indicates that the content of a non-editable TextView can be selected.
     Default value is false. EditText content is always selectable. -->
    <attr name="textIsSelectable" format="boolean" />
@@ -2429,8 +2426,6 @@
        <attr name="textColorHint" />
        <!-- Color of the links. -->
        <attr name="textColorLink" />
        <!-- Height of a single line of text. -->
        <attr name="textLineHeight" />
    </declare-styleable>
    <declare-styleable name="TextSwitcher">
    </declare-styleable>
@@ -2672,10 +2667,7 @@
        <attr name="textEditPasteWindowLayout" />
        <!-- Variation of textEditPasteWindowLayout displayed when the clipboard is empty. -->
        <attr name="textEditNoPasteWindowLayout" />

        <!-- Height of a line of text. -->
        <attr name="textLineHeight" />
        <!-- Indicates that a non-editable text can be selected. -->
        <!-- Indicates that the content of a non-editable text can be selected. -->
        <attr name="textIsSelectable" />
        <!--  A specific background drawable used by multi-line EditText only. -->
        <attr name="multilineBackground" format="reference"/>
+0 −1
Original line number Diff line number Diff line
@@ -1358,7 +1358,6 @@
  <public type="attr" name="loopViews" />
  <public type="attr" name="dialogTheme" />
  <public type="attr" name="alertDialogTheme" />
  <public type="attr" name="textLineHeight" />
  <public type="attr" name="dividerVertical" />
  <public type="attr" name="homeAsUpIndicator" />
  <public type="attr" name="enterFadeDuration" />