parent
5475e92b3f
commit
9b233ecef2
|
@ -1716,7 +1716,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// getSuggestedWords handles gracefully a null value of prevWord
|
// getSuggestedWords handles gracefully a null value of prevWord
|
||||||
final SuggestedWords suggestedWords = mSuggest.getSuggestedWords(mWordComposer,
|
final SuggestedWords suggestedWords = mSuggest.getSuggestedWords(mWordComposer,
|
||||||
prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(),
|
prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(),
|
||||||
mCurrentSettings.mCorrectionMode);
|
mCurrentSettings.isCorrectionOn());
|
||||||
|
|
||||||
// Basically, we update the suggestion strip only when suggestion count > 1. However,
|
// Basically, we update the suggestion strip only when suggestion count > 1. However,
|
||||||
// there is an exception: We update the suggestion strip whenever typed word's length
|
// there is an exception: We update the suggestion strip whenever typed word's length
|
||||||
|
|
|
@ -208,9 +208,11 @@ public class SettingsValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int createCorrectionMode() {
|
private int createCorrectionMode() {
|
||||||
final boolean shouldAutoCorrect = mAutoCorrectEnabled
|
if (mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect) {
|
||||||
&& !mInputAttributes.mInputTypeNoAutoCorrect;
|
return Suggest.CORRECTION_FULL;
|
||||||
return shouldAutoCorrect ? Suggest.CORRECTION_FULL : Suggest.CORRECTION_NONE;
|
} else {
|
||||||
|
return Suggest.CORRECTION_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int createSuggestionVisibility(final Resources res) {
|
private int createSuggestionVisibility(final Resources res) {
|
||||||
|
|
|
@ -245,10 +245,18 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
true /* isPrediction */);
|
true /* isPrediction */);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder
|
// Wrapper for test compatibility. TODO: remove this method
|
||||||
public SuggestedWords getSuggestedWords(
|
public SuggestedWords getSuggestedWords(
|
||||||
final WordComposer wordComposer, CharSequence prevWordForBigram,
|
final WordComposer wordComposer, CharSequence prevWordForBigram,
|
||||||
final ProximityInfo proximityInfo, final int correctionMode) {
|
final ProximityInfo proximityInfo, final int correctionMode) {
|
||||||
|
return getSuggestedWords(wordComposer, prevWordForBigram, proximityInfo,
|
||||||
|
Suggest.CORRECTION_FULL == correctionMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder
|
||||||
|
public SuggestedWords getSuggestedWords(
|
||||||
|
final WordComposer wordComposer, CharSequence prevWordForBigram,
|
||||||
|
final ProximityInfo proximityInfo, final boolean isCorrectionEnabled) {
|
||||||
LatinImeLogger.onStartSuggestion(prevWordForBigram);
|
LatinImeLogger.onStartSuggestion(prevWordForBigram);
|
||||||
mIsFirstCharCapitalized = wordComposer.isFirstCharCapitalized();
|
mIsFirstCharCapitalized = wordComposer.isFirstCharCapitalized();
|
||||||
mIsAllUpperCase = wordComposer.isAllUpperCase();
|
mIsAllUpperCase = wordComposer.isAllUpperCase();
|
||||||
|
@ -263,7 +271,7 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM);
|
LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM);
|
||||||
mConsideredWord = consideredWord;
|
mConsideredWord = consideredWord;
|
||||||
|
|
||||||
if (wordComposer.size() <= 1 && (correctionMode == CORRECTION_FULL)) {
|
if (wordComposer.size() <= 1 && isCorrectionEnabled) {
|
||||||
// At first character typed, search only the bigrams
|
// At first character typed, search only the bigrams
|
||||||
mBigramSuggestions = new ArrayList<SuggestedWordInfo>(PREF_MAX_BIGRAMS);
|
mBigramSuggestions = new ArrayList<SuggestedWordInfo>(PREF_MAX_BIGRAMS);
|
||||||
|
|
||||||
|
@ -320,7 +328,7 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
mIsFirstCharCapitalized, mWhiteListDictionary.getWhitelistedWord(consideredWord));
|
mIsFirstCharCapitalized, mWhiteListDictionary.getWhitelistedWord(consideredWord));
|
||||||
|
|
||||||
final boolean hasAutoCorrection;
|
final boolean hasAutoCorrection;
|
||||||
if (CORRECTION_FULL == correctionMode) {
|
if (isCorrectionEnabled) {
|
||||||
final CharSequence autoCorrection =
|
final CharSequence autoCorrection =
|
||||||
AutoCorrection.computeAutoCorrectionWord(mUnigramDictionaries, wordComposer,
|
AutoCorrection.computeAutoCorrectionWord(mUnigramDictionaries, wordComposer,
|
||||||
mSuggestions, consideredWord, mAutoCorrectionThreshold,
|
mSuggestions, consideredWord, mAutoCorrectionThreshold,
|
||||||
|
@ -369,7 +377,7 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
&& mHasMainDictionary;
|
&& mHasMainDictionary;
|
||||||
|
|
||||||
boolean autoCorrectionAvailable = hasAutoCorrection;
|
boolean autoCorrectionAvailable = hasAutoCorrection;
|
||||||
if (correctionMode == CORRECTION_FULL) {
|
if (isCorrectionEnabled) {
|
||||||
autoCorrectionAvailable |= !allowsToBeAutoCorrected;
|
autoCorrectionAvailable |= !allowsToBeAutoCorrected;
|
||||||
}
|
}
|
||||||
// Don't auto-correct words with multiple capital letter
|
// Don't auto-correct words with multiple capital letter
|
||||||
|
|
Loading…
Reference in New Issue