am 362779d6: Merge "[IL104] Remove useless arguments"

* commit '362779d6084d0b5ca289764ae362c7ae909608c2':
  [IL104] Remove useless arguments
main
Jean Chalard 2014-01-29 19:47:04 -08:00 committed by Android Git Automerger
commit 0e9b742450
2 changed files with 9 additions and 32 deletions

View File

@ -42,7 +42,6 @@ import android.preference.PreferenceManager;
import android.text.InputType; import android.text.InputType;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.util.Pair;
import android.util.PrintWriterPrinter; import android.util.PrintWriterPrinter;
import android.util.Printer; import android.util.Printer;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -154,8 +153,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private static final int ARG1_NOT_GESTURE_INPUT = 0; private static final int ARG1_NOT_GESTURE_INPUT = 0;
private static final int ARG1_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT = 1; private static final int ARG1_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT = 1;
private static final int ARG1_SHOW_GESTURE_FLOATING_PREVIEW_TEXT = 2; private static final int ARG1_SHOW_GESTURE_FLOATING_PREVIEW_TEXT = 2;
private static final int ARG2_WITHOUT_TYPED_WORD = 0; private static final int ARG2_UNUSED = 0;
private static final int ARG2_WITH_TYPED_WORD = 1;
private int mDelayUpdateSuggestions; private int mDelayUpdateSuggestions;
private int mDelayUpdateShiftState; private int mDelayUpdateShiftState;
@ -190,16 +188,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
break; break;
case MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP: case MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP:
if (msg.arg1 == ARG1_NOT_GESTURE_INPUT) { if (msg.arg1 == ARG1_NOT_GESTURE_INPUT) {
if (msg.arg2 == ARG2_WITH_TYPED_WORD) { final SuggestedWords suggestedWords = (SuggestedWords) msg.obj;
final Pair<SuggestedWords, String> p = latinIme.showSuggestionStrip(suggestedWords, suggestedWords.mTypedWord);
(Pair<SuggestedWords, String>) msg.obj;
// [IL]: this is the only place where the second arg is not
// suggestedWords.mTypedWord.
latinIme.showSuggestionStrip(p.first, p.second);
} else {
final SuggestedWords suggestedWords = (SuggestedWords) msg.obj;
latinIme.showSuggestionStrip(suggestedWords, suggestedWords.mTypedWord);
}
} else { } else {
latinIme.showGesturePreviewAndSuggestionStrip((SuggestedWords) msg.obj, latinIme.showGesturePreviewAndSuggestionStrip((SuggestedWords) msg.obj,
msg.arg1 == ARG1_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT); msg.arg1 == ARG1_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT);
@ -292,22 +282,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
? ARG1_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT ? ARG1_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT
: ARG1_SHOW_GESTURE_FLOATING_PREVIEW_TEXT; : ARG1_SHOW_GESTURE_FLOATING_PREVIEW_TEXT;
obtainMessage(MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP, arg1, obtainMessage(MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP, arg1,
ARG2_WITHOUT_TYPED_WORD, suggestedWords).sendToTarget(); ARG2_UNUSED, suggestedWords).sendToTarget();
} }
public void showSuggestionStrip(final SuggestedWords suggestedWords) { public void showSuggestionStrip(final SuggestedWords suggestedWords) {
removeMessages(MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP); removeMessages(MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP);
obtainMessage(MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP, obtainMessage(MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP,
ARG1_NOT_GESTURE_INPUT, ARG2_WITHOUT_TYPED_WORD, suggestedWords).sendToTarget(); ARG1_NOT_GESTURE_INPUT, ARG2_UNUSED, suggestedWords).sendToTarget();
}
// TODO: Remove this method.
public void showSuggestionStripWithTypedWord(final SuggestedWords suggestedWords,
final String typedWord) {
removeMessages(MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP);
obtainMessage(MSG_SHOW_GESTURE_PREVIEW_AND_SUGGESTION_STRIP, ARG1_NOT_GESTURE_INPUT,
ARG2_WITH_TYPED_WORD,
new Pair<SuggestedWords, String>(suggestedWords, typedWord)).sendToTarget();
} }
public void onEndBatchInput(final SuggestedWords suggestedWords) { public void onEndBatchInput(final SuggestedWords suggestedWords) {
@ -1538,9 +1519,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} }
} }
// [IL] TODO: remove the second argument
public void unsetIsAutoCorrectionIndicatorOnAndCallShowSuggestionStrip( public void unsetIsAutoCorrectionIndicatorOnAndCallShowSuggestionStrip(
final SuggestedWords suggestedWords, final String typedWord) { final SuggestedWords suggestedWords) {
// Note that it's very important here that suggestedWords.mWillAutoCorrect is false. // Note that it's very important here that suggestedWords.mWillAutoCorrect is false.
// We never want to auto-correct on a resumed suggestion. Please refer to the three places // We never want to auto-correct on a resumed suggestion. Please refer to the three places
// above in restartSuggestionsOnWordTouchedByCursor() where suggestedWords is affected. // above in restartSuggestionsOnWordTouchedByCursor() where suggestedWords is affected.
@ -1548,7 +1528,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// the text to adapt it. // the text to adapt it.
// TODO: remove mIsAutoCorrectionIndicatorOn (see comment on definition) // TODO: remove mIsAutoCorrectionIndicatorOn (see comment on definition)
mInputLogic.mIsAutoCorrectionIndicatorOn = false; mInputLogic.mIsAutoCorrectionIndicatorOn = false;
mHandler.showSuggestionStripWithTypedWord(suggestedWords, suggestedWords.mTypedWord); mHandler.showSuggestionStrip(suggestedWords);
} }
// TODO: Make this private // TODO: Make this private

View File

@ -1217,10 +1217,8 @@ public final class InputLogic {
// Since there is only one word, willAutoCorrect is false. // Since there is only one word, willAutoCorrect is false.
suggestedWords = suggestedWordsIncludingTypedWord; suggestedWords = suggestedWordsIncludingTypedWord;
} }
// We need to pass typedWord because mWordComposer.mTypedWord may
// differ from typedWord.
mLatinIME.unsetIsAutoCorrectionIndicatorOnAndCallShowSuggestionStrip( mLatinIME.unsetIsAutoCorrectionIndicatorOnAndCallShowSuggestionStrip(
suggestedWords, typedWord); suggestedWords);
}}); }});
} else { } else {
// We found suggestion spans in the word. We'll create the SuggestedWords out of // We found suggestion spans in the word. We'll create the SuggestedWords out of
@ -1229,8 +1227,7 @@ public final class InputLogic {
true /* typedWordValid */, false /* willAutoCorrect */, true /* typedWordValid */, false /* willAutoCorrect */,
false /* isPunctuationSuggestions */, false /* isObsoleteSuggestions */, false /* isPunctuationSuggestions */, false /* isObsoleteSuggestions */,
false /* isPrediction */, SuggestedWords.NOT_A_SEQUENCE_NUMBER); false /* isPrediction */, SuggestedWords.NOT_A_SEQUENCE_NUMBER);
mLatinIME.unsetIsAutoCorrectionIndicatorOnAndCallShowSuggestionStrip(suggestedWords, mLatinIME.unsetIsAutoCorrectionIndicatorOnAndCallShowSuggestionStrip(suggestedWords);
typedWord);
} }
} }