diff options
Diffstat (limited to 'java')
28 files changed, 367 insertions, 199 deletions
diff --git a/java/res/values-be/donottranslate-more-keys.xml b/java/res/values-be/donottranslate-more-keys.xml index 0917f11ec..1550ddb17 100644 --- a/java/res/values-be/donottranslate-more-keys.xml +++ b/java/res/values-be/donottranslate-more-keys.xml @@ -19,7 +19,7 @@ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- U+045E: "ў" CYRILLIC SMALL LETTER SHORT U --> - <string name="keylabel_for_slavic_shcha">ў</string> + <string name="keylabel_for_cyrillic_shcha">ў</string> <!-- U+0456: "і" CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I --> - <string name="keylabel_for_slavic_i">і</string> + <string name="keylabel_for_cyrillic_i">і</string> </resources> diff --git a/java/res/values-ky/donottranslate-more-keys.xml b/java/res/values-ky/donottranslate-more-keys.xml index 824620987..b67a9f15d 100644 --- a/java/res/values-ky/donottranslate-more-keys.xml +++ b/java/res/values-ky/donottranslate-more-keys.xml @@ -19,9 +19,9 @@ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- U+04AF: "ү" CYRILLIC SMALL LETTER STRAIGHT U --> - <string name="more_keys_for_slavic_u">ү</string> + <string name="more_keys_for_cyrillic_u">ү</string> <!-- U+04A3: "ң" CYRILLIC SMALL LETTER EN WITH DESCENDER --> - <string name="more_keys_for_slavic_en">ң</string> + <string name="more_keys_for_cyrillic_en">ң</string> <!-- U+04E9: "ө" CYRILLIC SMALL LETTER BARRED O --> - <string name="more_keys_for_slavic_o">ө</string> + <string name="more_keys_for_cyrillic_o">ө</string> </resources> diff --git a/java/res/values-mk/donottranslate-more-keys.xml b/java/res/values-mk/donottranslate-more-keys.xml new file mode 100644 index 000000000..e96a306b6 --- /dev/null +++ b/java/res/values-mk/donottranslate-more-keys.xml @@ -0,0 +1,48 @@ +<?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"> + <!-- NOTE: Macedonian layouts are based on Serbian ones with the following key replacements. --> + <!-- U+0455: "ѕ" CYRILLIC SMALL LETTER DZE --> + <string name="keylabel_for_cyrillic_ze">ѕ</string> + <!-- U+045C: "ќ" CYRILLIC SMALL LETTER KJE --> + <string name="keylabel_for_cyrillic_tshe">ќ</string> + <!-- U+0437: "з" CYRILLIC SMALL LETTER ZE --> + <string name="keylabel_for_cyrillic_dze">з</string> + <!-- U+0453: "ѓ" CYRILLIC SMALL LETTER GJE --> + <string name="keylabel_for_cyrillic_dje">ѓ</string> + <!-- U+0450: "ѐ" CYRILLIC SMALL LETTER IE WITH GRAVE --> + <string name="more_keys_for_cyrillic_ie">ѐ</string> + <!-- U+045D: "ѝ" CYRILLIC SMALL LETTER I WITH GRAVE --> + <string name="more_keys_for_cyrillic_i">ѝ</string> + <!-- U+2018: "‘" LEFT SINGLE QUOTATION MARK + U+2019: "’" RIGHT SINGLE QUOTATION MARK + U+201A: "‚" SINGLE LOW-9 QUOTATION MARK + U+201B: "‛" SINGLE HIGH-REVERSED-9 QUOTATION MARK + U+201C: "“" LEFT DOUBLE QUOTATION MARK + U+201D: "”" RIGHT DOUBLE QUOTATION MARK + U+201E: "„" DOUBLE LOW-9 QUOTATION MARK + U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK --> + <!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK. --> + <!-- <string name="more_keys_for_double_quote">!fixedColumnOrder!6,„,“,”,‟,«,»</string> --> + <string name="more_keys_for_double_quote">!fixedColumnOrder!5,„,“,”,«,»</string> + <!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK. --> + <!-- <string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!6,“,”,„,‟,«,»,‘,’,‚,‛</string> --> + <string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!5,„,“,”,«,»,‘,’,‚,‛</string> +</resources> diff --git a/java/res/values-ru/donottranslate-more-keys.xml b/java/res/values-ru/donottranslate-more-keys.xml index 45c4551a1..a1a22e5aa 100644 --- a/java/res/values-ru/donottranslate-more-keys.xml +++ b/java/res/values-ru/donottranslate-more-keys.xml @@ -19,5 +19,5 @@ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- U+0451: "ё" CYRILLIC SMALL LETTER IO --> - <string name="more_keys_for_slavic_ye">ё</string> + <string name="more_keys_for_cyrillic_ye">ё</string> </resources> diff --git a/java/res/values-uk/donottranslate-more-keys.xml b/java/res/values-uk/donottranslate-more-keys.xml index 3208a6649..323eaafbb 100644 --- a/java/res/values-uk/donottranslate-more-keys.xml +++ b/java/res/values-uk/donottranslate-more-keys.xml @@ -19,7 +19,7 @@ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- U+0456: "і" CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I --> - <string name="keylabel_for_slavic_yery">і</string> + <string name="keylabel_for_cyrillic_yery">і</string> <!-- U+0457: "ї" CYRILLIC SMALL LETTER YI --> - <string name="more_keys_for_slavic_yery">ї</string> + <string name="more_keys_for_cyrillic_yery">ї</string> </resources> diff --git a/java/res/values/donottranslate-more-keys.xml b/java/res/values/donottranslate-more-keys.xml index 40d81177f..6577acdb9 100644 --- a/java/res/values/donottranslate-more-keys.xml +++ b/java/res/values/donottranslate-more-keys.xml @@ -41,20 +41,30 @@ <string name="more_keys_for_scandinavia_row2_10"></string> <string name="more_keys_for_scandinavia_row2_11"></string> <!-- U+0449: "щ" CYRILLIC SMALL LETTER SHCHA --> - <string name="keylabel_for_slavic_shcha">щ</string> + <string name="keylabel_for_cyrillic_shcha">щ</string> <!-- U+044B: "ы" CYRILLIC SMALL LETTER YERU --> - <string name="keylabel_for_slavic_yery">ы</string> + <string name="keylabel_for_cyrillic_yery">ы</string> <!-- U+0438: "и" CYRILLIC SMALL LETTER I --> - <string name="keylabel_for_slavic_i">и</string> - <string name="more_keys_for_slavic_u"></string> - <string name="more_keys_for_slavic_ye"></string> - <string name="more_keys_for_slavic_en"></string> + <string name="keylabel_for_cyrillic_i">и</string> + <!-- U+0437: "з" CYRILLIC SMALL LETTER ZE --> + <string name="keylabel_for_cyrillic_ze">з</string> + <!-- U+045B: "ћ" CYRILLIC SMALL LETTER TSHE --> + <string name="keylabel_for_cyrillic_tshe">ћ</string> + <!-- U+0455: "ѕ" CYRILLIC SMALL LETTER DZE --> + <string name="keylabel_for_cyrillic_dze">ѕ</string> + <!-- U+0452: "ђ" CYRILLIC SMALL LETTER DJE --> + <string name="keylabel_for_cyrillic_dje">ђ</string> + <string name="more_keys_for_cyrillic_u"></string> + <string name="more_keys_for_cyrillic_ye"></string> + <string name="more_keys_for_cyrillic_en"></string> <!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN --> - <string name="more_keys_for_slavic_ha">ъ</string> - <string name="more_keys_for_slavic_yery"></string> - <string name="more_keys_for_slavic_o"></string> + <string name="more_keys_for_cyrillic_ha">ъ</string> + <string name="more_keys_for_cyrillic_yery"></string> + <string name="more_keys_for_cyrillic_o"></string> <!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN --> - <string name="more_keys_for_slavic_soft_sign">ъ</string> + <string name="more_keys_for_cyrillic_soft_sign">ъ</string> + <string name="more_keys_for_cyrillic_ie"></string> + <string name="more_keys_for_cyrillic_i"></string> <!-- U+00A2: "¢" CENT SIGN U+00A3: "£" POUND SIGN U+20AC: "€" EURO SIGN @@ -115,6 +125,7 @@ <!-- U+207F: "ⁿ" SUPERSCRIPT LATIN SMALL LETTER N U+2205: "∅" EMPTY SET --> <string name="more_keys_for_symbols_0">ⁿ,∅</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/settingsKey|\@integer/key_settings</string> <string name="keylabel_for_comma">,</string> <string name="more_keys_for_comma"></string> diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index 94da9462f..d6a15deb0 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -58,6 +58,10 @@ <!-- U+FF0A: "*" FULLWIDTH ASTERISK U+FF03: "#" FULLWIDTH NUMBER SIGN --> <string name="label_to_phone_symbols_key">*#</string> + <!-- Key label for "ante meridiem" --> + <string name="label_time_am">"AM"</string> + <!-- Key label for "post meridiem" --> + <string name="label_time_pm">"PM"</string> <!-- Always show the suggestion strip --> <string name="prefs_suggestion_visibility_show_value">0</string> diff --git a/java/res/xml-mk/keyboard_set.xml b/java/res/xml-mk/keyboard_set.xml new file mode 100644 index 000000000..31199cb0a --- /dev/null +++ b/java/res/xml-mk/keyboard_set.xml @@ -0,0 +1,42 @@ +<?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. +*/ +--> + +<KeyboardSet + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + latin:keyboardLocale="mk"> + <Element + latin:elementName="alphabet" + latin:elementKeyboard="@xml/kbd_serbian" /> + <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" /> +</KeyboardSet> diff --git a/java/res/xml-sw600dp/rows_number_normal.xml b/java/res/xml-sw600dp/rows_number_normal.xml index 1c38a6265..3704c5284 100644 --- a/java/res/xml-sw600dp/rows_number_normal.xml +++ b/java/res/xml-sw600dp/rows_number_normal.xml @@ -63,10 +63,24 @@ latin:keyLabel="/" latin:keyStyle="numKeyStyle" latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="," - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> + <switch> + <case + latin:mode="time|datetime" + > + <Key + latin:keyLabel="," + latin:keyLabelFlags="hasPopupHint" + latin:moreKeys="@string/more_keys_for_am_pm" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + </case> + <default> + <Key + latin:keyLabel="," + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + </default> + </switch> <Key latin:keyLabel="4" latin:keyStyle="numKeyStyle" @@ -94,10 +108,22 @@ latin:keyLabel=")" latin:keyStyle="numKeyStyle" latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="=" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> + <switch> + <case + latin:mode="time|datetime" + > + <Key + latin:keyLabel=":" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + </case> + <default> + <Key + latin:keyLabel="=" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + </default> + </switch> <Key latin:keyLabel="7" latin:keyStyle="numKeyStyle" diff --git a/java/res/xml-sw600dp/rows_serbian.xml b/java/res/xml-sw600dp/rows_serbian.xml index 5730aa050..989fa488c 100644 --- a/java/res/xml-sw600dp/rows_serbian.xml +++ b/java/res/xml-sw600dp/rows_serbian.xml @@ -35,22 +35,23 @@ latin:keyLabel="њ" /> <!-- U+0435: "е" CYRILLIC SMALL LETTER IE --> <Key - latin:keyLabel="е" /> + latin:keyLabel="е" + latin:moreKeys="@string/more_keys_for_cyrillic_ie" /> <!-- U+0440: "р" CYRILLIC SMALL LETTER ER --> <Key latin:keyLabel="р" /> <!-- U+0442: "т" CYRILLIC SMALL LETTER TE --> <Key latin:keyLabel="т" /> - <!-- U+0437: "з" CYRILLIC SMALL LETTER ZE --> <Key - latin:keyLabel="з" /> + latin:keyLabel="@string/keylabel_for_cyrillic_ze" /> <!-- U+0443: "у" CYRILLIC SMALL LETTER U --> <Key latin:keyLabel="у" /> <!-- U+0438: "и" CYRILLIC SMALL LETTER I --> <Key - latin:keyLabel="и" /> + latin:keyLabel="и" + latin:moreKeys="@string/more_keys_for_cyrillic_i" /> <!-- U+043E: "о" CYRILLIC SMALL LETTER O --> <Key latin:keyLabel="о" /> @@ -98,9 +99,8 @@ <!-- U+0447: "ч" CYRILLIC SMALL LETTER CHE --> <Key latin:keyLabel="ч" /> - <!-- U+045B: "ћ" CYRILLIC SMALL LETTER TSHE --> <Key - latin:keyLabel="ћ" /> + latin:keyLabel="@string/keylabel_for_cyrillic_tshe" /> <Key latin:keyStyle="enterKeyStyle" latin:keyXPos="-14.6%p" @@ -112,9 +112,8 @@ <Key latin:keyStyle="shiftKeyStyle" latin:keyWidth="8.0%p" /> - <!-- U+0455: "ѕ" CYRILLIC SMALL LETTER DZE --> <Key - latin:keyLabel="ѕ" /> + latin:keyLabel="@string/keylabel_for_cyrillic_dze" /> <!-- U+045F: "џ" CYRILLIC SMALL LETTER DZHE --> <Key latin:keyLabel="џ" /> @@ -133,9 +132,8 @@ <!-- U+043C: "м" CYRILLIC SMALL LETTER EM --> <Key latin:keyLabel="м" /> - <!-- U+0452: "ђ" CYRILLIC SMALL LETTER DJE --> <Key - latin:keyLabel="ђ" /> + latin:keyLabel="@string/keylabel_for_cyrillic_dje" /> <!-- U+0436: "ж" CYRILLIC SMALL LETTER ZHE --> <Key latin:keyLabel="ж" /> diff --git a/java/res/xml-sw600dp/rows_slavic.xml b/java/res/xml-sw600dp/rows_slavic.xml index 58f0b3900..7ff63bc0e 100644 --- a/java/res/xml-sw600dp/rows_slavic.xml +++ b/java/res/xml-sw600dp/rows_slavic.xml @@ -35,18 +35,18 @@ <!-- U+0443: "у" CYRILLIC SMALL LETTER U --> <Key latin:keyLabel="у" - latin:moreKeys="@string/more_keys_for_slavic_u" /> + latin:moreKeys="@string/more_keys_for_cyrillic_u" /> <!-- U+043A: "к" CYRILLIC SMALL LETTER KA --> <Key latin:keyLabel="к" /> <!-- U+0435: "е" CYRILLIC SMALL LETTER IE --> <Key latin:keyLabel="е" - latin:moreKeys="@string/more_keys_for_slavic_ye" /> + latin:moreKeys="@string/more_keys_for_cyrillic_ye" /> <!-- U+043D: "н" CYRILLIC SMALL LETTER EN --> <Key latin:keyLabel="н" - latin:moreKeys="@string/more_keys_for_slavic_en" /> + latin:moreKeys="@string/more_keys_for_cyrillic_en" /> <!-- U+0433: "г" CYRILLIC SMALL LETTER GHE --> <Key latin:keyLabel="г" /> @@ -54,7 +54,7 @@ <Key latin:keyLabel="ш" /> <Key - latin:keyLabel="@string/keylabel_for_slavic_shcha" /> + latin:keyLabel="@string/keylabel_for_cyrillic_shcha" /> <!-- U+0437: "з" CYRILLIC SMALL LETTER ZE --> <Key latin:keyLabel="з" /> @@ -77,8 +77,8 @@ latin:keyLabel="ф" latin:keyXPos="2.25%p" /> <Key - latin:keyLabel="@string/keylabel_for_slavic_yery" - latin:moreKeys="@string/more_keys_for_slavic_yery" /> + latin:keyLabel="@string/keylabel_for_cyrillic_yery" + latin:moreKeys="@string/more_keys_for_cyrillic_yery" /> <!-- U+0432: "в" CYRILLIC SMALL LETTER VE --> <Key latin:keyLabel="в" /> @@ -94,7 +94,7 @@ <!-- U+043E: "о" CYRILLIC SMALL LETTER O --> <Key latin:keyLabel="о" - latin:moreKeys="@string/more_keys_for_slavic_o" /> + latin:moreKeys="@string/more_keys_for_cyrillic_o" /> <!-- U+043B: "л" CYRILLIC SMALL LETTER EL --> <Key latin:keyLabel="л" /> @@ -130,7 +130,7 @@ <Key latin:keyLabel="м" /> <Key - latin:keyLabel="@string/keylabel_for_slavic_i" /> + latin:keyLabel="@string/keylabel_for_cyrillic_i" /> <!-- U+0442: "т" CYRILLIC SMALL LETTER TE --> <Key latin:keyLabel="т" /> diff --git a/java/res/xml-sw768dp/rows_number_normal.xml b/java/res/xml-sw768dp/rows_number_normal.xml index 60674cd17..8bf1a173f 100644 --- a/java/res/xml-sw768dp/rows_number_normal.xml +++ b/java/res/xml-sw768dp/rows_number_normal.xml @@ -65,10 +65,24 @@ latin:keyLabel="/" latin:keyStyle="numKeyStyle" latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="," - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + <switch> + <case + latin:mode="time|datetime" + > + <Key + latin:keyLabel="," + latin:keyLabelFlags="hasPopupHint" + latin:moreKeys="@string/more_keys_for_am_pm" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + </case> + <default> + <Key + latin:keyLabel="," + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + </default> + </switch> <Key latin:keyLabel="4" latin:keyStyle="numKeyStyle" @@ -96,10 +110,22 @@ latin:keyLabel=")" latin:keyStyle="numKeyStyle" latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="=" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> + <switch> + <case + latin:mode="time|datetime" + > + <Key + latin:keyLabel=":" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + </case> + <default> + <Key + latin:keyLabel="=" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + </default> + </switch> <Key latin:keyLabel="7" latin:keyStyle="numKeyStyle" diff --git a/java/res/xml-sw768dp/rows_serbian.xml b/java/res/xml-sw768dp/rows_serbian.xml index 39907c867..62668e5cc 100644 --- a/java/res/xml-sw768dp/rows_serbian.xml +++ b/java/res/xml-sw768dp/rows_serbian.xml @@ -37,22 +37,23 @@ latin:keyLabel="њ" /> <!-- U+0435: "е" CYRILLIC SMALL LETTER IE --> <Key - latin:keyLabel="е" /> + latin:keyLabel="е" + latin:moreKeys="@string/more_keys_for_cyrillic_ie" /> <!-- U+0440: "р" CYRILLIC SMALL LETTER ER --> <Key latin:keyLabel="р" /> <!-- U+0442: "т" CYRILLIC SMALL LETTER TE --> <Key latin:keyLabel="т" /> - <!-- U+0437: "з" CYRILLIC SMALL LETTER ZE --> <Key - latin:keyLabel="з" /> + latin:keyLabel="@string/keylabel_for_cyrillic_ze" /> <!-- U+0443: "у" CYRILLIC SMALL LETTER U --> <Key latin:keyLabel="у" /> <!-- U+0438: "и" CYRILLIC SMALL LETTER I --> <Key - latin:keyLabel="и" /> + latin:keyLabel="и" + latin:moreKeys="@string/more_keys_for_cyrillic_i" /> <!-- U+043E: "о" CYRILLIC SMALL LETTER O --> <Key latin:keyLabel="о" /> @@ -107,9 +108,8 @@ <!-- U+0447: "ч" CYRILLIC SMALL LETTER CHE --> <Key latin:keyLabel="ч" /> - <!-- U+045B: "ћ" CYRILLIC SMALL LETTER TSHE --> <Key - latin:keyLabel="ћ" /> + latin:keyLabel="@string/keylabel_for_cyrillic_tshe" /> <Key latin:keyStyle="deleteKeyStyle" latin:keyXPos="-9.219%p" @@ -121,9 +121,8 @@ <Key latin:keyStyle="shiftKeyStyle" latin:keyWidth="13.829%p" /> - <!-- U+0455: "ѕ" CYRILLIC SMALL LETTER DZE --> <Key - latin:keyLabel="ѕ" /> + latin:keyLabel="@string/keylabel_for_cyrillic_dze" /> <!-- U+045F: "џ" CYRILLIC SMALL LETTER DZHE --> <Key latin:keyLabel="џ" /> @@ -142,6 +141,8 @@ <!-- U+043C: "м" CYRILLIC SMALL LETTER EM --> <Key latin:keyLabel="м" /> + <Key + latin:keyLabel="@string/keylabel_for_cyrillic_dje" /> <include latin:keyboardLayout="@xml/keys_comma_period" /> <Key diff --git a/java/res/xml-sw768dp/rows_slavic.xml b/java/res/xml-sw768dp/rows_slavic.xml index 26857aebc..3611ef6b3 100644 --- a/java/res/xml-sw768dp/rows_slavic.xml +++ b/java/res/xml-sw768dp/rows_slavic.xml @@ -38,18 +38,18 @@ <!-- U+0443: "у" CYRILLIC SMALL LETTER U --> <Key latin:keyLabel="у" - latin:moreKeys="@string/more_keys_for_slavic_u" /> + latin:moreKeys="@string/more_keys_for_cyrillic_u" /> <!-- U+043A: "к" CYRILLIC SMALL LETTER KA --> <Key latin:keyLabel="к" /> <!-- U+0435: "е" CYRILLIC SMALL LETTER IE --> <Key latin:keyLabel="е" - latin:moreKeys="@string/more_keys_for_slavic_ye" /> + latin:moreKeys="@string/more_keys_for_cyrillic_ye" /> <!-- U+043D: "н" CYRILLIC SMALL LETTER EN --> <Key latin:keyLabel="н" - latin:moreKeys="@string/more_keys_for_slavic_en" /> + latin:moreKeys="@string/more_keys_for_cyrillic_en" /> <!-- U+0433: "г" CYRILLIC SMALL LETTER GHE --> <Key latin:keyLabel="г" /> @@ -57,7 +57,7 @@ <Key latin:keyLabel="ш" /> <Key - latin:keyLabel="@string/keylabel_for_slavic_shcha" /> + latin:keyLabel="@string/keylabel_for_cyrillic_shcha" /> <!-- U+0437: "з" CYRILLIC SMALL LETTER ZE --> <Key latin:keyLabel="з" /> @@ -82,8 +82,8 @@ <Key latin:keyLabel="ф" /> <Key - latin:keyLabel="@string/keylabel_for_slavic_yery" - latin:moreKeys="@string/more_keys_for_slavic_yery" /> + latin:keyLabel="@string/keylabel_for_cyrillic_yery" + latin:moreKeys="@string/more_keys_for_cyrillic_yery" /> <!-- U+0432: "в" CYRILLIC SMALL LETTER VE --> <Key latin:keyLabel="в" /> @@ -99,7 +99,7 @@ <!-- U+043E: "о" CYRILLIC SMALL LETTER O --> <Key latin:keyLabel="о" - latin:moreKeys="@string/more_keys_for_slavic_o" /> + latin:moreKeys="@string/more_keys_for_cyrillic_o" /> <!-- U+043B: "л" CYRILLIC SMALL LETTER EL --> <Key latin:keyLabel="л" /> @@ -136,7 +136,7 @@ <Key latin:keyLabel="м" /> <Key - latin:keyLabel="@string/keylabel_for_slavic_i" /> + latin:keyLabel="@string/keylabel_for_cyrillic_i" /> <!-- U+0442: "т" CYRILLIC SMALL LETTER TE --> <Key latin:keyLabel="т" /> diff --git a/java/res/xml/key_styles_number.xml b/java/res/xml/key_styles_number.xml index 01f7aee59..3627836b9 100644 --- a/java/res/xml/key_styles_number.xml +++ b/java/res/xml/key_styles_number.xml @@ -41,9 +41,12 @@ latin:styleName="numberKeyStyle" latin:keyLabelFlags="alignLeftOfCenter|hasHintLabel" latin:parentStyle="numKeyStyle" /> + <!-- U+0030: "0" DIGIT ZERO + U+002B: "+" PLUS SIGN --> <key-style latin:styleName="num0KeyStyle" - latin:code="48" + latin:code="0x0030" + latin:altCode="0x002B" latin:keyLabel="0 +" latin:keyActionFlags="enableLongPress" latin:parentStyle="numberKeyStyle" /> @@ -91,10 +94,11 @@ latin:keyLabel="9" latin:keyHintLabel="WXYZ" latin:parentStyle="numberKeyStyle" /> - <!-- U+FF0A: "*" FULLWIDTH ASTERISK --> + <!-- U+002A: "*" ASTERISK + U+FF0A: "*" FULLWIDTH ASTERISK --> <key-style latin:styleName="numStarKeyStyle" - latin:code="42" + latin:code="0x002A" latin:keyLabel="*" latin:parentStyle="numKeyStyle" /> <!-- Only for non-tablet device --> @@ -108,15 +112,17 @@ latin:code="@integer/key_switch_alpha_symbol" latin:keyLabel="@string/label_to_phone_numeric_key" latin:parentStyle="numModeKeyStyle" /> + <!-- U+002C: "," COMMA --> <key-style latin:styleName="numPauseKeyStyle" - latin:code="44" + latin:code="0x002C" latin:keyLabel="@string/label_pause_key" latin:keyLabelFlags="followKeyHintLabelRatio|autoXScale" latin:parentStyle="numKeyBaseStyle" /> + <!-- U+003B: ";" SEMICOLON --> <key-style latin:styleName="numWaitKeyStyle" - latin:code="59" + latin:code="0x003B" latin:keyLabel="@string/label_wait_key" latin:keyLabelFlags="followKeyHintLabelRatio|autoXScale" latin:parentStyle="numKeyBaseStyle" /> diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 98dc7667e..e29cc0d6a 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -21,7 +21,8 @@ <!-- for the Input Method Manager. --> <!-- Keyboard: en_US, en_GB, ar, be, bg, cs, da, de, de(QWERTY), es, es_US, et, fi, fr, fr_CA, - fr_CH, hr, hu, it, iw, ka, ky, lt, lv, nb, nl, pl, pt, ro, ru, sk, sl, sr, sv, tr, uk, vi --> + fr_CH, hr, hu, it, iw, ka, ky, lt, lv, mk, nb, nl, pl, pt, ro, ru, sk, sl, sr, sv, tr, uk, + vi --> <!-- TODO: use <lang>_keyboard icon instead of a common keyboard icon. --> <!-- If IME doesn't have an applicable subtype, the first subtype will be used as a default subtype.--> @@ -169,6 +170,12 @@ /> <subtype android:icon="@drawable/ic_subtype_keyboard" android:label="@string/subtype_generic" + android:imeSubtypeLocale="mk" + android:imeSubtypeMode="keyboard" + android:imeSubtypeExtraValue="SupportTouchPositionCorrection" + /> + <subtype android:icon="@drawable/ic_subtype_keyboard" + android:label="@string/subtype_generic" android:imeSubtypeLocale="nb" android:imeSubtypeMode="keyboard" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection" diff --git a/java/res/xml/rows_number_normal.xml b/java/res/xml/rows_number_normal.xml index b581fb5cd..91b1fe989 100644 --- a/java/res/xml/rows_number_normal.xml +++ b/java/res/xml/rows_number_normal.xml @@ -46,10 +46,32 @@ <Key latin:keyLabel="6" latin:keyStyle="numKeyStyle" /> - <Key - latin:keyLabel="," - latin:keyStyle="numFunctionalKeyStyle" - latin:keyWidth="fillRight" /> + <switch> + <case + latin:mode="date" + > + <Key + latin:keyLabel="." + latin:keyStyle="numFunctionalKeyStyle" + latin:keyWidth="fillRight" /> + </case> + <case + latin:mode="time|datetime" + > + <Key + latin:keyLabel="." + latin:keyLabelFlags="hasPopupHint" + latin:moreKeys="@string/more_keys_for_am_pm" + latin:keyStyle="numFunctionalKeyStyle" + latin:keyWidth="fillRight" /> + </case> + <default> + <Key + latin:keyLabel="," + latin:keyStyle="numFunctionalKeyStyle" + latin:keyWidth="fillRight" /> + </default> + </switch> </Row> <Row> <Key @@ -71,9 +93,39 @@ <Key latin:keyLabel="0" latin:keyStyle="numKeyStyle" /> - <Key - latin:keyLabel="." - latin:keyStyle="numKeyStyle" /> + <switch> + <case + latin:mode="date" + > + <Key + latin:keyLabel="/" + latin:keyStyle="numKeyStyle" /> + </case> + <case + latin:mode="time" + > + <Key + latin:keyLabel=":" + latin:keyStyle="numKeyStyle" /> + </case> + <case + latin:mode="datetime" + > + <!-- U+002F: "/" SOLIDUS + U+003A: ":" COLON --> + <Key + latin:code="0x002F" + latin:altCode="0x003A" + latin:keyLabel="/ :" + latin:keyActionFlags="enableLongPress" + latin:keyStyle="numKeyStyle" /> + </case> + <default> + <Key + latin:keyLabel="." + latin:keyStyle="numKeyStyle" /> + </default> + </switch> <Key latin:keyStyle="enterKeyStyle" latin:keyWidth="fillRight" /> diff --git a/java/res/xml/rows_serbian.xml b/java/res/xml/rows_serbian.xml index cf52fe0cc..ed33dc751 100644 --- a/java/res/xml/rows_serbian.xml +++ b/java/res/xml/rows_serbian.xml @@ -40,7 +40,8 @@ <Key latin:keyLabel="е" latin:keyHintLabel="3" - latin:additionalMoreKeys="3" /> + latin:additionalMoreKeys="3" + latin:moreKeys="@string/more_keys_for_cyrillic_ie" /> <!-- U+0440: "р" CYRILLIC SMALL LETTER ER --> <Key latin:keyLabel="р" @@ -51,9 +52,8 @@ latin:keyLabel="т" latin:keyHintLabel="5" latin:additionalMoreKeys="5" /> - <!-- U+0437: "з" CYRILLIC SMALL LETTER ZE --> <Key - latin:keyLabel="з" + latin:keyLabel="@string/keylabel_for_cyrillic_ze" latin:keyHintLabel="6" latin:additionalMoreKeys="6" /> <!-- U+0443: "у" CYRILLIC SMALL LETTER U --> @@ -65,7 +65,8 @@ <Key latin:keyLabel="и" latin:keyHintLabel="8" - latin:additionalMoreKeys="8" /> + latin:additionalMoreKeys="8" + latin:moreKeys="@string/more_keys_for_cyrillic_i" /> <!-- U+043E: "о" CYRILLIC SMALL LETTER O --> <Key latin:keyLabel="о" @@ -114,9 +115,8 @@ <!-- U+0447: "ч" CYRILLIC SMALL LETTER CHE --> <Key latin:keyLabel="ч" /> - <!-- U+045B: "ћ" CYRILLIC SMALL LETTER TSHE --> <Key - latin:keyLabel="ћ" + latin:keyLabel="@string/keylabel_for_cyrillic_tshe" latin:keyWidth="fillRight" /> </Row> <Row @@ -125,9 +125,8 @@ <Key latin:keyStyle="shiftKeyStyle" latin:keyWidth="11.75%p" /> - <!-- U+0455: "ѕ" CYRILLIC SMALL LETTER DZE --> <Key - latin:keyLabel="ѕ" /> + latin:keyLabel="@string/keylabel_for_cyrillic_dze" /> <!-- U+045F: "џ" CYRILLIC SMALL LETTER DZHE --> <Key latin:keyLabel="џ" /> @@ -146,9 +145,8 @@ <!-- U+043C: "м" CYRILLIC SMALL LETTER EM --> <Key latin:keyLabel="м" /> - <!-- U+0452: "ђ" CYRILLIC SMALL LETTER DJE --> <Key - latin:keyLabel="ђ" /> + latin:keyLabel="@string/keylabel_for_cyrillic_dje" /> <!-- U+0436: "ж" CYRILLIC SMALL LETTER ZHE --> <Key latin:keyLabel="ж" /> diff --git a/java/res/xml/rows_slavic.xml b/java/res/xml/rows_slavic.xml index 4099edd3f..d75f2091a 100644 --- a/java/res/xml/rows_slavic.xml +++ b/java/res/xml/rows_slavic.xml @@ -41,7 +41,7 @@ latin:keyLabel="у" latin:keyHintLabel="3" latin:additionalMoreKeys="3" - latin:moreKeys="@string/more_keys_for_slavic_u" /> + latin:moreKeys="@string/more_keys_for_cyrillic_u" /> <!-- U+043A: "к" CYRILLIC SMALL LETTER KA --> <Key latin:keyLabel="к" @@ -52,13 +52,13 @@ latin:keyLabel="е" latin:keyHintLabel="5" latin:additionalMoreKeys="5" - latin:moreKeys="@string/more_keys_for_slavic_ye" /> + latin:moreKeys="@string/more_keys_for_cyrillic_ye" /> <!-- U+043D: "н" CYRILLIC SMALL LETTER EN --> <Key latin:keyLabel="н" latin:keyHintLabel="6" latin:additionalMoreKeys="6" - latin:moreKeys="@string/more_keys_for_slavic_en" /> + latin:moreKeys="@string/more_keys_for_cyrillic_en" /> <!-- U+0433: "г" CYRILLIC SMALL LETTER GHE --> <Key latin:keyLabel="г" @@ -70,7 +70,7 @@ latin:keyHintLabel="8" latin:additionalMoreKeys="8" /> <Key - latin:keyLabel="@string/keylabel_for_slavic_shcha" + latin:keyLabel="@string/keylabel_for_cyrillic_shcha" latin:keyHintLabel="9" latin:additionalMoreKeys="9" /> <!-- U+0437: "з" CYRILLIC SMALL LETTER ZE --> @@ -81,7 +81,7 @@ <!-- U+0445: "х" CYRILLIC SMALL LETTER HA --> <Key latin:keyLabel="х" - latin:moreKeys="@string/more_keys_for_slavic_ha" + latin:moreKeys="@string/more_keys_for_cyrillic_ha" latin:keyWidth="fillRight" /> </Row> <Row @@ -91,8 +91,8 @@ <Key latin:keyLabel="ф" /> <Key - latin:keyLabel="@string/keylabel_for_slavic_yery" - latin:moreKeys="@string/more_keys_for_slavic_yery" /> + latin:keyLabel="@string/keylabel_for_cyrillic_yery" + latin:moreKeys="@string/more_keys_for_cyrillic_yery" /> <!-- U+0432: "в" CYRILLIC SMALL LETTER VE --> <Key latin:keyLabel="в" /> @@ -108,7 +108,7 @@ <!-- U+043E: "о" CYRILLIC SMALL LETTER O --> <Key latin:keyLabel="о" - latin:moreKeys="@string/more_keys_for_slavic_o" /> + latin:moreKeys="@string/more_keys_for_cyrillic_o" /> <!-- U+043B: "л" CYRILLIC SMALL LETTER EL --> <Key latin:keyLabel="л" /> @@ -142,14 +142,14 @@ <Key latin:keyLabel="м" /> <Key - latin:keyLabel="@string/keylabel_for_slavic_i" /> + latin:keyLabel="@string/keylabel_for_cyrillic_i" /> <!-- U+0442: "т" CYRILLIC SMALL LETTER TE --> <Key latin:keyLabel="т" /> <!-- U+044C: "ь" CYRILLIC SMALL LETTER SOFT SIGN --> <Key latin:keyLabel="ь" - latin:moreKeys="@string/more_keys_for_slavic_soft_sign" /> + latin:moreKeys="@string/more_keys_for_cyrillic_soft_sign" /> <!-- U+0431: "б" CYRILLIC SMALL LETTER BE --> <Key latin:keyLabel="б" /> diff --git a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java b/java/src/com/android/inputmethod/deprecated/VoiceProxy.java index 5c4e9af68..700709d50 100644 --- a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java +++ b/java/src/com/android/inputmethod/deprecated/VoiceProxy.java @@ -435,44 +435,6 @@ public class VoiceProxy implements VoiceInput.UiListener { } } - /** - * Tries to apply any voice alternatives for the word if this was a spoken word and - * there are voice alternatives. - * @param touching The word that the cursor is touching, with position information - * @return true if an alternative was found, false otherwise. - */ - public boolean applyVoiceAlternatives(EditingUtils.SelectedWord touching) { - if (!VOICE_INSTALLED) { - return false; - } - // Search for result in spoken word alternatives - String selectedWord = touching.mWord.toString().trim(); - if (!mWordToSuggestions.containsKey(selectedWord)) { - selectedWord = selectedWord.toLowerCase(); - } - if (mWordToSuggestions.containsKey(selectedWord)) { - mShowingVoiceSuggestions = true; - List<CharSequence> suggestions = mWordToSuggestions.get(selectedWord); - SuggestedWords.Builder builder = new SuggestedWords.Builder(); - // If the first letter of touching is capitalized, make all the suggestions - // start with a capital letter. - if (Character.isUpperCase(touching.mWord.charAt(0))) { - for (CharSequence word : suggestions) { - String str = word.toString(); - word = Character.toUpperCase(str.charAt(0)) + str.substring(1); - builder.addWord(word); - } - } else { - builder.addWords(suggestions, null); - } - builder.setTypedWordValid(true).setHasMinimalSuggestion(true); - mService.setSuggestions(builder.build()); -// mService.setCandidatesViewShown(true); - return true; - } - return false; - } - public void handleBackspace() { if (!VOICE_INSTALLED) { return; diff --git a/java/src/com/android/inputmethod/keyboard/KeyDetector.java b/java/src/com/android/inputmethod/keyboard/KeyDetector.java index 0ce98d2f1..10cf1d1f4 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyDetector.java +++ b/java/src/com/android/inputmethod/keyboard/KeyDetector.java @@ -267,7 +267,7 @@ public class KeyDetector { addDelimiter = false; } else { if (addDelimiter) sb.append(", "); - sb.append(code); + sb.append(Keyboard.printableCode(code)); addDelimiter = true; } } diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 30ed59e18..c6cdf7986 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -85,8 +85,6 @@ public class Keyboard { public static final int CODE_CLOSING_SQUARE_BRACKET = ']'; public static final int CODE_CLOSING_CURLY_BRACKET = '}'; public static final int CODE_CLOSING_ANGLE_BRACKET = '>'; - public static final int CODE_DIGIT0 = '0'; - public static final int CODE_PLUS = '+'; private static final int MINIMUM_LETTER_CODE = CODE_TAB; /** Special keys code. Must be negative. @@ -185,18 +183,11 @@ public class Keyboard { } // TODO: Remove this method. - public boolean isShiftLocked() { - return mId.isAlphabetShiftLockedKeyboard(); - } - - // TODO: Remove this method. public boolean isShiftedOrShiftLocked() { - return mId.isAlphabetShiftedOrShiftLockedKeyboard(); - } - - // TODO: Remove this method. - public boolean isManualShifted() { - return mId.isAlphabetManualShiftedKeyboard(); + // Alphabet mode have unshifted, manual shifted, automatic shifted, shift locked, and + // shift lock shifted element. So that unshifed element is the only one that is NOT in + // shifted or shift locked state. + return mId.isAlphabetKeyboard() && mId.mElementId != KeyboardId.ELEMENT_ALPHABET; } public static boolean isLetterCode(int code) { diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index ed4a89e0f..f5752962e 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -36,6 +36,9 @@ public class KeyboardId { public static final int MODE_IM = 3; public static final int MODE_PHONE = 4; public static final int MODE_NUMBER = 5; + public static final int MODE_DATE = 6; + public static final int MODE_TIME = 7; + public static final int MODE_DATETIME = 8; public static final int ELEMENT_ALPHABET = 0; public static final int ELEMENT_ALPHABET_MANUAL_SHIFTED = 1; @@ -123,31 +126,6 @@ public class KeyboardId { return mElementId < ELEMENT_SYMBOLS; } - public boolean isAlphabetShiftLockedKeyboard() { - return mElementId == ELEMENT_ALPHABET_SHIFT_LOCKED - || mElementId == ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED; - } - - public boolean isAlphabetShiftedOrShiftLockedKeyboard() { - return isAlphabetKeyboard() && mElementId != ELEMENT_ALPHABET; - } - - public boolean isAlphabetManualShiftedKeyboard() { - return mElementId == ELEMENT_ALPHABET_MANUAL_SHIFTED; - } - - public boolean isSymbolsKeyboard() { - return mElementId == ELEMENT_SYMBOLS || mElementId == ELEMENT_SYMBOLS_SHIFTED; - } - - public boolean isPhoneKeyboard() { - return mElementId == ELEMENT_PHONE || mElementId == ELEMENT_PHONE_SYMBOLS; - } - - public boolean isPhoneShiftKeyboard() { - return mElementId == ELEMENT_PHONE_SYMBOLS; - } - public boolean navigateNext() { return EditorInfoCompatUtils.hasFlagNavigateNext(mEditorInfo.imeOptions); } @@ -242,6 +220,9 @@ public class KeyboardId { case MODE_IM: return "im"; case MODE_PHONE: return "phone"; case MODE_NUMBER: return "number"; + case MODE_DATE: return "date"; + case MODE_TIME: return "time"; + case MODE_DATETIME: return "datetime"; default: return null; } } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java index 6e62f743b..ee882edc0 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java @@ -131,6 +131,9 @@ public class KeyboardSet { } break; case KeyboardId.MODE_NUMBER: + case KeyboardId.MODE_DATE: + case KeyboardId.MODE_TIME: + case KeyboardId.MODE_DATETIME: keyboardSetElementId = KeyboardId.ELEMENT_NUMBER; break; default: diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index d65253ede..78e0ee230 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -849,7 +849,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { final KeyPreviewDrawParams params = mKeyPreviewDrawParams; final int keyDrawX = key.mX + key.mVisualInsetsLeft; final int keyDrawWidth = key.mWidth - key.mVisualInsetsLeft - key.mVisualInsetsRight; - // What we show as preview should match what we show on key top in onBufferDraw(). + // What we show as preview should match what we show on a key top in onBufferDraw(). if (key.mLabel != null) { // TODO Should take care of temporaryShiftLabel here. previewText.setCompoundDrawables(null, null, null, null); diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java index 432959508..89dad7be5 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java @@ -481,11 +481,10 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke */ protected boolean onLongPress(Key parentKey, PointerTracker tracker) { final int primaryCode = parentKey.mCode; - final Keyboard keyboard = getKeyboard(); - if (primaryCode == Keyboard.CODE_DIGIT0 && keyboard.mId.isPhoneKeyboard()) { + if (parentKey.mAltCode != Keyboard.CODE_UNSPECIFIED) { + // Long press on a key that has altCode defined. tracker.onLongPressed(); - // Long pressing on 0 in phone number keypad gives you a '+'. - invokeCodeInput(Keyboard.CODE_PLUS); + invokeCodeInput(parentKey.mAltCode); invokeReleaseKey(primaryCode); KeyboardSwitcher.getInstance().hapticAndAudioFeedback(primaryCode); return true; diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 953d87beb..211b69a44 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -979,7 +979,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar .setTypedWordValid(false) .setHasMinimalSuggestion(false); // When in fullscreen mode, show completions generated by the application - setSuggestions(builder.build()); + final SuggestedWords words = builder.build(); + setSuggestions(words); + setAutoCorrectionIndicator(Utils.willAutoCorrect(words)); // TODO: is this the right thing to do? What should we auto-correct to in // this case? This says to keep whatever the user typed. mWordComposer.setAutoCorrection(mWordComposer.getTypedWord()); @@ -1713,21 +1715,23 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void clearSuggestions() { setSuggestions(SuggestedWords.EMPTY); + setAutoCorrectionIndicator(false); } - public void setSuggestions(SuggestedWords words) { + public void setSuggestions(final SuggestedWords words) { if (mSuggestionsView != null) { mSuggestionsView.setSuggestions(words); mKeyboardSwitcher.onAutoCorrectionStateChanged( words.hasWordAboveAutoCorrectionScoreThreshold()); } + } + private void setAutoCorrectionIndicator(final boolean newAutoCorrectionIndicator) { // Put a blue underline to a word in TextView which will be auto-corrected. final InputConnection ic = getCurrentInputConnection(); if (ic != null) { final boolean oldAutoCorrectionIndicator = mComposingStateManager.isAutoCorrectionIndicatorOn(); - final boolean newAutoCorrectionIndicator = Utils.willAutoCorrect(words); if (oldAutoCorrectionIndicator != newAutoCorrectionIndicator) { mComposingStateManager.setAutoCorrectionIndicatorOn(newAutoCorrectionIndicator); if (DEBUG) { @@ -1738,9 +1742,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar throw new RuntimeException("Couldn't flip the indicator!"); } } - final CharSequence textWithUnderline = - getTextWithUnderline(mWordComposer.getTypedWord()); - if (!TextUtils.isEmpty(textWithUnderline)) { + if (mWordComposer.isComposingWord()) { + final CharSequence textWithUnderline = + getTextWithUnderline(mWordComposer.getTypedWord()); ic.setComposingText(textWithUnderline, 1); } } @@ -1830,25 +1834,25 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar showSuggestions(builder.build(), typedWord); } - public void showSuggestions(SuggestedWords suggestedWords, CharSequence typedWord) { + public void showSuggestions(final SuggestedWords suggestedWords, final CharSequence typedWord) { final boolean shouldBlockAutoCorrectionBySafetyNet = Utils.shouldBlockAutoCorrectionBySafetyNet(suggestedWords, mSuggest); if (shouldBlockAutoCorrectionBySafetyNet) { suggestedWords.setShouldBlockAutoCorrection(); } - setSuggestions(suggestedWords); + final CharSequence autoCorrection; if (suggestedWords.size() > 0) { - if (shouldBlockAutoCorrectionBySafetyNet) { - mWordComposer.setAutoCorrection(typedWord); - } else if (suggestedWords.hasAutoCorrectionWord()) { - mWordComposer.setAutoCorrection(suggestedWords.getWord(1)); + if (!shouldBlockAutoCorrectionBySafetyNet && suggestedWords.hasAutoCorrectionWord()) { + autoCorrection = suggestedWords.getWord(1); } else { - mWordComposer.setAutoCorrection(typedWord); + autoCorrection = typedWord; } } else { - // TODO: replace with mWordComposer.deleteAutoCorrection()? - mWordComposer.setAutoCorrection(null); + autoCorrection = null; } + mWordComposer.setAutoCorrection(autoCorrection); + setSuggestions(suggestedWords); + setAutoCorrectionIndicator(Utils.willAutoCorrect(suggestedWords)); setSuggestionStripShown(isSuggestionsStripVisible()); } @@ -2022,6 +2026,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void setPunctuationSuggestions() { setSuggestions(mSettingsValues.mSuggestPuncList); + setAutoCorrectionIndicator(false); setSuggestionStripShown(isSuggestionsStripVisible()); } diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index 6d63e95f6..47ea9ee8a 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -563,8 +563,16 @@ public class Utils { switch (inputType & InputType.TYPE_MASK_CLASS) { case InputType.TYPE_CLASS_NUMBER: - case InputType.TYPE_CLASS_DATETIME: return KeyboardId.MODE_NUMBER; + case InputType.TYPE_CLASS_DATETIME: + switch (variation) { + case InputType.TYPE_DATETIME_VARIATION_DATE: + return KeyboardId.MODE_DATE; + case InputType.TYPE_DATETIME_VARIATION_TIME: + return KeyboardId.MODE_TIME; + default: // InputType.TYPE_DATETIME_VARIATION_NORMAL + return KeyboardId.MODE_DATETIME; + } case InputType.TYPE_CLASS_PHONE: return KeyboardId.MODE_PHONE; case InputType.TYPE_CLASS_TEXT: |