diff --git a/CHANGELOG b/CHANGELOG index 8dea9df68..74bbd12d6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ KeePassDX(4.5.0_beta04) * Fix exception during template selection #2617 * Fix autoscrolls to TOTP section #2621 * Fix comparator in SortedList #2630 + * Fix special character input in entry fields #2632 KeePassDX(4.5.0_beta03) * Fix URL actions #2604 diff --git a/app/src/main/java/com/kunzisoft/keepass/view/TextEditFieldView.kt b/app/src/main/java/com/kunzisoft/keepass/view/TextEditFieldView.kt index ecf60b921..c0afec66e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/view/TextEditFieldView.kt +++ b/app/src/main/java/com/kunzisoft/keepass/view/TextEditFieldView.kt @@ -45,7 +45,7 @@ open class TextEditFieldView @JvmOverloads constructor( layoutParams = LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT) - inputType = EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS + inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { imeOptions = EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING importantForAutofill = IMPORTANT_FOR_AUTOFILL_NO @@ -147,18 +147,12 @@ open class TextEditFieldView @JvmOverloads constructor( fun setMaxLines(numberLines: Int) { when { numberLines == 1 -> { - valueView.inputType = valueView.inputType or - InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_NORMAL + valueView.inputType = (valueView.inputType and InputType.TYPE_TEXT_FLAG_MULTI_LINE.inv()) or + InputType.TYPE_CLASS_TEXT valueView.maxLines = 1 } - numberLines <= 0 -> { - valueView.inputType = valueView.inputType or - InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE - valueView.maxLines = MAX_LINES_LIMIT - } else -> { - @Suppress("KotlinConstantConditions") - val lines = if (numberLines > MAX_LINES_LIMIT) MAX_LINES_LIMIT else numberLines + val lines = if (numberLines !in 1..MAX_LINES_LIMIT) MAX_LINES_LIMIT else numberLines valueView.inputType = valueView.inputType or InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE valueView.maxLines = lines @@ -185,12 +179,19 @@ open class TextEditFieldView @JvmOverloads constructor( } override fun changeProtectedValueParameters(shouldRequestFocus: Boolean) { - if (isRevealed()) { - valueView.inputType = valueView.inputType or InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD - valueView.transformationMethod = SingleLineTransformationMethod.getInstance() + if (isProtected) { + if (isRevealed()) { + valueView.inputType = (valueView.inputType and InputType.TYPE_MASK_VARIATION.inv()) or + InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD + valueView.transformationMethod = SingleLineTransformationMethod.getInstance() + } else { + valueView.inputType = (valueView.inputType and InputType.TYPE_MASK_VARIATION.inv()) or + InputType.TYPE_TEXT_VARIATION_PASSWORD + valueView.transformationMethod = PasswordTransformationMethod.getInstance() + } } else { - valueView.inputType = valueView.inputType or InputType.TYPE_TEXT_VARIATION_PASSWORD - valueView.transformationMethod = PasswordTransformationMethod.getInstance() + valueView.inputType = valueView.inputType and InputType.TYPE_MASK_VARIATION.inv() + valueView.transformationMethod = if (valueView.maxLines > 1) null else SingleLineTransformationMethod.getInstance() } if (shouldRequestFocus) valueView.requestFocus() diff --git a/app/src/main/java/com/kunzisoft/keepass/view/TextSelectFieldView.kt b/app/src/main/java/com/kunzisoft/keepass/view/TextSelectFieldView.kt index 8c7de094d..c216c85f1 100644 --- a/app/src/main/java/com/kunzisoft/keepass/view/TextSelectFieldView.kt +++ b/app/src/main/java/com/kunzisoft/keepass/view/TextSelectFieldView.kt @@ -51,7 +51,7 @@ class TextSelectFieldView @JvmOverloads constructor(context: Context, layoutParams = LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT) - inputType = EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS + inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { imeOptions = EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING importantForAutofill = IMPORTANT_FOR_AUTOFILL_NO diff --git a/fastlane/metadata/android/en-US/changelogs/45004.txt b/fastlane/metadata/android/en-US/changelogs/45004.txt index a5a0daec8..79dd32d26 100644 --- a/fastlane/metadata/android/en-US/changelogs/45004.txt +++ b/fastlane/metadata/android/en-US/changelogs/45004.txt @@ -1,3 +1,4 @@ * Fix exception during template selection #2617 * Fix autoscrolls to TOTP section #2621 - * Fix comparator in SortedList #2630 \ No newline at end of file + * Fix comparator in SortedList #2630 + * Fix special character input in entry fields #2632 \ No newline at end of file diff --git a/fastlane/metadata/android/fr-FR/changelogs/45004.txt b/fastlane/metadata/android/fr-FR/changelogs/45004.txt index 8423bde90..792ac71e9 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/45004.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/45004.txt @@ -1,3 +1,4 @@ * Correction de l'exception pendant la sélection du gabarit #2617 * Correction des défilements vers le champ OTP #2621 - * Correction des comparateurs dans les SortedList #2630 \ No newline at end of file + * Correction des comparateurs dans les SortedList #2630 + * Correction des caractères spéciaux dans les champs d'entrée #2632 \ No newline at end of file