Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70f2762e authored by Satoshi Kataoka's avatar Satoshi Kataoka
Browse files

Make aggressive threshold really aggressive

Bug: 8701480
Change-Id: If8242cfe61f3e56712fd6e25e36858cff7f0d177
parent 3ee39be1
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -111,8 +111,9 @@
        <!-- Aggressive -->
        <item>0.067</item>
        <!-- Very Aggressive : Suggestion whose normalized score is greater than this value
             will be subject to auto-correction. -->
        <item>0</item>
             will be subject to auto-correction. "floatNegativeInfinity" is a special marker
             string for Float.NEGATIVE_INFINITY -->
        <item>floatNegativeInfinity</item>
    </string-array>
    <!-- Threshold of the normalized score of the best suggestion for the spell checker to declare
         a word to be "recommended" -->
+10 −3
Original line number Diff line number Diff line
@@ -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;
    }