From fb26eb8e7ae618bea9c40cfaf6ff38f2c18401c7 Mon Sep 17 00:00:00 2001 From: Helium314 Date: Sun, 26 May 2024 19:34:55 +0200 Subject: [PATCH] fix inconsistent behavior when switching text fields actually the previous input attributes were used initially, which caused suggestions to show up or not depending on the previously selected field moving the settings reload should be safe, at least i checked for potential issues --- .../java/helium314/keyboard/latin/LatinIME.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/helium314/keyboard/latin/LatinIME.java b/app/src/main/java/helium314/keyboard/latin/LatinIME.java index 84a41d6ef..82e19e796 100644 --- a/app/src/main/java/helium314/keyboard/latin/LatinIME.java +++ b/app/src/main/java/helium314/keyboard/latin/LatinIME.java @@ -947,6 +947,13 @@ public class LatinIME extends InputMethodService implements // Note: This call should be done by InputMethodService? updateFullscreenMode(); + // we need to reload the setting before using them, e.g. in startInput or in postResumeSuggestions + // not sure why it was further below, but this introduced inconsistent behavior where wrong input attributes were used + if (isDifferentTextField || + !currentSettingsValues.hasSameOrientation(getResources().getConfiguration())) { + loadSettings(); + currentSettingsValues = mSettings.getCurrent(); + } // ALERT: settings have not been reloaded and there is a chance they may be stale. // In the practice, if it is, we should have gotten onConfigurationChanged so it should // be fine, but this is horribly confusing and must be fixed AS SOON AS POSSIBLE. @@ -990,14 +997,8 @@ public class LatinIME extends InputMethodService implements needToCallLoadKeyboardLater = false; } - if (isDifferentTextField || - !currentSettingsValues.hasSameOrientation(getResources().getConfiguration())) { - loadSettings(); - } if (isDifferentTextField) { mainKeyboardView.closing(); - currentSettingsValues = mSettings.getCurrent(); - if (currentSettingsValues.mAutoCorrectEnabled) { suggest.setAutoCorrectionThreshold(currentSettingsValues.mAutoCorrectionThreshold); }