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

Commit 3d6153d0 authored by Seigo Nonaka's avatar Seigo Nonaka Committed by Android (Google) Code Review
Browse files

Merge "Set upper-limit for the single line edit text."

parents 503f89f3 9140d2b2
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -396,6 +396,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    private static final int EMS = LINES;
    private static final int PIXELS = 2;
    // Maximum text length for single line input.
    private static final int MAX_LENGTH_FOR_SINGLE_LINE_EDIT_TEXT = 5000;
    private static final RectF TEMP_RECTF = new RectF();
    /** @hide */
@@ -1643,6 +1646,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            setTransformationMethod(PasswordTransformationMethod.getInstance());
        }
        // For addressing b/145128646
        // For the performance reason, we limit characters for single line text field.
        if (bufferType == BufferType.EDITABLE && singleLine && maxlength == -1) {
            maxlength = MAX_LENGTH_FOR_SINGLE_LINE_EDIT_TEXT;
        }
        if (maxlength >= 0) {
            setFilters(new InputFilter[] { new InputFilter.LengthFilter(maxlength) });
        } else {
+6 −1
Original line number Diff line number Diff line
@@ -1259,7 +1259,12 @@
        <!-- Can be combined with <var>text</var> and its variations to
             allow multiple lines of text in the field.  If this flag is not set,
             the text field will be constrained to a single line.  Corresponds to
             {@link android.text.InputType#TYPE_TEXT_FLAG_MULTI_LINE}. -->
             {@link android.text.InputType#TYPE_TEXT_FLAG_MULTI_LINE}.

             Note: If this flag is not set and the text field doesn't have max length limit, the
             framework automatically set maximum length of the characters to 5000 for the
             performance reasons.
             -->
        <flag name="textMultiLine" value="0x00020001" />
        <!-- Can be combined with <var>text</var> and its variations to
             indicate that though the regular text view should not be multiple