aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-07-04 21:08:21 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-07-04 21:08:21 -0700
commit0726f466f7789ca112697adf6505870bb821ea17 (patch)
tree61db65e43ce4186b48fb008d0c8aacb420bf8487 /java/src
parent7aeb7ef1ab77e7a4372b69b3b67e1dcb1f0d192f (diff)
parente47c728dd517a150fe19340aebcfbd170f61f9f9 (diff)
downloadlatinime-0726f466f7789ca112697adf6505870bb821ea17.tar.gz
latinime-0726f466f7789ca112697adf6505870bb821ea17.tar.xz
latinime-0726f466f7789ca112697adf6505870bb821ea17.zip
Merge "Add a wrapper to updateSuggestions / Predictions (A48)"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 127a07d13..21f0ea007 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -208,13 +208,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final KeyboardSwitcher switcher = latinIme.mKeyboardSwitcher;
switch (msg.what) {
case MSG_UPDATE_SUGGESTIONS:
- latinIme.updateSuggestions();
+ latinIme.updateSuggestionsOrPredictions(false /* isPredictions */);
break;
case MSG_UPDATE_SHIFT_STATE:
switcher.updateShiftState();
break;
case MSG_SET_BIGRAM_PREDICTIONS:
- latinIme.updateBigramPredictions();
+ latinIme.updateSuggestionsOrPredictions(true /* isPredictions */);
break;
}
}
@@ -1003,7 +1003,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 */);
- updateSuggestions();
+ updateSuggestionsOrPredictions(false /* isPredictions */);
mConnection.finishComposingText();
}
@@ -1026,7 +1026,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD, typedWord.toString(),
separatorCode, prevWord);
}
- updateSuggestions();
+ updateSuggestionsOrPredictions(false /* isPredictions */);
}
public int getCurrentAutoCapsState() {
@@ -1694,7 +1694,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
- public void updateSuggestions() {
+ public void updateSuggestionsOrPredictions(final boolean isPredictions) {
+ if (isPredictions) {
+ updateBigramPredictions();
+ } else {
+ updateSuggestions();
+ }
+ }
+
+ private void updateSuggestions() {
mHandler.cancelUpdateSuggestions();
mHandler.cancelUpdateBigramPredictions();
@@ -1775,7 +1783,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Complete any pending suggestions query first
if (mHandler.hasPendingUpdateSuggestions()) {
mHandler.cancelUpdateSuggestions();
- updateSuggestions();
+ updateSuggestionsOrPredictions(false /* isPredictions */);
}
final CharSequence autoCorrection = mWordComposer.getAutoCorrectionOrNull();
if (autoCorrection != null) {
@@ -1885,7 +1893,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (!showingAddToDictionaryHint) {
// 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.
- updateBigramPredictions();
+ updateSuggestionsOrPredictions(true /* isPredictions */);
// 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.