diff options
author | 2011-08-22 12:19:37 +0900 | |
---|---|---|
committer | 2011-08-22 12:21:25 +0900 | |
commit | cee174b8ccb47ccddc8a8a7e88a9c617f9b5e766 (patch) | |
tree | ef490a2a7cace347885e068cecd16b215a2cedff /java/src | |
parent | 6da8b74582b1c70cae02558c605c5a224329cf7a (diff) | |
download | latinime-cee174b8ccb47ccddc8a8a7e88a9c617f9b5e766.tar.gz latinime-cee174b8ccb47ccddc8a8a7e88a9c617f9b5e766.tar.xz latinime-cee174b8ccb47ccddc8a8a7e88a9c617f9b5e766.zip |
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
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java | 2 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/Settings.java | 21 |
2 files changed, 13 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index 9937937ff..10f110e0b 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -402,7 +402,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha break; } - final boolean settingsKeyEnabled = settingsValues.isSettingsKeyEnabled(editorInfo); + final boolean settingsKeyEnabled = settingsValues.isSettingsKeyEnabled(); final boolean noMicrophone = Utils.inPrivateImeOptions( mPackageName, LatinIME.IME_OPTION_NO_MICROPHONE, editorInfo) || Utils.inPrivateImeOptions( diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java index 4c2627be3..87a713f5c 100644 --- a/java/src/com/android/inputmethod/latin/Settings.java +++ b/java/src/com/android/inputmethod/latin/Settings.java @@ -53,7 +53,7 @@ import java.util.Locale; public class Settings extends InputMethodSettingsActivity implements SharedPreferences.OnSharedPreferenceChangeListener, 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_VIBRATE_ON = "vibrate_on"; @@ -182,8 +182,9 @@ public class Settings extends InputMethodSettingsActivity mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true); final boolean defaultShowSettingsKey = res.getBoolean( R.bool.config_default_show_settings_key); - mShowSettingsKey = prefs.getBoolean(Settings.PREF_SHOW_SETTINGS_KEY, - defaultShowSettingsKey); + mShowSettingsKey = isShowSettingsKeyOption(res) + ? prefs.getBoolean(Settings.PREF_SHOW_SETTINGS_KEY, defaultShowSettingsKey) + : defaultShowSettingsKey; final String voiceModeMain = res.getString(R.string.voice_mode_main); final String voiceModeOff = res.getString(R.string.voice_mode_off); final String voiceMode = prefs.getString(PREF_VOICE_SETTINGS_KEY, voiceModeMain); @@ -292,7 +293,12 @@ public class Settings extends InputMethodSettingsActivity 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; } @@ -386,9 +392,7 @@ public class Settings extends InputMethodSettingsActivity final PreferenceGroup textCorrectionGroup = (PreferenceGroup) findPreference(PREF_CORRECTION_SETTINGS_KEY); - final boolean showSettingsKeyOption = res.getBoolean( - R.bool.config_enable_show_settings_key_option); - if (!showSettingsKeyOption) { + if (!Values.isShowSettingsKeyOption(res)) { generalSettings.removePreference(mShowSettingsKeyPreference); } @@ -445,8 +449,7 @@ public class Settings extends InputMethodSettingsActivity if (null == mKeyPreviewPopupDismissDelay.getValue()) { mKeyPreviewPopupDismissDelay.setValue(popupDismissDelayDefaultValue); } - mKeyPreviewPopupDismissDelay.setEnabled( - Settings.Values.isKeyPreviewPopupEnabled(prefs, res)); + mKeyPreviewPopupDismissDelay.setEnabled(Values.isKeyPreviewPopupEnabled(prefs, res)); final PreferenceScreen dictionaryLink = (PreferenceScreen) findPreference(PREF_CONFIGURE_DICTIONARIES_KEY); |