From 0bf7ff5f34eca0ff4b4605b22c418749656db03d Mon Sep 17 00:00:00 2001 From: Edgars Date: Sat, 15 Jan 2022 11:13:41 +0200 Subject: [PATCH] Add keys for Latvian New accents - caron and macron - were defined and QWERTY layout was updated to add accents for Latvian specific characters. --- res/xml/method.xml | 5 +++-- res/xml/qwerty.xml | 6 +++--- srcs/juloo.keyboard2/Config.java | 14 ++++++++------ srcs/juloo.keyboard2/KeyModifier.java | 10 ++++++++++ srcs/juloo.keyboard2/KeyValue.java | 13 +++++++++---- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/res/xml/method.xml b/res/xml/method.xml index 4250ae2..d7e5147 100644 --- a/res/xml/method.xml +++ b/res/xml/method.xml @@ -1,9 +1,10 @@ + - - + + diff --git a/res/xml/qwerty.xml b/res/xml/qwerty.xml index fa9fc2e..73b41a5 100644 --- a/res/xml/qwerty.xml +++ b/res/xml/qwerty.xml @@ -9,7 +9,7 @@ - + @@ -17,10 +17,10 @@ - + - + diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index f9c6df6..6834733 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -78,7 +78,7 @@ final class Config { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); DisplayMetrics dm = context.getResources().getDisplayMetrics(); - layout = layoutId_of_string(prefs.getString("layout", "system")); + layout = layoutId_of_string(prefs.getString("layout", "system")); swipe_dist_dp = Float.valueOf(prefs.getString("swipe_dist", "15")); swipe_dist_px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, swipe_dist_dp, dm); vibrateEnabled = prefs.getBoolean("vibrate_enabled", vibrateEnabled); @@ -91,7 +91,7 @@ final class Config keyHeight = getDipPref(dm, prefs, "key_height", keyHeight) + keyVerticalInterval; horizontalMargin = getDipPref(dm, prefs, "horizontal_margin", horizontalMargin); preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat); - characterSize = prefs.getFloat("character_size", characterSize); + characterSize = prefs.getFloat("character_size", characterSize); accents = Integer.valueOf(prefs.getString("accents", "1")); theme = themeId_of_string(prefs.getString("theme", "")); } @@ -120,14 +120,16 @@ final class Config { switch (name) { - case "grave": return KeyValue.FLAG_ACCENT1; case "aigu": return KeyValue.FLAG_ACCENT2; - case "circonflexe": return KeyValue.FLAG_ACCENT3; - case "tilde": return KeyValue.FLAG_ACCENT4; + case "caron": return KeyValue.FLAG_ACCENT_CARON; case "cedille": return KeyValue.FLAG_ACCENT5; - case "trema": return KeyValue.FLAG_ACCENT6; + case "circonflexe": return KeyValue.FLAG_ACCENT3; + case "grave": return KeyValue.FLAG_ACCENT1; + case "macron": return KeyValue.FLAG_ACCENT_MACRON; case "ring": return KeyValue.FLAG_ACCENT_RING; case "szlig": return KeyValue.FLAG_LANG_SZLIG; + case "tilde": return KeyValue.FLAG_ACCENT4; + case "trema": return KeyValue.FLAG_ACCENT6; default: throw new RuntimeException(name); } } diff --git a/srcs/juloo.keyboard2/KeyModifier.java b/srcs/juloo.keyboard2/KeyModifier.java index 08d1681..4d8d9c5 100644 --- a/srcs/juloo.keyboard2/KeyModifier.java +++ b/srcs/juloo.keyboard2/KeyModifier.java @@ -98,11 +98,21 @@ class KeyModifier case '-': return '÷'; default: return (char)KeyCharacterMap.getDeadChar('\u00A8', c); } + case KeyValue.FLAG_ACCENT_CARON: + switch (c) + { + default: return (char)KeyCharacterMap.getDeadChar('\u02C7', c); + } case KeyValue.FLAG_ACCENT_RING: switch (c) { default: return (char)KeyCharacterMap.getDeadChar('\u02DA', c); } + case KeyValue.FLAG_ACCENT_MACRON: + switch (c) + { + default: return (char)KeyCharacterMap.getDeadChar('\u00AF', c); + } case KeyValue.FLAG_ACCENT_SUPERSCRIPT: switch (c) { diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index 3447c01..bf8c1d2 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -43,10 +43,13 @@ class KeyValue public static final int FLAG_ACCENT_SUPERSCRIPT = (1 << 22); public static final int FLAG_ACCENT_SUBSCRIPT = (1 << 23); public static final int FLAG_ACCENT_RING = (1 << 24); + public static final int FLAG_ACCENT_CARON = (1 << 26); + public static final int FLAG_ACCENT_MACRON = (1 << 27); public static final int FLAGS_ACCENTS = FLAG_ACCENT1 | FLAG_ACCENT2 | FLAG_ACCENT3 | FLAG_ACCENT4 | FLAG_ACCENT5 | FLAG_ACCENT6 | - FLAG_ACCENT_SUPERSCRIPT | FLAG_ACCENT_SUBSCRIPT | FLAG_ACCENT_RING; + FLAG_ACCENT_CARON | FLAG_ACCENT_MACRON | FLAG_ACCENT_SUPERSCRIPT | + FLAG_ACCENT_SUBSCRIPT | FLAG_ACCENT_RING; // Language specific keys public static final int FLAG_LANG_SZLIG = (1 << 25); @@ -143,11 +146,13 @@ class KeyValue addModifierKey("shift", "⇧", FLAG_LOCK | FLAG_SHIFT); addModifierKey("ctrl", "Ctrl", FLAG_CTRL); addModifierKey("alt", "Alt", FLAG_ALT); - addModifierKey("accent_grave", "◌̀", FLAG_ACCENT1); addModifierKey("accent_aigu", "◌́", FLAG_ACCENT2); - addModifierKey("accent_circonflexe", "◌̂", FLAG_ACCENT3); - addModifierKey("accent_tilde", "◌̃", FLAG_ACCENT4); + addModifierKey("accent_caron", "◌̌", FLAG_ACCENT_CARON); addModifierKey("accent_cedille", "◌̧", FLAG_ACCENT5); + addModifierKey("accent_circonflexe", "◌̂", FLAG_ACCENT3); + addModifierKey("accent_grave", "◌̀", FLAG_ACCENT1); + addModifierKey("accent_macron", "◌̄", FLAG_ACCENT_MACRON); + addModifierKey("accent_tilde", "◌̃", FLAG_ACCENT4); addModifierKey("accent_trema", "◌̈", FLAG_ACCENT6); addModifierKey("accent_ring", "◌̊", FLAG_ACCENT_RING); addModifierKey("superscript", "◌͆", FLAG_ACCENT_SUPERSCRIPT);