abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2
diff options
context:
space:
mode:
authorJules Aguillon2022-01-30 12:17:31 +0100
committerJules Aguillon2022-01-30 12:17:31 +0100
commit2f47d2400bc1272e003ecd718cf35ddba0d7fb01 (patch)
treebb24ed48bee40faae54fccedbe60cdf1a19e4da8 /srcs/juloo.keyboard2
parent348c278eaef84228fe1d44709187a4216e5f6c90 (diff)
downloadunexpected-keyboard-2f47d2400bc1272e003ecd718cf35ddba0d7fb01.tar.gz
unexpected-keyboard-2f47d2400bc1272e003ecd718cf35ddba0d7fb01.zip
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.
Diffstat (limited to 'srcs/juloo.keyboard2')
-rw-r--r--srcs/juloo.keyboard2/Keyboard2.java6
-rw-r--r--srcs/juloo.keyboard2/Keyboard2View.java9
2 files changed, 4 insertions, 11 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index 5f1f592..fa4b494 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -144,13 +144,13 @@ public class Keyboard2 extends InputMethodService
int res;
switch (action)
{
- case EditorInfo.IME_ACTION_UNSPECIFIED:
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_GO: res = R.string.key_action_go; 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_SEND: res = R.string.key_action_send; break;
+ case EditorInfo.IME_ACTION_UNSPECIFIED:
case EditorInfo.IME_ACTION_NONE:
default: return null;
}
@@ -173,7 +173,7 @@ public class Keyboard2 extends InputMethodService
_config.actionLabel = actionLabel_of_imeAction(action); // Might be null
_config.actionId = action;
_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;
_config.refresh(this);
refreshSubtypeImm();
- _keyboardView.refreshConfig(getLayout(_currentTextLayout));
+ _keyboardView.setKeyboard(getLayout(_currentTextLayout));
// Refreshing the theme config requires re-creating the views
if (prev_theme != _config.theme)
{
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java
index 18a6c72..49a9ccb 100644
--- a/srcs/juloo.keyboard2/Keyboard2View.java
+++ b/srcs/juloo.keyboard2/Keyboard2View.java
@@ -47,15 +47,8 @@ public class Keyboard2View extends View
_handler = new Handler(this);
_theme = new Theme(getContext(), attrs);
_config = Config.globalConfig();
- refreshConfig(null);
setOnTouchListener(this);
- }
-
- /* Internally calls [reset()]. */
- public void refreshConfig(KeyboardData kw)
- {
- if (kw != null)
- setKeyboard(kw); // handle layout options then calls reset().
+ reset();
}
public void setKeyboard(KeyboardData kw)