From 43984a6a769816ede2f96115fa8c5dcb7f3ae656 Mon Sep 17 00:00:00 2001 From: Aleksandras Kostarevas Date: Mon, 22 Apr 2024 00:45:46 -0400 Subject: [PATCH] Fix swipe trail disappearing on theme change --- .../keyboard/KeyboardSwitcher.java | 1 + .../inputmethod/latin/LatinIMELegacy.java | 27 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/java/src/org/futo/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/org/futo/inputmethod/keyboard/KeyboardSwitcher.java index 0ada491ee..f63c29549 100644 --- a/java/src/org/futo/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/org/futo/inputmethod/keyboard/KeyboardSwitcher.java @@ -95,6 +95,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { if (themeUpdated && mKeyboardView != null) { ((LatinIME)mLatinIMELegacy.getInputMethodService()).updateLegacyView(onCreateInputView( displayContext, mIsHardwareAcceleratedDrawingEnabled)); + mLatinIMELegacy.updateMainKeyboardViewSettings(); } } diff --git a/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java b/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java index e00907cbd..fcd521e11 100644 --- a/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java +++ b/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java @@ -943,6 +943,22 @@ public class LatinIMELegacy implements KeyboardActionListener, mHandler.postSwitchLanguage(newSubtype); } + public void updateMainKeyboardViewSettings() { + final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); + SettingsValues currentSettingsValues = mSettings.getCurrent(); + + mainKeyboardView.setMainDictionaryAvailability( + mDictionaryFacilitator.hasAtLeastOneInitializedMainDictionary()); + mainKeyboardView.setKeyPreviewPopupEnabled(currentSettingsValues.mKeyPreviewPopupOn, + currentSettingsValues.mKeyPreviewPopupDismissDelay); + mainKeyboardView.setSlidingKeyInputPreviewEnabled( + currentSettingsValues.mSlidingKeyInputPreviewEnabled); + mainKeyboardView.setGestureHandlingEnabledByUser( + currentSettingsValues.mGestureInputEnabled, + currentSettingsValues.mGestureTrailEnabled, + currentSettingsValues.mGestureFloatingPreviewTextEnabled); + } + @SuppressWarnings("deprecation") void onStartInputViewInternal(final EditorInfo editorInfo, final boolean restarting) { mDictionaryFacilitator.onStartInput(); @@ -1098,16 +1114,7 @@ public class LatinIMELegacy implements KeyboardActionListener, mHandler.cancelUpdateSuggestionStrip(); - mainKeyboardView.setMainDictionaryAvailability( - mDictionaryFacilitator.hasAtLeastOneInitializedMainDictionary()); - mainKeyboardView.setKeyPreviewPopupEnabled(currentSettingsValues.mKeyPreviewPopupOn, - currentSettingsValues.mKeyPreviewPopupDismissDelay); - mainKeyboardView.setSlidingKeyInputPreviewEnabled( - currentSettingsValues.mSlidingKeyInputPreviewEnabled); - mainKeyboardView.setGestureHandlingEnabledByUser( - currentSettingsValues.mGestureInputEnabled, - currentSettingsValues.mGestureTrailEnabled, - currentSettingsValues.mGestureFloatingPreviewTextEnabled); + updateMainKeyboardViewSettings(); if (TRACE) Debug.startMethodTracing("/data/trace/latinime"); }