aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-07-06 12:15:45 +0900
committerJean Chalard <jchalard@google.com>2012-07-09 15:06:16 +0900
commitdc1b84d96cf7fc4ee21cf7df8a12bc7913ffd64e (patch)
treebef33a421a67cc33ba085ec236f411a54dae204f /java/src
parenta6757f400a7a1acc66b2c64f4aa84137dd4395cd (diff)
downloadlatinime-dc1b84d96cf7fc4ee21cf7df8a12bc7913ffd64e.tar.gz
latinime-dc1b84d96cf7fc4ee21cf7df8a12bc7913ffd64e.tar.xz
latinime-dc1b84d96cf7fc4ee21cf7df8a12bc7913ffd64e.zip
Defer testing composition to a later time (A70)
This is not exactly the same logically speaking, because it's theoretically possible that the composing state changed in between the message enqueueing and it's retrieval. However in the practice, if the composing state changed the message *must* have been cancelled and resent, else the behavior breaks. So this actually is more robust, and removes some obscure requirements on the calling code. In the practice, it should also make the cancelUpdateSuggestionStrip message useless, although this change does not yet remove it. Change-Id: I75141920ce64e38e2f92e9c02b6c979936eee9a9
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java24
1 files changed, 7 insertions, 17 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index c8fdbca5e..20f6a8d71 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -177,9 +177,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public static class UIHandler extends StaticInnerHandlerWrapper<LatinIME> {
private static final int MSG_UPDATE_SHIFT_STATE = 1;
- private static final int MSG_SET_BIGRAM_PREDICTIONS = 5;
private static final int MSG_PENDING_IMS_CALLBACK = 6;
- private static final int MSG_UPDATE_SUGGESTIONS = 7;
+ private static final int MSG_UPDATE_SUGGESTION_STRIP = 7;
private int mDelayUpdateSuggestions;
private int mDelayUpdateShiftState;
@@ -205,35 +204,26 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final LatinIME latinIme = getOuterInstance();
final KeyboardSwitcher switcher = latinIme.mKeyboardSwitcher;
switch (msg.what) {
- case MSG_UPDATE_SUGGESTIONS:
- latinIme.updateSuggestionsOrPredictions(false /* isPredictions */);
+ case MSG_UPDATE_SUGGESTION_STRIP:
+ latinIme.updateSuggestionsOrPredictions(
+ !getOuterInstance().mWordComposer.isComposingWord());
break;
case MSG_UPDATE_SHIFT_STATE:
switcher.updateShiftState();
break;
- case MSG_SET_BIGRAM_PREDICTIONS:
- latinIme.updateSuggestionsOrPredictions(true /* isPredictions */);
- break;
}
}
public void postUpdateSuggestionStrip() {
- cancelUpdateSuggestionStrip();
- if (getOuterInstance().mWordComposer.isComposingWord()) {
- sendMessageDelayed(obtainMessage(MSG_UPDATE_SUGGESTIONS), mDelayUpdateSuggestions);
- } else {
- sendMessageDelayed(obtainMessage(MSG_SET_BIGRAM_PREDICTIONS),
- mDelayUpdateSuggestions);
- }
+ sendMessageDelayed(obtainMessage(MSG_UPDATE_SUGGESTION_STRIP), mDelayUpdateSuggestions);
}
public void cancelUpdateSuggestionStrip() {
- removeMessages(MSG_UPDATE_SUGGESTIONS);
- removeMessages(MSG_SET_BIGRAM_PREDICTIONS);
+ removeMessages(MSG_UPDATE_SUGGESTION_STRIP);
}
public boolean hasPendingUpdateSuggestions() {
- return hasMessages(MSG_UPDATE_SUGGESTIONS);
+ return hasMessages(MSG_UPDATE_SUGGESTION_STRIP);
}
public void postUpdateShiftState() {