Merge "A simplification."

main
Jean Chalard 2013-12-16 12:57:42 +00:00 committed by Android (Google) Code Review
commit 27ad01947a
1 changed files with 13 additions and 19 deletions

View File

@ -2565,26 +2565,20 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final SettingsValues currentSettings = mSettings.getCurrent(); final SettingsValues currentSettings = mSettings.getCurrent();
final int[] additionalFeaturesOptions = currentSettings.mAdditionalFeaturesSettingValues; final int[] additionalFeaturesOptions = currentSettings.mAdditionalFeaturesSettingValues;
final String previousWord;
if (mWordComposer.isComposingWord() || mWordComposer.isBatchMode()) {
previousWord = mWordComposer.getPreviousWord();
} else {
// Not composing: this is for prediction.
// TODO: read the previous word earlier for prediction, like we are doing for
// normal suggestions.
previousWord = getNthPreviousWordForSuggestion(currentSettings, 1 /* nthPreviousWord*/);
}
if (DEBUG) { if (DEBUG) {
// TODO: this is for checking consistency with older versions. Remove this when if (mWordComposer.isComposingWord() || mWordComposer.isBatchMode()) {
// we are confident this is stable. final String previousWord = mWordComposer.getPreviousWord();
// We're checking the previous word in the text field against the memorized previous // TODO: this is for checking consistency with older versions. Remove this when
// word. If we are composing a word we should have the second word before the cursor // we are confident this is stable.
// memorized, otherwise we should have the first. // We're checking the previous word in the text field against the memorized previous
final String rereadPrevWord = getNthPreviousWordForSuggestion(currentSettings, // word. If we are composing a word we should have the second word before the cursor
mWordComposer.isComposingWord() ? 2 : 1); // memorized, otherwise we should have the first.
if (!TextUtils.equals(previousWord, rereadPrevWord)) { final String rereadPrevWord = getNthPreviousWordForSuggestion(currentSettings,
throw new RuntimeException("Unexpected previous word: " mWordComposer.isComposingWord() ? 2 : 1);
+ previousWord + " <> " + rereadPrevWord); if (!TextUtils.equals(previousWord, rereadPrevWord)) {
throw new RuntimeException("Unexpected previous word: "
+ previousWord + " <> " + rereadPrevWord);
}
} }
} }
suggest.getSuggestedWords(mWordComposer, mWordComposer.getPreviousWord(), suggest.getSuggestedWords(mWordComposer, mWordComposer.getPreviousWord(),