diff options
author | 2014-08-24 23:52:49 +0000 | |
---|---|---|
committer | 2014-08-24 23:52:49 +0000 | |
commit | 7d146cdbe86692f153fb5b7f781f701a8c04050d (patch) | |
tree | 3f4a524e7b71c9d4d5a04e7201b68068d5ef0901 /java/src | |
parent | cc4d21df7b08c3143dd1c4af786609a279a0bb79 (diff) | |
parent | cd6ef9a8b117b82623251510fac72ee108ec1a2a (diff) | |
download | latinime-7d146cdbe86692f153fb5b7f781f701a8c04050d.tar.gz latinime-7d146cdbe86692f153fb5b7f781f701a8c04050d.tar.xz latinime-7d146cdbe86692f153fb5b7f781f701a8c04050d.zip |
am cd6ef9a8: Indroduce SuggestedWords#getTypedWordInfoOrNull
* commit 'cd6ef9a8b117b82623251510fac72ee108ec1a2a':
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; + } } |