Loading core/java/android/widget/TextView.java +9 −0 Original line number Diff line number Diff line Loading @@ -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 */ Loading Loading @@ -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 { Loading core/res/res/values/attrs.xml +6 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading
core/java/android/widget/TextView.java +9 −0 Original line number Diff line number Diff line Loading @@ -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 */ Loading Loading @@ -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 { Loading
core/res/res/values/attrs.xml +6 −1 Original line number Diff line number Diff line Loading @@ -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 Loading