diff options
Diffstat (limited to 'srcs')
| -rw-r--r-- | srcs/juloo.keyboard2/Config.java | 4 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 3 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/KeyboardData.java | 21 |
3 files changed, 27 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index baecc1b..20e0311 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -9,7 +9,6 @@ class Config { private Keyboard2 _context; - public final float marginTop; public final float keyPadding; public final float keyBgPadding; @@ -23,6 +22,7 @@ class Config public float marginBottom; public float keyHeight; public float horizontalMargin; + public boolean disableAccentKeys; public Config(Keyboard2 context) { @@ -43,6 +43,7 @@ class Config marginBottom = res.getDimension(R.dimen.margin_bottom); keyHeight = res.getDimension(R.dimen.key_height); horizontalMargin = res.getDimension(R.dimen.horizontal_margin); + disableAccentKeys = false; // from prefs refresh(); } @@ -62,6 +63,7 @@ class Config marginBottom = getDipPref(prefs, "margin_bottom", marginBottom); keyHeight = getDipPref(prefs, "key_height", keyHeight); horizontalMargin = getDipPref(prefs, "horizontal_margin", horizontalMargin); + disableAccentKeys = prefs.getBoolean("disable_accent_keys", disableAccentKeys); } private float getDipPref(SharedPreferences prefs, String pref_name, float def) diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index 50a528d..06af9ab 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -33,6 +33,9 @@ class KeyValue public static final int FLAG_ACCENT5 = (1 << 20); public static final int FLAG_ACCENT6 = (1 << 21); + public static final int FLAGS_ACCENTS = FLAG_ACCENT1 | FLAG_ACCENT2 | + FLAG_ACCENT3 | FLAG_ACCENT4 | FLAG_ACCENT5 | FLAG_ACCENT6; + private String _name; private String _symbol; private char _char; diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java index 0b73b3d..b52a172 100644 --- a/srcs/juloo.keyboard2/KeyboardData.java +++ b/srcs/juloo.keyboard2/KeyboardData.java @@ -43,6 +43,27 @@ class KeyboardData return (_rows); } + // Remove every keys that has the given flags. + public void removeKeysByFlag(int flags) + { + for (Row r : _rows) + { + for (Key k : r) + { + k.key0 = _removeKeyValueFlag(k.key0, flags); + k.key1 = _removeKeyValueFlag(k.key1, flags); + k.key2 = _removeKeyValueFlag(k.key2, flags); + k.key3 = _removeKeyValueFlag(k.key3, flags); + k.key4 = _removeKeyValueFlag(k.key4, flags); + } + } + } + + private KeyValue _removeKeyValueFlag(KeyValue v, int flags) + { + return (v != null && (v.getFlags() & flags) != 0) ? null : v; + } + public class Row extends ArrayList<Key> { private float _keysWidth; |
