diff options
author | 2013-04-17 19:47:12 -0700 | |
---|---|---|
committer | 2013-04-17 19:47:12 -0700 | |
commit | 2532265d6a1b85cc318c06d010632584a9bc7a63 (patch) | |
tree | 4a669ff05db1f091651e161871e1866eef1bb9a0 /java/src/com/android/inputmethod/latin/SuggestedWords.java | |
parent | da9c04cd45ded0fe8b9860f7386c1a695d6a6026 (diff) | |
parent | 34676d92cc08c5575995a36cef1df9c50c1facca (diff) | |
download | latinime-2532265d6a1b85cc318c06d010632584a9bc7a63.tar.gz latinime-2532265d6a1b85cc318c06d010632584a9bc7a63.tar.xz latinime-2532265d6a1b85cc318c06d010632584a9bc7a63.zip |
am 34676d92: am a022c538: Merge "If there are no suggestion span, recompute suggestions."
* commit '34676d92cc08c5575995a36cef1df9c50c1facca':
If there are no suggestion span, recompute suggestions.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SuggestedWords.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/SuggestedWords.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index 158cc1155..616e1911b 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -195,4 +195,21 @@ public final class SuggestedWords { } } } + + // SuggestedWords is an immutable object, as much as possible. We must not just remove + // words from the member ArrayList as some other parties may expect the object to never change. + public SuggestedWords getSuggestedWordsExcludingTypedWord() { + final ArrayList<SuggestedWordInfo> newSuggestions = CollectionUtils.newArrayList(); + for (int i = 0; i < mSuggestedWordInfoList.size(); ++i) { + final SuggestedWordInfo info = mSuggestedWordInfoList.get(i); + if (SuggestedWordInfo.KIND_TYPED != info.mKind) { + newSuggestions.add(info); + } + } + // We should never autocorrect, so we say the typed word is valid. Also, in this case, + // no auto-correction should take place hence willAutoCorrect = false. + return new SuggestedWords(newSuggestions, true /* typedWordValid */, + false /* willAutoCorrect */, mIsPunctuationSuggestions, mIsObsoleteSuggestions, + mIsPrediction); + } } |