diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardSwitcher.java b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardSwitcher.java index d0dae53d3..c42cdeabf 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardSwitcher.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardSwitcher.java @@ -86,11 +86,12 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { public void updateKeyboardTheme(@NonNull Context displayContext) { final boolean themeUpdated = updateKeyboardThemeAndContextThemeWrapper( - displayContext, KeyboardTheme.getKeyboardTheme(displayContext /* context */)); - if (themeUpdated && mKeyboardView != null) { + displayContext, KeyboardTheme.getKeyboardTheme(displayContext)); + if (themeUpdated) { Settings settings = Settings.getInstance(); settings.loadSettings(displayContext, settings.getCurrent().mLocale, settings.getCurrent().mInputAttributes); - mLatinIME.setInputView(onCreateInputView(displayContext, mIsHardwareAcceleratedDrawingEnabled)); + if (mKeyboardView != null) + mLatinIME.setInputView(onCreateInputView(displayContext, mIsHardwareAcceleratedDrawingEnabled)); } } @@ -102,6 +103,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { final KeyboardTheme keyboardTheme) { final boolean nightModeChanged = (mCurrentUiMode & Configuration.UI_MODE_NIGHT_MASK) != (context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK); + Log.d(TAG, "old ui mode "+ mCurrentUiMode+", new ui mode "+context.getResources().getConfiguration().uiMode); if (mThemeContext == null || !keyboardTheme.equals(mKeyboardTheme) || nightModeChanged || !mThemeContext.getResources().equals(context.getResources()) || Settings.getInstance().getCurrent().mColors.haveColorsChanged(context)) { diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/LatinIME.java b/app/src/main/java/org/dslul/openboard/inputmethod/latin/LatinIME.java index 8b09cbf61..e2b3bd529 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/LatinIME.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/LatinIME.java @@ -815,7 +815,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen @Override public void onInitializeInterface() { mDisplayContext = getDisplayContext(); - Log.d(TAG, "onInitializeInterface -> possibly configuration changed"); + Log.d(TAG, "onInitializeInterface"); mKeyboardSwitcher.updateKeyboardTheme(mDisplayContext); }