mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Resolve TODOs: add members to store raw settings
Change-Id: I481eadb6a73faf239e24d05b7e220fcb01194fa4
This commit is contained in:
parent
12f10e1585
commit
85b063f97e
@ -48,8 +48,8 @@ public class SettingsValues {
|
|||||||
public final boolean mSoundOn;
|
public final boolean mSoundOn;
|
||||||
public final boolean mKeyPreviewPopupOn;
|
public final boolean mKeyPreviewPopupOn;
|
||||||
private final boolean mShowSettingsKey;
|
private final boolean mShowSettingsKey;
|
||||||
// TODO: add a member for the raw "voice_mode" setting
|
private final String mVoiceMode;
|
||||||
// TODO: add a member for the raw "auto_correction_threshold" setting
|
private final String mAutoCorrectionThresholdRawValue;
|
||||||
// TODO: add a member for the raw "show_suggestions_setting" setting
|
// TODO: add a member for the raw "show_suggestions_setting" setting
|
||||||
// TODO: add a member for the raw "usability_study_mode" setting
|
// TODO: add a member for the raw "usability_study_mode" setting
|
||||||
// TODO: add a member for the raw "pref_key_preview_popup_dismiss_delay" setting
|
// TODO: add a member for the raw "pref_key_preview_popup_dismiss_delay" setting
|
||||||
@ -102,6 +102,11 @@ public class SettingsValues {
|
|||||||
res.getBoolean(R.bool.config_default_sound_enabled));
|
res.getBoolean(R.bool.config_default_sound_enabled));
|
||||||
mKeyPreviewPopupOn = isKeyPreviewPopupEnabled(prefs, res);
|
mKeyPreviewPopupOn = isKeyPreviewPopupEnabled(prefs, res);
|
||||||
mShowSettingsKey = isSettingsKeyShown(prefs, res);
|
mShowSettingsKey = isSettingsKeyShown(prefs, res);
|
||||||
|
final String voiceModeMain = res.getString(R.string.voice_mode_main);
|
||||||
|
final String voiceModeOff = res.getString(R.string.voice_mode_off);
|
||||||
|
mVoiceMode = prefs.getString(Settings.PREF_VOICE_MODE, voiceModeMain);
|
||||||
|
mAutoCorrectionThresholdRawValue = prefs.getString(Settings.PREF_AUTO_CORRECTION_THRESHOLD,
|
||||||
|
res.getString(R.string.auto_correction_threshold_mode_index_modest));
|
||||||
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
|
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
|
||||||
mAutoCorrectEnabled = isAutoCorrectEnabled(prefs, res);
|
mAutoCorrectEnabled = isAutoCorrectEnabled(prefs, res);
|
||||||
mBigramSuggestionEnabled = mAutoCorrectEnabled
|
mBigramSuggestionEnabled = mAutoCorrectEnabled
|
||||||
@ -115,12 +120,10 @@ public class SettingsValues {
|
|||||||
mKeypressVibrationDuration = getCurrentVibrationDuration(prefs, res);
|
mKeypressVibrationDuration = getCurrentVibrationDuration(prefs, res);
|
||||||
mFxVolume = getCurrentKeypressSoundVolume(prefs, res);
|
mFxVolume = getCurrentKeypressSoundVolume(prefs, res);
|
||||||
mKeyPreviewPopupDismissDelay = getKeyPreviewPopupDismissDelay(prefs, res);
|
mKeyPreviewPopupDismissDelay = getKeyPreviewPopupDismissDelay(prefs, res);
|
||||||
mAutoCorrectionThreshold = getAutoCorrectionThreshold(prefs, res);
|
mAutoCorrectionThreshold = getAutoCorrectionThreshold(prefs, res,
|
||||||
final String voiceModeMain = res.getString(R.string.voice_mode_main);
|
mAutoCorrectionThresholdRawValue);
|
||||||
final String voiceModeOff = res.getString(R.string.voice_mode_off);
|
mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff);
|
||||||
final String voiceMode = prefs.getString(Settings.PREF_VOICE_MODE, voiceModeMain);
|
mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain);
|
||||||
mVoiceKeyEnabled = voiceMode != null && !voiceMode.equals(voiceModeOff);
|
|
||||||
mVoiceKeyOnMain = voiceMode != null && voiceMode.equals(voiceModeMain);
|
|
||||||
|
|
||||||
LocaleUtils.setSystemLocale(res, savedLocale);
|
LocaleUtils.setSystemLocale(res, savedLocale);
|
||||||
}
|
}
|
||||||
@ -214,8 +217,8 @@ public class SettingsValues {
|
|||||||
Integer.toString(resources.getInteger(R.integer.config_delay_after_preview))));
|
Integer.toString(resources.getInteger(R.integer.config_delay_after_preview))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isBigramSuggestionEnabled(SharedPreferences sp, Resources resources,
|
private static boolean isBigramSuggestionEnabled(final SharedPreferences sp,
|
||||||
boolean autoCorrectEnabled) {
|
final Resources resources, final boolean autoCorrectEnabled) {
|
||||||
final boolean showBigramSuggestionsOption = resources.getBoolean(
|
final boolean showBigramSuggestionsOption = resources.getBoolean(
|
||||||
R.bool.config_enable_bigram_suggestions_option);
|
R.bool.config_enable_bigram_suggestions_option);
|
||||||
if (!showBigramSuggestionsOption) {
|
if (!showBigramSuggestionsOption) {
|
||||||
@ -225,17 +228,14 @@ public class SettingsValues {
|
|||||||
R.bool.config_default_bigram_suggestions));
|
R.bool.config_default_bigram_suggestions));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isBigramPredictionEnabled(SharedPreferences sp,
|
private static boolean isBigramPredictionEnabled(final SharedPreferences sp,
|
||||||
Resources resources) {
|
final Resources resources) {
|
||||||
return sp.getBoolean(Settings.PREF_BIGRAM_PREDICTIONS, resources.getBoolean(
|
return sp.getBoolean(Settings.PREF_BIGRAM_PREDICTIONS, resources.getBoolean(
|
||||||
R.bool.config_default_bigram_prediction));
|
R.bool.config_default_bigram_prediction));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double getAutoCorrectionThreshold(SharedPreferences sp,
|
private static double getAutoCorrectionThreshold(final SharedPreferences sp,
|
||||||
Resources resources) {
|
final Resources resources, final String currentAutoCorrectionSetting) {
|
||||||
final String currentAutoCorrectionSetting = sp.getString(
|
|
||||||
Settings.PREF_AUTO_CORRECTION_THRESHOLD,
|
|
||||||
resources.getString(R.string.auto_correction_threshold_mode_index_modest));
|
|
||||||
final String[] autoCorrectionThresholdValues = resources.getStringArray(
|
final String[] autoCorrectionThresholdValues = resources.getStringArray(
|
||||||
R.array.auto_correction_threshold_values);
|
R.array.auto_correction_threshold_values);
|
||||||
// When autoCorrectionThreshold is greater than 1.0, it's like auto correction is off.
|
// When autoCorrectionThreshold is greater than 1.0, it's like auto correction is off.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user