From b54f9c5797690bf7ca77228f5a3647e72c20388f Mon Sep 17 00:00:00 2001 From: Kazoku Date: Fri, 10 Feb 2023 00:40:48 +0700 Subject: [PATCH] Vietnamese keyboard (#291) Added missing accent (horn, hook, dot below) Added layout Added accent font svg (by modified existing accent) --- res/values/arrays.xml | 2 + res/xml/method.xml | 1 + res/xml/qwerty_vi.xml | 37 +++++++++++ res/xml/settings.xml | 3 + srcs/juloo.keyboard2/Config.java | 1 + .../ExtraKeyCheckBoxPreference.java | 3 + srcs/juloo.keyboard2/KeyModifier.java | 61 ++++++++++++++++++ srcs/juloo.keyboard2/KeyValue.java | 7 +- srcs/special_font/60.svg | 1 + srcs/special_font/61.svg | 1 + srcs/special_font/62.svg | 1 + srcs/special_font/result.ttf | Bin 7916 -> 8660 bytes 12 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 res/xml/qwerty_vi.xml create mode 100644 srcs/special_font/60.svg create mode 100644 srcs/special_font/61.svg create mode 100644 srcs/special_font/62.svg diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 2335487..86a7880 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -14,6 +14,7 @@ qwerty_hu qwerty_tr qwerty_pl + qwerty_vi ru_jcuken qwertz qwertz_cs @@ -46,6 +47,7 @@ QWERTY (Hungarian) QWERTY (Türkçe) QWERTY (Polski) + QWERTY (Vietnamese) ЙЦУКЕН (Русский) QWERTZ QWERTZ (Czech) diff --git a/res/xml/method.xml b/res/xml/method.xml index 3cdfd62..73db770 100644 --- a/res/xml/method.xml +++ b/res/xml/method.xml @@ -25,4 +25,5 @@ + diff --git a/res/xml/qwerty_vi.xml b/res/xml/qwerty_vi.xml new file mode 100644 index 0000000..e61f1f7 --- /dev/null +++ b/res/xml/qwerty_vi.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/xml/settings.xml b/res/xml/settings.xml index 4eccb02..1fdb5e6 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -40,6 +40,9 @@ + + + diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 3eacae3..eda2740 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -357,6 +357,7 @@ final class Config case "qwerty_sv_se": id = R.xml.qwerty_sv_se; break; case "qwerty_tr": id = R.xml.qwerty_tr; break; case "qwerty_pl": id = R.xml.qwerty_pl; break; + case "qwerty_vi": id = R.xml.qwerty_vi; break; case "qwertz": id = R.xml.qwertz; break; case "qwertz_cs": id = R.xml.qwertz_cs; break; case "qwertz_de": id = R.xml.qwertz_de; break; diff --git a/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java b/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java index f013e51..8938d2d 100644 --- a/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java +++ b/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java @@ -31,6 +31,9 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference "accent_breve", "accent_slash", "accent_bar", + "accent_dot_below", + "accent_hook_above", + "accent_horn", "€", "ß", "£", diff --git a/srcs/juloo.keyboard2/KeyModifier.java b/srcs/juloo.keyboard2/KeyModifier.java index c00ff07..ad41edc 100644 --- a/srcs/juloo.keyboard2/KeyModifier.java +++ b/srcs/juloo.keyboard2/KeyModifier.java @@ -60,6 +60,9 @@ class KeyModifier case SLASH: return apply_map_char(k, map_char_slash); case BAR: return apply_map_char(k, map_char_bar); case ARROW_RIGHT: return apply_combining(k, "\u20D7"); + case DOT_BELOW: return apply_map_char(k, map_char_dot_below); + case HORN: return apply_map_char(k, map_char_horn); + case HOOK_ABOVE: return apply_map_char(k, map_char_hook_above); default: return k; } } @@ -570,4 +573,62 @@ class KeyModifier } } }; + + private static final Map_char map_char_dot_below = + new Map_char() { + public char apply(char c) + { + switch (c) + { + case 'a': return 'ạ'; + case 'ă': return 'ặ'; + case 'â': return 'ậ'; + case 'e': return 'ẹ'; + case 'ê': return 'ệ'; + case 'i': return 'ị'; + case 'o': return 'ọ'; + case 'ô': return 'ộ'; + case 'ơ': return 'ợ'; + case 'u': return 'ụ'; + case 'ư': return 'ự'; + case 'y': return 'ỵ'; + default: return c; + } + } + }; + private static final Map_char map_char_horn = + new Map_char() { + public char apply(char c) + { + switch (c) + { + case 'o': return 'ơ'; + case 'u': return 'ư'; + default: return c; + } + } + }; + + private static final Map_char map_char_hook_above = + new Map_char() { + public char apply(char c) + { + switch (c) + { + case 'a': return 'ả'; + case 'ă': return 'ẳ'; + case 'â': return 'ẩ'; + case 'e': return 'ẻ'; + case 'ê': return 'ể'; + case 'i': return 'ỉ'; + case 'o': return 'ỏ'; + case 'ô': return 'ổ'; + case 'ơ': return 'ở'; + case 'u': return 'ủ'; + case 'ư': return 'ử'; + case 'y': return 'ỷ'; + default: return c; + } + } + }; } diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index e93e61f..f45bc7c 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -1,6 +1,5 @@ package juloo.keyboard2; -import android.view.KeyCharacterMap; import android.view.KeyEvent; import java.util.HashMap; @@ -30,12 +29,15 @@ final class KeyValue META, DOUBLE_AIGU, DOT_ABOVE, + DOT_BELOW, GRAVE, AIGU, CIRCONFLEXE, TILDE, CEDILLE, TREMA, + HORN, + HOOK_ABOVE, SUPERSCRIPT, SUBSCRIPT, RING, @@ -310,6 +312,9 @@ final class KeyValue case "accent_arrow_right": return diacritic(0x5D, Modifier.ARROW_RIGHT); case "accent_breve": return diacritic(0x5E, Modifier.BREVE); case "accent_bar": return diacritic(0x5F, Modifier.BAR); + case "accent_dot_below": return diacritic(0x60, Modifier.DOT_BELOW); + case "accent_horn": return diacritic(0x61, Modifier.HORN); + case "accent_hook_above": return diacritic(0x62, Modifier.HOOK_ABOVE); case "superscript": return modifierKey("Sup", Modifier.SUPERSCRIPT, 0); case "subscript": return modifierKey("Sub", Modifier.SUBSCRIPT, 0); case "ordinal": return modifierKey("Ord", Modifier.ORDINAL, 0); diff --git a/srcs/special_font/60.svg b/srcs/special_font/60.svg new file mode 100644 index 0000000..ef403c8 --- /dev/null +++ b/srcs/special_font/60.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/srcs/special_font/61.svg b/srcs/special_font/61.svg new file mode 100644 index 0000000..e9b930c --- /dev/null +++ b/srcs/special_font/61.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/srcs/special_font/62.svg b/srcs/special_font/62.svg new file mode 100644 index 0000000..2df211f --- /dev/null +++ b/srcs/special_font/62.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/srcs/special_font/result.ttf b/srcs/special_font/result.ttf index 45aa45994a256a6e892a7f6268871e062ff5a3ec..c7a8ca03a333a010850fbc687c2702d1c70bb3cd 100644 GIT binary patch delta 1205 zcmbVMUuaup6#sqS&Aqo>(>2|CbJx<8o7^@xS<);`(%jiU=~&uS*G(<%p`G34Z5Er- z)udfk+gXU>a6^39xG#beCknnzLBufy@xh^Q3L=P#dk_&3+>3jYcy4mV2cI->_^ecY4ZCcnfz| z%^zL{_!7lV6}M^{f_w)M9KL78x=?L2s1t(kk>9p*e&^|ga_c&!d_doBxn!NwU%Wj^ zx$nuc<#MTR$)5@Ls96sM2FvTU?fRKL?~v~_eEWQ*Xst#nKhc1X$v?SnZCA02cPW3E zeC-))y%gEK@(nQX3W@SnD;H{|($=e#y3y?ET#oFKpF8fJ?V9)l9l|dZ!M(Pzjn>J> zHm=_{*qD8sO)1NQ);Nq)LKdI5dQkt<_Dy!v%RfS)X?HMVAK@cx+1}(= zg|HE^nQ+7Yl6&meg?Y()%zL*p_x^q13-!r%6dDu!S>6kg-daTfI${`siE&`akYpum zgpH(Z`c*o0zba3$?2sak(j&>O;iq2;8UEf*)$8ky z1rp=qx#i$NaYTxVaW=>wk}jub7N$8#rNlXLG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