diff options
author | 2013-04-15 11:18:27 +0000 | |
---|---|---|
committer | 2013-04-15 11:18:27 +0000 | |
commit | a022c53882642d1669e229f4f1b8d649c09447f7 (patch) | |
tree | b05b41da96876e5f3d685c13ca0de4001ea3c57d /java/src/com/android/inputmethod/latin/SuggestedWords.java | |
parent | 837f46dcb35a8f42a6bd5bc5fc6395d7386acb81 (diff) | |
parent | 0e9ee4d3bf75459560670ca5c28ff4c4f7c346fb (diff) | |
download | latinime-a022c53882642d1669e229f4f1b8d649c09447f7.tar.gz latinime-a022c53882642d1669e229f4f1b8d649c09447f7.tar.xz latinime-a022c53882642d1669e229f4f1b8d649c09447f7.zip |
Merge "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); + } } |