Merge "Merge the interface of two methods that do the same thing (A9)"
commit
d522ddefc2
|
@ -1710,7 +1710,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.mCorrectionEnabled);
|
mCurrentSettings.mCorrectionEnabled, false);
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -1922,7 +1922,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
if (mCurrentSettings.mCorrectionEnabled) {
|
if (mCurrentSettings.mCorrectionEnabled) {
|
||||||
final CharSequence prevWord = mConnection.getThisWord(mCurrentSettings.mWordSeparators);
|
final CharSequence prevWord = mConnection.getThisWord(mCurrentSettings.mWordSeparators);
|
||||||
if (!TextUtils.isEmpty(prevWord)) {
|
if (!TextUtils.isEmpty(prevWord)) {
|
||||||
suggestedWords = mSuggest.getBigramPredictions(prevWord);
|
suggestedWords = mSuggest.getSuggestedWords(mWordComposer,
|
||||||
|
prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(),
|
||||||
|
mCurrentSettings.mCorrectionEnabled, true);
|
||||||
} else {
|
} else {
|
||||||
suggestedWords = null;
|
suggestedWords = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,13 +234,22 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
true /* isPrediction */);
|
true /* isPrediction */);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder
|
// Compatibility for tests. TODO: remove this
|
||||||
public SuggestedWords getSuggestedWords(
|
public SuggestedWords getSuggestedWords(
|
||||||
final WordComposer wordComposer, CharSequence prevWordForBigram,
|
final WordComposer wordComposer, CharSequence prevWordForBigram,
|
||||||
final ProximityInfo proximityInfo, final boolean isCorrectionEnabled) {
|
final ProximityInfo proximityInfo, final boolean isCorrectionEnabled) {
|
||||||
|
return getSuggestedWords(wordComposer, prevWordForBigram, proximityInfo,
|
||||||
|
isCorrectionEnabled, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
final boolean isPrediction) {
|
||||||
LatinImeLogger.onStartSuggestion(prevWordForBigram);
|
LatinImeLogger.onStartSuggestion(prevWordForBigram);
|
||||||
mIsFirstCharCapitalized = wordComposer.isFirstCharCapitalized();
|
mIsFirstCharCapitalized = !isPrediction && wordComposer.isFirstCharCapitalized();
|
||||||
mIsAllUpperCase = wordComposer.isAllUpperCase();
|
mIsAllUpperCase = !isPrediction && wordComposer.isAllUpperCase();
|
||||||
mTrailingSingleQuotesCount = wordComposer.trailingSingleQuotesCount();
|
mTrailingSingleQuotesCount = wordComposer.trailingSingleQuotesCount();
|
||||||
mSuggestions = new ArrayList<SuggestedWordInfo>(MAX_SUGGESTIONS);
|
mSuggestions = new ArrayList<SuggestedWordInfo>(MAX_SUGGESTIONS);
|
||||||
|
|
||||||
|
@ -305,12 +314,14 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mSuggestions.add(0, new SuggestedWordInfo(typedWord, SuggestedWordInfo.MAX_SCORE,
|
if (!isPrediction) {
|
||||||
SuggestedWordInfo.KIND_TYPED));
|
mSuggestions.add(0, new SuggestedWordInfo(typedWord, SuggestedWordInfo.MAX_SCORE,
|
||||||
|
SuggestedWordInfo.KIND_TYPED));
|
||||||
|
}
|
||||||
SuggestedWordInfo.removeDups(mSuggestions);
|
SuggestedWordInfo.removeDups(mSuggestions);
|
||||||
|
|
||||||
final ArrayList<SuggestedWordInfo> suggestionsList;
|
final ArrayList<SuggestedWordInfo> suggestionsList;
|
||||||
if (DBG) {
|
if (DBG && !mSuggestions.isEmpty()) {
|
||||||
suggestionsList = getSuggestionsInfoListWithDebugInfo(typedWord, mSuggestions);
|
suggestionsList = getSuggestionsInfoListWithDebugInfo(typedWord, mSuggestions);
|
||||||
} else {
|
} else {
|
||||||
suggestionsList = mSuggestions;
|
suggestionsList = mSuggestions;
|
||||||
|
@ -343,12 +354,12 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
autoCorrectionAvailable = false;
|
autoCorrectionAvailable = false;
|
||||||
}
|
}
|
||||||
return new SuggestedWords(suggestionsList,
|
return new SuggestedWords(suggestionsList,
|
||||||
!allowsToBeAutoCorrected /* typedWordValid */,
|
!isPrediction && !allowsToBeAutoCorrected /* typedWordValid */,
|
||||||
autoCorrectionAvailable /* hasAutoCorrectionCandidate */,
|
!isPrediction && autoCorrectionAvailable /* hasAutoCorrectionCandidate */,
|
||||||
allowsToBeAutoCorrected /* allowsToBeAutoCorrected */,
|
!isPrediction && allowsToBeAutoCorrected /* allowsToBeAutoCorrected */,
|
||||||
false /* isPunctuationSuggestions */,
|
false /* isPunctuationSuggestions */,
|
||||||
false /* isObsoleteSuggestions */,
|
false /* isObsoleteSuggestions */,
|
||||||
false /* isPrediction */);
|
isPrediction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue