forked from extern/Unexpected-Keyboard
Improve Action key detection
There were two problems: - The Action key was swapped when it shouldn't be. The flag 'IME_FLAG_NO_ENTER_ACTION' wasn't interpreted correctly for inputs that specified both an action and this flag. - The value 'IME_ACTION_UNSPECIFIED' should remove the Action key.
This commit is contained in:
parent
348c278eae
commit
2f47d2400b
@ -144,13 +144,13 @@ public class Keyboard2 extends InputMethodService
|
|||||||
int res;
|
int res;
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case EditorInfo.IME_ACTION_UNSPECIFIED:
|
|
||||||
case EditorInfo.IME_ACTION_NEXT: res = R.string.key_action_next; break;
|
case EditorInfo.IME_ACTION_NEXT: res = R.string.key_action_next; break;
|
||||||
case EditorInfo.IME_ACTION_DONE: res = R.string.key_action_done; break;
|
case EditorInfo.IME_ACTION_DONE: res = R.string.key_action_done; break;
|
||||||
case EditorInfo.IME_ACTION_GO: res = R.string.key_action_go; break;
|
case EditorInfo.IME_ACTION_GO: res = R.string.key_action_go; break;
|
||||||
case EditorInfo.IME_ACTION_PREVIOUS: res = R.string.key_action_prev; break;
|
case EditorInfo.IME_ACTION_PREVIOUS: res = R.string.key_action_prev; break;
|
||||||
case EditorInfo.IME_ACTION_SEARCH: res = R.string.key_action_search; break;
|
case EditorInfo.IME_ACTION_SEARCH: res = R.string.key_action_search; break;
|
||||||
case EditorInfo.IME_ACTION_SEND: res = R.string.key_action_send; break;
|
case EditorInfo.IME_ACTION_SEND: res = R.string.key_action_send; break;
|
||||||
|
case EditorInfo.IME_ACTION_UNSPECIFIED:
|
||||||
case EditorInfo.IME_ACTION_NONE:
|
case EditorInfo.IME_ACTION_NONE:
|
||||||
default: return null;
|
default: return null;
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ public class Keyboard2 extends InputMethodService
|
|||||||
_config.actionLabel = actionLabel_of_imeAction(action); // Might be null
|
_config.actionLabel = actionLabel_of_imeAction(action); // Might be null
|
||||||
_config.actionId = action;
|
_config.actionId = action;
|
||||||
_config.swapEnterActionKey =
|
_config.swapEnterActionKey =
|
||||||
(info.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0;
|
(info.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ public class Keyboard2 extends InputMethodService
|
|||||||
int prev_theme = _config.theme;
|
int prev_theme = _config.theme;
|
||||||
_config.refresh(this);
|
_config.refresh(this);
|
||||||
refreshSubtypeImm();
|
refreshSubtypeImm();
|
||||||
_keyboardView.refreshConfig(getLayout(_currentTextLayout));
|
_keyboardView.setKeyboard(getLayout(_currentTextLayout));
|
||||||
// Refreshing the theme config requires re-creating the views
|
// Refreshing the theme config requires re-creating the views
|
||||||
if (prev_theme != _config.theme)
|
if (prev_theme != _config.theme)
|
||||||
{
|
{
|
||||||
|
@ -47,15 +47,8 @@ public class Keyboard2View extends View
|
|||||||
_handler = new Handler(this);
|
_handler = new Handler(this);
|
||||||
_theme = new Theme(getContext(), attrs);
|
_theme = new Theme(getContext(), attrs);
|
||||||
_config = Config.globalConfig();
|
_config = Config.globalConfig();
|
||||||
refreshConfig(null);
|
|
||||||
setOnTouchListener(this);
|
setOnTouchListener(this);
|
||||||
}
|
reset();
|
||||||
|
|
||||||
/* Internally calls [reset()]. */
|
|
||||||
public void refreshConfig(KeyboardData kw)
|
|
||||||
{
|
|
||||||
if (kw != null)
|
|
||||||
setKeyboard(kw); // handle layout options then calls reset().
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyboard(KeyboardData kw)
|
public void setKeyboard(KeyboardData kw)
|
||||||
|
Loading…
Reference in New Issue
Block a user