aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-12-27 00:06:03 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-12-27 00:06:03 -0800
commite099325f99131a75c6aa375197ac775fb6cd3130 (patch)
tree748ba680eabecb2055f88c76b57915252ea1e11a /java
parentab14bb51c89cd553719c3397169bc84f94deb429 (diff)
parentaf26a44102c004844546cb8d049aa43b629f3598 (diff)
downloadlatinime-e099325f99131a75c6aa375197ac775fb6cd3130.tar.gz
latinime-e099325f99131a75c6aa375197ac775fb6cd3130.tar.xz
latinime-e099325f99131a75c6aa375197ac775fb6cd3130.zip
am af26a441: Merge "[IL47] Inline getSuggestedWordsGestureLocked"
* commit 'af26a44102c004844546cb8d049aa43b629f3598': [IL47] Inline getSuggestedWordsGestureLocked
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java33
1 files changed, 10 insertions, 23 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 0529ecaa9..354856320 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1341,13 +1341,21 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Batch input has ended or canceled while the message was being delivered.
return;
}
- getSuggestedWordsGestureLocked(batchPointers, sequenceNumber,
+ mLatinIme.mInputLogic.mWordComposer.setBatchInputPointers(batchPointers);
+ getSuggestedWords(Suggest.SESSION_GESTURE, sequenceNumber,
new OnGetSuggestedWordsCallback() {
@Override
- public void onGetSuggestedWords(final SuggestedWords suggestedWords) {
+ public void onGetSuggestedWords(SuggestedWords suggestedWords) {
// We're now inside the callback. This always runs on the
// InputUpdater thread, no matter what thread updateBatchInput
// was called on.
+ if (suggestedWords.isEmpty()) {
+ // Use old suggestions if we don't have any new ones.
+ // Previous suggestions are found in InputLogic#mSuggestedWords.
+ // Since these are the most recent ones and we just recomputed
+ // new ones to update them, then the previous ones are there.
+ suggestedWords = mLatinIme.mInputLogic.mSuggestedWords;
+ }
mLatinIme.mHandler.showGesturePreviewAndSuggestionStrip(
suggestedWords,
forEnd /* dismissGestureFloatingPreviewText */);
@@ -1404,27 +1412,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
updateBatchInput(batchPointers, sequenceNumber, true /* forEnd */);
}
- // {@link LatinIME#getSuggestedWords(int)} method calls with same session id have to
- // be synchronized.
- private void getSuggestedWordsGestureLocked(final InputPointers batchPointers,
- final int sequenceNumber, final OnGetSuggestedWordsCallback callback) {
- mLatinIme.mInputLogic.mWordComposer.setBatchInputPointers(batchPointers);
- getSuggestedWords(Suggest.SESSION_GESTURE, sequenceNumber,
- new OnGetSuggestedWordsCallback() {
- @Override
- public void onGetSuggestedWords(SuggestedWords suggestedWords) {
- if (suggestedWords.isEmpty()) {
- // Previous suggestions are found in InputLogic#mSuggestedWords.
- // Since these are the most recent ones and we just recomputed new
- // ones to update them, it means the previous ones are there.
- callback.onGetSuggestedWords(mLatinIme.mInputLogic.mSuggestedWords);
- } else {
- callback.onGetSuggestedWords(suggestedWords);
- }
- }
- });
- }
-
public void getSuggestedWords(final int sessionId, final int sequenceNumber,
final OnGetSuggestedWordsCallback callback) {
mHandler.obtainMessage(MSG_GET_SUGGESTED_WORDS, sessionId, sequenceNumber, callback)