Removing the "off" value from the auto_correction_threshold_values array. Making required code changes to auto correct threshold code based on this change.

This commit is contained in:
Paul Shields 2022-12-14 21:48:36 +00:00
parent 0ae60405d7
commit 0109899da8
2 changed files with 9 additions and 12 deletions

View file

@ -53,6 +53,7 @@ public class SettingsValues {
private static final String FLOAT_NEGATIVE_INFINITY_MARKER_STRING = "floatNegativeInfinity";
private static final int TIMEOUT_TO_GET_TARGET_PACKAGE = 5; // seconds
public static final float DEFAULT_SIZE_SCALE = 1.0f; // 100%
public static final float AUTO_CORRECTION_DISABLED_THRESHOLD = Float.MAX_VALUE;
// From resources:
public final SpacingAndPunctuations mSpacingAndPunctuations;
@ -163,9 +164,9 @@ public class SettingsValues {
&& inputAttributes.mIsGeneralTextInput;
mBlockPotentiallyOffensive = Settings.readBlockPotentiallyOffensive(prefs, res);
mAutoCorrectEnabled = Settings.readAutoCorrectEnabled(prefs, res);
final String autoCorrectionThresholdRawValue = mAutoCorrectEnabled
? Settings.readAutoCorrectConfidence(prefs, res)
: res.getString(R.string.auto_correction_threshold_mode_index_off);
mAutoCorrectionThreshold = mAutoCorrectEnabled
? readAutoCorrectionThreshold(res, prefs)
: AUTO_CORRECTION_DISABLED_THRESHOLD;
mBigramPredictionEnabled = readBigramPredictionEnabled(prefs, res);
mDoubleSpacePeriodTimeout = res.getInteger(R.integer.config_double_space_period_timeout);
mHasHardwareKeyboard = Settings.readHasHardwareKeyboard(res.getConfiguration());
@ -183,8 +184,6 @@ public class SettingsValues {
Settings.PREF_ENABLE_EMOJI_ALT_PHYSICAL_KEY, true);
mShowAppIcon = Settings.readShowSetupWizardIcon(prefs, context);
mIsShowAppIconSettingInPreferences = prefs.contains(Settings.PREF_SHOW_SETUP_WIZARD_ICON);
mAutoCorrectionThreshold = readAutoCorrectionThreshold(res,
autoCorrectionThresholdRawValue);
mPlausibilityThreshold = Settings.readPlausibilityThreshold(res);
mGestureInputEnabled = Settings.readGestureInputEnabled(prefs, res);
mGestureTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true);
@ -331,7 +330,8 @@ public class SettingsValues {
}
private static float readAutoCorrectionThreshold(final Resources res,
final String currentAutoCorrectionSetting) {
final SharedPreferences prefs) {
final String currentAutoCorrectionSetting = Settings.readAutoCorrectConfidence(prefs, res);
final String[] autoCorrectionThresholdValues = res.getStringArray(
R.array.auto_correction_threshold_values);
// When autoCorrectionThreshold is greater than 1.0, it's like auto correction is off.

View file

@ -21,8 +21,6 @@
<resources>
<!-- The array of auto correction threshold values. -->
<string-array name="auto_correction_threshold_values" translatable="false">
<!-- Off, When auto correction setting is Off, this value is not used. -->
<item>floatMaxValue</item>
<!-- Modest : Suggestion whose normalized score is greater than this value
will be subject to auto-correction. -->
<item>0.185</item>
@ -41,10 +39,9 @@
<string name="plausibility_threshold" translatable="false">0.065</string>
<!-- The index of the auto correction threshold values array. -->
<string name="auto_correction_threshold_mode_index_off" translatable="false">0</string>
<string name="auto_correction_threshold_mode_index_modest" translatable="false">1</string>
<string name="auto_correction_threshold_mode_index_aggressive" translatable="false">2</string>
<string name="auto_correction_threshold_mode_index_very_aggressive" translatable="false">3</string>
<string name="auto_correction_threshold_mode_index_modest" translatable="false">0</string>
<string name="auto_correction_threshold_mode_index_aggressive" translatable="false">1</string>
<string name="auto_correction_threshold_mode_index_very_aggressive" translatable="false">2</string>
<!-- The array of the auto correction threshold settings values. -->
<string-array name="auto_correction_threshold_mode_indexes" translatable="false">