mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1438682 - 1. Cache initial selection offsets; r=esawin
Getting the selection offsets in onCreateInputConnection can fail because of us being on a wrong thread. The solution is to cache the last selection offsets and use those in onCreateInputConnection. MozReview-Commit-ID: AOlZsuOvzHm --HG-- extra : rebase_source : 42f35bc60219707fc29db7cc2803f64313806244
This commit is contained in:
parent
d6729b8d28
commit
a1a66f9c59
@ -67,6 +67,8 @@ import android.view.inputmethod.InputMethodManager;
|
||||
private String mIMEActionHint = "";
|
||||
private int mIMEFlags;
|
||||
private boolean mFocused;
|
||||
private int mLastSelectionStart;
|
||||
private int mLastSelectionEnd;
|
||||
|
||||
private String mCurrentInputMethod = "";
|
||||
|
||||
@ -339,8 +341,9 @@ import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
final Editable editable = getEditable();
|
||||
if (editable != null) {
|
||||
notifySelectionChange(Selection.getSelectionStart(editable),
|
||||
Selection.getSelectionEnd(editable));
|
||||
mLastSelectionStart = Selection.getSelectionStart(editable);
|
||||
mLastSelectionEnd = Selection.getSelectionEnd(editable);
|
||||
notifySelectionChange(mLastSelectionStart, mLastSelectionEnd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -640,9 +643,8 @@ import android.view.inputmethod.InputMethodManager;
|
||||
Log.d(LOGTAG, "IME: CurrentInputMethod=" + mCurrentInputMethod);
|
||||
}
|
||||
|
||||
Editable editable = getEditable();
|
||||
outAttrs.initialSelStart = Selection.getSelectionStart(editable);
|
||||
outAttrs.initialSelEnd = Selection.getSelectionEnd(editable);
|
||||
outAttrs.initialSelStart = mLastSelectionStart;
|
||||
outAttrs.initialSelEnd = mLastSelectionEnd;
|
||||
|
||||
if ((mIMEFlags & IME_FLAG_USER_ACTION) != 0) {
|
||||
if ((context instanceof Activity) &&
|
||||
|
Loading…
Reference in New Issue
Block a user