Make "show settings key option" dependent to device configuration
Bug: 3095814 Change-Id: I73b8a5023b398621a910c953eade252dc6412923main
parent
41338e6c32
commit
503797ae0e
|
@ -20,4 +20,5 @@
|
|||
<resources>
|
||||
<!-- Whether or not Popup on key press is enabled by default -->
|
||||
<bool name="default_popup_preview">false</bool>
|
||||
<bool name="config_enable_show_settings_key_option">false</bool>
|
||||
</resources>
|
||||
|
|
|
@ -30,4 +30,5 @@
|
|||
<bool name="default_popup_preview">true</bool>
|
||||
<bool name="default_recorrection_enabled">true</bool>
|
||||
<bool name="config_long_press_comma_for_settings_enabled">true</bool>
|
||||
<bool name="config_enable_show_settings_key_option">true</bool>
|
||||
</resources>
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue