From 2744a24951e074f5998b808a96949c39a3e2af01 Mon Sep 17 00:00:00 2001 From: Benau Date: Tue, 28 May 2019 00:53:53 +0800 Subject: [PATCH] Don't set input type if it's the same as old one It breaks Gboard word correction if you change cursor in screen --- android/src/main/java/STKEditText.java | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/android/src/main/java/STKEditText.java b/android/src/main/java/STKEditText.java index 03087701f..0cadc85c3 100644 --- a/android/src/main/java/STKEditText.java +++ b/android/src/main/java/STKEditText.java @@ -182,27 +182,40 @@ public class STKEditText extends EditText // ------------------------------------------------------------------------ public void configType(final int type) { + int it = InputType.TYPE_CLASS_TEXT; // Check text_box_widget.hpp for definition switch (type) { case 0: - setInputType(InputType.TYPE_CLASS_TEXT); + { + it = InputType.TYPE_CLASS_TEXT; break; + } case 1: - setInputType(InputType.TYPE_CLASS_TEXT | - InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); + { + it = InputType.TYPE_CLASS_TEXT | + InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; break; + } case 2: - setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); + { + it = InputType.TYPE_TEXT_VARIATION_PASSWORD; break; + } case 3: - setInputType(InputType.TYPE_CLASS_NUMBER); + { + it = InputType.TYPE_CLASS_NUMBER; break; + } case 4: - setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); + { + it = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; break; + } default: break; } + if (it != getInputType()) + setInputType(it); } }