aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/WordComposer.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-01-26 15:52:55 +0900
committerJean Chalard <jchalard@google.com>2012-01-26 17:22:52 +0900
commit267563d1bb4d8091293fbd8774f0f95ef59f03c4 (patch)
treee88e3d5f11277243cbd45f686b09a8b7d1f73994 /java/src/com/android/inputmethod/latin/WordComposer.java
parenta02e703289d2704963f140c44d630dcc0a65e34a (diff)
downloadlatinime-267563d1bb4d8091293fbd8774f0f95ef59f03c4.tar.gz
latinime-267563d1bb4d8091293fbd8774f0f95ef59f03c4.tar.xz
latinime-267563d1bb4d8091293fbd8774f0f95ef59f03c4.zip
Add a class for previously composed data (A1)
Change-Id: I87498799e6a48b8fa65924a098bb0ceb7626dce1
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r--java/src/com/android/inputmethod/latin/WordComposer.java24
1 files changed, 4 insertions, 20 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index e95dcfdc9..02968c934 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -33,23 +33,6 @@ public class WordComposer {
public static final int NOT_A_CODE = KeyDetector.NOT_A_CODE;
public static final int NOT_A_COORDINATE = -1;
- // TODO: Straighten out commit behavior so that the flags here are more understandable,
- // and possibly adjust their names.
- // COMMIT_TYPE_USER_TYPED_WORD is used when the word committed is the exact typed word, with
- // no hinting from the IME. It happens when some external event happens (rotating the device,
- // for example) or when auto-correction is off by settings or editor attributes.
- public static final int COMMIT_TYPE_USER_TYPED_WORD = 0;
- // COMMIT_TYPE_MANUAL_PICK is used when the user pressed a field in the suggestion strip.
- public static final int COMMIT_TYPE_MANUAL_PICK = 1;
- // COMMIT_TYPE_DECIDED_WORD is used when the IME commits the word it decided was best
- // for the current user input. It may be different from what the user typed (true auto-correct)
- // or it may be exactly what the user typed if it's in the dictionary or the IME does not have
- // enough confidence in any suggestion to auto-correct (auto-correct to typed word).
- public static final int COMMIT_TYPE_DECIDED_WORD = 2;
- // COMMIT_TYPE_CANCEL_AUTO_CORRECT is used upon committing back the old word upon cancelling
- // an auto-correction.
- public static final int COMMIT_TYPE_CANCEL_AUTO_CORRECT = 3;
-
// Storage for all the info about the current input.
private static class CharacterStore {
/**
@@ -346,8 +329,8 @@ public class WordComposer {
return mCurrentWord.mAutoCorrection;
}
- // `type' should be one of the COMMIT_TYPE_* constants above.
- public void onCommitWord(final int type) {
+ // `type' should be one of the LastComposedWord.COMMIT_TYPE_* constants above.
+ public LastComposedWord onCommitWord(final int type) {
mCommittedWordSavedForSuggestionResuming = mCurrentWord;
// Note: currently, we come here whenever we commit a word. If it's any *other* kind than
// DECIDED_WORD, we should reset mAutoCorrection so that we don't attempt to cancel later.
@@ -359,12 +342,13 @@ public class WordComposer {
// #didAutoCorrectToAnotherWord with #equals(). It would be marginally cleaner to do it
// here, but it would be slower (since we would #equals() for each commit, instead of
// only on cancel), and ultimately we want to figure it out even earlier anyway.
- if (type != COMMIT_TYPE_DECIDED_WORD) {
+ if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD) {
// Only ever revert an auto-correct.
mCommittedWordSavedForSuggestionResuming.mAutoCorrection = null;
}
// TODO: improve performance by swapping buffers instead of creating a new object.
mCurrentWord = new CharacterStore();
+ return new LastComposedWord(type);
}
public boolean hasWordKeptForSuggestionResuming() {