diff options
author | 2010-12-12 03:58:50 -0800 | |
---|---|---|
committer | 2010-12-12 03:58:50 -0800 | |
commit | 3ef38b2907a8b162bb98a5059a296f0541ae7ef2 (patch) | |
tree | f16f8e085f09accb4f0c1a2615d800290201bb83 /java/src/com/android/inputmethod/latin/Suggest.java | |
parent | e7f9a2221c6b1231d1242173312ce8f48adf8756 (diff) | |
parent | 7e181fe1010c8eac7814cc67a0c4b3864a10b151 (diff) | |
download | latinime-3ef38b2907a8b162bb98a5059a296f0541ae7ef2.tar.gz latinime-3ef38b2907a8b162bb98a5059a296f0541ae7ef2.tar.xz latinime-3ef38b2907a8b162bb98a5059a296f0541ae7ef2.zip |
Merge "Introduce SuggestedWords class to represent suggestions list"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index a6df187e6..237d7cb67 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -25,12 +25,10 @@ import android.view.View; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; -import java.util.List; /** * This class loads a dictionary and provides a list of suggestions for a given sequence of * characters. This includes corrections and completions. - * @hide pending API Council Approval */ public class Suggest implements Dictionary.WordCallback { @@ -191,14 +189,21 @@ public class Suggest implements Dictionary.WordCallback { } /** - * Returns a list of words that match the list of character codes passed in. - * This list will be overwritten the next time this function is called. + * Returns a object which represents suggested words that match the list of character codes + * passed in. This object contents will be overwritten the next time this function is called. * @param view a view for retrieving the context for AutoText * @param wordComposer contains what is currently being typed * @param prevWordForBigram previous word (used only for bigram) - * @return list of suggestions. + * @return suggested words object. */ - public List<CharSequence> getSuggestions(View view, WordComposer wordComposer, + public SuggestedWords getSuggestions(View view, WordComposer wordComposer, + boolean includeTypedWordIfValid, CharSequence prevWordForBigram) { + return getSuggestedWordBuilder(view, wordComposer, includeTypedWordIfValid, + prevWordForBigram).build(); + } + + // TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder + public SuggestedWords.Builder getSuggestedWordBuilder(View view, WordComposer wordComposer, boolean includeTypedWordIfValid, CharSequence prevWordForBigram) { LatinImeLogger.onStartSuggestion(prevWordForBigram); mHaveCorrection = false; @@ -342,7 +347,7 @@ public class Suggest implements Dictionary.WordCallback { } } removeDupes(); - return mSuggestions; + return new SuggestedWords.Builder().setWords(mSuggestions); } public int[] getNextLettersFrequencies() { |