aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/SuggestedWords.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-08-24 14:37:24 -0700
committerYohei Yukawa <yukawa@google.com>2014-08-24 16:32:17 -0700
commitcd6ef9a8b117b82623251510fac72ee108ec1a2a (patch)
treece8db7f2eee374f02176ea084e78c50d980447e8 /java/src/com/android/inputmethod/latin/SuggestedWords.java
parent2637be27c51be03e39b0db1c66312c4cc55bc7de (diff)
downloadlatinime-cd6ef9a8b117b82623251510fac72ee108ec1a2a.tar.gz
latinime-cd6ef9a8b117b82623251510fac72ee108ec1a2a.tar.xz
latinime-cd6ef9a8b117b82623251510fac72ee108ec1a2a.zip
Indroduce SuggestedWords#getTypedWordInfoOrNull
This is a groundwork for subsequent CLs whith need to do certain things for and only for the typed word. Change-Id: I374b79cbc79470f57f523c996010301ea5701a61
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SuggestedWords.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;
+ }
}