Merge "Enable choosing a bigram prediction several times in a row."

This commit is contained in:
Jean Chalard 2011-05-30 19:35:15 -07:00 committed by Android (Google) Code Review
commit 57c38bf4b0
2 changed files with 13 additions and 11 deletions

View file

@ -218,10 +218,10 @@ public class Recorrection implements SharedPreferences.OnSharedPreferenceChangeL
mService.showSuggestions(builder.build(), entries.getOriginalWord()); mService.showSuggestions(builder.build(), entries.getOriginalWord());
} }
public void setRecorrectionSuggestions(VoiceProxy voiceProxy, CandidateView candidateView, public void fetchAndDisplayRecorrectionSuggestions(VoiceProxy voiceProxy,
Suggest suggest, KeyboardSwitcher keyboardSwitcher, WordComposer word, CandidateView candidateView, Suggest suggest, KeyboardSwitcher keyboardSwitcher,
boolean hasUncommittedTypedChars, int lastSelectionStart, int lastSelectionEnd, WordComposer word, boolean hasUncommittedTypedChars, int lastSelectionStart,
String wordSeparators) { int lastSelectionEnd, String wordSeparators) {
if (!InputConnectionCompatUtils.RECORRECTION_SUPPORTED) return; if (!InputConnectionCompatUtils.RECORRECTION_SUPPORTED) return;
if (SuggestionSpanUtils.SUGGESTION_SPAN_IS_SUPPORTED || !mRecorrectionEnabled) return; if (SuggestionSpanUtils.SUGGESTION_SPAN_IS_SUPPORTED || !mRecorrectionEnabled) return;
voiceProxy.setShowingVoiceSuggestions(false); voiceProxy.setShowingVoiceSuggestions(false);
@ -249,7 +249,7 @@ public class Recorrection implements SharedPreferences.OnSharedPreferenceChangeL
ic.endBatchEdit(); ic.endBatchEdit();
} else { } else {
abortRecorrection(true); abortRecorrection(true);
mService.setPunctuationSuggestions(); // Show the punctuation suggestions list mService.updateBigramPredictions();
} }
} else { } else {
abortRecorrection(true); abortRecorrection(true);

View file

@ -222,9 +222,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
updateSuggestions(); updateSuggestions();
break; break;
case MSG_UPDATE_OLD_SUGGESTIONS: case MSG_UPDATE_OLD_SUGGESTIONS:
mRecorrection.setRecorrectionSuggestions(mVoiceProxy, mCandidateView, mSuggest, mRecorrection.fetchAndDisplayRecorrectionSuggestions(mVoiceProxy, mCandidateView,
mKeyboardSwitcher, mWord, mHasUncommittedTypedChars, mLastSelectionStart, mSuggest, mKeyboardSwitcher, mWord, mHasUncommittedTypedChars,
mLastSelectionEnd, mSettingsValues.mWordSeparators); mLastSelectionStart, mLastSelectionEnd, mSettingsValues.mWordSeparators);
break; break;
case MSG_UPDATE_SHIFT_STATE: case MSG_UPDATE_SHIFT_STATE:
switcher.updateShiftState(); switcher.updateShiftState();
@ -1623,8 +1623,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (!showingAddToDictionaryHint) { if (!showingAddToDictionaryHint) {
// If we're not showing the "Touch again to save", then show corrections again. // If we're not showing the "Touch again to save", then show corrections again.
// In case the cursor position doesn't change, make sure we show the suggestions again. // In case the cursor position doesn't change, make sure we show the suggestions again.
clearSuggestions(); updateBigramPredictions();
mHandler.postUpdateOldSuggestions(); // Updating the predictions right away may be slow and feel unresponsive on slower
// terminals. On the other hand if we just postUpdateBigramPredictions() it will
// take a noticeable delay to update them which may feel uneasy.
} }
if (showingAddToDictionaryHint) { if (showingAddToDictionaryHint) {
mCandidateView.showAddToDictionaryHint(suggestion); mCandidateView.showAddToDictionaryHint(suggestion);
@ -1655,7 +1657,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} }
private static final WordComposer sEmptyWordComposer = new WordComposer(); private static final WordComposer sEmptyWordComposer = new WordComposer();
private void updateBigramPredictions() { public void updateBigramPredictions() {
if (mSuggest == null || !isSuggestionsRequested()) if (mSuggest == null || !isSuggestionsRequested())
return; return;