diff options
| author | Jules Aguillon | 2022-01-09 12:47:47 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2022-01-09 12:47:47 +0100 |
| commit | 23e59c6b09fdaecc92ae67ee7c5c2936f161696a (patch) | |
| tree | e91f28385801b1a19da774fe2b4e096e8757a433 /srcs/juloo.keyboard2/Keyboard2.java | |
| parent | 2764e96eb1e6c40a1c3e96f52f9a08877cead8a9 (diff) | |
| download | unexpected-keyboard-23e59c6b09fdaecc92ae67ee7c5c2936f161696a.tar.gz unexpected-keyboard-23e59c6b09fdaecc92ae67ee7c5c2936f161696a.zip | |
Allow to hide more keys than just accents
Add the "FLAGS_LANGS" set of flags, which will be used to hide
individual keys that are not accents.
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2.java | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index b820b98..2d807cf 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -81,33 +81,32 @@ public class Keyboard2 extends InputMethodService _currentTextLayout = l; } - private int accents_of_subtype(InputMethodSubtype subtype) + private int extra_keys_of_subtype(InputMethodSubtype subtype) { - String accents_option = subtype.getExtraValueOf("accents"); + String extra_keys = subtype.getExtraValueOf("extra_keys"); int flags = 0; - if (accents_option != null) - for (String acc : accents_option.split("\\|")) - flags |= Config.accentFlag_of_name(acc); + if (extra_keys != null) + for (String acc : extra_keys.split("\\|")) + flags |= Config.extra_key_flag_of_name(acc); return flags; } private void refreshAccentsOption(InputMethodManager imm, InputMethodSubtype subtype) { - final int DONT_REMOVE = KeyValue.FLAG_ACCENT_SUPERSCRIPT | KeyValue.FLAG_ACCENT_SUBSCRIPT; - int to_keep = DONT_REMOVE; + int to_keep = 0; switch (_config.accents) { case 1: - to_keep |= accents_of_subtype(subtype); + to_keep |= extra_keys_of_subtype(subtype); for (InputMethodSubtype s : getEnabledSubtypes(imm)) - to_keep |= accents_of_subtype(s); + to_keep |= extra_keys_of_subtype(s); break; - case 2: to_keep |= accents_of_subtype(subtype); break; - case 3: to_keep = KeyValue.FLAGS_ACCENTS; break; + case 2: to_keep |= extra_keys_of_subtype(subtype); break; + case 3: to_keep = KeyValue.FLAGS_HIDDEN_KEYS; break; case 4: break; default: throw new IllegalArgumentException(); } - _config.accent_flags_to_remove = ~to_keep & KeyValue.FLAGS_ACCENTS; + _config.key_flags_to_remove = ~to_keep & KeyValue.FLAGS_HIDDEN_KEYS; } private void refreshSubtypeLegacyFallback() @@ -115,8 +114,8 @@ public class Keyboard2 extends InputMethodService // Fallback for the accents option: Only respect the "None" case switch (_config.accents) { - case 1: case 2: case 3: _config.accent_flags_to_remove = 0; break; - case 4: _config.accent_flags_to_remove = KeyValue.FLAGS_ACCENTS; break; + case 1: case 2: case 3: _config.key_flags_to_remove = 0; break; + case 4: _config.key_flags_to_remove = KeyValue.FLAGS_HIDDEN_KEYS; break; } // Fallback for the layout option: Use qwerty in the "system settings" case _currentTextLayout = (_config.layout == -1) ? R.xml.qwerty : _config.layout; |
