diff options
author | 2014-08-25 08:25:24 +0000 | |
---|---|---|
committer | 2014-08-25 08:25:24 +0000 | |
commit | c06c6e42ad24e02a5433dcb44dba452d1cfb3f4f (patch) | |
tree | 828f8df77fbe222af958b92e73fe6fd41d2dab28 /java/src | |
parent | e38f79182d61c2b965cc3b47065c17107865df46 (diff) | |
parent | 7d146cdbe86692f153fb5b7f781f701a8c04050d (diff) | |
download | latinime-c06c6e42ad24e02a5433dcb44dba452d1cfb3f4f.tar.gz latinime-c06c6e42ad24e02a5433dcb44dba452d1cfb3f4f.tar.xz latinime-c06c6e42ad24e02a5433dcb44dba452d1cfb3f4f.zip |
am 7d146cdb: am cd6ef9a8: Indroduce SuggestedWords#getTypedWordInfoOrNull
* commit '7d146cdbe86692f153fb5b7f781f701a8c04050d':
Indroduce SuggestedWords#getTypedWordInfoOrNull
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/SuggestedWords.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index d7693af41..38fcb683d 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -19,6 +19,7 @@ package com.android.inputmethod.latin; import android.text.TextUtils; import android.view.inputmethod.CompletionInfo; +import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.latin.define.DebugFlags; import com.android.inputmethod.latin.utils.StringUtils; @@ -420,4 +421,18 @@ public class SuggestedWords { mWillAutoCorrect, mIsObsoleteSuggestions, mIsPrediction, INPUT_STYLE_TAIL_BATCH); } + + /** + * @return the {@link SuggestedWordInfo} which corresponds to the word that is originally + * typed by the user. Otherwise returns {@code null}. Note that gesture input is not + * considered to be a typed word. + */ + @UsedForTesting + public SuggestedWordInfo getTypedWordInfoOrNull() { + if (this == EMPTY) { + return null; + } + final SuggestedWordInfo info = getInfo(SuggestedWords.INDEX_OF_TYPED_WORD); + return (info.getKind() == SuggestedWordInfo.KIND_TYPED) ? info : null; + } } |