aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/SuggestedWords.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-08-20 16:21:27 +0900
committerJean Chalard <jchalard@google.com>2013-08-20 19:26:11 +0900
commit66a870cb538ab4a6da9b9e3134fcca79120c1c5f (patch)
tree4abb0bf6c3e1c92f62dea0a15a2e529a8e66d341 /java/src/com/android/inputmethod/latin/SuggestedWords.java
parente8ef09567077211da034a77b457fd5f87e70f6f0 (diff)
downloadlatinime-66a870cb538ab4a6da9b9e3134fcca79120c1c5f.tar.gz
latinime-66a870cb538ab4a6da9b9e3134fcca79120c1c5f.tar.xz
latinime-66a870cb538ab4a6da9b9e3134fcca79120c1c5f.zip
[AC3] Start calling the methods for auto-commit.
Bug: 9059617 Change-Id: I190a4baf2fa831b70e00e129b5dfaa8c9c32b3a0
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SuggestedWords.java')
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestedWords.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java
index 3d6d0d751..b27fd81e9 100644
--- a/java/src/com/android/inputmethod/latin/SuggestedWords.java
+++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java
@@ -143,6 +143,12 @@ public final class SuggestedWords {
return suggestionsList;
}
+ public SuggestedWordInfo getAutoCommitCandidate() {
+ if (mSuggestedWordInfoList.size() <= 0) return null;
+ final SuggestedWordInfo candidate = mSuggestedWordInfoList.get(0);
+ return candidate.isEligibleForAutoCommit() ? candidate : null;
+ }
+
public static final class SuggestedWordInfo {
public static final int NOT_AN_INDEX = -1;
public static final int MAX_SCORE = Integer.MAX_VALUE;
@@ -186,6 +192,10 @@ public final class SuggestedWords {
mIndexOfTouchPointOfSecondWord = indexOfTouchPointOfSecondWord;
}
+ public boolean isEligibleForAutoCommit() {
+ return (KIND_CORRECTION == mKind && NOT_AN_INDEX != mIndexOfTouchPointOfSecondWord);
+ }
+
public void setDebugString(final String str) {
if (null == str) throw new NullPointerException("Debug info is null");
mDebugString = str;