abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Keyboard2.java
diff options
context:
space:
mode:
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2.java')
-rw-r--r--srcs/juloo.keyboard2/Keyboard2.java34
1 files changed, 7 insertions, 27 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index f8aab34..8a5c69b 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -99,19 +99,18 @@ public class Keyboard2 extends InputMethodService
return Arrays.asList();
}
- private void extra_keys_of_subtype(Set<KeyValue> dst, InputMethodSubtype subtype)
+ private void extra_keys_of_subtype(ExtraKeys dst, InputMethodSubtype subtype)
{
String extra_keys = subtype.getExtraValueOf("extra_keys");
+ String script = subtype.getExtraValueOf("script");
if (extra_keys == null)
return;
- String[] ks = extra_keys.split("\\|");
- for (int i = 0; i < ks.length; i++)
- dst.add(KeyValue.getKeyByName(ks[i]));
+ dst.add_keys_for_script(script, ExtraKeys.parse_extra_keys(extra_keys));
}
private void refreshAccentsOption(InputMethodManager imm, InputMethodSubtype subtype)
{
- HashSet<KeyValue> extra_keys = new HashSet<KeyValue>();
+ ExtraKeys extra_keys = new ExtraKeys();
List<InputMethodSubtype> enabled_subtypes = getEnabledSubtypes(imm);
switch (_config.accents)
{
@@ -132,16 +131,6 @@ public class Keyboard2 extends InputMethodService
_config.shouldOfferSwitchingToNextInputMethod = true;
}
- private void refreshSubtypeLegacyFallback()
- {
- // Fallback for the accents option: Only respect the "None" case
- switch (_config.accents)
- {
- case 1: case 2: case 3: _config.extra_keys_subtype = null; break;
- case 4: _config.extra_keys_subtype = new HashSet<KeyValue>(); break;
- }
- }
-
InputMethodManager get_imm()
{
return (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
@@ -156,20 +145,11 @@ public class Keyboard2 extends InputMethodService
_config.shouldOfferSwitchingToNextInputMethod = shouldOfferSwitchingToNextInputMethod();
_config.shouldOfferVoiceTyping = (get_voice_typing_im(imm) != null);
KeyboardData default_layout = null;
- if (VERSION.SDK_INT < 12)
- {
- // Subtypes won't work well under API level 12 (getExtraValueOf)
- refreshSubtypeLegacyFallback();
- }
- else
+ _config.extra_keys_subtype = null;
+ if (VERSION.SDK_INT >= 12)
{
InputMethodSubtype subtype = imm.getCurrentInputMethodSubtype();
- if (subtype == null)
- {
- // On some rare cases, [subtype] is null.
- refreshSubtypeLegacyFallback();
- }
- else
+ if (subtype != null)
{
String s = subtype.getExtraValueOf("default_layout");
if (s != null)