mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-19 14:17:40 +00:00
Merge pull request #12315 from keymanapp/fix/android/enter-search
fix(android): Prioritize certain actions over multi-line for ENTER key
This commit is contained in:
commit
31d2b76b30
1 changed files with 10 additions and 11 deletions
|
|
@ -1274,17 +1274,13 @@ public final class KMManager {
|
|||
/**
|
||||
* Sets enterMode which specifies how the System keyboard ENTER key is handled
|
||||
*
|
||||
* @param imeOptions EditorInfo.imeOptions
|
||||
* @param inputType InputType
|
||||
* @param imeOptions EditorInfo.imeOptions used to determine the action
|
||||
* @param inputType InputType used to determine if the text field is multi-line
|
||||
*/
|
||||
public static void setEnterMode(int imeOptions, int inputType) {
|
||||
if ((inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE) != 0) {
|
||||
enterMode = EnterModeType.NEWLINE;
|
||||
return;
|
||||
}
|
||||
|
||||
int imeActions = imeOptions & EditorInfo.IME_MASK_ACTION;
|
||||
EnterModeType value = EnterModeType.DEFAULT;
|
||||
int imeActions = imeOptions & EditorInfo.IME_MASK_ACTION;
|
||||
boolean isMultiLine = (inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE) != 0;
|
||||
|
||||
switch (imeActions) {
|
||||
case EditorInfo.IME_ACTION_GO:
|
||||
|
|
@ -1296,7 +1292,8 @@ public final class KMManager {
|
|||
break;
|
||||
|
||||
case EditorInfo.IME_ACTION_SEND:
|
||||
value = EnterModeType.SEND;
|
||||
value = isMultiLine ?
|
||||
EnterModeType.NEWLINE :EnterModeType.SEND;
|
||||
break;
|
||||
|
||||
case EditorInfo.IME_ACTION_NEXT:
|
||||
|
|
@ -1304,7 +1301,8 @@ public final class KMManager {
|
|||
break;
|
||||
|
||||
case EditorInfo.IME_ACTION_DONE:
|
||||
value = EnterModeType.DONE;
|
||||
value = isMultiLine ?
|
||||
EnterModeType.NEWLINE : EnterModeType.DONE;
|
||||
break;
|
||||
|
||||
case EditorInfo.IME_ACTION_PREVIOUS:
|
||||
|
|
@ -1312,7 +1310,8 @@ public final class KMManager {
|
|||
break;
|
||||
|
||||
default:
|
||||
value = EnterModeType.DEFAULT;
|
||||
value = isMultiLine ?
|
||||
EnterModeType.NEWLINE : EnterModeType.DEFAULT;
|
||||
}
|
||||
|
||||
enterMode = value;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue