From 70f2762e285fe85676de4270edee97de54674879 Mon Sep 17 00:00:00 2001 From: Satoshi Kataoka Date: Wed, 24 Apr 2013 14:43:29 +0900 Subject: [PATCH] Make aggressive threshold really aggressive Bug: 8701480 Change-Id: If8242cfe61f3e56712fd6e25e36858cff7f0d177 --- java/res/values/config.xml | 5 +++-- .../android/inputmethod/latin/SettingsValues.java | 13 ++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/java/res/values/config.xml b/java/res/values/config.xml index 4e2936c5c..f2e76bd29 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -111,8 +111,9 @@ 0.067 - 0 + will be subject to auto-correction. "floatNegativeInfinity" is a special marker + string for Float.NEGATIVE_INFINITY --> + floatNegativeInfinity diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java index f77a92885..838863c71 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; @@ -266,8 +269,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 +282,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; }