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
This commit is contained in:
Gilles Debunne
2011-11-16 17:08:42 +01:00
parent b90a70d154
commit efbad5fb90

View File

@@ -3786,7 +3786,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
return;
}
}
// This is the handling for some default action.
// Note that for backwards compatibility we don't do this
// default handling if explicit ime options have not been given,
@@ -5599,6 +5599,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
outAttrs.extras = mInputContentType.extras;
} else {
outAttrs.imeOptions = EditorInfo.IME_NULL;
// May not be defined otherwise and needed by onEditorAction
mInputContentType = new InputContentType();
}
if (focusSearch(FOCUS_DOWN) != null) {
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NAVIGATE_NEXT;