Rename suggestion strip related methods

Change-Id: I942692bbc2e577482f353d875405c4658a1102fc
main
Tadashi G. Takaoka 2012-07-23 18:03:16 +09:00
parent 4702671ea4
commit 259905ba90
1 changed files with 18 additions and 18 deletions

View File

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