Merge "Small refactor (A1)"
This commit is contained in:
commit
9727aea418
1 changed files with 9 additions and 10 deletions
|
@ -1715,7 +1715,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
setSuggestions(SuggestedWords.EMPTY);
|
setSuggestions(SuggestedWords.EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSuggestions(SuggestedWords words) {
|
public void setSuggestions(final SuggestedWords words) {
|
||||||
if (mSuggestionsView != null) {
|
if (mSuggestionsView != null) {
|
||||||
mSuggestionsView.setSuggestions(words);
|
mSuggestionsView.setSuggestions(words);
|
||||||
mKeyboardSwitcher.onAutoCorrectionStateChanged(
|
mKeyboardSwitcher.onAutoCorrectionStateChanged(
|
||||||
|
@ -1830,25 +1830,24 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
showSuggestions(builder.build(), typedWord);
|
showSuggestions(builder.build(), typedWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showSuggestions(SuggestedWords suggestedWords, CharSequence typedWord) {
|
public void showSuggestions(final SuggestedWords suggestedWords, final CharSequence typedWord) {
|
||||||
final boolean shouldBlockAutoCorrectionBySafetyNet =
|
final boolean shouldBlockAutoCorrectionBySafetyNet =
|
||||||
Utils.shouldBlockAutoCorrectionBySafetyNet(suggestedWords, mSuggest);
|
Utils.shouldBlockAutoCorrectionBySafetyNet(suggestedWords, mSuggest);
|
||||||
if (shouldBlockAutoCorrectionBySafetyNet) {
|
if (shouldBlockAutoCorrectionBySafetyNet) {
|
||||||
suggestedWords.setShouldBlockAutoCorrection();
|
suggestedWords.setShouldBlockAutoCorrection();
|
||||||
}
|
}
|
||||||
setSuggestions(suggestedWords);
|
final CharSequence autoCorrection;
|
||||||
if (suggestedWords.size() > 0) {
|
if (suggestedWords.size() > 0) {
|
||||||
if (shouldBlockAutoCorrectionBySafetyNet) {
|
if (!shouldBlockAutoCorrectionBySafetyNet && suggestedWords.hasAutoCorrectionWord()) {
|
||||||
mWordComposer.setAutoCorrection(typedWord);
|
autoCorrection = suggestedWords.getWord(1);
|
||||||
} else if (suggestedWords.hasAutoCorrectionWord()) {
|
|
||||||
mWordComposer.setAutoCorrection(suggestedWords.getWord(1));
|
|
||||||
} else {
|
} else {
|
||||||
mWordComposer.setAutoCorrection(typedWord);
|
autoCorrection = typedWord;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: replace with mWordComposer.deleteAutoCorrection()?
|
autoCorrection = null;
|
||||||
mWordComposer.setAutoCorrection(null);
|
|
||||||
}
|
}
|
||||||
|
mWordComposer.setAutoCorrection(autoCorrection);
|
||||||
|
setSuggestions(suggestedWords);
|
||||||
setSuggestionStripShown(isSuggestionsStripVisible());
|
setSuggestionStripShown(isSuggestionsStripVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue