diff options
-rw-r--r-- | java/res/xml-sw600dp/rows_esperanto.xml | 61 | ||||
-rw-r--r-- | java/res/xml-sw768dp/rows_esperanto.xml | 69 | ||||
-rw-r--r-- | java/res/xml/kbd_esperanto.xml | 26 | ||||
-rw-r--r-- | java/res/xml/keyboard_layout_set_esperanto.xml | 42 | ||||
-rw-r--r-- | java/res/xml/method.xml | 4 | ||||
-rw-r--r-- | java/res/xml/rowkeys_esperanto1.xml | 125 | ||||
-rw-r--r-- | java/res/xml/rowkeys_esperanto2.xml | 83 | ||||
-rw-r--r-- | java/res/xml/rowkeys_esperanto3.xml | 58 | ||||
-rw-r--r-- | java/res/xml/rowkeys_qwerty1.xml | 9 | ||||
-rw-r--r-- | java/res/xml/rowkeys_qwerty3.xml | 3 | ||||
-rw-r--r-- | java/res/xml/rowkeys_spanish2.xml | 2 | ||||
-rw-r--r-- | java/res/xml/rows_esperanto.xml | 54 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java | 218 | ||||
-rw-r--r-- | native/jni/src/proximity_info_state.cpp | 196 | ||||
-rw-r--r-- | native/jni/src/proximity_info_state.h | 19 | ||||
-rw-r--r-- | tools/maketext/res/values-eo/donottranslate-more-keys.xml | 146 | ||||
-rw-r--r-- | tools/maketext/res/values/donottranslate-more-keys.xml | 8 |
17 files changed, 548 insertions, 575 deletions
diff --git a/java/res/xml-sw600dp/rows_esperanto.xml b/java/res/xml-sw600dp/rows_esperanto.xml deleted file mode 100644 index e0c62fed7..000000000 --- a/java/res/xml-sw600dp/rows_esperanto.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" -> - <include - latin:keyboardLayout="@xml/key_styles_common" /> - <Row - latin:keyWidth="9.0%p" - > - <include - latin:keyboardLayout="@xml/rowkeys_esperanto1" - latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> - <Key - latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillRight" /> - </Row> - <Row - latin:keyWidth="9.0%p" - > - <include - latin:keyboardLayout="@xml/rowkeys_esperanto2" /> - <Key - latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillRight" /> - </Row> - <Row - latin:keyWidth="9.0%p" - > - <Key - latin:keyStyle="shiftKeyStyle" - latin:keyWidth="10.0%p" /> - <include - latin:keyboardLayout="@xml/rowkeys_esperanto3" /> - <include - latin:keyboardLayout="@xml/keys_comma_period" /> - <Key - latin:keyStyle="shiftKeyStyle" - latin:keyWidth="fillRight" /> - </Row> - <include - latin:keyboardLayout="@xml/row_qwerty4" /> -</merge> diff --git a/java/res/xml-sw768dp/rows_esperanto.xml b/java/res/xml-sw768dp/rows_esperanto.xml deleted file mode 100644 index 0b3bb1fe0..000000000 --- a/java/res/xml-sw768dp/rows_esperanto.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" -> - <include - latin:keyboardLayout="@xml/key_styles_common" /> - <Row - latin:keyWidth="8.282%p" - > - <Key - latin:keyStyle="tabKeyStyle" - latin:keyLabelFlags="alignLeft" - latin:keyWidth="7.969%p" /> - <include - latin:keyboardLayout="@xml/rowkeys_esperanto1" - latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" /> - <Key - latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillRight"/> - </Row> - <Row - latin:keyWidth="8.125%p" - > - <Key - latin:keyStyle="toSymbolKeyStyle" - latin:keyLabelFlags="alignLeft" - latin:keyWidth="10.167%"/> - <include - latin:keyboardLayout="@xml/rowkeys_esperanto2" /> - <Key - latin:keyStyle="enterKeyStyle" - latin:keyWidth="fillRight" /> - </Row> - <Row - latin:keyWidth="8.047%p" - > - <Key - latin:keyStyle="shiftKeyStyle" - latin:keyWidth="13.829%p"/> - <include - latin:keyboardLayout="@xml/rowkeys_esperanto3" /> - <include - latin:keyboardLayout="@xml/keys_comma_period" /> - <Key - latin:keyStyle="shiftKeyStyle" - latin:keyWidth="fillRight" /> - </Row> - <include - latin:keyboardLayout="@xml/row_qwerty4" /> -</merge> diff --git a/java/res/xml/kbd_esperanto.xml b/java/res/xml/kbd_esperanto.xml deleted file mode 100644 index c0c45dd11..000000000 --- a/java/res/xml/kbd_esperanto.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<Keyboard - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" -> - <include - latin:keyboardLayout="@xml/rows_esperanto" /> -</Keyboard> diff --git a/java/res/xml/keyboard_layout_set_esperanto.xml b/java/res/xml/keyboard_layout_set_esperanto.xml deleted file mode 100644 index 94a386d6c..000000000 --- a/java/res/xml/keyboard_layout_set_esperanto.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<KeyboardLayoutSet - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"> - <Element - latin:elementName="alphabet" - latin:elementKeyboard="@xml/kbd_esperanto" - latin:enableProximityCharsCorrection="true" /> - <Element - latin:elementName="symbols" - latin:elementKeyboard="@xml/kbd_symbols" /> - <Element - latin:elementName="symbolsShifted" - latin:elementKeyboard="@xml/kbd_symbols_shift" /> - <Element - latin:elementName="phone" - latin:elementKeyboard="@xml/kbd_phone" /> - <Element - latin:elementName="phoneSymbols" - latin:elementKeyboard="@xml/kbd_phone_symbols" /> - <Element - latin:elementName="number" - latin:elementKeyboard="@xml/kbd_number" /> -</KeyboardLayoutSet> diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 9b769f66e..613e9f6c4 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -34,7 +34,7 @@ el: Greek/greek en_US: English United States/qwerty en_GB: English Great Britain/qwerty - eo: Esperanto/esperanto + eo: Esperanto/spanish es: Spanish/spanish et: Estonian/nordic fa: Persian/arabic @@ -157,7 +157,7 @@ android:label="@string/subtype_generic" android:imeSubtypeLocale="eo" android:imeSubtypeMode="keyboard" - android:imeSubtypeExtraValue="KeyboardLayoutSet=esperanto,AsciiCapable" + android:imeSubtypeExtraValue="KeyboardLayoutSet=spanish" /> <subtype android:icon="@drawable/ic_subtype_keyboard" android:label="@string/subtype_generic" diff --git a/java/res/xml/rowkeys_esperanto1.xml b/java/res/xml/rowkeys_esperanto1.xml deleted file mode 100644 index 6994d4b5e..000000000 --- a/java/res/xml/rowkeys_esperanto1.xml +++ /dev/null @@ -1,125 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" -> - <!-- U+015D: "ŝ" LATIN SMALL LETTER S WITH CIRCUMFLEX --> - <Key - latin:keyLabel="ŝ" - latin:keyHintLabel="1" - latin:additionalMoreKeys="1" - latin:moreKeys="q" /> - <!-- U+011D: "ĝ" LATIN SMALL LETTER G WITH CIRCUMFLEX - U+0175: "ŵ" LATIN SMALL LETTER W WITH CIRCUMFLEX --> - <Key - latin:keyLabel="ĝ" - latin:keyHintLabel="2" - latin:additionalMoreKeys="2" - latin:moreKeys="w,ŵ" /> - <!-- U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE - U+011B: "ě" LATIN SMALL LETTER E WITH CARON - U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE - U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX - U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS - U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK - U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE - U+0113: "ē" LATIN SMALL LETTER E WITH MACRON --> - <Key - latin:keyLabel="e" - latin:keyHintLabel="3" - latin:additionalMoreKeys="3" - latin:moreKeys="é,ě,è,ê,ë,ę,ė,ē" /> - <!-- U+0159: "ř" LATIN SMALL LETTER R WITH CARON - U+0155: "ŕ" LATIN SMALL LETTER R WITH ACUTE - U+0157: "ŗ" LATIN SMALL LETTER R WITH CEDILLA --> - <Key - latin:keyLabel="r" - latin:keyHintLabel="4" - latin:additionalMoreKeys="4" - latin:moreKeys="ř,ŕ,ŗ" /> - <!-- U+0165: "ť" LATIN SMALL LETTER T WITH CARON - U+021B: "ț" LATIN SMALL LETTER T WITH COMMA BELOW - U+0163: "ţ" LATIN SMALL LETTER T WITH CEDILLA - U+0167: "ŧ" LATIN SMALL LETTER T WITH STROKE --> - <Key - latin:keyLabel="t" - latin:keyHintLabel="5" - latin:additionalMoreKeys="5" - latin:moreKeys="ť,ț,ţ,ŧ" /> - <!-- U+016D: "ŭ" LATIN SMALL LETTER U WITH BREVE - U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE - U+0177: "ŷ" LATIN SMALL LETTER Y WITH CIRCUMFLEX - U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS - U+00FE: "þ" LATIN SMALL LETTER THORN --> - <Key - latin:keyLabel="ŭ" - latin:keyHintLabel="6" - latin:additionalMoreKeys="6" - latin:moreKeys="y,ý,ŷ,ÿ,þ" /> - <!-- U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE - U+016F: "ů" LATIN SMALL LETTER U WITH RING ABOVE - U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX - U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS - U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE - U+016B: "ū" LATIN SMALL LETTER U WITH MACRON - U+0169: "ũ" LATIN SMALL LETTER U WITH TILDE - U+0171: "ű" LATIN SMALL LETTER U WITH DOUBLE ACUTE - U+0173: "ų" LATIN SMALL LETTER U WITH OGONEK - U+00B5: "µ" MICRO SIGN --> - <Key - latin:keyLabel="u" - latin:keyHintLabel="7" - latin:additionalMoreKeys="7" - latin:moreKeys="ú,ů,û,ü,ù,ū,ũ,ű,ų,µ" /> - <!-- U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE - U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX - U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS - U+0129: "ĩ" LATIN SMALL LETTER I WITH TILDE - U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE - U+012F: "į" LATIN SMALL LETTER I WITH OGONEK - U+012B: "ī" LATIN SMALL LETTER I WITH MACRON - U+0131: "ı" LATIN SMALL LETTER DOTLESS I - U+0133: "ij" LATIN SMALL LIGATURE IJ --> - <Key - latin:keyLabel="i" - latin:keyHintLabel="8" - latin:additionalMoreKeys="8" - latin:moreKeys="í,î,ï,ĩ,ì,į,ī,ı,ij" /> - <!-- U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE - U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS - U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX - U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE - U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE - U+0153: "œ" LATIN SMALL LIGATURE OE - U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE - U+014D: "ō" LATIN SMALL LETTER O WITH MACRON - U+0151: "ő" LATIN SMALL LETTER O WITH DOUBLE ACUTE - U+00BA: "º" MASCULINE ORDINAL INDICATOR --> - <Key - latin:keyLabel="o" - latin:keyHintLabel="9" - latin:additionalMoreKeys="9" - latin:moreKeys="ó,ö,ô,ò,õ,œ,ø,ō,ő,º" /> - <Key - latin:keyLabel="p" - latin:keyHintLabel="0" - latin:additionalMoreKeys="0" /> -</merge> diff --git a/java/res/xml/rowkeys_esperanto2.xml b/java/res/xml/rowkeys_esperanto2.xml deleted file mode 100644 index ebc968a70..000000000 --- a/java/res/xml/rowkeys_esperanto2.xml +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" -> - <!-- U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE - U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE - U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX - U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS - U+00E6: "æ" LATIN SMALL LETTER AE - U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE - U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE - U+0101: "ā" LATIN SMALL LETTER A WITH MACRON - U+0103: "ă" LATIN SMALL LETTER A WITH BREVE - U+0105: "ą" LATIN SMALL LETTER A WITH OGONEK - U+00AA: "ª" FEMININE ORDINAL INDICATOR --> - <Key - latin:keyLabel="a" - latin:moreKeys="á,à,â,ä,æ,ã,å,ā,ă,ą,ª" /> - <!-- U+00DF: "ß" LATIN SMALL LETTER SHARP S - U+0161: "š" LATIN SMALL LETTER S WITH CARON - U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE - U+0219: "ș" LATIN SMALL LETTER S WITH COMMA BELOW - U+015F: "ş" LATIN SMALL LETTER S WITH CEDILLA --> - <Key - latin:keyLabel="s" - latin:moreKeys="ß,š,ś,ș,ş" /> - <!-- U+00F0: "ð" LATIN SMALL LETTER ETH - U+010F: "ď" LATIN SMALL LETTER D WITH CARON - U+0111: "đ" LATIN SMALL LETTER D WITH STROKE --> - <Key - latin:keyLabel="d" - latin:moreKeys="ð,ď,đ" /> - <Key - latin:keyLabel="f" /> - <!-- U+011F: "ğ" LATIN SMALL LETTER G WITH BREVE - U+0121: "ġ" LATIN SMALL LETTER G WITH DOT ABOVE - U+0123: "ģ" LATIN SMALL LETTER G WITH CEDILLA --> - <Key - latin:keyLabel="g" - latin:moreKeys="ğ,ġ,ģ" /> - <!-- U+0125: "ĥ" LATIN SMALL LETTER H WITH CIRCUMFLEX - U+0127: "ħ" LATIN SMALL LETTER H WITH STROKE --> - <Key - latin:keyLabel="h" - latin:moreKeys="ĥ,ħ" /> - <Key - latin:keyLabel="j" /> - <!-- U+0137: "ķ" LATIN SMALL LETTER K WITH CEDILLA - U+0138: "ĸ" LATIN SMALL LETTER KRA --> - <Key - latin:keyLabel="k" - latin:moreKeys="ķ,ĸ" /> - <!-- U+013A: "ĺ" LATIN SMALL LETTER L WITH ACUTE - U+013C: "ļ" LATIN SMALL LETTER L WITH CEDILLA - U+013E: "ľ" LATIN SMALL LETTER L WITH CARON - U+0140: "ŀ" LATIN SMALL LETTER L WITH MIDDLE DOT - U+0142: "ł" LATIN SMALL LETTER L WITH STROKE --> - <Key - latin:keyLabel="l" - latin:moreKeys="ĺ,ļ,ľ,ŀ,ł" /> - <!-- U+0135: "ĵ" LATIN SMALL LETTER J WITH CIRCUMFLEX --> - <Key - latin:keyLabel="ĵ" /> -</merge> diff --git a/java/res/xml/rowkeys_esperanto3.xml b/java/res/xml/rowkeys_esperanto3.xml deleted file mode 100644 index b2eab8d60..000000000 --- a/java/res/xml/rowkeys_esperanto3.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" -> - <!-- U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE - U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE - U+017E: "ž" LATIN SMALL LETTER Z WITH CARON --> - <Key - latin:keyLabel="z" - latin:moreKeys="ź,ż,ž" /> - <!-- U+0109: "ĉ" LATIN SMALL LETTER C WITH CIRCUMFLEX --> - <Key - latin:keyLabel="ĉ" - latin:moreKeys="x" /> - <!-- U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE - U+010D: "č" LATIN SMALL LETTER C WITH CARON - U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA - U+010B: "ċ" LATIN SMALL LETTER C WITH DOT ABOVE --> - <Key - latin:keyLabel="c" - latin:moreKeys="ć,č,ç,ċ" /> - <!-- U+0175: "ŵ" LATIN SMALL LETTER W WITH CIRCUMFLEX --> - <Key - latin:keyLabel="v" - latin:moreKeys="w,ŵ" /> - <Key - latin:keyLabel="b" /> - <!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE - U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE - U+0146: "ņ" LATIN SMALL LETTER N WITH CEDILLA - U+0148: "ň" LATIN SMALL LETTER N WITH CARON - U+0149: "ʼn" LATIN SMALL LETTER N PRECEDED BY APOSTROPHE - U+014B: "ŋ" LATIN SMALL LETTER ENG --> - <Key - latin:keyLabel="n" - latin:moreKeys="ñ,ń,ņ,ň,ʼn,ŋ" /> - <Key - latin:keyLabel="m" /> -</merge> diff --git a/java/res/xml/rowkeys_qwerty1.xml b/java/res/xml/rowkeys_qwerty1.xml index 84d613460..e7c9b590b 100644 --- a/java/res/xml/rowkeys_qwerty1.xml +++ b/java/res/xml/rowkeys_qwerty1.xml @@ -22,11 +22,12 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <Key - latin:keyLabel="q" + latin:keyLabel="!text/keylabel_for_q" latin:keyHintLabel="1" - latin:additionalMoreKeys="1" /> + latin:additionalMoreKeys="1" + latin:moreKeys="!text/more_keys_for_q" /> <Key - latin:keyLabel="w" + latin:keyLabel="!text/keylabel_for_w" latin:keyHintLabel="2" latin:additionalMoreKeys="2" latin:moreKeys="!text/more_keys_for_w" /> @@ -46,7 +47,7 @@ latin:additionalMoreKeys="5" latin:moreKeys="!text/more_keys_for_t" /> <Key - latin:keyLabel="y" + latin:keyLabel="!text/keylabel_for_y" latin:keyHintLabel="6" latin:additionalMoreKeys="6" latin:moreKeys="!text/more_keys_for_y" /> diff --git a/java/res/xml/rowkeys_qwerty3.xml b/java/res/xml/rowkeys_qwerty3.xml index a74aeb842..b70fd729f 100644 --- a/java/res/xml/rowkeys_qwerty3.xml +++ b/java/res/xml/rowkeys_qwerty3.xml @@ -25,7 +25,8 @@ latin:keyLabel="z" latin:moreKeys="!text/more_keys_for_z" /> <Key - latin:keyLabel="x" /> + latin:keyLabel="!text/keylabel_for_x" + latin:moreKeys="!text/more_keys_for_x" /> <Key latin:keyLabel="c" latin:moreKeys="!text/more_keys_for_c" /> diff --git a/java/res/xml/rowkeys_spanish2.xml b/java/res/xml/rowkeys_spanish2.xml index 4c7e57997..335dff33c 100644 --- a/java/res/xml/rowkeys_spanish2.xml +++ b/java/res/xml/rowkeys_spanish2.xml @@ -25,5 +25,5 @@ latin:keyboardLayout="@xml/rowkeys_qwerty2" /> <!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE --> <Key - latin:keyLabel="ñ" /> + latin:keyLabel="!text/keylabel_for_spanish_row2_10" /> </merge> diff --git a/java/res/xml/rows_esperanto.xml b/java/res/xml/rows_esperanto.xml deleted file mode 100644 index c5f626e9b..000000000 --- a/java/res/xml/rows_esperanto.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2012, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<merge - xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" -> - <include - latin:keyboardLayout="@xml/key_styles_common" /> - <Row - latin:keyWidth="10%p" - > - <include - latin:keyboardLayout="@xml/rowkeys_esperanto1" /> - </Row> - <Row - latin:keyWidth="10%p" - > - <include - latin:keyboardLayout="@xml/rowkeys_esperanto2" /> - </Row> - <Row - latin:keyWidth="10%p" - > - <Key - latin:keyStyle="shiftKeyStyle" - latin:keyWidth="15%p" - latin:visualInsetsRight="1%p" /> - <include - latin:keyboardLayout="@xml/rowkeys_esperanto3" /> - <Key - latin:keyStyle="deleteKeyStyle" - latin:keyWidth="fillRight" - latin:visualInsetsLeft="1%p" /> - </Row> - <include - latin:keyboardLayout="@xml/row_qwerty4" /> -</merge> diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java index a608cdef0..3b7c6ad7a 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java @@ -210,22 +210,29 @@ public final class KeyboardTextsSet { /* 103 */ "keylabel_for_apostrophe", /* 104 */ "keyhintlabel_for_apostrophe", /* 105 */ "more_keys_for_apostrophe", - /* 106 */ "more_keys_for_am_pm", - /* 107 */ "settings_as_more_key", - /* 108 */ "shortcut_as_more_key", - /* 109 */ "action_next_as_more_key", - /* 110 */ "action_previous_as_more_key", - /* 111 */ "label_to_more_symbol_key", - /* 112 */ "label_to_more_symbol_for_tablet_key", - /* 113 */ "label_tab_key", - /* 114 */ "label_to_phone_numeric_key", - /* 115 */ "label_to_phone_symbols_key", - /* 116 */ "label_time_am", - /* 117 */ "label_time_pm", - /* 118 */ "label_to_symbol_key_pcqwerty", - /* 119 */ "keylabel_for_popular_domain", - /* 120 */ "more_keys_for_popular_domain", - /* 121 */ "more_keys_for_smiley", + /* 106 */ "more_keys_for_q", + /* 107 */ "more_keys_for_x", + /* 108 */ "keylabel_for_q", + /* 109 */ "keylabel_for_w", + /* 110 */ "keylabel_for_y", + /* 111 */ "keylabel_for_x", + /* 112 */ "keylabel_for_spanish_row2_10", + /* 113 */ "more_keys_for_am_pm", + /* 114 */ "settings_as_more_key", + /* 115 */ "shortcut_as_more_key", + /* 116 */ "action_next_as_more_key", + /* 117 */ "action_previous_as_more_key", + /* 118 */ "label_to_more_symbol_key", + /* 119 */ "label_to_more_symbol_for_tablet_key", + /* 120 */ "label_tab_key", + /* 121 */ "label_to_phone_numeric_key", + /* 122 */ "label_to_phone_symbols_key", + /* 123 */ "label_time_am", + /* 124 */ "label_time_pm", + /* 125 */ "label_to_symbol_key_pcqwerty", + /* 126 */ "keylabel_for_popular_domain", + /* 127 */ "more_keys_for_popular_domain", + /* 128 */ "more_keys_for_smiley", }; private static final String EMPTY = ""; @@ -348,33 +355,41 @@ public final class KeyboardTextsSet { /* 103 */ "\'", /* 104 */ "\"", /* 105 */ "\"", - /* 106 */ "!fixedColumnOrder!2,!hasLabels!,!text/label_time_am,!text/label_time_pm", - /* 107 */ "!icon/settings_key|!code/key_settings", - /* 108 */ "!icon/shortcut_key|!code/key_shortcut", - /* 109 */ "!hasLabels!,!text/label_next_key|!code/key_action_next", - /* 110 */ "!hasLabels!,!text/label_previous_key|!code/key_action_previous", + /* 106 */ EMPTY, + /* 107 */ EMPTY, + /* 108 */ "q", + /* 109 */ "w", + /* 110 */ "y", + /* 111 */ "x", + // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE + /* 112 */ "\u00F1", + /* 113 */ "!fixedColumnOrder!2,!hasLabels!,!text/label_time_am,!text/label_time_pm", + /* 114 */ "!icon/settings_key|!code/key_settings", + /* 115 */ "!icon/shortcut_key|!code/key_shortcut", + /* 116 */ "!hasLabels!,!text/label_next_key|!code/key_action_next", + /* 117 */ "!hasLabels!,!text/label_previous_key|!code/key_action_previous", // Label for "switch to more symbol" modifier key. Must be short to fit on key! - /* 111 */ "= \\ <", + /* 118 */ "= \\ <", // Label for "switch to more symbol" modifier key on tablets. Must be short to fit on key! - /* 112 */ "~ \\ {", + /* 119 */ "~ \\ {", // Label for "Tab" key. Must be short to fit on key! - /* 113 */ "Tab", + /* 120 */ "Tab", // Label for "switch to phone numeric" key. Must be short to fit on key! - /* 114 */ "123", + /* 121 */ "123", // Label for "switch to phone symbols" key. Must be short to fit on key! // U+FF0A: "*" FULLWIDTH ASTERISK // U+FF03: "#" FULLWIDTH NUMBER SIGN - /* 115 */ "\uFF0A\uFF03", + /* 122 */ "\uFF0A\uFF03", // Key label for "ante meridiem" - /* 116 */ "AM", + /* 123 */ "AM", // Key label for "post meridiem" - /* 117 */ "PM", + /* 124 */ "PM", // Label for "switch to symbols" key on PC QWERTY layout - /* 118 */ "Sym", - /* 119 */ ".com", + /* 125 */ "Sym", + /* 126 */ ".com", // popular web domains for the locale - most popular, displayed on the keyboard - /* 120 */ "!hasLabels!,.net,.org,.gov,.edu", - /* 121 */ "!fixedColumnOrder!5,!hasLabels!,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ ", + /* 127 */ "!hasLabels!,.net,.org,.gov,.edu", + /* 128 */ "!fixedColumnOrder!5,!hasLabels!,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ ", }; /* Language af: Afrikaans */ @@ -857,6 +872,144 @@ public final class KeyboardTextsSet { /* 7 */ "\u00E7", }; + /* Language eo: Esperanto */ + private static final String[] LANGUAGE_eo = { + // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE + // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE + // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX + // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS + // U+00E6: "æ" LATIN SMALL LETTER AE + // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE + // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE + // U+0101: "ā" LATIN SMALL LETTER A WITH MACRON + // U+0103: "ă" LATIN SMALL LETTER A WITH BREVE + // U+0105: "ą" LATIN SMALL LETTER A WITH OGONEK + // U+00AA: "ª" FEMININE ORDINAL INDICATOR + /* 0 */ "\u00E1,\u00E0,\u00E2,\u00E4,\u00E6,\u00E3,\u00E5,\u0101,\u0103,\u0105,\u00AA", + // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE + // U+011B: "ě" LATIN SMALL LETTER E WITH CARON + // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE + // U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX + // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS + // U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK + // U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE + // U+0113: "ē" LATIN SMALL LETTER E WITH MACRON + /* 1 */ "\u00E9,\u011B,\u00E8,\u00EA,\u00EB,\u0119,\u0117,\u0113", + // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE + // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX + // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS + // U+0129: "ĩ" LATIN SMALL LETTER I WITH TILDE + // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE + // U+012F: "į" LATIN SMALL LETTER I WITH OGONEK + // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON + // U+0131: "ı" LATIN SMALL LETTER DOTLESS I + // U+0133: "ij" LATIN SMALL LIGATURE IJ + /* 2 */ "\u00ED,\u00EE,\u00EF,\u0129,\u00EC,\u012F,\u012B,\u0131,\u0133", + // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE + // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS + // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX + // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE + // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE + // U+0153: "œ" LATIN SMALL LIGATURE OE + // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE + // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON + // U+0151: "ő" LATIN SMALL LETTER O WITH DOUBLE ACUTE + // U+00BA: "º" MASCULINE ORDINAL INDICATOR + /* 3 */ "\u00F3,\u00F6,\u00F4,\u00F2,\u00F5,\u0153,\u00F8,\u014D,\u0151,\u00BA", + // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE + // U+016F: "ů" LATIN SMALL LETTER U WITH RING ABOVE + // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX + // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS + // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE + // U+016B: "ū" LATIN SMALL LETTER U WITH MACRON + // U+0169: "ũ" LATIN SMALL LETTER U WITH TILDE + // U+0171: "ű" LATIN SMALL LETTER U WITH DOUBLE ACUTE + // U+0173: "ų" LATIN SMALL LETTER U WITH OGONEK + // U+00B5: "µ" MICRO SIGN + /* 4 */ "\u00FA,\u016F,\u00FB,\u00FC,\u00F9,\u016B,\u0169,\u0171,\u0173,\u00B5", + // U+00DF: "ß" LATIN SMALL LETTER SHARP S + // U+0161: "š" LATIN SMALL LETTER S WITH CARON + // U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE + // U+0219: "ș" LATIN SMALL LETTER S WITH COMMA BELOW + // U+015F: "ş" LATIN SMALL LETTER S WITH CEDILLA + /* 5 */ "\u00DF,\u0161,\u015B,\u0219,\u015F", + // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE + // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE + // U+0146: "ņ" LATIN SMALL LETTER N WITH CEDILLA + // U+0148: "ň" LATIN SMALL LETTER N WITH CARON + // U+0149: "ʼn" LATIN SMALL LETTER N PRECEDED BY APOSTROPHE + // U+014B: "ŋ" LATIN SMALL LETTER ENG + /* 6 */ "\u00F1,\u0144,\u0146,\u0148,\u0149,\u014B", + // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE + // U+010D: "č" LATIN SMALL LETTER C WITH CARON + // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA + // U+010B: "ċ" LATIN SMALL LETTER C WITH DOT ABOVE + /* 7 */ "\u0107,\u010D,\u00E7,\u010B", + // U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE + // U+0177: "ŷ" LATIN SMALL LETTER Y WITH CIRCUMFLEX + // U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS + // U+00FE: "þ" LATIN SMALL LETTER THORN + /* 8 */ "y,\u00FD,\u0177,\u00FF,\u00FE", + // U+00F0: "ð" LATIN SMALL LETTER ETH + // U+010F: "ď" LATIN SMALL LETTER D WITH CARON + // U+0111: "đ" LATIN SMALL LETTER D WITH STROKE + /* 9 */ "\u00F0,\u010F,\u0111", + // U+0159: "ř" LATIN SMALL LETTER R WITH CARON + // U+0155: "ŕ" LATIN SMALL LETTER R WITH ACUTE + // U+0157: "ŗ" LATIN SMALL LETTER R WITH CEDILLA + /* 10 */ "\u0159,\u0155,\u0157", + // U+0165: "ť" LATIN SMALL LETTER T WITH CARON + // U+021B: "ț" LATIN SMALL LETTER T WITH COMMA BELOW + // U+0163: "ţ" LATIN SMALL LETTER T WITH CEDILLA + // U+0167: "ŧ" LATIN SMALL LETTER T WITH STROKE + /* 11 */ "\u0165,\u021B,\u0163,\u0167", + // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE + // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE + // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON + /* 12 */ "\u017A,\u017C,\u017E", + // U+0137: "ķ" LATIN SMALL LETTER K WITH CEDILLA + // U+0138: "ĸ" LATIN SMALL LETTER KRA + /* 13 */ "\u0137,\u0138", + // U+013A: "ĺ" LATIN SMALL LETTER L WITH ACUTE + // U+013C: "ļ" LATIN SMALL LETTER L WITH CEDILLA + // U+013E: "ľ" LATIN SMALL LETTER L WITH CARON + // U+0140: "ŀ" LATIN SMALL LETTER L WITH MIDDLE DOT + // U+0142: "ł" LATIN SMALL LETTER L WITH STROKE + /* 14 */ "\u013A,\u013C,\u013E,\u0140,\u0142", + // U+011F: "ğ" LATIN SMALL LETTER G WITH BREVE + // U+0121: "ġ" LATIN SMALL LETTER G WITH DOT ABOVE + // U+0123: "ģ" LATIN SMALL LETTER G WITH CEDILLA + /* 15 */ "\u011F,\u0121,\u0123", + // U+0175: "ŵ" LATIN SMALL LETTER W WITH CIRCUMFLEX + /* 16 */ "w,\u0175", + // U+0125: "ĥ" LATIN SMALL LETTER H WITH CIRCUMFLEX + // U+0127: "ħ" LATIN SMALL LETTER H WITH STROKE + /* 17 */ "\u0125,\u0127", + /* 18 */ null, + // U+0175: "ŵ" LATIN SMALL LETTER W WITH CIRCUMFLEX + /* 19 */ "w,\u0175", + /* 20~ */ + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, + /* ~105 */ + /* 106 */ "q", + /* 107 */ "x", + // U+015D: "ŝ" LATIN SMALL LETTER S WITH CIRCUMFLEX + /* 108 */ "\u015D", + // U+011D: "ĝ" LATIN SMALL LETTER G WITH CIRCUMFLEX + /* 109 */ "\u011D", + // U+016D: "ŭ" LATIN SMALL LETTER U WITH BREVE + /* 110 */ "\u016D", + // U+0109: "ĉ" LATIN SMALL LETTER C WITH CIRCUMFLEX + /* 111 */ "\u0109", + // U+0135: "ĵ" LATIN SMALL LETTER J WITH CIRCUMFLEX + /* 112 */ "\u0135", + }; + /* Language es: Spanish */ private static final String[] LANGUAGE_es = { // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE @@ -2695,6 +2848,7 @@ public final class KeyboardTextsSet { "da", LANGUAGE_da, /* Danish */ "de", LANGUAGE_de, /* German */ "en", LANGUAGE_en, /* English */ + "eo", LANGUAGE_eo, /* Esperanto */ "es", LANGUAGE_es, /* Spanish */ "et", LANGUAGE_et, /* Estonian */ "fa", LANGUAGE_fa, /* Persian */ diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp index f01b81e8d..e13d4e664 100644 --- a/native/jni/src/proximity_info_state.cpp +++ b/native/jni/src/proximity_info_state.cpp @@ -76,10 +76,24 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi mTimes.clear(); mLengthCache.clear(); mDistanceCache.clear(); - mInputSize = 0; + if (xCoordinates && yCoordinates) { const bool proximityOnly = !isGeometric && (xCoordinates[0] < 0 || yCoordinates[0] < 0); + int lastInputIndex = 0; + for (int i = 0; i < inputSize; ++i) { + const int pid = pointerIds ? pointerIds[i] : 0; + if (pointerId == pid) { + lastInputIndex = i; + } + } + // Working space to save near keys distances for current, prev and prevprev input point. + NearKeysDistanceMap nearKeysDistances[3]; + // These pointers are swapped for each inputs points. + NearKeysDistanceMap *currentNearKeysDistances = &nearKeysDistances[0]; + NearKeysDistanceMap *prevNearKeysDistances = &nearKeysDistances[1]; + NearKeysDistanceMap *prevPrevNearKeysDistances = &nearKeysDistances[2]; + for (int i = 0; i < inputSize; ++i) { // Assuming pointerId == 0 if pointerIds is null. const int pid = pointerIds ? pointerIds[i] : 0; @@ -88,11 +102,22 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi const int x = proximityOnly ? NOT_A_COORDINATE : xCoordinates[i]; const int y = proximityOnly ? NOT_A_COORDINATE : yCoordinates[i]; const int time = times ? times[i] : -1; - if (pushTouchPoint(c, x, y, time, isGeometric)) { - ++mInputSize; + if (pushTouchPoint(c, x, y, time, isGeometric, i == lastInputIndex, + currentNearKeysDistances, prevNearKeysDistances, + prevPrevNearKeysDistances)) { + // Previous point information was popped. + NearKeysDistanceMap *tmp = prevNearKeysDistances; + prevNearKeysDistances = currentNearKeysDistances; + currentNearKeysDistances = tmp; + } else { + NearKeysDistanceMap *tmp = prevPrevNearKeysDistances; + prevPrevNearKeysDistances = prevNearKeysDistances; + prevNearKeysDistances = currentNearKeysDistances; + currentNearKeysDistances = tmp; } } } + mInputSize = mInputXs.size(); } if (mInputSize > 0) { @@ -153,20 +178,151 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi } } -bool ProximityInfoState::pushTouchPoint(const int nodeChar, int x, int y, - const int time, const bool sample) { - const uint32_t size = mInputXs.size(); - // TODO: Should have a const variable for 10 - const int sampleRate = mProximityInfo->getMostCommonKeyWidth() / 10; - if (size > 0) { - const int dist = getDistanceInt(x, y, mInputXs[size - 1], mInputYs[size - 1]); - if (sample && dist < sampleRate) { - return false; +// Calculating point to key distance for all near keys and returning the distance between +// the given point and the nearest key position. +float ProximityInfoState::updateNearKeysDistances(const int x, const int y, + NearKeysDistanceMap *const currentNearKeysDistances) { + static const float NEAR_KEY_THRESHOLD = 10.0f; + + currentNearKeysDistances->clear(); + const int keyCount = mProximityInfo->getKeyCount(); + float nearestKeyDistance = mMaxPointToKeyLength; + for (int k = 0; k < keyCount; ++k) { + const float dist = mProximityInfo->getNormalizedSquaredDistanceFromCenterFloat(k, x, y); + if (dist < NEAR_KEY_THRESHOLD) { + currentNearKeysDistances->insert(std::pair<int, float>(k, dist)); } - mLengthCache.push_back(mLengthCache[size - 1] + dist); - } else { - mLengthCache.push_back(0); + if (nearestKeyDistance > dist) { + nearestKeyDistance = dist; + } + } + return nearestKeyDistance; +} + +// Check if previous point is at local minimum position to near keys. +bool ProximityInfoState::isPrevLocalMin(const NearKeysDistanceMap *const currentNearKeysDistances, + const NearKeysDistanceMap *const prevNearKeysDistances, + const NearKeysDistanceMap *const prevPrevNearKeysDistances) const { + static const float MARGIN = 0.5f; + + for (NearKeysDistanceMap::const_iterator it = prevNearKeysDistances->begin(); + it != prevNearKeysDistances->end(); ++it) { + NearKeysDistanceMap::const_iterator itPP = prevPrevNearKeysDistances->find(it->first); + NearKeysDistanceMap::const_iterator itC = currentNearKeysDistances->find(it->first); + if ((itPP == prevPrevNearKeysDistances->end() || itPP->second > it->second + MARGIN) + && (itC == currentNearKeysDistances->end() || itC->second > it->second + MARGIN)) { + return true; + } + } + return false; +} + +// Calculating a point score that indicates usefulness of the point. +float ProximityInfoState::getPointScore( + const int x, const int y, const int time, const bool lastPoint, const float nearest, + const NearKeysDistanceMap *const currentNearKeysDistances, + const NearKeysDistanceMap *const prevNearKeysDistances, + const NearKeysDistanceMap *const prevPrevNearKeysDistances) const { + static const float BASE_SAMPLE_RATE_SCALE = 0.1f; + static const float SAVE_DISTANCE_SCALE = 12.0f; + static const float SAVE_DISTANCE_SCORE = 2.0f; + static const float SKIP_DISTANCE_SCALE = 1.5f; + static const float SKIP_DISTANCE_SCORE = -1.0f; + static const float CHECK_LOCALMIN_DISTANCE_THRESHOLD_SCALE = 2.5f; + static const float CHECK_LOCALMIN_DISTANCE_SCORE = -1.0f; + static const float STRAIGHT_ANGLE_THRESHOLD = M_PI_F / 32.0f; + static const float STRAIGHT_SKIP_DISTANCE_THRESHOLD_SCALE = 4.0f; + static const float STRAIGHT_SKIP_NEAREST_DISTANCE_THRESHOLD = 0.5f; + static const float STRAIGHT_SKIP_SCORE = -1.0f; + + const std::size_t size = mInputXs.size(); + if (size <= 1) { + return 0; } + const float baseSampleRate = mProximityInfo->getMostCommonKeyWidth() * BASE_SAMPLE_RATE_SCALE; + const float distNext = getDistanceFloat(x, y, mInputXs.back(), mInputYs.back()); + const float distPrev = getDistanceFloat(mInputXs.back(), mInputYs.back(), + mInputXs[size - 2], mInputYs[size - 2]); + float score = 0.0f; + + // Sum of distances + if (distPrev + distNext > baseSampleRate * SAVE_DISTANCE_SCALE) { + score += SAVE_DISTANCE_SCORE; + } + // Distance + if (distPrev < baseSampleRate * SKIP_DISTANCE_SCALE) { + score += SKIP_DISTANCE_SCORE; + } + // Location + if (!isPrevLocalMin(currentNearKeysDistances, currentNearKeysDistances, + prevPrevNearKeysDistances)) { + if (distPrev < baseSampleRate * CHECK_LOCALMIN_DISTANCE_THRESHOLD_SCALE) { + score += CHECK_LOCALMIN_DISTANCE_SCORE; + } + } + // Angle + const float angle1 = getAngle(x, y, mInputXs.back(), mInputYs.back()); + const float angle2 = getAngle(mInputXs.back(), mInputYs.back(), + mInputXs[size - 2], mInputYs[size - 2]); + if (getAngleDiff(angle1, angle2) < STRAIGHT_ANGLE_THRESHOLD) { + if (nearest > STRAIGHT_SKIP_NEAREST_DISTANCE_THRESHOLD + && distPrev < baseSampleRate * STRAIGHT_SKIP_DISTANCE_THRESHOLD_SCALE) { + score += STRAIGHT_SKIP_SCORE; + } + } + return score; +} + +// Sampling touch point and pushing information to vectors. +// Returning if previous point is popped or not. +bool ProximityInfoState::pushTouchPoint(const int nodeChar, int x, int y, const int time, + const bool sample, const bool isLastPoint, + NearKeysDistanceMap *const currentNearKeysDistances, + const NearKeysDistanceMap *const prevNearKeysDistances, + const NearKeysDistanceMap *const prevPrevNearKeysDistances) { + static const float LAST_POINT_SKIP_DISTANCE_SCALE = 0.25f; + + uint32_t size = mInputXs.size(); + bool popped = false; + if (nodeChar < 0 && sample) { + const float nearest = updateNearKeysDistances(x, y, currentNearKeysDistances); + const float score = getPointScore(x, y, time, isLastPoint, nearest, + currentNearKeysDistances, prevNearKeysDistances, prevPrevNearKeysDistances); + if (score < 0) { + // Pop previous point because it would be useless. + mInputXs.pop_back(); + mInputYs.pop_back(); + mTimes.pop_back(); + mLengthCache.pop_back(); + size = mInputXs.size(); + popped = true; + } else { + popped = false; + } + // Check if the last point should be skipped. + if (isLastPoint) { + if (size > 0 && getDistanceFloat(x, y, mInputXs.back(), mInputYs.back()) + < mProximityInfo->getMostCommonKeyWidth() * LAST_POINT_SKIP_DISTANCE_SCALE) { + return popped; + } else if (size > 1) { + int minChar = 0; + float minDist = mMaxPointToKeyLength; + for (NearKeysDistanceMap::const_iterator it = currentNearKeysDistances->begin(); + it != currentNearKeysDistances->end(); ++it) { + if(minDist > it->second){ + minChar = it->first; + minDist = it->second; + } + } + NearKeysDistanceMap::const_iterator itPP = + prevNearKeysDistances->find(minChar); + if (itPP != prevNearKeysDistances->end() && minDist > itPP->second) { + return popped; + } + } + } + } + if (nodeChar >= 0 && (x < 0 || y < 0)) { const int keyId = mProximityInfo->getKeyIndex(nodeChar); if (keyId >= 0) { @@ -174,10 +330,18 @@ bool ProximityInfoState::pushTouchPoint(const int nodeChar, int x, int y, y = mProximityInfo->getKeyCenterYOfIdG(keyId); } } + + // Pushing point information. + if (size > 0) { + mLengthCache.push_back( + mLengthCache.back() + getDistanceInt(x, y, mInputXs.back(), mInputYs.back())); + } else { + mLengthCache.push_back(0); + } mInputXs.push_back(x); mInputYs.push_back(y); mTimes.push_back(time); - return true; + return popped; } float ProximityInfoState::calculateNormalizedSquaredDistance( diff --git a/native/jni/src/proximity_info_state.h b/native/jni/src/proximity_info_state.h index 26fd89b36..746b9c968 100644 --- a/native/jni/src/proximity_info_state.h +++ b/native/jni/src/proximity_info_state.h @@ -24,6 +24,7 @@ #include "char_utils.h" #include "defines.h" +#include "hash_map_compat.h" namespace latinime { @@ -216,6 +217,7 @@ class ProximityInfoState { private: DISALLOW_COPY_AND_ASSIGN(ProximityInfoState); + typedef hash_map_compat<int, float> NearKeysDistanceMap; ///////////////////////////////////////// // Defined in proximity_info_state.cpp // ///////////////////////////////////////// @@ -224,7 +226,11 @@ class ProximityInfoState { float calculateSquaredDistanceFromSweetSpotCenter( const int keyIndex, const int inputIndex) const; - bool pushTouchPoint(const int nodeChar, int x, int y, const int time, const bool sample); + bool pushTouchPoint(const int nodeChar, int x, int y, const int time, + const bool sample, const bool isLastPoint, + NearKeysDistanceMap *const currentNearKeysDistances, + const NearKeysDistanceMap *const prevNearKeysDistances, + const NearKeysDistanceMap *const prevPrevNearKeysDistances); ///////////////////////////////////////// // Defined here // ///////////////////////////////////////// @@ -238,6 +244,17 @@ class ProximityInfoState { return mInputCodes + (index * MAX_PROXIMITY_CHARS_SIZE_INTERNAL); } + float updateNearKeysDistances(const int x, const int y, + NearKeysDistanceMap *const currentNearKeysDistances); + bool isPrevLocalMin(const NearKeysDistanceMap *const currentNearKeysDistances, + const NearKeysDistanceMap *const prevNearKeysDistances, + const NearKeysDistanceMap *const prevPrevNearKeysDistances) const; + float getPointScore( + const int x, const int y, const int time, const bool last, const float nearest, + const NearKeysDistanceMap *const currentNearKeysDistances, + const NearKeysDistanceMap *const prevNearKeysDistances, + const NearKeysDistanceMap *const prevPrevNearKeysDistances) const; + // const const ProximityInfo *mProximityInfo; float mMaxPointToKeyLength; diff --git a/tools/maketext/res/values-eo/donottranslate-more-keys.xml b/tools/maketext/res/values-eo/donottranslate-more-keys.xml new file mode 100644 index 000000000..e929869e2 --- /dev/null +++ b/tools/maketext/res/values-eo/donottranslate-more-keys.xml @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2012, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE + U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE + U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX + U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS + U+00E6: "æ" LATIN SMALL LETTER AE + U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE + U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE + U+0101: "ā" LATIN SMALL LETTER A WITH MACRON + U+0103: "ă" LATIN SMALL LETTER A WITH BREVE + U+0105: "ą" LATIN SMALL LETTER A WITH OGONEK + U+00AA: "ª" FEMININE ORDINAL INDICATOR --> + <string name="more_keys_for_a">á,à,â,ä,æ,ã,å,ā,ă,ą,ª</string> + <!-- U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE + U+011B: "ě" LATIN SMALL LETTER E WITH CARON + U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE + U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX + U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS + U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK + U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE + U+0113: "ē" LATIN SMALL LETTER E WITH MACRON --> + <string name="more_keys_for_e">é,ě,è,ê,ë,ę,ė,ē</string> + <!-- U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE + U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX + U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS + U+0129: "ĩ" LATIN SMALL LETTER I WITH TILDE + U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE + U+012F: "į" LATIN SMALL LETTER I WITH OGONEK + U+012B: "ī" LATIN SMALL LETTER I WITH MACRON + U+0131: "ı" LATIN SMALL LETTER DOTLESS I + U+0133: "ij" LATIN SMALL LIGATURE IJ --> + <string name="more_keys_for_i">í,î,ï,ĩ,ì,į,ī,ı,ij</string> + <!-- U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE + U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS + U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX + U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE + U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE + U+0153: "œ" LATIN SMALL LIGATURE OE + U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE + U+014D: "ō" LATIN SMALL LETTER O WITH MACRON + U+0151: "ő" LATIN SMALL LETTER O WITH DOUBLE ACUTE + U+00BA: "º" MASCULINE ORDINAL INDICATOR --> + <string name="more_keys_for_o">ó,ö,ô,ò,õ,œ,ø,ō,ő,º</string> + <!-- U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE + U+016F: "ů" LATIN SMALL LETTER U WITH RING ABOVE + U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX + U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS + U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE + U+016B: "ū" LATIN SMALL LETTER U WITH MACRON + U+0169: "ũ" LATIN SMALL LETTER U WITH TILDE + U+0171: "ű" LATIN SMALL LETTER U WITH DOUBLE ACUTE + U+0173: "ų" LATIN SMALL LETTER U WITH OGONEK + U+00B5: "µ" MICRO SIGN --> + <string name="more_keys_for_u">ú,ů,û,ü,ù,ū,ũ,ű,ų,µ</string> + <!-- U+00DF: "ß" LATIN SMALL LETTER SHARP S + U+0161: "š" LATIN SMALL LETTER S WITH CARON + U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE + U+0219: "ș" LATIN SMALL LETTER S WITH COMMA BELOW + U+015F: "ş" LATIN SMALL LETTER S WITH CEDILLA --> + <string name="more_keys_for_s">ß,š,ś,ș,ş</string> + <!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE + U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE + U+0146: "ņ" LATIN SMALL LETTER N WITH CEDILLA + U+0148: "ň" LATIN SMALL LETTER N WITH CARON + U+0149: "ʼn" LATIN SMALL LETTER N PRECEDED BY APOSTROPHE + U+014B: "ŋ" LATIN SMALL LETTER ENG --> + <string name="more_keys_for_n">ñ,ń,ņ,ň,ʼn,ŋ</string> + <!-- U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE + U+010D: "č" LATIN SMALL LETTER C WITH CARON + U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA + U+010B: "ċ" LATIN SMALL LETTER C WITH DOT ABOVE --> + <string name="more_keys_for_c">ć,č,ç,ċ</string> + <!-- U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE + U+0177: "ŷ" LATIN SMALL LETTER Y WITH CIRCUMFLEX + U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS + U+00FE: "þ" LATIN SMALL LETTER THORN --> + <string name="more_keys_for_y">y,ý,ŷ,ÿ,þ</string> + <!-- U+00F0: "ð" LATIN SMALL LETTER ETH + U+010F: "ď" LATIN SMALL LETTER D WITH CARON + U+0111: "đ" LATIN SMALL LETTER D WITH STROKE --> + <string name="more_keys_for_d">ð,ď,đ</string> + <!-- U+0159: "ř" LATIN SMALL LETTER R WITH CARON + U+0155: "ŕ" LATIN SMALL LETTER R WITH ACUTE + U+0157: "ŗ" LATIN SMALL LETTER R WITH CEDILLA --> + <string name="more_keys_for_r">ř,ŕ,ŗ</string> + <!-- U+0165: "ť" LATIN SMALL LETTER T WITH CARON + U+021B: "ț" LATIN SMALL LETTER T WITH COMMA BELOW + U+0163: "ţ" LATIN SMALL LETTER T WITH CEDILLA + U+0167: "ŧ" LATIN SMALL LETTER T WITH STROKE --> + <string name="more_keys_for_t">ť,ț,ţ,ŧ</string> + <!-- U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE + U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE + U+017E: "ž" LATIN SMALL LETTER Z WITH CARON --> + <string name="more_keys_for_z">ź,ż,ž</string> + <!-- U+0137: "ķ" LATIN SMALL LETTER K WITH CEDILLA + U+0138: "ĸ" LATIN SMALL LETTER KRA --> + <string name="more_keys_for_k">ķ,ĸ</string> + <!-- U+013A: "ĺ" LATIN SMALL LETTER L WITH ACUTE + U+013C: "ļ" LATIN SMALL LETTER L WITH CEDILLA + U+013E: "ľ" LATIN SMALL LETTER L WITH CARON + U+0140: "ŀ" LATIN SMALL LETTER L WITH MIDDLE DOT + U+0142: "ł" LATIN SMALL LETTER L WITH STROKE --> + <string name="more_keys_for_l">ĺ,ļ,ľ,ŀ,ł</string> + <!-- U+011F: "ğ" LATIN SMALL LETTER G WITH BREVE + U+0121: "ġ" LATIN SMALL LETTER G WITH DOT ABOVE + U+0123: "ģ" LATIN SMALL LETTER G WITH CEDILLA --> + <string name="more_keys_for_g">ğ,ġ,ģ</string> + <!-- U+0175: "ŵ" LATIN SMALL LETTER W WITH CIRCUMFLEX --> + <string name="more_keys_for_v">w,ŵ</string> + <!-- U+0125: "ĥ" LATIN SMALL LETTER H WITH CIRCUMFLEX + U+0127: "ħ" LATIN SMALL LETTER H WITH STROKE --> + <string name="more_keys_for_h">ĥ,ħ</string> + <!-- U+0175: "ŵ" LATIN SMALL LETTER W WITH CIRCUMFLEX --> + <string name="more_keys_for_w">w,ŵ</string> + <string name="more_keys_for_q">q</string> + <string name="more_keys_for_x">x</string> + <!-- U+015D: "ŝ" LATIN SMALL LETTER S WITH CIRCUMFLEX --> + <string name="keylabel_for_q">ŝ</string> + <!-- U+011D: "ĝ" LATIN SMALL LETTER G WITH CIRCUMFLEX --> + <string name="keylabel_for_w">ĝ</string> + <!-- U+016D: "ŭ" LATIN SMALL LETTER U WITH BREVE --> + <string name="keylabel_for_y">ŭ</string> + <!-- U+0109: "ĉ" LATIN SMALL LETTER C WITH CIRCUMFLEX --> + <string name="keylabel_for_x">ĉ</string> + <!-- U+0135: "ĵ" LATIN SMALL LETTER J WITH CIRCUMFLEX --> + <string name="keylabel_for_spanish_row2_10">ĵ</string> +</resources> diff --git a/tools/maketext/res/values/donottranslate-more-keys.xml b/tools/maketext/res/values/donottranslate-more-keys.xml index 543e93620..4d7100b8c 100644 --- a/tools/maketext/res/values/donottranslate-more-keys.xml +++ b/tools/maketext/res/values/donottranslate-more-keys.xml @@ -177,6 +177,14 @@ <string name="keylabel_for_apostrophe">\'</string> <string name="keyhintlabel_for_apostrophe">\"</string> <string name="more_keys_for_apostrophe">\"</string> + <string name="more_keys_for_q"></string> + <string name="more_keys_for_x"></string> + <string name="keylabel_for_q">q</string> + <string name="keylabel_for_w">w</string> + <string name="keylabel_for_y">y</string> + <string name="keylabel_for_x">x</string> + <!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE --> + <string name="keylabel_for_spanish_row2_10">ñ</string> <string name="more_keys_for_am_pm">!fixedColumnOrder!2,!hasLabels!,\@string/label_time_am,\@string/label_time_pm</string> <string name="settings_as_more_key">!icon/settings_key|!code/key_settings</string> <string name="shortcut_as_more_key">!icon/shortcut_key|!code/key_shortcut</string> |