Rename suggestion strip related methods

Change-Id: I942692bbc2e577482f353d875405c4658a1102fc
This commit is contained in:
Tadashi G. Takaoka 2012-07-23 18:03:16 +09:00
parent 4702671ea4
commit 259905ba90

View file

@ -206,7 +206,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final KeyboardSwitcher switcher = latinIme.mKeyboardSwitcher;
switch (msg.what) {
case MSG_UPDATE_SUGGESTION_STRIP:
latinIme.updateSuggestionsOrPredictions();
latinIme.updateSuggestionStrip();
break;
case MSG_UPDATE_SHIFT_STATE:
switcher.updateShiftState();
@ -862,7 +862,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (!mCurrentSettings.isApplicationSpecifiedCompletionsOn()) return;
mApplicationSpecifiedCompletions = applicationSpecifiedCompletions;
if (applicationSpecifiedCompletions == null) {
clearSuggestions();
clearSuggestionStrip();
return;
}
@ -878,7 +878,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
false /* isPrediction */);
// When in fullscreen mode, show completions generated by the application
final boolean isAutoCorrection = false;
setSuggestions(suggestedWords, isAutoCorrection);
setSuggestionStrip(suggestedWords, isAutoCorrection);
setAutoCorrectionIndicator(isAutoCorrection);
// TODO: is this the right thing to do? What should we auto-correct to in
// this case? This says to keep whatever the user typed.
@ -988,7 +988,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// the composing word, reset the last composed word, tell the inputconnection about it.
private void resetEntireInputState() {
resetComposingState(true /* alsoResetLastComposedWord */);
clearSuggestions();
clearSuggestionStrip();
mConnection.finishComposingText();
}
@ -1011,7 +1011,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD, typedWord.toString(),
separatorCode, prevWord);
}
updateSuggestionsOrPredictions();
updateSuggestionStrip();
}
// Called from the KeyboardSwitcher which needs to know auto caps state to display
@ -1332,13 +1332,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void onUpdateBatchInput(InputPointers batchPointers) {
mWordComposer.setBatchInputPointers(batchPointers);
updateSuggestionsOrPredictions();
updateSuggestionStrip();
}
@Override
public void onEndBatchInput(InputPointers batchPointers) {
mWordComposer.setBatchInputPointers(batchPointers);
final SuggestedWords suggestedWords = updateSuggestionsOrPredictions();
final SuggestedWords suggestedWords = updateSuggestionStrip();
if (suggestedWords == null || suggestedWords.size() == 0) {
return;
}
@ -1668,12 +1668,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return mCurrentSettings.isSuggestionsRequested(mDisplayOrientation);
}
private void clearSuggestions() {
setSuggestions(SuggestedWords.EMPTY, false);
private void clearSuggestionStrip() {
setSuggestionStrip(SuggestedWords.EMPTY, false);
setAutoCorrectionIndicator(false);
}
private void setSuggestions(final SuggestedWords words, final boolean isAutoCorrection) {
private void setSuggestionStrip(final SuggestedWords words, final boolean isAutoCorrection) {
if (mSuggestionStripView != null) {
mSuggestionStripView.setSuggestions(words);
mKeyboardSwitcher.onAutoCorrectionStateChanged(isAutoCorrection);
@ -1692,7 +1692,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
// TODO: rename this method to updateSuggestionStrip or simply updateSuggestions
private SuggestedWords updateSuggestionsOrPredictions() {
private SuggestedWords updateSuggestionStrip() {
mHandler.cancelUpdateSuggestionStrip();
// Check if we have a suggestion engine attached.
@ -1723,7 +1723,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mCurrentSettings.mCorrectionEnabled);
suggestedWords = maybeRetrieveOlderSuggestions(typedWord, suggestedWords);
showSuggestions(suggestedWords, typedWord);
showSuggestionStrip(suggestedWords, typedWord);
return suggestedWords;
}
@ -1757,10 +1757,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
private void showSuggestions(final SuggestedWords suggestedWords,
private void showSuggestionStrip(final SuggestedWords suggestedWords,
final CharSequence typedWord) {
if (null == suggestedWords || suggestedWords.size() <= 0) {
clearSuggestions();
clearSuggestionStrip();
return;
}
final CharSequence autoCorrection;
@ -1775,7 +1775,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
mWordComposer.setAutoCorrection(autoCorrection);
final boolean isAutoCorrection = suggestedWords.willAutoCorrect();
setSuggestions(suggestedWords, isAutoCorrection);
setSuggestionStrip(suggestedWords, isAutoCorrection);
setAutoCorrectionIndicator(isAutoCorrection);
setSuggestionStripShown(isSuggestionsStripVisible());
}
@ -1783,7 +1783,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void commitCurrentAutoCorrection(final int separatorCodePoint) {
// Complete any pending suggestions query first
if (mHandler.hasPendingUpdateSuggestions()) {
updateSuggestionsOrPredictions();
updateSuggestionStrip();
}
final CharSequence typedAutoCorrection = mWordComposer.getAutoCorrectionOrNull();
final String typedWord = mWordComposer.getTypedWord();
@ -1930,9 +1930,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void setPunctuationSuggestions() {
if (mCurrentSettings.mBigramPredictionEnabled) {
clearSuggestions();
clearSuggestionStrip();
} else {
setSuggestions(mCurrentSettings.mSuggestPuncList, false);
setSuggestionStrip(mCurrentSettings.mSuggestPuncList, false);
}
setAutoCorrectionIndicator(false);
setSuggestionStripShown(isSuggestionsStripVisible());