diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/WordComposer.java | 24 |
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() { |