abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Keyboard2.java
diff options
context:
space:
mode:
authorJules Aguillon2023-08-06 16:49:29 +0200
committerJules Aguillon2023-08-06 17:14:23 +0200
commit45905f5f3b4831e8831f0f284b90b7d7e7f2e1e3 (patch)
treef3e3a36152c09a7d3dce8d44b42a9f12aa45e074 /srcs/juloo.keyboard2/Keyboard2.java
parentc26343cd42cd3b8e251307e4cd97db876fc04b70 (diff)
downloadunexpected-keyboard-45905f5f3b4831e8831f0f284b90b7d7e7f2e1e3.tar.gz
unexpected-keyboard-45905f5f3b4831e8831f0f284b90b7d7e7f2e1e3.zip
Replace dead-keys when there's one alternative
The dead-key is replaced by its alternative if there's only one specified. Extra keys from every subtypes must be merged together to be able to make this check.
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2.java')
-rw-r--r--srcs/juloo.keyboard2/Keyboard2.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index 77c2c15..51026e1 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -18,6 +18,7 @@ import android.view.inputmethod.InputMethodSubtype;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import java.util.AbstractMap.SimpleEntry;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@@ -110,33 +111,34 @@ public class Keyboard2 extends InputMethodService
return Arrays.asList();
}
- private void extra_keys_of_subtype(ExtraKeys dst, InputMethodSubtype subtype)
+ private ExtraKeys extra_keys_of_subtype(InputMethodSubtype subtype)
{
String extra_keys = subtype.getExtraValueOf("extra_keys");
String script = subtype.getExtraValueOf("script");
if (extra_keys != null)
- dst.parse_and_add_keys_for_script(script, extra_keys);
+ return ExtraKeys.parse(script, extra_keys);
+ return ExtraKeys.EMPTY;
}
private void refreshAccentsOption(InputMethodManager imm, InputMethodSubtype subtype)
{
- ExtraKeys extra_keys = new ExtraKeys();
List<InputMethodSubtype> enabled_subtypes = getEnabledSubtypes(imm);
+ List<ExtraKeys> extra_keys = new ArrayList<ExtraKeys>();
switch (_config.accents)
{
// '3' was "all accents", now unused
case 1: case 3:
- extra_keys_of_subtype(extra_keys, subtype);
+ extra_keys.add(extra_keys_of_subtype(subtype));
for (InputMethodSubtype s : enabled_subtypes)
- extra_keys_of_subtype(extra_keys, s);
+ extra_keys.add(extra_keys_of_subtype(s));
break;
case 2:
- extra_keys_of_subtype(extra_keys, subtype);
+ extra_keys.add(extra_keys_of_subtype(subtype));
break;
case 4: break;
default: throw new IllegalArgumentException();
}
- _config.extra_keys_subtype = extra_keys;
+ _config.extra_keys_subtype = ExtraKeys.merge(extra_keys);
if (enabled_subtypes.size() > 1)
_config.shouldOfferSwitchingToNextInputMethod = true;
}