1
0
Fork 0

partially revert 8ce404d2b6 to have the correct OK event when when the connected app requests a standard IME action (#325)

This commit is contained in:
Dimo Karaivanov 2023-08-01 09:55:56 +03:00 committed by GitHub
parent c0eb1eafbb
commit cd60c55fe5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -326,18 +326,22 @@ public class TextField {
return EditorInfo.IME_ACTION_NONE;
}
int action;
if (field.actionId > 0) {
action = field.actionId; // custom action, defined by the connected app
} else {
action = field.imeOptions & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION);
if (field.actionId == EditorInfo.IME_ACTION_DONE) {
return IME_ACTION_ENTER;
} else if (field.actionId > 0) {
return field.actionId;
}
switch (action) {
case EditorInfo.IME_ACTION_UNSPECIFIED:
case EditorInfo.IME_ACTION_DONE:
return IME_ACTION_ENTER;
int standardAction = field.imeOptions & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION);
switch (standardAction) {
case EditorInfo.IME_ACTION_GO:
case EditorInfo.IME_ACTION_NEXT:
case EditorInfo.IME_ACTION_PREVIOUS:
case EditorInfo.IME_ACTION_SEARCH:
case EditorInfo.IME_ACTION_SEND:
return standardAction;
default:
return action;
return IME_ACTION_ENTER;
}
}
}