Skip to content

Commit c212c2e

Browse files
authored
Merge pull request #4306 from vector-im/feature/aris/improve_edittext_pr_4281
feature/aris/improve_edittext_pr_4281
2 parents a7d5c6a + 9d5f84b commit c212c2e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,18 @@ abstract class FormEditTextItem : VectorEpoxyModel<FormEditTextItem.Holder>() {
130130
* especially when we want to use a single line, we set the InputType to InputType.TYPE_CLASS_TEXT
131131
* while the default for the EditText is InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE
132132
*/
133-
private fun configureInputType(holder: Holder) = holder.textInputEditText.setRawInputType(
134-
inputType ?: when (singleLine) {
135-
true -> InputType.TYPE_CLASS_TEXT
136-
false -> InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE
137-
}
138-
)
133+
private fun configureInputType(holder: Holder) {
134+
val newInputType =
135+
inputType ?: when (singleLine) {
136+
true -> InputType.TYPE_CLASS_TEXT
137+
false -> InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE
138+
}
139+
140+
// This is a must in order to avoid extreme lag in some devices, on fast typing
141+
if (holder.textInputEditText.inputType != newInputType) {
142+
holder.textInputEditText.inputType = newInputType
143+
}
144+
}
139145

140146
/**
141147
* Configure the imeOptions of the EditText, when imeOptions are not defined by the developer

0 commit comments

Comments
 (0)