mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-06 14:50:14 +00:00
fix potential issue with not set autocorrect threshold
and an unintentionally changed default
This commit is contained in:
parent
201b430362
commit
fe59a598b7
4 changed files with 7 additions and 14 deletions
|
@ -691,9 +691,7 @@ public class LatinIME extends InputMethodService implements
|
|||
mDictionaryFacilitator.resetDictionaries(this, locale,
|
||||
settingsValues.mUseContactsDictionary, settingsValues.mUsePersonalizedDicts,
|
||||
false, settingsValues.mAccount, "", this);
|
||||
if (settingsValues.mAutoCorrectEnabled) {
|
||||
mInputLogic.mSuggest.setAutoCorrectionThreshold(settingsValues.mAutoCorrectionThreshold);
|
||||
}
|
||||
mInputLogic.mSuggest.setAutoCorrectionThreshold(settingsValues.mAutoCorrectionThreshold);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1017,9 +1015,7 @@ public class LatinIME extends InputMethodService implements
|
|||
|
||||
if (isDifferentTextField) {
|
||||
mainKeyboardView.closing();
|
||||
if (currentSettingsValues.mAutoCorrectEnabled) {
|
||||
suggest.setAutoCorrectionThreshold(currentSettingsValues.mAutoCorrectionThreshold);
|
||||
}
|
||||
suggest.setAutoCorrectionThreshold(currentSettingsValues.mAutoCorrectionThreshold);
|
||||
switcher.loadKeyboard(editorInfo, currentSettingsValues, getCurrentAutoCapsState(), getCurrentRecapitalizeState());
|
||||
if (needToCallLoadKeyboardLater) {
|
||||
// If we need to call loadKeyboard again later, we need to save its state now. The
|
||||
|
|
|
@ -45,7 +45,7 @@ object Defaults {
|
|||
const val PREF_AUTO_CORRECTION = true
|
||||
const val PREF_MORE_AUTO_CORRECTION = false
|
||||
const val PREF_AUTO_CORRECTION_CONFIDENCE = "0"
|
||||
const val PREF_AUTOCORRECT_SHORTCUTS = false
|
||||
const val PREF_AUTOCORRECT_SHORTCUTS = true
|
||||
const val PREF_CENTER_SUGGESTION_TEXT_TO_ENTER = false
|
||||
const val PREF_SHOW_SUGGESTIONS = true
|
||||
const val PREF_ALWAYS_SHOW_SUGGESTIONS = false
|
||||
|
|
|
@ -36,7 +36,7 @@ public final class AutoCorrectionUtils {
|
|||
if (DebugFlags.DEBUG_ENABLED) {
|
||||
Log.d(TAG, "Normalized " + consideredWord + "," + suggestion + ","
|
||||
+ autoCorrectionSuggestionScore + ", " + normalizedScore
|
||||
+ "(" + threshold + ")");
|
||||
+ " (" + threshold + ")");
|
||||
}
|
||||
if (normalizedScore >= threshold) {
|
||||
if (DebugFlags.DEBUG_ENABLED) {
|
||||
|
|
|
@ -268,11 +268,6 @@ class SuggestTest {
|
|||
assert(!result.last()) // should not be corrected
|
||||
}
|
||||
|
||||
private fun setAutCorrectThreshold(threshold: String) {
|
||||
val prefs = latinIME.prefs()
|
||||
prefs.edit { putString(Settings.PREF_AUTO_CORRECTION_CONFIDENCE, threshold) }
|
||||
}
|
||||
|
||||
private fun shouldBeAutoCorrected(word: String, // typed word
|
||||
suggestions: List<SuggestedWordInfo>, // suggestions ordered by score, including suggestion for typed word if in dictionary
|
||||
firstSuggestionForEmpty: SuggestedWordInfo?, // first suggestion if typed word would be empty (null if none)
|
||||
|
@ -280,7 +275,9 @@ class SuggestTest {
|
|||
typingLocale: Locale, // used for checking whether suggestion locale is the same, relevant e.g. for English i -> I shortcut, but we want Polish i
|
||||
autoCorrectThreshold: String // 0, 1, or 2, but better use the vals on top with the corresponding name
|
||||
): List<Boolean> {
|
||||
setAutCorrectThreshold(autoCorrectThreshold)
|
||||
latinIME.prefs().edit { putString(Settings.PREF_AUTO_CORRECTION_CONFIDENCE, autoCorrectThreshold) }
|
||||
// enable "more autocorrect" so we actually have autocorrect even though we don't set a compatible input type
|
||||
latinIME.prefs().edit { putBoolean(Settings.PREF_MORE_AUTO_CORRECTION, true) }
|
||||
currentTypingLocale = typingLocale
|
||||
val suggestionsContainer = ArrayList<SuggestedWordInfo>().apply { addAll(suggestions) }
|
||||
val suggestionResults = SuggestionResults(suggestions.size, false, false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue