From d6d46d1c21b36c4dbe6cab27852ddfaee49f2cc5 Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Thu, 21 Oct 2021 19:41:35 +0300 Subject: [PATCH 1/2] Avoid using setRawInputType --- .../app/features/form/FormEditTextItem.kt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt b/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt index 93973c1bdf..657c4c1b94 100644 --- a/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt +++ b/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt @@ -130,12 +130,18 @@ abstract class FormEditTextItem : VectorEpoxyModel() { * especially when we want to use a single line, we set the InputType to InputType.TYPE_CLASS_TEXT * while the default for the EditText is InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE */ - private fun configureInputType(holder: Holder) = holder.textInputEditText.setRawInputType( - inputType ?: when (singleLine) { - true -> InputType.TYPE_CLASS_TEXT - false -> InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE - } - ) + private fun configureInputType(holder: Holder) { + val newInputType = + inputType ?: when (singleLine) { + true -> InputType.TYPE_CLASS_TEXT + false -> InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE + } + + // This is a must in order to avoid extreme lag in some devices, on fast typing + if(holder.textInputEditText.inputType != newInputType){ + holder.textInputEditText.inputType = newInputType + } + } /** * Configure the imeOptions of the EditText, when imeOptions are not defined by the developer From 9d5f84b86aa7c4f528edb5aea8e6f42f104f515e Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Thu, 21 Oct 2021 20:02:21 +0300 Subject: [PATCH 2/2] Linter fixes --- .../main/java/im/vector/app/features/form/FormEditTextItem.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt b/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt index 657c4c1b94..7b7896316b 100644 --- a/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt +++ b/vector/src/main/java/im/vector/app/features/form/FormEditTextItem.kt @@ -138,7 +138,7 @@ abstract class FormEditTextItem : VectorEpoxyModel() { } // This is a must in order to avoid extreme lag in some devices, on fast typing - if(holder.textInputEditText.inputType != newInputType){ + if (holder.textInputEditText.inputType != newInputType) { holder.textInputEditText.inputType = newInputType } }