am 2e2d6b4d: Small simplification

* commit '2e2d6b4d4060ed3b956b4bd4c1f89b5d9c87b525':
  Small simplification
main
Jean Chalard 2012-02-07 19:45:25 -08:00 committed by Android Git Automerger
commit 73d471e4f5
1 changed files with 5 additions and 16 deletions

View File

@ -1870,20 +1870,18 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} }
@Override @Override
public void pickSuggestionManually(int index, CharSequence suggestion) { public void pickSuggestionManually(final int index, final CharSequence suggestion) {
mComposingStateManager.onFinishComposingText(); mComposingStateManager.onFinishComposingText();
SuggestedWords suggestions = mSuggestionsView.getSuggestions(); final SuggestedWords suggestions = mSuggestionsView.getSuggestions();
mVoiceProxy.flushAndLogAllTextModificationCounters(index, suggestion, mVoiceProxy.flushAndLogAllTextModificationCounters(index, suggestion,
mSettingsValues.mWordSeparators); mSettingsValues.mWordSeparators);
final InputConnection ic = getCurrentInputConnection();
if (ic != null) {
ic.beginBatchEdit();
}
if (mInputAttributes.mApplicationSpecifiedCompletionOn if (mInputAttributes.mApplicationSpecifiedCompletionOn
&& mApplicationSpecifiedCompletions != null && mApplicationSpecifiedCompletions != null
&& index >= 0 && index < mApplicationSpecifiedCompletions.length) { && index >= 0 && index < mApplicationSpecifiedCompletions.length) {
final InputConnection ic = getCurrentInputConnection();
if (ic != null) { if (ic != null) {
ic.beginBatchEdit();
final CompletionInfo completionInfo = mApplicationSpecifiedCompletions[index]; final CompletionInfo completionInfo = mApplicationSpecifiedCompletions[index];
ic.commitCompletion(completionInfo); ic.commitCompletion(completionInfo);
} }
@ -1904,18 +1902,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// So, LatinImeLogger logs "" as a user's input. // So, LatinImeLogger logs "" as a user's input.
LatinImeLogger.logOnManualSuggestion( LatinImeLogger.logOnManualSuggestion(
"", suggestion.toString(), index, suggestions.mWords); "", suggestion.toString(), index, suggestions.mWords);
final CharSequence outputText = mSettingsValues.mSuggestPuncOutputTextList final int primaryCode = suggestion.charAt(0);
.getWord(index);
final int primaryCode = outputText.charAt(0);
// Find out whether the previous character is a space. If it is, as a special case // Find out whether the previous character is a space. If it is, as a special case
// for punctuation entered through the suggestion strip, it should be swapped // for punctuation entered through the suggestion strip, it should be swapped
// if it was a magic or a weak space. This is meant to help in case the user // if it was a magic or a weak space. This is meant to help in case the user
// pressed space on purpose of displaying the suggestion strip punctuation. // pressed space on purpose of displaying the suggestion strip punctuation.
insertPunctuationFromSuggestionStrip(primaryCode); insertPunctuationFromSuggestionStrip(primaryCode);
// TODO: the following endBatchEdit seems useless, check
if (ic != null) {
ic.endBatchEdit();
}
return; return;
} }
// We need to log before we commit, because the word composer will store away the user // We need to log before we commit, because the word composer will store away the user
@ -1968,9 +1960,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mHandler.postUpdateSuggestions(); mHandler.postUpdateSuggestions();
} }
} }
if (ic != null) {
ic.endBatchEdit();
}
} }
/** /**