Skip to content
Snippets Groups Projects
Commit cee174b8 authored by Ken Wakasa's avatar Ken Wakasa
Browse files

Settings key visibility should always follow the system default value,

by ignoring its preference value, when the "show settings key option" in
the settings is disabled.

Change-Id: I934be2d9eb0bf6bf731e03f5d9b752de4a7a1c7c
parent 6da8b745
No related branches found
No related tags found
No related merge requests found
...@@ -402,7 +402,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha ...@@ -402,7 +402,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
break; break;
} }
final boolean settingsKeyEnabled = settingsValues.isSettingsKeyEnabled(editorInfo); final boolean settingsKeyEnabled = settingsValues.isSettingsKeyEnabled();
final boolean noMicrophone = Utils.inPrivateImeOptions( final boolean noMicrophone = Utils.inPrivateImeOptions(
mPackageName, LatinIME.IME_OPTION_NO_MICROPHONE, editorInfo) mPackageName, LatinIME.IME_OPTION_NO_MICROPHONE, editorInfo)
|| Utils.inPrivateImeOptions( || Utils.inPrivateImeOptions(
......
...@@ -53,7 +53,7 @@ import java.util.Locale; ...@@ -53,7 +53,7 @@ import java.util.Locale;
public class Settings extends InputMethodSettingsActivity public class Settings extends InputMethodSettingsActivity
implements SharedPreferences.OnSharedPreferenceChangeListener, implements SharedPreferences.OnSharedPreferenceChangeListener,
DialogInterface.OnDismissListener, OnPreferenceClickListener { DialogInterface.OnDismissListener, OnPreferenceClickListener {
private static final String TAG = "Settings"; private static final String TAG = Settings.class.getSimpleName();
public static final String PREF_GENERAL_SETTINGS_KEY = "general_settings"; public static final String PREF_GENERAL_SETTINGS_KEY = "general_settings";
public static final String PREF_VIBRATE_ON = "vibrate_on"; public static final String PREF_VIBRATE_ON = "vibrate_on";
...@@ -182,8 +182,9 @@ public class Settings extends InputMethodSettingsActivity ...@@ -182,8 +182,9 @@ public class Settings extends InputMethodSettingsActivity
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true); mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
final boolean defaultShowSettingsKey = res.getBoolean( final boolean defaultShowSettingsKey = res.getBoolean(
R.bool.config_default_show_settings_key); R.bool.config_default_show_settings_key);
mShowSettingsKey = prefs.getBoolean(Settings.PREF_SHOW_SETTINGS_KEY, mShowSettingsKey = isShowSettingsKeyOption(res)
defaultShowSettingsKey); ? prefs.getBoolean(Settings.PREF_SHOW_SETTINGS_KEY, defaultShowSettingsKey)
: defaultShowSettingsKey;
final String voiceModeMain = res.getString(R.string.voice_mode_main); final String voiceModeMain = res.getString(R.string.voice_mode_main);
final String voiceModeOff = res.getString(R.string.voice_mode_off); final String voiceModeOff = res.getString(R.string.voice_mode_off);
final String voiceMode = prefs.getString(PREF_VOICE_SETTINGS_KEY, voiceModeMain); final String voiceMode = prefs.getString(PREF_VOICE_SETTINGS_KEY, voiceModeMain);
...@@ -292,7 +293,12 @@ public class Settings extends InputMethodSettingsActivity ...@@ -292,7 +293,12 @@ public class Settings extends InputMethodSettingsActivity
return builder.setIsPunctuationSuggestions().build(); return builder.setIsPunctuationSuggestions().build();
} }
public boolean isSettingsKeyEnabled(EditorInfo attribute) { public static boolean isShowSettingsKeyOption(final Resources resources) {
return resources.getBoolean(R.bool.config_enable_show_settings_key_option);
}
public boolean isSettingsKeyEnabled() {
return mShowSettingsKey; return mShowSettingsKey;
} }
...@@ -386,9 +392,7 @@ public class Settings extends InputMethodSettingsActivity ...@@ -386,9 +392,7 @@ public class Settings extends InputMethodSettingsActivity
final PreferenceGroup textCorrectionGroup = final PreferenceGroup textCorrectionGroup =
(PreferenceGroup) findPreference(PREF_CORRECTION_SETTINGS_KEY); (PreferenceGroup) findPreference(PREF_CORRECTION_SETTINGS_KEY);
final boolean showSettingsKeyOption = res.getBoolean( if (!Values.isShowSettingsKeyOption(res)) {
R.bool.config_enable_show_settings_key_option);
if (!showSettingsKeyOption) {
generalSettings.removePreference(mShowSettingsKeyPreference); generalSettings.removePreference(mShowSettingsKeyPreference);
} }
...@@ -445,8 +449,7 @@ public class Settings extends InputMethodSettingsActivity ...@@ -445,8 +449,7 @@ public class Settings extends InputMethodSettingsActivity
if (null == mKeyPreviewPopupDismissDelay.getValue()) { if (null == mKeyPreviewPopupDismissDelay.getValue()) {
mKeyPreviewPopupDismissDelay.setValue(popupDismissDelayDefaultValue); mKeyPreviewPopupDismissDelay.setValue(popupDismissDelayDefaultValue);
} }
mKeyPreviewPopupDismissDelay.setEnabled( mKeyPreviewPopupDismissDelay.setEnabled(Values.isKeyPreviewPopupEnabled(prefs, res));
Settings.Values.isKeyPreviewPopupEnabled(prefs, res));
final PreferenceScreen dictionaryLink = final PreferenceScreen dictionaryLink =
(PreferenceScreen) findPreference(PREF_CONFIGURE_DICTIONARIES_KEY); (PreferenceScreen) findPreference(PREF_CONFIGURE_DICTIONARIES_KEY);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment