am 7a76350b
: Merge "Enable "show language switch key" settings on K and before"
* commit '7a76350b7b7c500d12d0f1e8e15fd2ea8b4d3035': Enable "show language switch key" settings on K and before
This commit is contained in:
commit
99ee123c71
4 changed files with 19 additions and 10 deletions
|
@ -153,6 +153,7 @@
|
|||
android:defaultValue="true" />
|
||||
<CheckBoxPreference
|
||||
android:key="pref_include_other_imes_in_language_switch_list"
|
||||
android:dependency="pref_show_language_switch_key"
|
||||
android:title="@string/include_other_imes_in_language_switch_list"
|
||||
android:summary="@string/include_other_imes_in_language_switch_list_summary"
|
||||
android:persistent="true"
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
|
@ -60,6 +61,10 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
"pref_key_use_double_space_period";
|
||||
public static final String PREF_BLOCK_POTENTIALLY_OFFENSIVE =
|
||||
"pref_key_block_potentially_offensive";
|
||||
public static final boolean ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS =
|
||||
(Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
|
||||
|| (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT
|
||||
&& Build.VERSION.CODENAME.equals("REL"));
|
||||
public static final String PREF_SHOW_LANGUAGE_SWITCH_KEY =
|
||||
"pref_show_language_switch_key";
|
||||
public static final String PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST =
|
||||
|
|
|
@ -59,7 +59,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment
|
|||
private static final boolean DBG_USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS = false;
|
||||
private static final boolean USE_INTERNAL_PERSONAL_DICTIONARY_SETTIGS =
|
||||
DBG_USE_INTERNAL_PERSONAL_DICTIONARY_SETTINGS
|
||||
|| Build.VERSION.SDK_INT <= 18 /* Build.VERSION.JELLY_BEAN_MR2 */;
|
||||
|| Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2;
|
||||
|
||||
private void setPreferenceEnabled(final String preferenceKey, final boolean enabled) {
|
||||
final Preference preference = findPreference(preferenceKey);
|
||||
|
@ -169,6 +169,13 @@ public final class SettingsFragment extends InputMethodSettingsFragment
|
|||
removePreference(Settings.PREF_VIBRATE_ON, generalSettings);
|
||||
removePreference(Settings.PREF_VIBRATION_DURATION_SETTINGS, advancedSettings);
|
||||
}
|
||||
if (!Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS) {
|
||||
removePreference(
|
||||
Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, advancedSettings);
|
||||
removePreference(
|
||||
Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, advancedSettings);
|
||||
}
|
||||
|
||||
|
||||
// TODO: consolidate key preview dismiss delay with the key preview animation parameters.
|
||||
if (!Settings.readFromBuildConfigIfToShowKeyPreviewPopupOption(res)) {
|
||||
|
@ -199,9 +206,6 @@ public final class SettingsFragment extends InputMethodSettingsFragment
|
|||
removePreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON, advancedSettings);
|
||||
}
|
||||
|
||||
setPreferenceEnabled(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST,
|
||||
Settings.readShowsLanguageSwitchKey(prefs));
|
||||
|
||||
final PreferenceGroup textCorrectionGroup =
|
||||
(PreferenceGroup) findPreference(Settings.PREF_CORRECTION_SETTINGS);
|
||||
final PreferenceScreen dictionaryLink =
|
||||
|
@ -299,9 +303,6 @@ public final class SettingsFragment extends InputMethodSettingsFragment
|
|||
if (key.equals(Settings.PREF_POPUP_ON)) {
|
||||
setPreferenceEnabled(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
|
||||
Settings.readKeyPreviewPopupEnabled(prefs, res));
|
||||
} else if (key.equals(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY)) {
|
||||
setPreferenceEnabled(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST,
|
||||
Settings.readShowsLanguageSwitchKey(prefs));
|
||||
} else if (key.equals(Settings.PREF_SHOW_SETUP_WIZARD_ICON)) {
|
||||
LauncherIconVisibilityManager.updateSetupWizardIconVisibility(getActivity());
|
||||
}
|
||||
|
|
|
@ -125,9 +125,11 @@ public final class SettingsValues {
|
|||
final String autoCorrectionThresholdRawValue = prefs.getString(
|
||||
Settings.PREF_AUTO_CORRECTION_THRESHOLD,
|
||||
res.getString(R.string.auto_correction_threshold_mode_index_modest));
|
||||
mIncludesOtherImesInLanguageSwitchList = prefs.getBoolean(
|
||||
Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false);
|
||||
mShowsLanguageSwitchKey = Settings.readShowsLanguageSwitchKey(prefs);
|
||||
mIncludesOtherImesInLanguageSwitchList = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS
|
||||
? 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 */;
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue