[IL38] Fix a wrong double call

This only gives bad results if a gesture results in only one suggestion.

Change-Id: I5a2f27f83f6901a5a9ecf22f02bdfc9cca6d9f1d
This commit is contained in:
Jean Chalard 2013-12-24 22:35:14 +09:00
parent d77ad1902b
commit 98140faac3

View file

@ -1378,14 +1378,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
sequenceNumber, new OnGetSuggestedWordsCallback() { sequenceNumber, new OnGetSuggestedWordsCallback() {
@Override @Override
public void onGetSuggestedWords(SuggestedWords suggestedWords) { public void onGetSuggestedWords(SuggestedWords suggestedWords) {
final int suggestionCount = suggestedWords.size(); if (suggestedWords.isEmpty()) {
if (suggestionCount <= 1) { // Previous suggestions are found in InputLogic#mSuggestedWords. Since
final String mostProbableSuggestion = (suggestionCount == 0) ? null // these are the most recent suggestions and we just recomputed new
: suggestedWords.getWord(0); // ones to update them, it means the previous ones are there.
callback.onGetSuggestedWords( callback.onGetSuggestedWords(mLatinIme.mInputLogic.mSuggestedWords);
mLatinIme.getOlderSuggestions(mostProbableSuggestion)); } else {
callback.onGetSuggestedWords(suggestedWords);
} }
callback.onGetSuggestedWords(suggestedWords);
} }
}); });
} }