1
0
Fork 0

fixed OK key not sending the correct key event when the connected app passes a standard IME_ACTION through the custom actionId property (#309)

Co-authored-by: Alex Knop <alexknoptech@protonmail.com>
This commit is contained in:
alexknop 2023-07-26 09:33:39 -04:00 committed by GitHub
parent b985eb1849
commit 8ce404d2b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -326,20 +326,18 @@ public class TextField {
return EditorInfo.IME_ACTION_NONE;
}
int action;
if (field.actionId > 0) {
return field.actionId; // custom action, defined by the connected app
action = field.actionId; // custom action, defined by the connected app
} else {
action = field.imeOptions & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION);
}
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:
switch (action) {
case EditorInfo.IME_ACTION_UNSPECIFIED:
case EditorInfo.IME_ACTION_DONE:
return IME_ACTION_ENTER;
default:
return action;
}
}
}