mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-19 13:49:13 +00:00
stick to language key setting
don't show langauge switch key in comma popups when there is nothing to switch fixes #897
This commit is contained in:
parent
6e520bf84c
commit
d0983e6c3b
4 changed files with 17 additions and 6 deletions
|
@ -18,6 +18,7 @@ import helium314.keyboard.keyboard.internal.KeyboardParams
|
|||
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyCode.checkAndConvertCode
|
||||
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyLabel.convertFlorisLabel
|
||||
import helium314.keyboard.keyboard.internal.keyboard_parser.floris.KeyLabel.rtlLabel
|
||||
import helium314.keyboard.latin.RichInputMethodManager
|
||||
import helium314.keyboard.latin.common.Constants
|
||||
import helium314.keyboard.latin.common.LocaleUtils.constructLocale
|
||||
import helium314.keyboard.latin.common.StringUtils
|
||||
|
@ -121,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)
|
||||
if (!params.mId.mLanguageSwitchKeyEnabled && !params.mId.isNumberLayout && RichInputMethodManager.getInstance().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")
|
||||
|
|
|
@ -1412,10 +1412,11 @@ public class LatinIME extends InputMethodService implements
|
|||
if (switchIme && !switchSubtype && switchInputMethod())
|
||||
return;
|
||||
final boolean hasMoreThanOneSubtype = mRichImm.getMyEnabledInputMethodSubtypeList(false).size() > 1;
|
||||
// switch subtype if wanted and possible
|
||||
if (switchSubtype && !switchIme && hasMoreThanOneSubtype) {
|
||||
// switch to previous subtype if current one was used, otherwise cycle through list
|
||||
mSubtypeState.switchSubtype(mRichImm);
|
||||
// switch subtype if wanted, do nothing if no other subtype is available
|
||||
if (switchSubtype && !switchIme) {
|
||||
if (hasMoreThanOneSubtype)
|
||||
// switch to previous subtype if current one was used, otherwise cycle through list
|
||||
mSubtypeState.switchSubtype(mRichImm);
|
||||
return;
|
||||
}
|
||||
// language key set to switch both, or language key is not shown on keyboard -> switch both
|
||||
|
|
|
@ -360,6 +360,14 @@ public class RichInputMethodManager {
|
|||
mCurrentRichInputMethodSubtype = RichInputMethodSubtype.getRichInputMethodSubtype(subtype);
|
||||
}
|
||||
|
||||
public boolean canSwitchLanguage() {
|
||||
if (Settings.getInstance().getCurrent().mLanguageSwitchKeyToOtherSubtypes && hasMultipleEnabledSubtypesInThisIme(false))
|
||||
return true;
|
||||
if (Settings.getInstance().getCurrent().mLanguageSwitchKeyToOtherImes && mImm.getEnabledInputMethodList().size() > 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// todo: is shortcutIme only voice input, or can it be something else?
|
||||
// if always voice input, rename it and other things like mHasShortcutKey
|
||||
private void updateShortcutIme() {
|
||||
|
|
|
@ -77,7 +77,8 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
|||
if (key == null) return;
|
||||
switch (key) {
|
||||
case Settings.PREF_POPUP_KEYS_ORDER, Settings.PREF_SHOW_POPUP_HINTS, Settings.PREF_SHOW_NUMBER_ROW,
|
||||
Settings.PREF_POPUP_KEYS_LABELS_ORDER -> mReloadKeyboard = true;
|
||||
Settings.PREF_POPUP_KEYS_LABELS_ORDER, Settings.PREF_LANGUAGE_SWITCH_KEY,
|
||||
Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY -> mReloadKeyboard = true;
|
||||
case Settings.PREF_LOCALIZED_NUMBER_ROW -> KeyboardLayoutSet.onSystemLocaleChanged();
|
||||
case Settings.PREF_SHOW_HINTS
|
||||
-> findPreference(Settings.PREF_POPUP_KEYS_LABELS_ORDER).setVisible(prefs.getBoolean(Settings.PREF_SHOW_HINTS, false));
|
||||
|
|
Loading…
Add table
Reference in a new issue