Merge "Remove unused variables"

main
Tadashi G. Takaoka 2013-01-09 22:32:23 -08:00 committed by Android (Google) Code Review
commit 433f54ce90
2 changed files with 10 additions and 20 deletions

View File

@ -135,7 +135,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static int readKeyPreviewPopupDismissDelay(final SharedPreferences prefs, public static int readKeyPreviewPopupDismissDelay(final SharedPreferences prefs,
final Resources res) { final Resources res) {
// TODO: use mKeyPreviewPopupDismissDelayRawValue instead of reading it again here.
return Integer.parseInt(prefs.getString(PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY, return Integer.parseInt(prefs.getString(PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
Integer.toString(res.getInteger( Integer.toString(res.getInteger(
R.integer.config_key_preview_linger_timeout)))); R.integer.config_key_preview_linger_timeout))));
@ -186,7 +185,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
} }
public static boolean readUsabilityStudyMode(final SharedPreferences prefs) { public static boolean readUsabilityStudyMode(final SharedPreferences prefs) {
// TODO: use mUsabilityStudyMode instead of reading it again here
return prefs.getBoolean(DebugSettings.PREF_USABILITY_STUDY_MODE, true); return prefs.getBoolean(DebugSettings.PREF_USABILITY_STUDY_MODE, true);
} }

View File

@ -51,14 +51,8 @@ public final class SettingsValues {
public final boolean mSoundOn; public final boolean mSoundOn;
public final boolean mKeyPreviewPopupOn; public final boolean mKeyPreviewPopupOn;
private final String mVoiceMode; private final String mVoiceMode;
private final String mAutoCorrectionThresholdRawValue;
public final String mShowSuggestionsSetting;
@SuppressWarnings("unused") // TODO: Use this
private final boolean mUsabilityStudyMode;
public final boolean mIncludesOtherImesInLanguageSwitchList; public final boolean mIncludesOtherImesInLanguageSwitchList;
public final boolean mShowsLanguageSwitchKey; public final boolean mShowsLanguageSwitchKey;
@SuppressWarnings("unused") // TODO: Use this
private final String mKeyPreviewPopupDismissDelayRawValue;
public final boolean mUseContactsDict; public final boolean mUseContactsDict;
public final boolean mUseDoubleSpacePeriod; public final boolean mUseDoubleSpacePeriod;
// Use bigrams to predict the next word when there is no input for it yet // Use bigrams to predict the next word when there is no input for it yet
@ -122,20 +116,15 @@ public final class SettingsValues {
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);
mVoiceMode = prefs.getString(Settings.PREF_VOICE_MODE, voiceModeMain); mVoiceMode = prefs.getString(Settings.PREF_VOICE_MODE, voiceModeMain);
mAutoCorrectionThresholdRawValue = prefs.getString(Settings.PREF_AUTO_CORRECTION_THRESHOLD, final String autoCorrectionThresholdRawValue = prefs.getString(
Settings.PREF_AUTO_CORRECTION_THRESHOLD,
res.getString(R.string.auto_correction_threshold_mode_index_modest)); res.getString(R.string.auto_correction_threshold_mode_index_modest));
mShowSuggestionsSetting = prefs.getString(Settings.PREF_SHOW_SUGGESTIONS_SETTING,
res.getString(R.string.prefs_suggestion_visibility_default_value));
mUsabilityStudyMode = Settings.readUsabilityStudyMode(prefs);
mIncludesOtherImesInLanguageSwitchList = prefs.getBoolean( mIncludesOtherImesInLanguageSwitchList = prefs.getBoolean(
Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false); Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false);
mShowsLanguageSwitchKey = Settings.readShowsLanguageSwitchKey(prefs); mShowsLanguageSwitchKey = Settings.readShowsLanguageSwitchKey(prefs);
mKeyPreviewPopupDismissDelayRawValue = prefs.getString(
Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
Integer.toString(res.getInteger(R.integer.config_key_preview_linger_timeout)));
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true); mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true); mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true);
mAutoCorrectEnabled = readAutoCorrectEnabled(res, mAutoCorrectionThresholdRawValue); mAutoCorrectEnabled = readAutoCorrectEnabled(res, autoCorrectionThresholdRawValue);
mBigramPredictionEnabled = readBigramPredictionEnabled(prefs, res); mBigramPredictionEnabled = readBigramPredictionEnabled(prefs, res);
// Compute other readable settings // Compute other readable settings
@ -143,7 +132,7 @@ public final class SettingsValues {
mKeypressSoundVolume = Settings.readKeypressSoundVolume(prefs, res); mKeypressSoundVolume = Settings.readKeypressSoundVolume(prefs, res);
mKeyPreviewPopupDismissDelay = Settings.readKeyPreviewPopupDismissDelay(prefs, res); mKeyPreviewPopupDismissDelay = Settings.readKeyPreviewPopupDismissDelay(prefs, res);
mAutoCorrectionThreshold = readAutoCorrectionThreshold(res, mAutoCorrectionThreshold = readAutoCorrectionThreshold(res,
mAutoCorrectionThresholdRawValue); autoCorrectionThresholdRawValue);
mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff); mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff);
mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain); mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain);
final boolean gestureInputEnabledByBuildConfig = res.getBoolean( final boolean gestureInputEnabledByBuildConfig = res.getBoolean(
@ -154,7 +143,10 @@ public final class SettingsValues {
mGestureFloatingPreviewTextEnabled = prefs.getBoolean( mGestureFloatingPreviewTextEnabled = prefs.getBoolean(
Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true); Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true);
mCorrectionEnabled = mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect; mCorrectionEnabled = mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect;
mSuggestionVisibility = createSuggestionVisibility(res); final String showSuggestionsSetting = prefs.getString(
Settings.PREF_SHOW_SUGGESTIONS_SETTING,
res.getString(R.string.prefs_suggestion_visibility_default_value));
mSuggestionVisibility = createSuggestionVisibility(res, showSuggestionsSetting);
} }
public boolean isApplicationSpecifiedCompletionsOn() { public boolean isApplicationSpecifiedCompletionsOn() {
@ -271,8 +263,8 @@ public final class SettingsValues {
SUGGESTION_VISIBILITY_HIDE_VALUE SUGGESTION_VISIBILITY_HIDE_VALUE
}; };
private int createSuggestionVisibility(final Resources res) { private static int createSuggestionVisibility(final Resources res,
final String suggestionVisiblityStr = mShowSuggestionsSetting; final String suggestionVisiblityStr) {
for (int visibility : SUGGESTION_VISIBILITY_VALUE_ARRAY) { for (int visibility : SUGGESTION_VISIBILITY_VALUE_ARRAY) {
if (suggestionVisiblityStr.equals(res.getString(visibility))) { if (suggestionVisiblityStr.equals(res.getString(visibility))) {
return visibility; return visibility;