Fix keyboard not showing up after rotation

'setInputView()' must be called on every 'onStartInputView()', not just
when the view is re-created.

This is broken since bf31872.
This commit is contained in:
Jules Aguillon 2022-12-14 14:49:35 +01:00
parent cb2ea83f8a
commit 7d6306fbc9

View File

@ -58,7 +58,6 @@ public class Keyboard2 extends InputMethodService
_config = Config.globalConfig(); _config = Config.globalConfig();
_keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard); _keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard);
_keyboardView.reset(); _keyboardView.reset();
setInputView(_keyboardView);
_debug_logs = getResources().getBoolean(R.bool.debug_logs); _debug_logs = getResources().getBoolean(R.bool.debug_logs);
} }
@ -193,8 +192,8 @@ public class Keyboard2 extends InputMethodService
} }
} }
/** Might re-create the keyboard view. [_keyboardView.setKeyboard()] must be /** Might re-create the keyboard view. [_keyboardView.setKeyboard()] and
called soon after. */ [setInputView()] must be called soon after. */
private void refresh_config() private void refresh_config()
{ {
int prev_theme = _config.theme; int prev_theme = _config.theme;
@ -204,7 +203,6 @@ public class Keyboard2 extends InputMethodService
if (prev_theme != _config.theme) if (prev_theme != _config.theme)
{ {
_keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard); _keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard);
setInputView(_keyboardView);
_emojiPane = null; _emojiPane = null;
} }
_keyboardView.reset(); _keyboardView.reset();
@ -241,6 +239,7 @@ public class Keyboard2 extends InputMethodService
refresh_special_layout(info); refresh_special_layout(info);
_keyboardView.setKeyboard(main_layout()); _keyboardView.setKeyboard(main_layout());
_keyeventhandler.started(info); _keyeventhandler.started(info);
setInputView(_keyboardView);
if (_debug_logs) if (_debug_logs)
log_editor_info(info); log_editor_info(info);
} }
@ -279,6 +278,7 @@ public class Keyboard2 extends InputMethodService
public void onSharedPreferenceChanged(SharedPreferences _prefs, String _key) public void onSharedPreferenceChanged(SharedPreferences _prefs, String _key)
{ {
refresh_config(); refresh_config();
setInputView(_keyboardView);
_keyboardView.setKeyboard(main_layout()); _keyboardView.setKeyboard(main_layout());
} }