From 2a2393aaf9ffab363964410e346689450827fa11 Mon Sep 17 00:00:00 2001 From: sspanak Date: Wed, 3 Apr 2024 21:14:56 +0300 Subject: [PATCH] one more fix for the problem with restarting, this time is for real --- .../io/github/sspanak/tt9/ime/TypingHandler.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/github/sspanak/tt9/ime/TypingHandler.java b/app/src/main/java/io/github/sspanak/tt9/ime/TypingHandler.java index 32cd3a9d..c897bb20 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ime/TypingHandler.java +++ b/app/src/main/java/io/github/sspanak/tt9/ime/TypingHandler.java @@ -46,23 +46,25 @@ public abstract class TypingHandler extends KeyPadHandler { @Override protected boolean onStart(InputConnection connection, EditorInfo field) { - // ignore multiple calls for the same field, caused by showWindow() - // or weirdly functioning apps, such as the Qin SMS app - if (textField.equals(connection, field)) { - return false; - } + boolean restart = textField.equals(connection, field); setInputField(connection, field); // in case we are back from Settings screen, update the language list + int oldLang = mLanguage != null ? mLanguage.getId() : -1; mEnabledLanguages = settings.getEnabledLanguageIds(); mLanguage = LanguageCollection.getLanguage(getApplicationContext(), settings.getInputLanguage()); validateLanguages(); + // ignore multiple calls for the same field, caused by requestShowSelf() -> showWindow(), + // or weirdly functioning apps, such as the Qin SMS app + if (restart && oldLang == mLanguage.getId() && mInputMode.getId() == getInputModeId()) { + return false; + } + resetKeyRepeat(); mInputMode = getInputMode(); determineTextCase(); - suggestionOps.set(null); return true;