Increase encapsulation (A118)
showSuggestions is only ever called by updateSuggestionsOrPredictions. It only feels natural that, when called with a 0-sized or null suggestion list, it clears the suggestions. Change-Id: I5b52bc9151afca1bb6c6f0a7f81e3255add92177
This commit is contained in:
parent
1343d27de3
commit
2c5cf744e5
1 changed files with 6 additions and 6 deletions
|
@ -1668,6 +1668,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: rename this method to updateSuggestionStrip or simply updateSuggestions
|
||||||
private void updateSuggestionsOrPredictions() {
|
private void updateSuggestionsOrPredictions() {
|
||||||
mHandler.cancelUpdateSuggestionStrip();
|
mHandler.cancelUpdateSuggestionStrip();
|
||||||
|
|
||||||
|
@ -1699,11 +1700,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
mCurrentSettings.mCorrectionEnabled);
|
mCurrentSettings.mCorrectionEnabled);
|
||||||
suggestedWords = maybeRetrieveOlderSuggestions(typedWord, suggestedWords);
|
suggestedWords = maybeRetrieveOlderSuggestions(typedWord, suggestedWords);
|
||||||
|
|
||||||
if (null != suggestedWords && suggestedWords.size() > 0) {
|
|
||||||
showSuggestions(suggestedWords, typedWord);
|
showSuggestions(suggestedWords, typedWord);
|
||||||
} else {
|
|
||||||
clearSuggestions();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SuggestedWords maybeRetrieveOlderSuggestions(final CharSequence typedWord,
|
private SuggestedWords maybeRetrieveOlderSuggestions(final CharSequence typedWord,
|
||||||
|
@ -1738,7 +1735,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
private void showSuggestions(final SuggestedWords suggestedWords,
|
private void showSuggestions(final SuggestedWords suggestedWords,
|
||||||
final CharSequence typedWord) {
|
final CharSequence typedWord) {
|
||||||
// This method is only ever called by updateSuggestions or updateBigramPredictions.
|
if (null == suggestedWords || suggestedWords.size() <= 0) {
|
||||||
|
clearSuggestions();
|
||||||
|
return;
|
||||||
|
}
|
||||||
final CharSequence autoCorrection;
|
final CharSequence autoCorrection;
|
||||||
if (suggestedWords.size() > 0) {
|
if (suggestedWords.size() > 0) {
|
||||||
if (suggestedWords.mWillAutoCorrect) {
|
if (suggestedWords.mWillAutoCorrect) {
|
||||||
|
|
Loading…
Reference in a new issue