Fix swipe trail disappearing on theme change

This commit is contained in:
Aleksandras Kostarevas 2024-04-22 00:45:46 -04:00
parent d62b733412
commit 43984a6a76
2 changed files with 18 additions and 10 deletions

View File

@ -95,6 +95,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
if (themeUpdated && mKeyboardView != null) { if (themeUpdated && mKeyboardView != null) {
((LatinIME)mLatinIMELegacy.getInputMethodService()).updateLegacyView(onCreateInputView( ((LatinIME)mLatinIMELegacy.getInputMethodService()).updateLegacyView(onCreateInputView(
displayContext, mIsHardwareAcceleratedDrawingEnabled)); displayContext, mIsHardwareAcceleratedDrawingEnabled));
mLatinIMELegacy.updateMainKeyboardViewSettings();
} }
} }

View File

@ -943,6 +943,22 @@ public class LatinIMELegacy implements KeyboardActionListener,
mHandler.postSwitchLanguage(newSubtype); 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") @SuppressWarnings("deprecation")
void onStartInputViewInternal(final EditorInfo editorInfo, final boolean restarting) { void onStartInputViewInternal(final EditorInfo editorInfo, final boolean restarting) {
mDictionaryFacilitator.onStartInput(); mDictionaryFacilitator.onStartInput();
@ -1098,16 +1114,7 @@ public class LatinIMELegacy implements KeyboardActionListener,
mHandler.cancelUpdateSuggestionStrip(); mHandler.cancelUpdateSuggestionStrip();
mainKeyboardView.setMainDictionaryAvailability( updateMainKeyboardViewSettings();
mDictionaryFacilitator.hasAtLeastOneInitializedMainDictionary());
mainKeyboardView.setKeyPreviewPopupEnabled(currentSettingsValues.mKeyPreviewPopupOn,
currentSettingsValues.mKeyPreviewPopupDismissDelay);
mainKeyboardView.setSlidingKeyInputPreviewEnabled(
currentSettingsValues.mSlidingKeyInputPreviewEnabled);
mainKeyboardView.setGestureHandlingEnabledByUser(
currentSettingsValues.mGestureInputEnabled,
currentSettingsValues.mGestureTrailEnabled,
currentSettingsValues.mGestureFloatingPreviewTextEnabled);
if (TRACE) Debug.startMethodTracing("/data/trace/latinime"); if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
} }