am f330de95: am c01707db: Merge "Suppress exceptions that have always been happening."
* commit 'f330de9526025448e64bdfe69b3d277e214c2512': Suppress exceptions that have always been happening.main
commit
d439ee371d
|
@ -103,7 +103,7 @@
|
||||||
-->
|
-->
|
||||||
<string-array name="auto_correction_threshold_values" translatable="false">
|
<string-array name="auto_correction_threshold_values" translatable="false">
|
||||||
<!-- Off, When auto correction setting is Off, this value is not used. -->
|
<!-- Off, When auto correction setting is Off, this value is not used. -->
|
||||||
<item></item>
|
<item>floatMaxValue</item>
|
||||||
<!-- Modest : Suggestion whose normalized score is greater than this value
|
<!-- Modest : Suggestion whose normalized score is greater than this value
|
||||||
will be subject to auto-correction. -->
|
will be subject to auto-correction. -->
|
||||||
<item>0.185</item>
|
<item>0.185</item>
|
||||||
|
|
|
@ -45,8 +45,9 @@ import java.util.Locale;
|
||||||
*/
|
*/
|
||||||
public final class SettingsValues {
|
public final class SettingsValues {
|
||||||
private static final String TAG = SettingsValues.class.getSimpleName();
|
private static final String TAG = SettingsValues.class.getSimpleName();
|
||||||
// "floatNegativeInfinity" is a special marker string for Float.NEGATIVE_INFINITE
|
// "floatMaxValue" and "floatNegativeInfinity" are special marker strings for
|
||||||
// currently used for auto-correction
|
// Float.NEGATIVE_INFINITE and Float.MAX_VALUE. Currently used for auto-correction settings.
|
||||||
|
private static final String FLOAT_MAX_VALUE_MARKER_STRING = "floatMaxValue";
|
||||||
private static final String FLOAT_NEGATIVE_INFINITY_MARKER_STRING = "floatNegativeInfinity";
|
private static final String FLOAT_NEGATIVE_INFINITY_MARKER_STRING = "floatNegativeInfinity";
|
||||||
|
|
||||||
// From resources:
|
// From resources:
|
||||||
|
@ -343,24 +344,28 @@ public final class SettingsValues {
|
||||||
final String[] autoCorrectionThresholdValues = res.getStringArray(
|
final String[] autoCorrectionThresholdValues = res.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.
|
||||||
float autoCorrectionThreshold = Float.MAX_VALUE;
|
final float autoCorrectionThreshold;
|
||||||
try {
|
try {
|
||||||
final int arrayIndex = Integer.valueOf(currentAutoCorrectionSetting);
|
final int arrayIndex = Integer.valueOf(currentAutoCorrectionSetting);
|
||||||
if (arrayIndex >= 0 && arrayIndex < autoCorrectionThresholdValues.length) {
|
if (arrayIndex >= 0 && arrayIndex < autoCorrectionThresholdValues.length) {
|
||||||
final String val = autoCorrectionThresholdValues[arrayIndex];
|
final String val = autoCorrectionThresholdValues[arrayIndex];
|
||||||
if (FLOAT_NEGATIVE_INFINITY_MARKER_STRING.equals(val)) {
|
if (FLOAT_MAX_VALUE_MARKER_STRING.equals(val)) {
|
||||||
|
autoCorrectionThreshold = Float.MAX_VALUE;
|
||||||
|
} else if (FLOAT_NEGATIVE_INFINITY_MARKER_STRING.equals(val)) {
|
||||||
autoCorrectionThreshold = Float.NEGATIVE_INFINITY;
|
autoCorrectionThreshold = Float.NEGATIVE_INFINITY;
|
||||||
} else {
|
} else {
|
||||||
autoCorrectionThreshold = Float.parseFloat(val);
|
autoCorrectionThreshold = Float.parseFloat(val);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
autoCorrectionThreshold = Float.MAX_VALUE;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (final NumberFormatException e) {
|
||||||
// Whenever the threshold settings are correct, never come here.
|
// Whenever the threshold settings are correct, never come here.
|
||||||
autoCorrectionThreshold = Float.MAX_VALUE;
|
|
||||||
Log.w(TAG, "Cannot load auto correction threshold setting."
|
Log.w(TAG, "Cannot load auto correction threshold setting."
|
||||||
+ " currentAutoCorrectionSetting: " + currentAutoCorrectionSetting
|
+ " currentAutoCorrectionSetting: " + currentAutoCorrectionSetting
|
||||||
+ ", autoCorrectionThresholdValues: "
|
+ ", autoCorrectionThresholdValues: "
|
||||||
+ Arrays.toString(autoCorrectionThresholdValues), e);
|
+ Arrays.toString(autoCorrectionThresholdValues), e);
|
||||||
|
return Float.MAX_VALUE;
|
||||||
}
|
}
|
||||||
return autoCorrectionThreshold;
|
return autoCorrectionThreshold;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue