aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-08-25 09:10:31 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-08-25 09:10:31 +0000
commit3d057b402df705ea990add536afbd307a0c99b6b (patch)
tree74df2fea42b4b6b82ac4d30d34d7f2a69f4c2613 /java
parentba8d5e6b8584dc0aa15f9bf39ffe71b8bf547eea (diff)
parentc06c6e42ad24e02a5433dcb44dba452d1cfb3f4f (diff)
downloadlatinime-3d057b402df705ea990add536afbd307a0c99b6b.tar.gz
latinime-3d057b402df705ea990add536afbd307a0c99b6b.tar.xz
latinime-3d057b402df705ea990add536afbd307a0c99b6b.zip
am c06c6e42: am 7d146cdb: am cd6ef9a8: Indroduce SuggestedWords#getTypedWordInfoOrNull
* commit 'c06c6e42ad24e02a5433dcb44dba452d1cfb3f4f': Indroduce SuggestedWords#getTypedWordInfoOrNull
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestedWords.java15
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;
+ }
}