Disable globe key by default

This commit is contained in:
Aleksandras Kostarevas 2023-10-13 21:40:06 +03:00
parent 92480fd460
commit ec7cae6bbf
6 changed files with 14 additions and 11 deletions

View File

@ -1362,14 +1362,8 @@ public class LatinIMELegacy implements KeyboardActionListener,
mRichImm.setInputMethodAndSubtype(token, subtype); mRichImm.setInputMethodAndSubtype(token, subtype);
} }
// TODO: Revise the language switch key behavior to make it much smarter and more reasonable.
public void switchToNextSubtype() { public void switchToNextSubtype() {
final IBinder token = mInputMethodService.getWindow().getWindow().getAttributes().token; mRichImm.getInputMethodManager().showInputMethodPicker();
if (shouldSwitchToOtherInputMethods()) {
mRichImm.switchToNextInputMethod(token, false /* onlyCurrentIme */);
return;
}
mSubtypeState.switchSubtype(token, mRichImm);
} }
// TODO: Instead of checking for alphabetic keyboard here, separate keycodes for // TODO: Instead of checking for alphabetic keyboard here, separate keycodes for

View File

@ -496,6 +496,8 @@ public class RichInputMethodManager {
public boolean shouldOfferSwitchingToNextInputMethod(final IBinder binder, public boolean shouldOfferSwitchingToNextInputMethod(final IBinder binder,
boolean defaultValue) { boolean defaultValue) {
if(true) return defaultValue;
// Use the default value instead on Jelly Bean MR2 and previous where // Use the default value instead on Jelly Bean MR2 and previous where
// {@link InputMethodManager#shouldOfferSwitchingToNextInputMethod} isn't yet available // {@link InputMethodManager#shouldOfferSwitchingToNextInputMethod} isn't yet available
// and on KitKat where the API is still just a stub to return true always. // and on KitKat where the API is still just a stub to return true always.

View File

@ -263,13 +263,13 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static boolean readShowsLanguageSwitchKey(final SharedPreferences prefs) { public static boolean readShowsLanguageSwitchKey(final SharedPreferences prefs) {
if (prefs.contains(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY)) { if (prefs.contains(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY)) {
final boolean suppressLanguageSwitchKey = prefs.getBoolean( final boolean suppressLanguageSwitchKey = prefs.getBoolean(
PREF_SUPPRESS_LANGUAGE_SWITCH_KEY, false); PREF_SUPPRESS_LANGUAGE_SWITCH_KEY, true);
final SharedPreferences.Editor editor = prefs.edit(); final SharedPreferences.Editor editor = prefs.edit();
editor.remove(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY); editor.remove(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY);
editor.putBoolean(PREF_SHOW_LANGUAGE_SWITCH_KEY, !suppressLanguageSwitchKey); editor.putBoolean(PREF_SHOW_LANGUAGE_SWITCH_KEY, !suppressLanguageSwitchKey);
editor.apply(); editor.apply();
} }
return prefs.getBoolean(PREF_SHOW_LANGUAGE_SWITCH_KEY, true); return prefs.getBoolean(PREF_SHOW_LANGUAGE_SWITCH_KEY, false);
} }
public static String readPrefAdditionalSubtypes(final SharedPreferences prefs, public static String readPrefAdditionalSubtypes(final SharedPreferences prefs,

View File

@ -144,7 +144,7 @@ public class SettingsValues {
? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false) ? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false)
: true /* forcibly */; : true /* forcibly */;
mShowsLanguageSwitchKey = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS mShowsLanguageSwitchKey = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS
? Settings.readShowsLanguageSwitchKey(prefs) : true /* forcibly */; ? Settings.readShowsLanguageSwitchKey(prefs) : false /* forcibly */;
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true); mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true); mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true);
mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true) mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true)

View File

@ -48,6 +48,13 @@ fun TypingScreen(navController: NavHostController = rememberNavController()) {
default = booleanResource(R.bool.config_default_key_preview_popup) default = booleanResource(R.bool.config_default_key_preview_popup)
) )
SettingToggleSharedPrefs(
title = stringResource(R.string.show_language_switch_key),
subtitle = stringResource(R.string.show_language_switch_key_summary),
key = Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY,
default = false
)
// TODO: SeekBarDialogPreference pref_vibration_duration_settings etc // TODO: SeekBarDialogPreference pref_vibration_duration_settings etc
} }
} }

View File

@ -195,7 +195,7 @@ public class LanguageModel extends Dictionary {
} else { } else {
// Otherwise, we cannot autocorrect to the top prediction unless the model is // Otherwise, we cannot autocorrect to the top prediction unless the model is
// super confident about this // super confident about this
if(outProbabilities[i] * 8.0f >= outProbabilities[0]) { if(outProbabilities[i] * 2.5f >= outProbabilities[0]) {
mustNotAutocorrect = true; mustNotAutocorrect = true;
} }
} }