am 74671cf6: Resolve TODOs: add members to hold preferences

* commit '74671cf6c5c2fbe7cee72c2cd74e55168e3306aa':
  Resolve TODOs: add members to hold preferences
main
Jean Chalard 2011-12-09 11:00:52 -08:00 committed by Android Git Automerger
commit 2b2e5b2d5c
1 changed files with 9 additions and 3 deletions

View File

@ -59,8 +59,8 @@ public class SettingsValues {
// Prediction: use bigrams to predict the next word when there is no input for it yet // Prediction: use bigrams to predict the next word when there is no input for it yet
public final boolean mBigramPredictionEnabled; public final boolean mBigramPredictionEnabled;
public final boolean mEnableSuggestionSpanInsertion; public final boolean mEnableSuggestionSpanInsertion;
// TODO: add a member for the raw "pref_vibration_duration_settings" setting private final int mVibrationDurationSettingsRawValue;
// TODO: add a member for the raw "pref_keypress_sound_volume" setting private final float mKeypressSoundVolumeRawValue;
// Deduced settings // Deduced settings
public final int mKeypressVibrationDuration; public final int mKeypressVibrationDuration;
@ -120,7 +120,10 @@ public class SettingsValues {
mBigramPredictionEnabled = mBigramSuggestionEnabled mBigramPredictionEnabled = mBigramSuggestionEnabled
&& isBigramPredictionEnabled(prefs, res); && isBigramPredictionEnabled(prefs, res);
mEnableSuggestionSpanInsertion = mEnableSuggestionSpanInsertion =
prefs.getBoolean(Settings.PREF_KEY_ENABLE_SPAN_INSERT, true); prefs.getBoolean(Settings.PREF_KEY_ENABLE_SPAN_INSERT, true);
mVibrationDurationSettingsRawValue =
prefs.getInt(Settings.PREF_VIBRATION_DURATION_SETTINGS, -1);
mKeypressSoundVolumeRawValue = prefs.getFloat(Settings.PREF_KEYPRESS_SOUND_VOLUME, -1.0f);
// Compute other readable settings // Compute other readable settings
mKeypressVibrationDuration = getCurrentVibrationDuration(prefs, res); mKeypressVibrationDuration = getCurrentVibrationDuration(prefs, res);
@ -280,6 +283,7 @@ public class SettingsValues {
// Accessed from the settings interface, hence public // Accessed from the settings interface, hence public
public static float getCurrentKeypressSoundVolume(final SharedPreferences sp, public static float getCurrentKeypressSoundVolume(final SharedPreferences sp,
final Resources res) { final Resources res) {
// TODO: use mVibrationDurationSettingsRawValue instead of reading it again here
final float volume = sp.getFloat(Settings.PREF_KEYPRESS_SOUND_VOLUME, -1.0f); final float volume = sp.getFloat(Settings.PREF_KEYPRESS_SOUND_VOLUME, -1.0f);
if (volume >= 0) { if (volume >= 0) {
return volume; return volume;
@ -298,6 +302,7 @@ public class SettingsValues {
// Likewise // Likewise
public static int getCurrentVibrationDuration(final SharedPreferences sp, public static int getCurrentVibrationDuration(final SharedPreferences sp,
final Resources res) { final Resources res) {
// TODO: use mKeypressVibrationDuration instead of reading it again here
final int ms = sp.getInt(Settings.PREF_VIBRATION_DURATION_SETTINGS, -1); final int ms = sp.getInt(Settings.PREF_VIBRATION_DURATION_SETTINGS, -1);
if (ms >= 0) { if (ms >= 0) {
return ms; return ms;
@ -316,6 +321,7 @@ public class SettingsValues {
// Likewise // Likewise
public static boolean getUsabilityStudyMode(final SharedPreferences prefs, public static boolean getUsabilityStudyMode(final SharedPreferences prefs,
final Resources res) { final Resources res) {
// TODO: use mUsabilityStudyMode instead of reading it again here
return prefs.getBoolean(Settings.PREF_USABILITY_STUDY_MODE, true); return prefs.getBoolean(Settings.PREF_USABILITY_STUDY_MODE, true);
} }
} }