Loading java/src/com/android/inputmethod/latin/LatinIME.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -1747,7 +1747,9 @@ public final class LatinIME extends InputMethodService implements KeyboardAction ResearchLogger.getInstance().uncommitCurrentLogUnit( ResearchLogger.getInstance().uncommitCurrentLogUnit( word, false /* dumpCurrentLogUnit */); word, false /* dumpCurrentLogUnit */); } } final String rejectedSuggestion = mWordComposer.getTypedWord(); mWordComposer.reset(); mWordComposer.reset(); mWordComposer.setRejectedBatchModeSuggestion(rejectedSuggestion); } else { } else { mWordComposer.deleteLast(); mWordComposer.deleteLast(); } } Loading java/src/com/android/inputmethod/latin/Suggest.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -334,6 +334,11 @@ public final class Suggest { } } } } if (suggestionsContainer.size() > 1 && TextUtils.equals(suggestionsContainer.get(0).mWord, wordComposer.getRejectedBatchModeSuggestion())) { final SuggestedWordInfo rejected = suggestionsContainer.remove(0); suggestionsContainer.add(1, rejected); } SuggestedWordInfo.removeDups(suggestionsContainer); SuggestedWordInfo.removeDups(suggestionsContainer); // In the batch input mode, the most relevant suggested word should act as a "typed word" // In the batch input mode, the most relevant suggested word should act as a "typed word" // (typedWordValid=true), not as an "auto correct word" (willAutoCorrect=false). // (typedWordValid=true), not as an "auto correct word" (willAutoCorrect=false). Loading java/src/com/android/inputmethod/latin/WordComposer.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,13 @@ public final class WordComposer { private String mAutoCorrection; private String mAutoCorrection; private boolean mIsResumed; private boolean mIsResumed; private boolean mIsBatchMode; private boolean mIsBatchMode; // A memory of the last rejected batch mode suggestion, if any. This goes like this: the user // gestures a word, is displeased with the results and hits backspace, then gestures again. // At the very least we should avoid re-suggesting the same thing, and to do that we memorize // the rejected suggestion in this variable. // TODO: this should be done in a comprehensive way by the User History feature instead of // as an ad-hockery here. private String mRejectedBatchModeSuggestion; // Cache these values for performance // Cache these values for performance private int mCapsCount; private int mCapsCount; Loading @@ -64,6 +71,7 @@ public final class WordComposer { mIsResumed = false; mIsResumed = false; mIsBatchMode = false; mIsBatchMode = false; mCursorPositionWithinWord = 0; mCursorPositionWithinWord = 0; mRejectedBatchModeSuggestion = null; refreshSize(); refreshSize(); } } Loading @@ -79,6 +87,7 @@ public final class WordComposer { mIsResumed = source.mIsResumed; mIsResumed = source.mIsResumed; mIsBatchMode = source.mIsBatchMode; mIsBatchMode = source.mIsBatchMode; mCursorPositionWithinWord = source.mCursorPositionWithinWord; mCursorPositionWithinWord = source.mCursorPositionWithinWord; mRejectedBatchModeSuggestion = source.mRejectedBatchModeSuggestion; refreshSize(); refreshSize(); } } Loading @@ -95,6 +104,7 @@ public final class WordComposer { mIsResumed = false; mIsResumed = false; mIsBatchMode = false; mIsBatchMode = false; mCursorPositionWithinWord = 0; mCursorPositionWithinWord = 0; mRejectedBatchModeSuggestion = null; refreshSize(); refreshSize(); } } Loading Loading @@ -384,6 +394,7 @@ public final class WordComposer { mAutoCorrection = null; mAutoCorrection = null; mCursorPositionWithinWord = 0; mCursorPositionWithinWord = 0; mIsResumed = false; mIsResumed = false; mRejectedBatchModeSuggestion = null; return lastComposedWord; return lastComposedWord; } } Loading @@ -396,10 +407,19 @@ public final class WordComposer { mCapitalizedMode = lastComposedWord.mCapitalizedMode; mCapitalizedMode = lastComposedWord.mCapitalizedMode; mAutoCorrection = null; // This will be filled by the next call to updateSuggestion. mAutoCorrection = null; // This will be filled by the next call to updateSuggestion. mCursorPositionWithinWord = mCodePointSize; mCursorPositionWithinWord = mCodePointSize; mRejectedBatchModeSuggestion = null; mIsResumed = true; mIsResumed = true; } } public boolean isBatchMode() { public boolean isBatchMode() { return mIsBatchMode; return mIsBatchMode; } } public void setRejectedBatchModeSuggestion(final String rejectedSuggestion) { mRejectedBatchModeSuggestion = rejectedSuggestion; } public String getRejectedBatchModeSuggestion() { return mRejectedBatchModeSuggestion; } } } Loading
java/src/com/android/inputmethod/latin/LatinIME.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -1747,7 +1747,9 @@ public final class LatinIME extends InputMethodService implements KeyboardAction ResearchLogger.getInstance().uncommitCurrentLogUnit( ResearchLogger.getInstance().uncommitCurrentLogUnit( word, false /* dumpCurrentLogUnit */); word, false /* dumpCurrentLogUnit */); } } final String rejectedSuggestion = mWordComposer.getTypedWord(); mWordComposer.reset(); mWordComposer.reset(); mWordComposer.setRejectedBatchModeSuggestion(rejectedSuggestion); } else { } else { mWordComposer.deleteLast(); mWordComposer.deleteLast(); } } Loading
java/src/com/android/inputmethod/latin/Suggest.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -334,6 +334,11 @@ public final class Suggest { } } } } if (suggestionsContainer.size() > 1 && TextUtils.equals(suggestionsContainer.get(0).mWord, wordComposer.getRejectedBatchModeSuggestion())) { final SuggestedWordInfo rejected = suggestionsContainer.remove(0); suggestionsContainer.add(1, rejected); } SuggestedWordInfo.removeDups(suggestionsContainer); SuggestedWordInfo.removeDups(suggestionsContainer); // In the batch input mode, the most relevant suggested word should act as a "typed word" // In the batch input mode, the most relevant suggested word should act as a "typed word" // (typedWordValid=true), not as an "auto correct word" (willAutoCorrect=false). // (typedWordValid=true), not as an "auto correct word" (willAutoCorrect=false). Loading
java/src/com/android/inputmethod/latin/WordComposer.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,13 @@ public final class WordComposer { private String mAutoCorrection; private String mAutoCorrection; private boolean mIsResumed; private boolean mIsResumed; private boolean mIsBatchMode; private boolean mIsBatchMode; // A memory of the last rejected batch mode suggestion, if any. This goes like this: the user // gestures a word, is displeased with the results and hits backspace, then gestures again. // At the very least we should avoid re-suggesting the same thing, and to do that we memorize // the rejected suggestion in this variable. // TODO: this should be done in a comprehensive way by the User History feature instead of // as an ad-hockery here. private String mRejectedBatchModeSuggestion; // Cache these values for performance // Cache these values for performance private int mCapsCount; private int mCapsCount; Loading @@ -64,6 +71,7 @@ public final class WordComposer { mIsResumed = false; mIsResumed = false; mIsBatchMode = false; mIsBatchMode = false; mCursorPositionWithinWord = 0; mCursorPositionWithinWord = 0; mRejectedBatchModeSuggestion = null; refreshSize(); refreshSize(); } } Loading @@ -79,6 +87,7 @@ public final class WordComposer { mIsResumed = source.mIsResumed; mIsResumed = source.mIsResumed; mIsBatchMode = source.mIsBatchMode; mIsBatchMode = source.mIsBatchMode; mCursorPositionWithinWord = source.mCursorPositionWithinWord; mCursorPositionWithinWord = source.mCursorPositionWithinWord; mRejectedBatchModeSuggestion = source.mRejectedBatchModeSuggestion; refreshSize(); refreshSize(); } } Loading @@ -95,6 +104,7 @@ public final class WordComposer { mIsResumed = false; mIsResumed = false; mIsBatchMode = false; mIsBatchMode = false; mCursorPositionWithinWord = 0; mCursorPositionWithinWord = 0; mRejectedBatchModeSuggestion = null; refreshSize(); refreshSize(); } } Loading Loading @@ -384,6 +394,7 @@ public final class WordComposer { mAutoCorrection = null; mAutoCorrection = null; mCursorPositionWithinWord = 0; mCursorPositionWithinWord = 0; mIsResumed = false; mIsResumed = false; mRejectedBatchModeSuggestion = null; return lastComposedWord; return lastComposedWord; } } Loading @@ -396,10 +407,19 @@ public final class WordComposer { mCapitalizedMode = lastComposedWord.mCapitalizedMode; mCapitalizedMode = lastComposedWord.mCapitalizedMode; mAutoCorrection = null; // This will be filled by the next call to updateSuggestion. mAutoCorrection = null; // This will be filled by the next call to updateSuggestion. mCursorPositionWithinWord = mCodePointSize; mCursorPositionWithinWord = mCodePointSize; mRejectedBatchModeSuggestion = null; mIsResumed = true; mIsResumed = true; } } public boolean isBatchMode() { public boolean isBatchMode() { return mIsBatchMode; return mIsBatchMode; } } public void setRejectedBatchModeSuggestion(final String rejectedSuggestion) { mRejectedBatchModeSuggestion = rejectedSuggestion; } public String getRejectedBatchModeSuggestion() { return mRejectedBatchModeSuggestion; } } }