mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
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.
This commit is contained in:
commit
d2a74e9f16
@ -675,10 +675,33 @@ public class LatinIME extends InputMethodService
|
|||||||
inputView.setPreviewEnabled(mPopupOn);
|
inputView.setPreviewEnabled(mPopupOn);
|
||||||
inputView.setProximityCorrectionEnabled(true);
|
inputView.setProximityCorrectionEnabled(true);
|
||||||
mPredictionOn = mPredictionOn && (mCorrectionMode > 0 || mShowSuggestions);
|
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);
|
checkTutorial(attribute.privateImeOptions);
|
||||||
if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
|
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
|
@Override
|
||||||
public void onFinishInput() {
|
public void onFinishInput() {
|
||||||
super.onFinishInput();
|
super.onFinishInput();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user