diff options
author | 2013-01-22 13:29:30 +0900 | |
---|---|---|
committer | 2013-01-25 16:23:29 +0900 | |
commit | ce875664e0564f3e26d130a4d3e8b8e9a2e8a368 (patch) | |
tree | 07c38fd4ea30cd82392707b320ad842a28e349b0 /java/src/com/android/inputmethod/latin/SettingsValues.java | |
parent | 20b6775acc957896bdb038dfd99794d6cd7cea5a (diff) | |
download | latinime-ce875664e0564f3e26d130a4d3e8b8e9a2e8a368.tar.gz latinime-ce875664e0564f3e26d130a4d3e8b8e9a2e8a368.tar.xz latinime-ce875664e0564f3e26d130a4d3e8b8e9a2e8a368.zip |
Clean up Settings and SettingsFragment a bit
Change-Id: I93bf3cb1ea7e8fc09f4ad34b0bdd74f5f5ff1a68
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SettingsValues.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/SettingsValues.java | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java index f43382cb5..728f6b281 100644 --- a/java/src/com/android/inputmethod/latin/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/SettingsValues.java @@ -104,9 +104,8 @@ public final class SettingsValues { // Get the settings preferences mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true); - mVibrateOn = readVibrationEnabled(prefs, res); - mSoundOn = prefs.getBoolean(Settings.PREF_SOUND_ON, - res.getBoolean(R.bool.config_default_sound_enabled)); + mVibrateOn = Settings.readVibrationEnabled(prefs, res); + mSoundOn = Settings.readKeypressSoundEnabled(prefs, res); mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res); mSlidingKeyInputPreviewEnabled = prefs.getBoolean( Settings.PREF_SLIDING_KEY_INPUT_PREVIEW, true); @@ -121,7 +120,7 @@ public final class SettingsValues { mShowsLanguageSwitchKey = Settings.readShowsLanguageSwitchKey(prefs); mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true); mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true); - mAutoCorrectEnabled = readAutoCorrectEnabled(res, autoCorrectionThresholdRawValue); + mAutoCorrectEnabled = Settings.readAutoCorrectEnabled(autoCorrectionThresholdRawValue, res); mBigramPredictionEnabled = readBigramPredictionEnabled(prefs, res); // Compute other readable settings @@ -133,10 +132,7 @@ public final class SettingsValues { autoCorrectionThresholdRawValue); mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff); mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain); - final boolean gestureInputEnabledByBuildConfig = res.getBoolean( - R.bool.config_gesture_input_enabled_by_build_config); - mGestureInputEnabled = gestureInputEnabledByBuildConfig - && prefs.getBoolean(Settings.PREF_GESTURE_INPUT, true); + mGestureInputEnabled = Settings.readGestureInputEnabled(prefs, res); mGesturePreviewTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true); mGestureFloatingPreviewTextEnabled = prefs.getBoolean( Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true); @@ -250,20 +246,6 @@ public final class SettingsValues { throw new RuntimeException("Bug: visibility string is not configured correctly"); } - private static boolean readVibrationEnabled(final SharedPreferences prefs, - final Resources res) { - final boolean hasVibrator = AudioAndHapticFeedbackManager.getInstance().hasVibrator(); - return hasVibrator && prefs.getBoolean(Settings.PREF_VIBRATE_ON, - res.getBoolean(R.bool.config_default_vibration_enabled)); - } - - private static boolean readAutoCorrectEnabled(final Resources res, - final String currentAutoCorrectionSetting) { - final String autoCorrectionOff = res.getString( - R.string.auto_correction_threshold_mode_index_off); - return !currentAutoCorrectionSetting.equals(autoCorrectionOff); - } - private static boolean readBigramPredictionEnabled(final SharedPreferences prefs, final Resources res) { return prefs.getBoolean(Settings.PREF_BIGRAM_PREDICTIONS, res.getBoolean( |