Add keys for Latvian

New accents - caron and macron - were defined and QWERTY layout was
updated to add accents for Latvian specific characters.
This commit is contained in:
Edgars 2022-01-15 11:13:41 +02:00 committed by Jules Aguillon
parent aa12466767
commit 0bf7ff5f34
5 changed files with 33 additions and 15 deletions

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<input-method xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="juloo.keyboard2.SettingsActivity" android:supportsSwitchingToNextInputMethod="true"> <input-method xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="juloo.keyboard2.SettingsActivity" android:supportsSwitchingToNextInputMethod="true">
<subtype android:label="%s" android:languageTag="de" android:imeSubtypeLocale="de_DE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=trema|szlig"/>
<subtype android:label="%s" android:languageTag="en" android:imeSubtypeLocale="en_US" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty"/> <subtype android:label="%s" android:languageTag="en" android:imeSubtypeLocale="en_US" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty"/>
<subtype android:label="%s" android:languageTag="fr" android:imeSubtypeLocale="fr_FR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=azerty,extra_keys=grave|aigu|circonflexe|cedille|trema"/>
<subtype android:label="%s" android:languageTag="es" android:imeSubtypeLocale="es_ES" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|tilde|trema"/> <subtype android:label="%s" android:languageTag="es" android:imeSubtypeLocale="es_ES" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|tilde|trema"/>
<subtype android:label="%s" android:languageTag="de" android:imeSubtypeLocale="de_DE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwertz,extra_keys=trema|szlig"/> <subtype android:label="%s" android:languageTag="fr" android:imeSubtypeLocale="fr_FR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=azerty,extra_keys=grave|aigu|circonflexe|cedille|trema"/>
<subtype android:label="%s" android:languageTag="it" android:imeSubtypeLocale="it_IT" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=grave|aigu"/> <subtype android:label="%s" android:languageTag="it" android:imeSubtypeLocale="it_IT" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=grave|aigu"/>
<subtype android:label="%s" android:languageTag="lv" android:imeSubtypeLocale="lv_LV" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=caron|cedille|macron"/>
<subtype android:label="%s" android:languageTag="sv" android:imeSubtypeLocale="sv_SE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|trema|ring"/> <subtype android:label="%s" android:languageTag="sv" android:imeSubtypeLocale="sv_SE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|trema|ring"/>
</input-method> </input-method>

View File

@ -9,7 +9,7 @@
<key key0="y" key2="6" key3="^"/> <key key0="y" key2="6" key3="^"/>
<key key0="u" key2="7" key3="&amp;"/> <key key0="u" key2="7" key3="&amp;"/>
<key key0="i" key2="8" key3="*"/> <key key0="i" key2="8" key3="*"/>
<key key0="o" key2="9" key3="(" key4=")"/> <key key0="o" key1="accent_macron" key2="9" key3="(" key4=")"/>
<key key0="p" key2="0"/> <key key0="p" key2="0"/>
</row> </row>
<row> <row>
@ -17,10 +17,10 @@
<key key0="s" key1="accent_ring" key3="ß"/> <key key0="s" key1="accent_ring" key3="ß"/>
<key key0="d" key1="accent_grave" key3="accent_aigu"/> <key key0="d" key1="accent_grave" key3="accent_aigu"/>
<key key0="f"/> <key key0="f"/>
<key key0="g" key2="-" key3="_"/> <key key0="g" key1="accent_caron" key2="-" key3="_"/>
<key key0="h" key2="=" key3="+"/> <key key0="h" key2="=" key3="+"/>
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key4="}" key3="{"/> <key key0="j" key1="accent_trema" key2="accent_circonflexe" key4="}" key3="{"/>
<key key0="k" key4="]" key3="["/> <key key0="k" key3="[" key4="]"/>
<key key0="l" key2="|" key3="\\"/> <key key0="l" key2="|" key3="\\"/>
</row> </row>
<row> <row>

View File

@ -78,7 +78,7 @@ final class Config
{ {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
DisplayMetrics dm = context.getResources().getDisplayMetrics(); 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_dp = Float.valueOf(prefs.getString("swipe_dist", "15"));
swipe_dist_px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, swipe_dist_dp, dm); swipe_dist_px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, swipe_dist_dp, dm);
vibrateEnabled = prefs.getBoolean("vibrate_enabled", vibrateEnabled); vibrateEnabled = prefs.getBoolean("vibrate_enabled", vibrateEnabled);
@ -91,7 +91,7 @@ final class Config
keyHeight = getDipPref(dm, prefs, "key_height", keyHeight) + keyVerticalInterval; keyHeight = getDipPref(dm, prefs, "key_height", keyHeight) + keyVerticalInterval;
horizontalMargin = getDipPref(dm, prefs, "horizontal_margin", horizontalMargin); horizontalMargin = getDipPref(dm, prefs, "horizontal_margin", horizontalMargin);
preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat); 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")); accents = Integer.valueOf(prefs.getString("accents", "1"));
theme = themeId_of_string(prefs.getString("theme", "")); theme = themeId_of_string(prefs.getString("theme", ""));
} }
@ -120,14 +120,16 @@ final class Config
{ {
switch (name) switch (name)
{ {
case "grave": return KeyValue.FLAG_ACCENT1;
case "aigu": return KeyValue.FLAG_ACCENT2; case "aigu": return KeyValue.FLAG_ACCENT2;
case "circonflexe": return KeyValue.FLAG_ACCENT3; case "caron": return KeyValue.FLAG_ACCENT_CARON;
case "tilde": return KeyValue.FLAG_ACCENT4;
case "cedille": return KeyValue.FLAG_ACCENT5; 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 "ring": return KeyValue.FLAG_ACCENT_RING;
case "szlig": return KeyValue.FLAG_LANG_SZLIG; case "szlig": return KeyValue.FLAG_LANG_SZLIG;
case "tilde": return KeyValue.FLAG_ACCENT4;
case "trema": return KeyValue.FLAG_ACCENT6;
default: throw new RuntimeException(name); default: throw new RuntimeException(name);
} }
} }

View File

@ -98,11 +98,21 @@ class KeyModifier
case '-': return '÷'; case '-': return '÷';
default: return (char)KeyCharacterMap.getDeadChar('\u00A8', c); 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: case KeyValue.FLAG_ACCENT_RING:
switch (c) switch (c)
{ {
default: return (char)KeyCharacterMap.getDeadChar('\u02DA', 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: case KeyValue.FLAG_ACCENT_SUPERSCRIPT:
switch (c) switch (c)
{ {

View File

@ -43,10 +43,13 @@ class KeyValue
public static final int FLAG_ACCENT_SUPERSCRIPT = (1 << 22); public static final int FLAG_ACCENT_SUPERSCRIPT = (1 << 22);
public static final int FLAG_ACCENT_SUBSCRIPT = (1 << 23); public static final int FLAG_ACCENT_SUBSCRIPT = (1 << 23);
public static final int FLAG_ACCENT_RING = (1 << 24); 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 | public static final int FLAGS_ACCENTS = FLAG_ACCENT1 | FLAG_ACCENT2 |
FLAG_ACCENT3 | FLAG_ACCENT4 | FLAG_ACCENT5 | FLAG_ACCENT6 | 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 // Language specific keys
public static final int FLAG_LANG_SZLIG = (1 << 25); public static final int FLAG_LANG_SZLIG = (1 << 25);
@ -143,11 +146,13 @@ class KeyValue
addModifierKey("shift", "", FLAG_LOCK | FLAG_SHIFT); addModifierKey("shift", "", FLAG_LOCK | FLAG_SHIFT);
addModifierKey("ctrl", "Ctrl", FLAG_CTRL); addModifierKey("ctrl", "Ctrl", FLAG_CTRL);
addModifierKey("alt", "Alt", FLAG_ALT); addModifierKey("alt", "Alt", FLAG_ALT);
addModifierKey("accent_grave", "◌̀", FLAG_ACCENT1);
addModifierKey("accent_aigu", "◌́", FLAG_ACCENT2); addModifierKey("accent_aigu", "◌́", FLAG_ACCENT2);
addModifierKey("accent_circonflexe", "◌̂", FLAG_ACCENT3); addModifierKey("accent_caron", "◌̌", FLAG_ACCENT_CARON);
addModifierKey("accent_tilde", "◌̃", FLAG_ACCENT4);
addModifierKey("accent_cedille", "◌̧", FLAG_ACCENT5); 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_trema", "◌̈", FLAG_ACCENT6);
addModifierKey("accent_ring", "◌̊", FLAG_ACCENT_RING); addModifierKey("accent_ring", "◌̊", FLAG_ACCENT_RING);
addModifierKey("superscript", "◌͆", FLAG_ACCENT_SUPERSCRIPT); addModifierKey("superscript", "◌͆", FLAG_ACCENT_SUPERSCRIPT);