aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/SettingsValues.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SettingsValues.java')
-rw-r--r--java/src/com/android/inputmethod/latin/SettingsValues.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index f77a92885..615b2dfab 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -34,6 +34,9 @@ import java.util.Arrays;
*/
public final class SettingsValues {
private static final String TAG = SettingsValues.class.getSimpleName();
+ // "floatNegativeInfinity" is a special marker string for Float.NEGATIVE_INFINITE
+ // currently used for auto-correction
+ private static final String FLOAT_NEGATIVE_INFINITY_MARKER_STRING = "floatNegativeInfinity";
// From resources:
public final int mDelayUpdateOldSuggestions;
@@ -54,6 +57,7 @@ public final class SettingsValues {
public final boolean mShowsLanguageSwitchKey;
public final boolean mUseContactsDict;
public final boolean mUseDoubleSpacePeriod;
+ public final boolean mBlockPotentiallyOffensive;
// Use bigrams to predict the next word when there is no input for it yet
public final boolean mBigramPredictionEnabled;
public final boolean mGestureInputEnabled;
@@ -123,6 +127,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);
+ mBlockPotentiallyOffensive = Settings.readBlockPotentiallyOffensive(prefs, res);
mAutoCorrectEnabled = Settings.readAutoCorrectEnabled(autoCorrectionThresholdRawValue, res);
mBigramPredictionEnabled = readBigramPredictionEnabled(prefs, res);
@@ -266,8 +271,12 @@ public final class SettingsValues {
try {
final int arrayIndex = Integer.valueOf(currentAutoCorrectionSetting);
if (arrayIndex >= 0 && arrayIndex < autoCorrectionThresholdValues.length) {
- autoCorrectionThreshold = Float.parseFloat(
- autoCorrectionThresholdValues[arrayIndex]);
+ final String val = autoCorrectionThresholdValues[arrayIndex];
+ if (FLOAT_NEGATIVE_INFINITY_MARKER_STRING.equals(val)) {
+ autoCorrectionThreshold = Float.NEGATIVE_INFINITY;
+ } else {
+ autoCorrectionThreshold = Float.parseFloat(val);
+ }
}
} catch (NumberFormatException e) {
// Whenever the threshold settings are correct, never come here.
@@ -275,7 +284,7 @@ public final class SettingsValues {
Log.w(TAG, "Cannot load auto correction threshold setting."
+ " currentAutoCorrectionSetting: " + currentAutoCorrectionSetting
+ ", autoCorrectionThresholdValues: "
- + Arrays.toString(autoCorrectionThresholdValues));
+ + Arrays.toString(autoCorrectionThresholdValues), e);
}
return autoCorrectionThreshold;
}