Merge "[IL101] Remove a method"

main
Jean Chalard 2014-01-28 09:43:09 +00:00 committed by Android (Google) Code Review
commit 67d85f663a
2 changed files with 14 additions and 11 deletions

View File

@ -193,9 +193,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (msg.arg2 == ARG2_WITH_TYPED_WORD) { if (msg.arg2 == ARG2_WITH_TYPED_WORD) {
final Pair<SuggestedWords, String> p = final Pair<SuggestedWords, String> p =
(Pair<SuggestedWords, String>) msg.obj; (Pair<SuggestedWords, String>) msg.obj;
// [IL]: this is the only place where the second arg is not
// suggestedWords.mTypedWord.
latinIme.showSuggestionStripWithTypedWord(p.first, p.second); latinIme.showSuggestionStripWithTypedWord(p.first, p.second);
} else { } else {
latinIme.showSuggestionStrip((SuggestedWords) msg.obj); final SuggestedWords suggestedWords = (SuggestedWords) msg.obj;
latinIme.showSuggestionStripWithTypedWord(suggestedWords,
suggestedWords.mTypedWord);
} }
} else { } else {
latinIme.showGesturePreviewAndSuggestionStrip((SuggestedWords) msg.obj, latinIme.showGesturePreviewAndSuggestionStrip((SuggestedWords) msg.obj,
@ -1270,7 +1274,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// This method must run on the UI Thread. // This method must run on the UI Thread.
private void showGesturePreviewAndSuggestionStrip(final SuggestedWords suggestedWords, private void showGesturePreviewAndSuggestionStrip(final SuggestedWords suggestedWords,
final boolean dismissGestureFloatingPreviewText) { final boolean dismissGestureFloatingPreviewText) {
showSuggestionStrip(suggestedWords); showSuggestionStripWithTypedWord(suggestedWords, suggestedWords.mTypedWord);
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
mainKeyboardView.showGestureFloatingPreviewText(suggestedWords); mainKeyboardView.showGestureFloatingPreviewText(suggestedWords);
if (dismissGestureFloatingPreviewText) { if (dismissGestureFloatingPreviewText) {
@ -1405,7 +1409,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} }
} }
private void showSuggestionStripWithTypedWord(final SuggestedWords sourceSuggestedWords, // TODO[IL]: Define a clean interface for this
public void showSuggestionStripWithTypedWord(final SuggestedWords sourceSuggestedWords,
final String typedWord) { final String typedWord) {
final SuggestedWords suggestedWords = final SuggestedWords suggestedWords =
sourceSuggestedWords.isEmpty() ? SuggestedWords.EMPTY : sourceSuggestedWords; sourceSuggestedWords.isEmpty() ? SuggestedWords.EMPTY : sourceSuggestedWords;
@ -1426,11 +1431,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
AccessibilityUtils.getInstance().setAutoCorrection(suggestedWords, typedWord); AccessibilityUtils.getInstance().setAutoCorrection(suggestedWords, typedWord);
} }
// TODO[IL]: Define a clean interface for this
public void showSuggestionStrip(final SuggestedWords suggestedWords) {
showSuggestionStripWithTypedWord(suggestedWords, suggestedWords.mTypedWord);
}
// Called from {@link SuggestionStripView} through the {@link SuggestionStripView#Listener} // Called from {@link SuggestionStripView} through the {@link SuggestionStripView#Listener}
// interface // interface
@Override @Override

View File

@ -1116,7 +1116,7 @@ public final class InputLogic {
final SuggestedWords suggestedWords = holder.get(null, final SuggestedWords suggestedWords = holder.get(null,
Constants.GET_SUGGESTED_WORDS_TIMEOUT); Constants.GET_SUGGESTED_WORDS_TIMEOUT);
if (suggestedWords != null) { if (suggestedWords != null) {
mLatinIME.showSuggestionStrip(suggestedWords); mLatinIME.showSuggestionStripWithTypedWord(suggestedWords, suggestedWords.mTypedWord);
} }
} }
@ -1618,8 +1618,11 @@ public final class InputLogic {
final int indexOfLastSpace = batchInputText.lastIndexOf(Constants.CODE_SPACE) + 1; final int indexOfLastSpace = batchInputText.lastIndexOf(Constants.CODE_SPACE) + 1;
if (0 != indexOfLastSpace) { if (0 != indexOfLastSpace) {
mConnection.commitText(batchInputText.substring(0, indexOfLastSpace), 1); mConnection.commitText(batchInputText.substring(0, indexOfLastSpace), 1);
mLatinIME.showSuggestionStrip( final SuggestedWords suggestedWordsForLastWordOfPhraseGesture =
suggestedWords.getSuggestedWordsForLastWordOfPhraseGesture()); suggestedWords.getSuggestedWordsForLastWordOfPhraseGesture();
mLatinIME.showSuggestionStripWithTypedWord(
suggestedWordsForLastWordOfPhraseGesture,
suggestedWordsForLastWordOfPhraseGesture.mTypedWord);
} }
final String lastWord = batchInputText.substring(indexOfLastSpace); final String lastWord = batchInputText.substring(indexOfLastSpace);
mWordComposer.setBatchInputWord(lastWord); mWordComposer.setBatchInputWord(lastWord);