diff options
author | 2012-09-20 06:09:15 -0700 | |
---|---|---|
committer | 2012-09-20 06:09:15 -0700 | |
commit | d839242c95b6f251a005c07bdc179c6647906e9a (patch) | |
tree | 6c2e6c1179d8502663f69a15020c339664910b4d /java/src/com/android/inputmethod/latin/SettingsValues.java | |
parent | 854c00dcbb3fc529f30c2b2127b0bcc2bf5db580 (diff) | |
parent | bfcd2b3fc0ae7269396d4f694827928630b89d59 (diff) | |
download | latinime-d839242c95b6f251a005c07bdc179c6647906e9a.tar.gz latinime-d839242c95b6f251a005c07bdc179c6647906e9a.tar.xz latinime-d839242c95b6f251a005c07bdc179c6647906e9a.zip |
am bfcd2b3f: Merge "Change to "Show language switch key" option" into jb-mr1-dev
* commit 'bfcd2b3fc0ae7269396d4f694827928630b89d59':
Change to "Show language switch key" option
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SettingsValues.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/SettingsValues.java | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java index d9cf2700b..9d8379a7a 100644 --- a/java/src/com/android/inputmethod/latin/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/SettingsValues.java @@ -72,7 +72,7 @@ public final class SettingsValues { @SuppressWarnings("unused") // TODO: Use this private final boolean mUsabilityStudyMode; public final boolean mIncludesOtherImesInLanguageSwitchList; - public final boolean mIsLanguageSwitchKeySuppressed; + public final boolean mShowsLanguageSwitchKey; @SuppressWarnings("unused") // TODO: Use this private final String mKeyPreviewPopupDismissDelayRawValue; public final boolean mUseContactsDict; @@ -151,7 +151,7 @@ public final class SettingsValues { mUsabilityStudyMode = getUsabilityStudyMode(prefs); mIncludesOtherImesInLanguageSwitchList = prefs.getBoolean( Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false); - mIsLanguageSwitchKeySuppressed = isLanguageSwitchKeySupressed(prefs); + mShowsLanguageSwitchKey = showsLanguageSwitchKey(prefs); mKeyPreviewPopupDismissDelayRawValue = prefs.getString( Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY, Integer.toString(res.getInteger(R.integer.config_key_preview_linger_timeout))); @@ -336,12 +336,25 @@ public final class SettingsValues { return mVoiceKeyOnMain; } - public static boolean isLanguageSwitchKeySupressed(final SharedPreferences prefs) { - return prefs.getBoolean(Settings.PREF_SUPPRESS_LANGUAGE_SWITCH_KEY, false); + // This preference key is deprecated. Use {@link #PREF_SHOW_LANGUAGE_SWITCH_KEY} instead. + // This is being used only for the backward compatibility. + private static final String PREF_SUPPRESS_LANGUAGE_SWITCH_KEY = + "pref_suppress_language_switch_key"; + + public static boolean showsLanguageSwitchKey(final SharedPreferences prefs) { + if (prefs.contains(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY)) { + final boolean suppressLanguageSwitchKey = prefs.getBoolean( + PREF_SUPPRESS_LANGUAGE_SWITCH_KEY, false); + final SharedPreferences.Editor editor = prefs.edit(); + editor.remove(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY); + editor.putBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, !suppressLanguageSwitchKey); + editor.apply(); + } + return prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, true); } public boolean isLanguageSwitchKeyEnabled(final Context context) { - if (mIsLanguageSwitchKeySuppressed) { + if (!mShowsLanguageSwitchKey) { return false; } if (mIncludesOtherImesInLanguageSwitchList) { @@ -353,7 +366,7 @@ public final class SettingsValues { } } - public boolean isFullscreenModeAllowed(final Resources res) { + public static boolean isFullscreenModeAllowed(final Resources res) { return res.getBoolean(R.bool.config_use_fullscreen_mode); } |