diff --git a/java/res/values-xlarge/bools.xml b/java/res/values-xlarge/bools.xml index fe8fc5838..66cfd9d79 100644 --- a/java/res/values-xlarge/bools.xml +++ b/java/res/values-xlarge/bools.xml @@ -20,4 +20,5 @@ false + false diff --git a/java/res/values/bools.xml b/java/res/values/bools.xml index 5a24e4c60..64d05bd17 100644 --- a/java/res/values/bools.xml +++ b/java/res/values/bools.xml @@ -30,4 +30,5 @@ true true true + true diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index ec422174d..3a54904d3 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -160,11 +160,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha // Indicates whether or not we have the settings key private boolean mHasSettingsKey; private static final int SETTINGS_KEY_MODE_AUTO = R.string.settings_key_mode_auto; - private static final int SETTINGS_KEY_MODE_ALWAYS_SHOW = R.string.settings_key_mode_always_show; - // NOTE: No need to have SETTINGS_KEY_MODE_ALWAYS_HIDE here because it's not being referred to - // in the source code now. - // Default is SETTINGS_KEY_MODE_AUTO. - private static final int DEFAULT_SETTINGS_KEY_MODE = SETTINGS_KEY_MODE_AUTO; + private static final int SETTINGS_KEY_MODE_ALWAYS_SHOW = + R.string.settings_key_mode_always_show; + private static final int SETTINGS_KEY_MODE_ALWAYS_HIDE = + R.string.settings_key_mode_always_hide; private int mLastDisplayWidth; private LanguageSwitcher mLanguageSwitcher; @@ -543,8 +542,12 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha private void updateSettingsKeyState(SharedPreferences prefs) { Resources resources = mInputMethodService.getResources(); + final boolean showSettingsKeyOption = resources.getBoolean( + R.bool.config_enable_show_settings_key_option); + final int defaultSettingsKeyMode = showSettingsKeyOption + ? SETTINGS_KEY_MODE_AUTO : SETTINGS_KEY_MODE_ALWAYS_HIDE; final String settingsKeyMode = prefs.getString(LatinIMESettings.PREF_SETTINGS_KEY, - resources.getString(DEFAULT_SETTINGS_KEY_MODE)); + resources.getString(defaultSettingsKeyMode)); // We show the settings key when 1) SETTINGS_KEY_MODE_ALWAYS_SHOW or // 2) SETTINGS_KEY_MODE_AUTO and there are two or more enabled IMEs on the system if (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_ALWAYS_SHOW)) diff --git a/java/src/com/android/inputmethod/latin/LatinIMESettings.java b/java/src/com/android/inputmethod/latin/LatinIMESettings.java index 99d8a622e..4f20e9b10 100644 --- a/java/src/com/android/inputmethod/latin/LatinIMESettings.java +++ b/java/src/com/android/inputmethod/latin/LatinIMESettings.java @@ -96,6 +96,11 @@ public class LatinIMESettings extends PreferenceActivity mAutoCompletionThreshold = (ListPreference) findPreference(PREF_AUTO_COMPLETION_THRESHOLD); mBigramSuggestion = (CheckBoxPreference) findPreference(PREF_BIGRAM_SUGGESTIONS); ensureConsistencyOfAutoCompletionSettings(); + + final boolean showSettingsKeyOption = getResources().getBoolean( + R.bool.config_enable_show_settings_key_option); + if (!showSettingsKeyOption) + getPreferenceScreen().removePreference(mSettingsKeyPreference); } @Override