Skip to content

Commit efbad5f

Browse files
author
Gilles Debunne
committed
IME action (done, next...) correctly handled
Bugs 5599728 and 5319237. mInputContentType should be set for a "modern" cupcake environment says a comment in TextView. However, it is possible to call onEditorAction on a TextView that didn't use any of the method that lazily create that field. This is for instance achieved using the extracted mode in landscape (Done, Next actions) or in Contacts, that feature a Next/Done button in the IME. As a result, the action is ignored. The patch is to force the creation of the mInputContentType when the EditText is associated to the IME. Change-Id: I5beec5a52e9eec0c209af37d68791bb6ff83d6f6
1 parent b90a70d commit efbad5f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/java/android/widget/TextView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3786,7 +3786,7 @@ public void onEditorAction(int actionCode) {
37863786
return;
37873787
}
37883788
}
3789-
3789+
37903790
// This is the handling for some default action.
37913791
// Note that for backwards compatibility we don't do this
37923792
// default handling if explicit ime options have not been given,
@@ -5599,6 +5599,8 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {
55995599
outAttrs.extras = mInputContentType.extras;
56005600
} else {
56015601
outAttrs.imeOptions = EditorInfo.IME_NULL;
5602+
// May not be defined otherwise and needed by onEditorAction
5603+
mInputContentType = new InputContentType();
56025604
}
56035605
if (focusSearch(FOCUS_DOWN) != null) {
56045606
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NAVIGATE_NEXT;

0 commit comments

Comments
 (0)