Clean up unnecessary uses of toString()

Leftover from changing variables from CharSequence to String

Change-Id: I4db43fcb075aa37bf9c5b2a23bad0e4c2d718379
main
Kurt Partridge 2012-12-23 12:08:42 -08:00
parent f763dc5915
commit 4aff3bf0ea
1 changed files with 10 additions and 12 deletions

View File

@ -1454,7 +1454,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
public void onTextInput(final String rawText) { public void onTextInput(final String rawText) {
mConnection.beginBatchEdit(); mConnection.beginBatchEdit();
if (mWordComposer.isComposingWord()) { if (mWordComposer.isComposingWord()) {
commitCurrentAutoCorrection(rawText.toString()); commitCurrentAutoCorrection(rawText);
} else { } else {
resetComposingState(true /* alsoResetLastComposedWord */); resetComposingState(true /* alsoResetLastComposedWord */);
} }
@ -2104,13 +2104,12 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
+ "is empty? Impossible! I must commit suicide."); + "is empty? Impossible! I must commit suicide.");
} }
if (ProductionFlag.IS_INTERNAL) { if (ProductionFlag.IS_INTERNAL) {
Stats.onAutoCorrection( Stats.onAutoCorrection(typedWord, autoCorrection, separatorString, mWordComposer);
typedWord, autoCorrection.toString(), separatorString, mWordComposer);
} }
mExpectingUpdateSelection = true; mExpectingUpdateSelection = true;
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIme_commitCurrentAutoCorrection(typedWord, ResearchLogger.latinIme_commitCurrentAutoCorrection(typedWord, autoCorrection,
autoCorrection.toString(), separatorString); separatorString);
} }
commitChosenWord(autoCorrection, LastComposedWord.COMMIT_TYPE_DECIDED_WORD, commitChosenWord(autoCorrection, LastComposedWord.COMMIT_TYPE_DECIDED_WORD,
@ -2177,7 +2176,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// 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
// typed word. // typed word.
final String replacedWord = mWordComposer.getTypedWord().toString(); final String replacedWord = mWordComposer.getTypedWord();
LatinImeLogger.logOnManualSuggestion(replacedWord, suggestion, index, suggestedWords); LatinImeLogger.logOnManualSuggestion(replacedWord, suggestion, index, suggestedWords);
mExpectingUpdateSelection = true; mExpectingUpdateSelection = true;
commitChosenWord(suggestion, LastComposedWord.COMMIT_TYPE_MANUAL_PICK, commitChosenWord(suggestion, LastComposedWord.COMMIT_TYPE_MANUAL_PICK,
@ -2227,8 +2226,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// what user typed. Note: currently this is done much later in // what user typed. Note: currently this is done much later in
// LastComposedWord#didCommitTypedWord by string equality of the remembered // LastComposedWord#didCommitTypedWord by string equality of the remembered
// strings. // strings.
mLastComposedWord = mWordComposer.commitWord(commitType, chosenWord.toString(), mLastComposedWord = mWordComposer.commitWord(commitType, chosenWord, separatorString,
separatorString, prevWord); prevWord);
} }
private void setPunctuationSuggestions() { private void setPunctuationSuggestions() {
@ -2252,7 +2251,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
final UserHistoryDictionary userHistoryDictionary = mUserHistoryDictionary; final UserHistoryDictionary userHistoryDictionary = mUserHistoryDictionary;
if (userHistoryDictionary != null) { if (userHistoryDictionary != null) {
final CharSequence prevWord final String prevWord
= mConnection.getNthPreviousWord(mCurrentSettings.mWordSeparators, 2); = mConnection.getNthPreviousWord(mCurrentSettings.mWordSeparators, 2);
final String secondWord; final String secondWord;
if (mWordComposer.wasAutoCapitalized() && !mWordComposer.isMostlyCaps()) { if (mWordComposer.wasAutoCapitalized() && !mWordComposer.isMostlyCaps()) {
@ -2265,9 +2264,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
final int maxFreq = AutoCorrection.getMaxFrequency( final int maxFreq = AutoCorrection.getMaxFrequency(
mSuggest.getUnigramDictionaries(), suggestion); mSuggest.getUnigramDictionaries(), suggestion);
if (maxFreq == 0) return null; if (maxFreq == 0) return null;
final String prevWordString = (null == prevWord) ? null : prevWord.toString(); userHistoryDictionary.addToUserHistory(prevWord, secondWord, maxFreq > 0);
userHistoryDictionary.addToUserHistory(prevWordString, secondWord, maxFreq > 0); return prevWord;
return prevWordString;
} }
return null; return null;
} }