aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java48
1 files changed, 19 insertions, 29 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 68ed23897..d8fb4f2be 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1147,7 +1147,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public boolean onEvaluateFullscreenMode() {
- // Reread resource value here, because this method is called by framework anytime as needed.
+ // Reread resource value here, because this method is called by the framework as needed.
final boolean isFullscreenModeAllowed = Settings.readUseFullscreenMode(getResources());
if (super.onEvaluateFullscreenMode() && isFullscreenModeAllowed) {
// TODO: Remove this hack. Actually we should not really assume NO_EXTRACT_UI
@@ -1272,7 +1272,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void onCancelBatchInput() {
- mInputLogic.onCancelBatchInput(mInputUpdater);
+ mInputLogic.onCancelBatchInput(mHandler, mInputUpdater);
}
// TODO[IL]: Make this a package-private standalone class in inputlogic/ and remove all
@@ -1310,17 +1310,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return true;
}
- // Run in the UI thread.
+ // Run on the UI thread.
public void onStartBatchInput() {
synchronized (mLock) {
mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP);
mInBatchInput = true;
- mLatinIme.mHandler.showGesturePreviewAndSuggestionStrip(
- SuggestedWords.EMPTY, false /* dismissGestureFloatingPreviewText */);
}
}
- // Run in the Handler thread.
+ // Run on the Handler thread.
private void updateBatchInput(final InputPointers batchPointers, final int sequenceNumber) {
synchronized (mLock) {
if (!mInBatchInput) {
@@ -1339,7 +1337,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
- // Run in the UI thread.
+ // Run on the UI thread.
public void onUpdateBatchInput(final InputPointers batchPointers,
final int sequenceNumber) {
if (mHandler.hasMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP)) {
@@ -1352,12 +1350,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void onCancelBatchInput() {
synchronized (mLock) {
mInBatchInput = false;
- mLatinIme.mHandler.showGesturePreviewAndSuggestionStrip(
- SuggestedWords.EMPTY, true /* dismissGestureFloatingPreviewText */);
}
}
- // Run in the UI thread.
+ // Run on the UI thread.
public void onEndBatchInput(final InputPointers batchPointers) {
synchronized(mLock) {
getSuggestedWordsGestureLocked(batchPointers, SuggestedWords.NOT_A_SEQUENCE_NUMBER,
@@ -1407,7 +1403,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
- // This method must run in UI Thread.
+ // This method must run on the UI Thread.
private void showGesturePreviewAndSuggestionStrip(final SuggestedWords suggestedWords,
final boolean dismissGestureFloatingPreviewText) {
showSuggestionStrip(suggestedWords);
@@ -1418,7 +1414,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
- // This method must run in UI Thread.
+ // This method must run on the UI Thread.
public void onEndBatchInputAsyncInternal(final SuggestedWords suggestedWords) {
final String batchInputText = suggestedWords.isEmpty() ? null : suggestedWords.getWord(0);
if (TextUtils.isEmpty(batchInputText)) {
@@ -1615,19 +1611,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
false /* isPrediction */);
}
- private void setAutoCorrection(final SuggestedWords suggestedWords, final String typedWord) {
- if (suggestedWords.isEmpty()) return;
- final String autoCorrection;
- if (suggestedWords.mWillAutoCorrect) {
- autoCorrection = suggestedWords.getWord(SuggestedWords.INDEX_OF_AUTO_CORRECTION);
- } else {
- // We can't use suggestedWords.getWord(SuggestedWords.INDEX_OF_TYPED_WORD)
- // because it may differ from mWordComposer.mTypedWord.
- autoCorrection = typedWord;
- }
- mInputLogic.mWordComposer.setAutoCorrection(autoCorrection);
- }
-
private void showSuggestionStripWithTypedWord(final SuggestedWords suggestedWords,
final String typedWord) {
if (suggestedWords.isEmpty()) {
@@ -1636,10 +1619,17 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
clearSuggestionStrip();
return;
}
- setAutoCorrection(suggestedWords, typedWord);
- final boolean isAutoCorrection = suggestedWords.willAutoCorrect();
- setSuggestedWords(suggestedWords, isAutoCorrection);
- setAutoCorrectionIndicator(isAutoCorrection);
+ final String autoCorrection;
+ if (suggestedWords.mWillAutoCorrect) {
+ autoCorrection = suggestedWords.getWord(SuggestedWords.INDEX_OF_AUTO_CORRECTION);
+ } else {
+ // We can't use suggestedWords.getWord(SuggestedWords.INDEX_OF_TYPED_WORD)
+ // because it may differ from mWordComposer.mTypedWord.
+ autoCorrection = typedWord;
+ }
+ mInputLogic.mWordComposer.setAutoCorrection(autoCorrection);
+ setSuggestedWords(suggestedWords, suggestedWords.mWillAutoCorrect);
+ setAutoCorrectionIndicator(suggestedWords.mWillAutoCorrect);
setSuggestionStripShown(isSuggestionsStripVisible());
// An auto-correction is available, cache it in accessibility code so
// we can be speak it if the user touches a key that will insert it.