Merge "Set upper-limit for the single line edit text." into rvc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
00440b4af0
@@ -395,6 +395,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 */
|
||||
@@ -1633,6 +1636,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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user