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.java32
1 files changed, 18 insertions, 14 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index 2db63e6..0cc2512 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -19,6 +19,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
public class Keyboard2 extends InputMethodService
implements SharedPreferences.OnSharedPreferenceChangeListener
@@ -70,32 +72,34 @@ public class Keyboard2 extends InputMethodService
_currentTextLayout = l;
}
- private int extra_keys_of_subtype(InputMethodSubtype subtype)
+ private void extra_keys_of_subtype(Set<String> dst, InputMethodSubtype subtype)
{
String extra_keys = subtype.getExtraValueOf("extra_keys");
- int flags = 0;
- if (extra_keys != null)
- for (String acc : extra_keys.split("\\|"))
- flags |= Config.extra_key_flag_of_name(acc);
- return flags;
+ if (extra_keys == null)
+ return;
+ String[] ks = extra_keys.split("\\|");
+ for (int i = 0; i < ks.length; i++)
+ dst.add(ks[i]);
}
private void refreshAccentsOption(InputMethodManager imm, InputMethodSubtype subtype)
{
- int to_keep = 0;
+ HashSet<String> extra_keys = new HashSet<String>();
switch (_config.accents)
{
case 1:
- to_keep |= extra_keys_of_subtype(subtype);
+ extra_keys_of_subtype(extra_keys, subtype);
for (InputMethodSubtype s : getEnabledSubtypes(imm))
- to_keep |= extra_keys_of_subtype(s);
+ extra_keys_of_subtype(extra_keys, s);
break;
- case 2: to_keep |= extra_keys_of_subtype(subtype); break;
- case 3: to_keep = KeyValue.FLAGS_HIDDEN_KEYS; break;
+ case 2:
+ extra_keys_of_subtype(extra_keys, subtype);
+ break;
+ case 3: extra_keys = null; break;
case 4: break;
default: throw new IllegalArgumentException();
}
- _config.key_flags_to_remove = ~to_keep & KeyValue.FLAGS_HIDDEN_KEYS;
+ _config.extra_keys = extra_keys;
}
private void refreshSubtypeLegacyFallback()
@@ -103,8 +107,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.key_flags_to_remove = 0; break;
- case 4: _config.key_flags_to_remove = KeyValue.FLAGS_HIDDEN_KEYS; break;
+ case 1: case 2: case 3: _config.extra_keys = null; break;
+ case 4: _config.extra_keys = new HashSet<String>(); break;
}
// Fallback for the layout option: Use qwerty in the "system settings" case
_currentTextLayout = (_config.layout == -1) ? R.xml.qwerty : _config.layout;