aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2010-09-30 11:26:57 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-30 11:26:57 -0700
commitd2a74e9f16ddd2e76f03fdb9da802c48ec37fac8 (patch)
tree79f64954ffd0ad26ae749467fcb7bfa7cd2e2663 /java/src/com/android
parent8bae0829d23048454ebf53a008f8187659e536e5 (diff)
parent4d158dc2779ffff8c92a41f32e6885bd0f155fc3 (diff)
downloadlatinime-d2a74e9f16ddd2e76f03fdb9da802c48ec37fac8.tar.gz
latinime-d2a74e9f16ddd2e76f03fdb9da802c48ec37fac8.tar.xz
latinime-d2a74e9f16ddd2e76f03fdb9da802c48ec37fac8.zip
am 4d158dc2: am 15b840cd: Merge "Check recorrection on focusing into a text field that has text already." into gingerbread
Merge commit '4d158dc2779ffff8c92a41f32e6885bd0f155fc3' * commit '4d158dc2779ffff8c92a41f32e6885bd0f155fc3': Check recorrection on focusing into a text field that has text already.
Diffstat (limited to 'java/src/com/android')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index f16f08f78..96688bab1 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -675,10 +675,33 @@ public class LatinIME extends InputMethodService
inputView.setPreviewEnabled(mPopupOn);
inputView.setProximityCorrectionEnabled(true);
mPredictionOn = mPredictionOn && (mCorrectionMode > 0 || mShowSuggestions);
+ // If we just entered a text field, maybe it has some old text that requires correction
+ checkReCorrectionOnStart();
checkTutorial(attribute.privateImeOptions);
if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
}
+ private void checkReCorrectionOnStart() {
+ if (mReCorrectionEnabled && isPredictionOn()) {
+ // First get the cursor position. This is required by setOldSuggestions(), so that
+ // it can pass the correct range to setComposingRegion(). At this point, we don't
+ // have valid values for mLastSelectionStart/Stop because onUpdateSelection() has
+ // not been called yet.
+ InputConnection ic = getCurrentInputConnection();
+ if (ic == null) return;
+ ExtractedTextRequest etr = new ExtractedTextRequest();
+ etr.token = 0; // anything is fine here
+ ExtractedText et = ic.getExtractedText(etr, 0);
+ if (et == null) return;
+
+ mLastSelectionStart = et.startOffset + et.selectionStart;
+ mLastSelectionEnd = et.startOffset + et.selectionEnd;
+
+ // Then look for possible corrections in a delayed fashion
+ if (!TextUtils.isEmpty(et.text)) postUpdateOldSuggestions();
+ }
+ }
+
@Override
public void onFinishInput() {
super.onFinishInput();