From 98140faac34ad2250c38c5f651788308adbedb2d Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Tue, 24 Dec 2013 22:35:14 +0900 Subject: [IL38] Fix a wrong double call This only gives bad results if a gesture results in only one suggestion. Change-Id: I5a2f27f83f6901a5a9ecf22f02bdfc9cca6d9f1d --- java/src/com/android/inputmethod/latin/LatinIME.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d8fb4f2be..7041c5688 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1378,14 +1378,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen sequenceNumber, new OnGetSuggestedWordsCallback() { @Override public void onGetSuggestedWords(SuggestedWords suggestedWords) { - final int suggestionCount = suggestedWords.size(); - if (suggestionCount <= 1) { - final String mostProbableSuggestion = (suggestionCount == 0) ? null - : suggestedWords.getWord(0); - callback.onGetSuggestedWords( - mLatinIme.getOlderSuggestions(mostProbableSuggestion)); + if (suggestedWords.isEmpty()) { + // Previous suggestions are found in InputLogic#mSuggestedWords. Since + // these are the most recent suggestions and we just recomputed new + // ones to update them, it means the previous ones are there. + callback.onGetSuggestedWords(mLatinIme.mInputLogic.mSuggestedWords); + } else { + callback.onGetSuggestedWords(suggestedWords); } - callback.onGetSuggestedWords(suggestedWords); } }); } -- cgit v1.2.3-83-g751a