mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-04 13:50:14 +00:00
avoid accessing uninitialized RichInputMethodManager, fixes #952
This commit is contained in:
parent
e5b82b53c4
commit
9f37c5505c
2 changed files with 5 additions and 4 deletions
|
@ -122,7 +122,7 @@ sealed interface KeyData : AbstractKeyData {
|
|||
keys.add("!icon/clipboard_normal_key|!code/key_clipboard")
|
||||
if (!params.mId.mEmojiKeyEnabled && !params.mId.isNumberLayout)
|
||||
keys.add("!icon/emoji_normal_key|!code/key_emoji")
|
||||
if (!params.mId.mLanguageSwitchKeyEnabled && !params.mId.isNumberLayout && RichInputMethodManager.getInstance().canSwitchLanguage())
|
||||
if (!params.mId.mLanguageSwitchKeyEnabled && !params.mId.isNumberLayout && RichInputMethodManager.canSwitchLanguage())
|
||||
keys.add("!icon/language_switch_key|!code/key_language_switch")
|
||||
if (!params.mId.mOneHandedModeEnabled)
|
||||
keys.add("!icon/start_onehanded_mode_key|!code/key_start_onehanded")
|
||||
|
|
|
@ -360,10 +360,11 @@ public class RichInputMethodManager {
|
|||
mCurrentRichInputMethodSubtype = RichInputMethodSubtype.getRichInputMethodSubtype(subtype);
|
||||
}
|
||||
|
||||
public boolean canSwitchLanguage() {
|
||||
if (Settings.getInstance().getCurrent().mLanguageSwitchKeyToOtherSubtypes && hasMultipleEnabledSubtypesInThisIme(false))
|
||||
public static boolean canSwitchLanguage() {
|
||||
if (!isInitialized()) return false;
|
||||
if (Settings.getInstance().getCurrent().mLanguageSwitchKeyToOtherSubtypes && getInstance().hasMultipleEnabledSubtypesInThisIme(false))
|
||||
return true;
|
||||
if (Settings.getInstance().getCurrent().mLanguageSwitchKeyToOtherImes && mImm.getEnabledInputMethodList().size() > 1)
|
||||
if (Settings.getInstance().getCurrent().mLanguageSwitchKeyToOtherImes && getInstance().mImm.getEnabledInputMethodList().size() > 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue