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);
}
// TODO: Revise the language switch key behavior to make it much smarter and more reasonable.
public void switchToNextSubtype() {
final IBinder token = mInputMethodService.getWindow().getWindow().getAttributes().token;
if (shouldSwitchToOtherInputMethods()) {
mRichImm.switchToNextInputMethod(token, false /* onlyCurrentIme */);
return;
}
mSubtypeState.switchSubtype(token, mRichImm);
mRichImm.getInputMethodManager().showInputMethodPicker();
}
// 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,
boolean defaultValue) {
if(true) return defaultValue;
// Use the default value instead on Jelly Bean MR2 and previous where
// {@link InputMethodManager#shouldOfferSwitchingToNextInputMethod} isn't yet available
// 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) {
if (prefs.contains(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY)) {
final boolean suppressLanguageSwitchKey = prefs.getBoolean(
PREF_SUPPRESS_LANGUAGE_SWITCH_KEY, false);
PREF_SUPPRESS_LANGUAGE_SWITCH_KEY, true);
final SharedPreferences.Editor editor = prefs.edit();
editor.remove(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY);
editor.putBoolean(PREF_SHOW_LANGUAGE_SWITCH_KEY, !suppressLanguageSwitchKey);
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,

View File

@ -144,7 +144,7 @@ public class SettingsValues {
? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false)
: true /* forcibly */;
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);
mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, 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)
)
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
}
}

View File

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