diff options
author | 2013-08-30 14:06:19 +0000 | |
---|---|---|
committer | 2013-08-30 14:06:19 +0000 | |
commit | 78f707a142570c33bf5a7a3173f39d19103383ea (patch) | |
tree | 9c4808da6e1b6a51bdbd4b24de4c6912528ec4db /java/src/com/android/inputmethod/latin/Suggest.java | |
parent | 820c290a61e4067c9d8557af4c3160c866f70667 (diff) | |
download | latinime-78f707a142570c33bf5a7a3173f39d19103383ea.tar.gz latinime-78f707a142570c33bf5a7a3173f39d19103383ea.tar.xz latinime-78f707a142570c33bf5a7a3173f39d19103383ea.zip |
Revert "Add onGetSuggestedWordsCallback."
This reverts commit 820c290a61e4067c9d8557af4c3160c866f70667.
Change-Id: I5c50731ff9f330c05c5841b8c65f16e28e67422c
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 18ba15872..826387a05 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -211,31 +211,26 @@ public final class Suggest { mAutoCorrectionThreshold = threshold; } - public interface OnGetSuggestedWordsCallback { - public void onGetSuggestedWords(final SuggestedWords suggestedWords); - } - - public void getSuggestedWords(final WordComposer wordComposer, + public SuggestedWords getSuggestedWords(final WordComposer wordComposer, final String prevWordForBigram, final ProximityInfo proximityInfo, final boolean blockOffensiveWords, final boolean isCorrectionEnabled, - final int[] additionalFeaturesOptions, final int sessionId, - final OnGetSuggestedWordsCallback callback) { + final int[] additionalFeaturesOptions, final int sessionId) { LatinImeLogger.onStartSuggestion(prevWordForBigram); if (wordComposer.isBatchMode()) { - getSuggestedWordsForBatchInput(wordComposer, prevWordForBigram, proximityInfo, - blockOffensiveWords, additionalFeaturesOptions, sessionId, callback); + return getSuggestedWordsForBatchInput( + wordComposer, prevWordForBigram, proximityInfo, blockOffensiveWords, + additionalFeaturesOptions, sessionId); } else { - getSuggestedWordsForTypingInput(wordComposer, prevWordForBigram, proximityInfo, - blockOffensiveWords, isCorrectionEnabled, additionalFeaturesOptions, callback); + return getSuggestedWordsForTypingInput(wordComposer, prevWordForBigram, proximityInfo, + blockOffensiveWords, isCorrectionEnabled, additionalFeaturesOptions); } } - // Retrieves suggestions for the typing input - // and calls the callback function with the suggestions. - private void getSuggestedWordsForTypingInput(final WordComposer wordComposer, + // Retrieves suggestions for the typing input. + private SuggestedWords getSuggestedWordsForTypingInput(final WordComposer wordComposer, final String prevWordForBigram, final ProximityInfo proximityInfo, final boolean blockOffensiveWords, final boolean isCorrectionEnabled, - final int[] additionalFeaturesOptions, final OnGetSuggestedWordsCallback callback) { + final int[] additionalFeaturesOptions) { final int trailingSingleQuotesCount = wordComposer.trailingSingleQuotesCount(); final BoundedTreeSet suggestionsSet = new BoundedTreeSet(sSuggestedWordInfoComparator, MAX_SUGGESTIONS); @@ -258,8 +253,8 @@ public final class Suggest { for (final String key : mDictionaries.keySet()) { final Dictionary dictionary = mDictionaries.get(key); - suggestionsSet.addAll(dictionary.getSuggestions(wordComposerForLookup, - prevWordForBigram, proximityInfo, blockOffensiveWords, + suggestionsSet.addAll(dictionary.getSuggestions( + wordComposerForLookup, prevWordForBigram, proximityInfo, blockOffensiveWords, additionalFeaturesOptions)); } @@ -337,7 +332,7 @@ public final class Suggest { suggestionsList = suggestionsContainer; } - callback.onGetSuggestedWords(new SuggestedWords(suggestionsList, + return new SuggestedWords(suggestionsList, // TODO: this first argument is lying. If this is a whitelisted word which is an // actual word, it says typedWordValid = false, which looks wrong. We should either // rename the attribute or change the value. @@ -345,15 +340,14 @@ public final class Suggest { hasAutoCorrection, /* willAutoCorrect */ false /* isPunctuationSuggestions */, false /* isObsoleteSuggestions */, - !wordComposer.isComposingWord() /* isPrediction */)); + !wordComposer.isComposingWord() /* isPrediction */); } - // Retrieves suggestions for the batch input - // and calls the callback function with the suggestions. - private void getSuggestedWordsForBatchInput(final WordComposer wordComposer, + // Retrieves suggestions for the batch input. + private SuggestedWords getSuggestedWordsForBatchInput(final WordComposer wordComposer, final String prevWordForBigram, final ProximityInfo proximityInfo, final boolean blockOffensiveWords, final int[] additionalFeaturesOptions, - final int sessionId, final OnGetSuggestedWordsCallback callback) { + final int sessionId) { final BoundedTreeSet suggestionsSet = new BoundedTreeSet(sSuggestedWordInfoComparator, MAX_SUGGESTIONS); @@ -407,12 +401,12 @@ public final class Suggest { // In the batch input mode, the most relevant suggested word should act as a "typed word" // (typedWordValid=true), not as an "auto correct word" (willAutoCorrect=false). - callback.onGetSuggestedWords(new SuggestedWords(suggestionsContainer, + return new SuggestedWords(suggestionsContainer, true /* typedWordValid */, false /* willAutoCorrect */, false /* isPunctuationSuggestions */, false /* isObsoleteSuggestions */, - false /* isPrediction */)); + false /* isPrediction */); } private static ArrayList<SuggestedWordInfo> getSuggestionsInfoListWithDebugInfo( |