am 03283b63: Follow up to Ic7d2cbb2c1b2deaa4e735484bdc7413c0b3b1939

* commit '03283b636c0c35bfd4ff8fe6b30db27fad5cf824':
  Follow up to Ic7d2cbb2c1b2deaa4e735484bdc7413c0b3b1939
main
Ken Wakasa 2014-01-26 23:19:57 -08:00 committed by Android Git Automerger
commit 3873ee735d
1 changed files with 23 additions and 26 deletions

View File

@ -1466,10 +1466,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final SuggestedWords punctuationList = final SuggestedWords punctuationList =
mSettings.getCurrent().mSpacingAndPunctuations.mSuggestPuncList; mSettings.getCurrent().mSpacingAndPunctuations.mSuggestPuncList;
final SuggestedWords oldSuggestedWords = previousSuggestedWords == punctuationList final SuggestedWords oldSuggestedWords = previousSuggestedWords == punctuationList
? SuggestedWords.EMPTY : previousSuggestedWords; ? SuggestedWords.EMPTY : previousSuggestedWords;
if (TextUtils.isEmpty(typedWord)) {
return oldSuggestedWords;
}
final ArrayList<SuggestedWords.SuggestedWordInfo> typedWordAndPreviousSuggestions = final ArrayList<SuggestedWords.SuggestedWordInfo> typedWordAndPreviousSuggestions =
SuggestedWords.getTypedWordAndPreviousSuggestions(typedWord, oldSuggestedWords); SuggestedWords.getTypedWordAndPreviousSuggestions(typedWord, oldSuggestedWords);
return new SuggestedWords(typedWordAndPreviousSuggestions, return new SuggestedWords(typedWordAndPreviousSuggestions,
@ -1483,27 +1480,27 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void showSuggestionStripWithTypedWord(final SuggestedWords suggestedWords, private void showSuggestionStripWithTypedWord(final SuggestedWords suggestedWords,
final String typedWord) { final String typedWord) {
if (suggestedWords.isEmpty()) { if (suggestedWords.isEmpty()) {
// No auto-correction is available, clear the cached values. // No auto-correction is available, clear the cached values.
AccessibilityUtils.getInstance().setAutoCorrection(null, null); AccessibilityUtils.getInstance().setAutoCorrection(null, null);
clearSuggestionStrip(); clearSuggestionStrip();
return; return;
} }
final String autoCorrection; final String autoCorrection;
if (suggestedWords.mWillAutoCorrect) { if (suggestedWords.mWillAutoCorrect) {
autoCorrection = suggestedWords.getWord(SuggestedWords.INDEX_OF_AUTO_CORRECTION); autoCorrection = suggestedWords.getWord(SuggestedWords.INDEX_OF_AUTO_CORRECTION);
} else { } else {
// We can't use suggestedWords.getWord(SuggestedWords.INDEX_OF_TYPED_WORD) // We can't use suggestedWords.getWord(SuggestedWords.INDEX_OF_TYPED_WORD)
// because it may differ from mWordComposer.mTypedWord. // because it may differ from mWordComposer.mTypedWord.
autoCorrection = typedWord; autoCorrection = typedWord;
} }
mInputLogic.mWordComposer.setAutoCorrection(autoCorrection); mInputLogic.mWordComposer.setAutoCorrection(autoCorrection);
setSuggestedWords(suggestedWords); setSuggestedWords(suggestedWords);
setAutoCorrectionIndicator(suggestedWords.mWillAutoCorrect); setAutoCorrectionIndicator(suggestedWords.mWillAutoCorrect);
setSuggestionStripShown(isSuggestionsStripVisible()); setSuggestionStripShown(isSuggestionsStripVisible());
// An auto-correction is available, cache it in accessibility code so // An auto-correction is available, cache it in accessibility code so
// we can be speak it if the user touches a key that will insert it. // we can be speak it if the user touches a key that will insert it.
AccessibilityUtils.getInstance().setAutoCorrection(suggestedWords, typedWord); AccessibilityUtils.getInstance().setAutoCorrection(suggestedWords, typedWord);
} }
// TODO[IL]: Define a clean interface for this // TODO[IL]: Define a clean interface for this
@ -1513,7 +1510,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return; return;
} }
showSuggestionStripWithTypedWord(suggestedWords, showSuggestionStripWithTypedWord(suggestedWords,
suggestedWords.getWord(SuggestedWords.INDEX_OF_TYPED_WORD)); suggestedWords.getWord(SuggestedWords.INDEX_OF_TYPED_WORD));
} }
// Called from {@link SuggestionStripView} through the {@link SuggestionStripView#Listener} // Called from {@link SuggestionStripView} through the {@link SuggestionStripView#Listener}