diff options
Diffstat (limited to 'java')
21 files changed, 420 insertions, 98 deletions
diff --git a/java/res/values-fa/donottranslate-more-keys.xml b/java/res/values-fa/donottranslate-more-keys.xml new file mode 100644 index 000000000..3e13c795a --- /dev/null +++ b/java/res/values-fa/donottranslate-more-keys.xml @@ -0,0 +1,160 @@ +<?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+061F: "؟" ARABIC QUESTION MARK + U+060C: "،" ARABIC COMMA + U+061B: "؛" ARABIC SEMICOLON --> + <!-- U+0650: "ِ" ARABIC KASRA + U+064E: "َ" ARABIC FATHA + U+064D: "ٍ" ARABIC KASRATAN + U+064B: "ً" ARABIC FATHATAN + U+0656: "ٖ" ARABIC SUBSCRIPT ALEF + U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF + U+0655: "ٕ" ARABIC HAMZA BELOW + U+0654: "ٔ" ARABIC HAMZA ABOVE --> + <!-- U+064F: "ُ" ARABIC DAMMA + U+064C: "ٌ" ARABIC DAMMATAN + U+0651: "ّ" ARABIC SHADDA + U+0652: "ْ" ARABIC SUKUN + U+0653: "ٓ" ARABIC MADDAH ABOVE + U+0640: "ـ" ARABIC TATWEEL --> + <!-- In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label. --> + <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',-,:,!,؟,،,؛,ِ,َ,ٍ,ً,ٖ,ٰ,ٕ,ٔ,ُ,ٌ,ّ,ْ,ٓ,ـــ|ـ,/"</string> + <string name="keyhintlabel_for_punctuation">ً</string> + <!-- U+0661: "١" ARABIC-INDIC DIGIT ONE --> + <string name="keylabel_for_symbols_1">١</string> + <!-- U+0662: "٢" ARABIC-INDIC DIGIT TWO --> + <string name="keylabel_for_symbols_2">٢</string> + <!-- U+0663: "٣" ARABIC-INDIC DIGIT THREE --> + <string name="keylabel_for_symbols_3">٣</string> + <!-- U+0664: "٤" ARABIC-INDIC DIGIT FOUR --> + <string name="keylabel_for_symbols_4">٤</string> + <!-- U+0665: "٥" ARABIC-INDIC DIGIT FIVE --> + <string name="keylabel_for_symbols_5">٥</string> + <!-- U+0666: "٦" ARABIC-INDIC DIGIT SIX --> + <string name="keylabel_for_symbols_6">٦</string> + <!-- U+0667: "٧" ARABIC-INDIC DIGIT SEVEN --> + <string name="keylabel_for_symbols_7">٧</string> + <!-- U+0668: "٨" ARABIC-INDIC DIGIT EIGHT --> + <string name="keylabel_for_symbols_8">٨</string> + <!-- U+0669: "٩" ARABIC-INDIC DIGIT NINE --> + <string name="keylabel_for_symbols_9">٩</string> + <!-- U+0660: "٠" ARABIC-INDIC DIGIT ZERO --> + <string name="keylabel_for_symbols_0">٠</string> + <string name="additional_more_keys_for_symbols_1">1</string> + <string name="additional_more_keys_for_symbols_2">2</string> + <string name="additional_more_keys_for_symbols_3">3</string> + <string name="additional_more_keys_for_symbols_4">4</string> + <string name="additional_more_keys_for_symbols_5">5</string> + <string name="additional_more_keys_for_symbols_6">6</string> + <string name="additional_more_keys_for_symbols_7">7</string> + <string name="additional_more_keys_for_symbols_8">8</string> + <string name="additional_more_keys_for_symbols_9">9</string> + <!-- U+066B: "٫" ARABIC DECIMAL SEPARATOR + U+066C: "٬" ARABIC THOUSANDS SEPARATOR --> + <string name="additional_more_keys_for_symbols_0">0,٫,٬</string> + <!-- U+060C: "،" ARABIC COMMA --> + <string name="keylabel_for_comma">،</string> + <string name="more_keys_for_comma">"\\,"</string> + <string name="keylabel_for_symbols_question">؟</string> + <string name="keylabel_for_symbols_semicolon">؛</string> + <!-- U+066A: "٪" ARABIC PERCENT SIGN --> + <string name="keylabel_for_symbols_percent">٪</string> + <string name="more_keys_for_symbols_question">\?</string> + <string name="more_keys_for_symbols_semicolon">;</string> + <!-- U+2030: "‰" PER MILLE SIGN --> + <string name="more_keys_for_symbols_percent">%,‰</string> + <!-- U+060C: "،" ARABIC COMMA + U+061B: "؛" ARABIC SEMICOLON + U+061F: "؟" ARABIC QUESTION MARK --> + <string name="keylabel_for_apostrophe">،</string> + <string name="keylabel_for_dash">"."</string> + <string name="keyhintlabel_for_apostrophe">؟</string> + <string name="keyhintlabel_for_dash">ً</string> + <string name="more_keys_for_apostrophe">"؟,؛,!,:,-,/,\',\""</string> + <!-- U+0651: "ّ" ARABIC SHADDA + U+0652: "ْ" ARABIC SUKUN + U+064C: "ٌ" ARABIC DAMMATAN + U+0653: "ٓ" ARABIC MADDAH ABOVE + U+064F: "ُ" ARABIC DAMMA --> + <!-- U+0650: "ِ" ARABIC KASRA + U+064E: "َ" ARABIC FATHA + U+064B: "ً" ARABIC FATHATAN + U+0640: "ـ" ARABIC TATWEEL + U+064D: "ٍ" ARABIC KASRATAN --> + <!-- U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF + U+0656: "ٖ" ARABIC SUBSCRIPT ALEF + U+0654: "ٔ" ARABIC HAMZA ABOVE + U+0655: "ٕ" ARABIC HAMZA BELOW --> + <!-- In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label. --> + <string name="more_keys_for_dash">"ّ,ْ,ٌ,ٓ,ُ,ِ,َ,ً,ـــ|ـ,ٍ,ٔ,ٖ,ٕ,ٰ"</string> + <!-- U+266A: "♪" EIGHTH NOTE --> + <string name="more_keys_for_bullet">♪</string> + <!-- U+2605: "★" BLACK STAR + U+066D: "٭" ARABIC FIVE POINTED STAR --> + <string name="more_keys_for_star">★,٭</string> + <!-- The all letters need to be mirrored are found at + http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt --> + <!-- U+0029: ")" RIGHT PARENTHESIS --> + <integer name="keycode_for_left_parenthesis">0x0029</integer> + <!-- U+0028: "(" LEFT PARENTHESIS --> + <integer name="keycode_for_right_parenthesis">0x0028</integer> + <!-- U+FD3E: "﴾" ORNATE LEFT PARENTHESIS + U+FD3F: "﴿" ORNATE RIGHT PARENTHESIS --> + <!-- TODO: DroidSansArabic lacks the glyph of U+FD3E ORNATE LEFT PARENTHESIS --> + <!-- TODO: DroidSansArabic lacks the glyph of U+FD3F ORNATE RIGHT PARENTHESIS --> + <string name="more_keys_for_left_parenthesis">!fixedColumnOrder!4,﴾|﴿,<|>,{|},[|]</string> + <string name="more_keys_for_right_parenthesis">!fixedColumnOrder!4,﴿|﴾,>|<,}|{,]|[</string> + <!-- U+003E: ">" GREATER-THAN SIGN --> + <integer name="keycode_for_less_than">0x003E</integer> + <!-- U+003C: "<" LESS-THAN SIGN --> + <integer name="keycode_for_greater_than">0x003C</integer> + <!-- U+2264: "≤" LESS-THAN OR EQUAL TO + U+2265: "≥" GREATER-THAN EQUAL TO + U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK + U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + The following characters don't need BIDI mirroring. + 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 --> + <string name="more_keys_for_less_than">!fixedColumnOrder!3,‹|›,≤|≥,«|»</string> + <string name="more_keys_for_greater_than">!fixedColumnOrder!3,›|‹,≥|≤,»|«</string> + <!-- U+005D: "]" RIGHT SQUARE BRACKET --> + <integer name="keycode_for_left_square_bracket">0x005D</integer> + <!-- U+005B: "[" LEFT SQUARE BRACKET --> + <integer name="keycode_for_right_square_bracket">0x005B</integer> + <!-- U+007D: "}" RIGHT CURLY BRACKET --> + <integer name="keycode_for_left_curly_bracket">0x007D</integer> + <!-- U+007B: "{" LEFT CURLY BRACKET --> + <integer name="keycode_for_right_curly_bracket">0x007B</integer> + <!-- TODO: Neither DroidSans nor Roboto have the glyph for U+201F DOUBLE HIGH-REVERSED-9 QUOTATION MARK --> + <!-- <string name="more_keys_for_double_quote">“,”,„,‟,«|»,»|«</string> --> + <string name="more_keys_for_double_quote">!fixedColumnOrder!4,“,”,«|»,»|«</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!4,“,”,«|»,»|«,‘,’,‚,‛</string> +</resources> diff --git a/java/res/values-fa/donottranslate.xml b/java/res/values-fa/donottranslate.xml new file mode 100644 index 000000000..57de2538b --- /dev/null +++ b/java/res/values-fa/donottranslate.xml @@ -0,0 +1,25 @@ +<?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"> + <!-- The all letters need to be mirrored are found at + http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt --> + <!-- Symbols that are suggested between words --> + <string name="suggested_punctuations">!,?,\\,,:,;,\",(|),)|(,\',-,/,@,_</string> +</resources> diff --git a/java/res/values-in/strings.xml b/java/res/values-in/strings.xml index 1f03a05a7..f10d613f2 100644 --- a/java/res/values-in/strings.xml +++ b/java/res/values-in/strings.xml @@ -45,7 +45,7 @@ <skip /> <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"Tundaan singkir munculan kunci"</string> <string name="key_preview_popup_dismiss_no_delay" msgid="2096123151571458064">"Tanpa penundaan"</string> - <string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"Bawaan"</string> + <string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"Default"</string> <string name="use_contacts_dict" msgid="4435317977804180815">"Sarankan nama Kenalan"</string> <string name="use_contacts_dict_summary" msgid="6599983334507879959">"Menggunakan nama dari Kenalan untuk saran dan koreksi"</string> <string name="enable_span_insert" msgid="7204653105667167620">"Aktifkan koreksi ulang"</string> diff --git a/java/res/xml-fa/keyboard_set.xml b/java/res/xml-fa/keyboard_set.xml new file mode 100644 index 000000000..9bd105093 --- /dev/null +++ b/java/res/xml-fa/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="fa" > + <Element + latin:elementName="alphabet" + latin:elementKeyboard="@xml/kbd_arabic" /> + <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/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml index 2fa8b3812..b206f0e54 100644 --- a/java/res/xml-sw600dp/key_styles_common.xml +++ b/java/res/xml-sw600dp/key_styles_common.xml @@ -79,9 +79,12 @@ latin:code="@integer/key_space" latin:keyActionFlags="noKeyPreview" /> <key-style - latin:styleName="nonSpecialBackgroundSpaceKeyStyle" - latin:code="@integer/key_space" - latin:keyActionFlags="noKeyPreview" /> + latin:styleName="zwnjKeyStyle" + latin:keyLabel="‌" + latin:moreKeys="‍" + latin:keyLabelFlags="hasPopupHint" + latin:altCode="@integer/key_space" + latin:keyActionFlags="altCodeWhileTyping" /> <key-style latin:styleName="smileyKeyStyle" latin:keyLabel=":-)" diff --git a/java/res/xml-sw600dp/row_qwerty4.xml b/java/res/xml-sw600dp/row_qwerty4.xml index 3c2f06d02..eec35b078 100644 --- a/java/res/xml-sw600dp/row_qwerty4.xml +++ b/java/res/xml-sw600dp/row_qwerty4.xml @@ -50,10 +50,24 @@ latin:keyStyle="hasShiftedLetterHintStyle" /> </default> </switch> - <Key - latin:keyStyle="spaceKeyStyle" - latin:keyXPos="30.750%p" - latin:keyWidth="39.750%p" /> + <switch> + <case + latin:languageCode="fa" + > + <Key + latin:keyStyle="spaceKeyStyle" + latin:keyXPos="30.750%p" + latin:keyWidth="30.850%p" /> + <Key + latin:keyStyle="zwnjKeyStyle" /> + </case> + <default> + <Key + latin:keyStyle="spaceKeyStyle" + latin:keyXPos="30.750%p" + latin:keyWidth="39.750%p" /> + </default> + </switch> <switch> <case latin:languageCode="iw" diff --git a/java/res/xml-sw600dp/rows_number_normal.xml b/java/res/xml-sw600dp/rows_number_normal.xml index 3704c5284..be5776b20 100644 --- a/java/res/xml-sw600dp/rows_number_normal.xml +++ b/java/res/xml-sw600dp/rows_number_normal.xml @@ -143,7 +143,7 @@ latin:keyStyle="numTabKeyStyle" latin:keyWidth="11.00%p" /> <Key - latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" + latin:keyStyle="spaceKeyStyle" latin:keyWidth="27.75%p" latin:keyXPos="12.75%p" /> <Key diff --git a/java/res/xml-sw600dp/rows_phone.xml b/java/res/xml-sw600dp/rows_phone.xml index 4c896e962..e8926936f 100644 --- a/java/res/xml-sw600dp/rows_phone.xml +++ b/java/res/xml-sw600dp/rows_phone.xml @@ -112,7 +112,7 @@ latin:keyStyle="numTabKeyStyle" latin:keyWidth="11.00%p" /> <Key - latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" + latin:keyStyle="spaceKeyStyle" latin:keyWidth="27.75%p" latin:keyXPos="12.75%p" /> <Key diff --git a/java/res/xml-sw768dp/key_styles_common.xml b/java/res/xml-sw768dp/key_styles_common.xml index 5c35f1cfb..069fc63b9 100644 --- a/java/res/xml-sw768dp/key_styles_common.xml +++ b/java/res/xml-sw768dp/key_styles_common.xml @@ -78,9 +78,12 @@ latin:code="@integer/key_space" latin:keyActionFlags="noKeyPreview" /> <key-style - latin:styleName="nonSpecialBackgroundSpaceKeyStyle" - latin:code="@integer/key_space" - latin:keyActionFlags="noKeyPreview" /> + latin:styleName="zwnjKeyStyle" + latin:keyLabel="‌" + latin:moreKeys="‍" + latin:keyLabelFlags="hasPopupHint" + latin:altCode="@integer/key_space" + latin:keyActionFlags="altCodeWhileTyping" /> <key-style latin:styleName="smileyKeyStyle" latin:keyLabel=":-)" diff --git a/java/res/xml-sw768dp/row_qwerty4.xml b/java/res/xml-sw768dp/row_qwerty4.xml index 24c081eb7..0aa04f8f7 100644 --- a/java/res/xml-sw768dp/row_qwerty4.xml +++ b/java/res/xml-sw768dp/row_qwerty4.xml @@ -76,10 +76,30 @@ </switch> </default> </switch> - <Key - latin:keyStyle="spaceKeyStyle" - latin:keyXPos="31.250%p" - latin:keyWidth="37.500%p" /> + <switch> + <case + latin:languageCode="fa" + > + <Key + latin:keyStyle="spaceKeyStyle" + latin:keyXPos="31.250%p" + latin:keyWidth="29.453%p" /> + <!-- U+200C: "" ZERO WIDTH NON-JOINER + U+200D: "" ZERO WIDTH JOINER --> + <Key + latin:keyLabel="‌" + latin:moreKeys="‍" + latin:keyLabelFlags="hasPopupHint" + latin:altCode="@integer/key_space" + latin:keyActionFlags="altCodeWhileTyping" /> + </case> + <default> + <Key + latin:keyStyle="spaceKeyStyle" + latin:keyXPos="31.250%p" + latin:keyWidth="37.500%p" /> + </default> + </switch> <switch> <case latin:languageCode="iw" diff --git a/java/res/xml-sw768dp/rows_number_normal.xml b/java/res/xml-sw768dp/rows_number_normal.xml index 8bf1a173f..2eeb6c9d4 100644 --- a/java/res/xml-sw768dp/rows_number_normal.xml +++ b/java/res/xml-sw768dp/rows_number_normal.xml @@ -145,7 +145,7 @@ latin:keyboardLayout="@xml/key_settings" latin:keyWidth="8.047%p" /> <Key - latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" + latin:keyStyle="spaceKeyStyle" latin:keyXPos="13.829%p" latin:keyWidth="24.140%p" /> <Key diff --git a/java/res/xml-sw768dp/rows_phone.xml b/java/res/xml-sw768dp/rows_phone.xml index 69c9e86ff..216fbedfb 100644 --- a/java/res/xml-sw768dp/rows_phone.xml +++ b/java/res/xml-sw768dp/rows_phone.xml @@ -114,7 +114,7 @@ latin:keyboardLayout="@xml/key_settings" latin:keyWidth="8.047%p" /> <Key - latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" + latin:keyStyle="spaceKeyStyle" latin:keyXPos="13.829%p" latin:keyWidth="24.140%p" /> <Key diff --git a/java/res/xml/key_styles_common.xml b/java/res/xml/key_styles_common.xml index f153a7d96..7b526c07f 100644 --- a/java/res/xml/key_styles_common.xml +++ b/java/res/xml/key_styles_common.xml @@ -108,6 +108,14 @@ latin:keyActionFlags="noKeyPreview|enableLongPress" latin:backgroundType="functional" /> <key-style + latin:styleName="zwnjKeyStyle" + latin:keyLabel="‌" + latin:moreKeys="‍" + latin:keyLabelFlags="hasPopupHint" + latin:altCode="@integer/key_space" + latin:keyActionFlags="altCodeWhileTyping" + latin:backgroundType="functional" /> + <key-style latin:styleName="shortcutKeyStyle" latin:code="@integer/key_shortcut" latin:keyIcon="iconShortcutKey" @@ -123,6 +131,8 @@ latin:keyActionFlags="noKeyPreview|altCodeWhileTyping|enableLongPress" latin:altCode="@integer/key_space" latin:backgroundType="functional" /> + <!-- U+200C: "" ZERO WIDTH NON-JOINER + U+200D: "" ZERO WIDTH JOINER --> <key-style latin:styleName="tabKeyStyle" latin:code="@integer/key_tab" diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index f330b268e..cdcea0ed0 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -33,6 +33,7 @@ en_GB: English Great Britain/qwerty es: Spanish/spanish et: Estonian/nordic + fa: Persian/arabic fi: Finnish/nordic fr: French/azerty fr_CA: French Canada/qwerty @@ -140,6 +141,12 @@ /> <subtype android:icon="@drawable/ic_subtype_keyboard" android:label="@string/subtype_generic" + android:imeSubtypeLocale="fa" + android:imeSubtypeMode="keyboard" + android:imeSubtypeExtraValue="SupportTouchPositionCorrection" + /> + <subtype android:icon="@drawable/ic_subtype_keyboard" + android:label="@string/subtype_generic" android:imeSubtypeLocale="fi" android:imeSubtypeMode="keyboard" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection" diff --git a/java/res/xml/row_qwerty4.xml b/java/res/xml/row_qwerty4.xml index 0dd2177e8..b2b47e9b5 100644 --- a/java/res/xml/row_qwerty4.xml +++ b/java/res/xml/row_qwerty4.xml @@ -59,6 +59,28 @@ </switch> <switch> <case + latin:languageCode="fa" + latin:languageSwitchKeyEnabled="true" + > + <Key + latin:keyStyle="languageSwitchKeyStyle" /> + <Key + latin:keyStyle="spaceKeyStyle" + latin:keyWidth="30%p" /> + <Key + latin:keyStyle="zwnjKeyStyle" /> + </case> + <case + latin:languageCode="fa" + latin:languageSwitchKeyEnabled="false" + > + <Key + latin:keyStyle="spaceKeyStyle" + latin:keyWidth="40%p" /> + <Key + latin:keyStyle="zwnjKeyStyle" /> + </case> + <case latin:languageSwitchKeyEnabled="true" > <Key diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java index dc7c12ba6..dd43166af 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java @@ -36,7 +36,6 @@ import com.android.inputmethod.keyboard.KeyboardView; import java.util.Collections; import java.util.LinkedList; import java.util.List; -import java.util.Set; /** * Exposes a virtual view sub-tree for {@link KeyboardView} and generates @@ -135,9 +134,9 @@ public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat ViewCompat.onInitializeAccessibilityNodeInfo(mKeyboardView, info); // Add the virtual children of the root View. - // TODO(alanv): Need to assign a unique ID to each key. + // TODO: Need to assign a unique ID to each key. final Keyboard keyboard = mKeyboardView.getKeyboard(); - final Set<Key> keys = keyboard.mKeys; + final Key[] keys = keyboard.mKeys; for (Key key : keys) { final int childVirtualViewId = generateVirtualViewIdForKey(key); info.addChild(mKeyboardView, childVirtualViewId); @@ -342,8 +341,8 @@ public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat mVirtualViewIdToKey.clear(); - final Set<Key> keySet = keyboard.mKeys; - for (Key key : keySet) { + final Key[] keys = keyboard.mKeys; + for (Key key : keys) { final int virtualViewId = generateVirtualViewIdForKey(key); mVirtualViewIdToKey.put(virtualViewId, key); } diff --git a/java/src/com/android/inputmethod/compat/MotionEventCompatUtils.java b/java/src/com/android/inputmethod/compat/MotionEventCompatUtils.java index eca922e68..9a523011a 100644 --- a/java/src/com/android/inputmethod/compat/MotionEventCompatUtils.java +++ b/java/src/com/android/inputmethod/compat/MotionEventCompatUtils.java @@ -17,7 +17,7 @@ package com.android.inputmethod.compat; public class MotionEventCompatUtils { - // TODO(alanv): Remove after these are added to MotionEventCompat. + // TODO: Remove after these are added to MotionEventCompat. public static final int ACTION_HOVER_ENTER = 0x9; public static final int ACTION_HOVER_EXIT = 0xA; } diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index b7f1ddde6..44c6a4966 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -40,12 +40,9 @@ import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; /** * Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard @@ -125,16 +122,17 @@ public class Keyboard { /** Maximum column for more keys keyboard */ public final int mMaxMoreKeysKeyboardColumn; - /** List of keys and icons in this keyboard */ - public final Set<Key> mKeys; - public final Set<Key> mShiftKeys; + /** Array of keys and icons in this keyboard */ + public final Key[] mKeys; + public final Key[] mShiftKeys; + public final Key[] mAltCodeKeysWhileTyping; public final KeyboardIconsSet mIconsSet; - private final Map<Integer, Key> mKeyCache = new HashMap<Integer, Key>(); + private final HashMap<Integer, Key> mKeyCache = new HashMap<Integer, Key>(); private final ProximityInfo mProximityInfo; - public final Map<Integer, List<Integer>> mAdditionalProximityChars; + private final Map<Integer, List<Integer>> mAdditionalProximityChars; public Keyboard(Params params) { mId = params.mId; @@ -149,8 +147,10 @@ public class Keyboard { mTopPadding = params.mTopPadding; mVerticalGap = params.mVerticalGap; - mKeys = Collections.unmodifiableSet(params.mKeys); - mShiftKeys = Collections.unmodifiableSet(params.mShiftKeys); + mKeys = params.mKeys.toArray(new Key[params.mKeys.size()]); + mShiftKeys = params.mShiftKeys.toArray(new Key[params.mShiftKeys.size()]); + mAltCodeKeysWhileTyping = params.mAltCodeKeysWhileTyping.toArray( + new Key[params.mAltCodeKeysWhileTyping.size()]); mIconsSet = params.mIconsSet; mAdditionalProximityChars = params.mAdditionalProximityChars; @@ -225,8 +225,9 @@ public class Keyboard { public int GRID_WIDTH; public int GRID_HEIGHT; - public final Set<Key> mKeys = new HashSet<Key>(); - public final Set<Key> mShiftKeys = new HashSet<Key>(); + public final ArrayList<Key> mKeys = new ArrayList<Key>(); + public final ArrayList<Key> mShiftKeys = new ArrayList<Key>(); + public final ArrayList<Key> mAltCodeKeysWhileTyping = new ArrayList<Key>(); public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet(); // TODO: Should be in Key instead of Keyboard.Params? public final Map<Integer, List<Integer>> mAdditionalProximityChars = @@ -308,12 +309,15 @@ public class Keyboard { if (key.mCode == Keyboard.CODE_SHIFT) { mShiftKeys.add(key); } + if (key.altCodeWhileTyping()) { + mAltCodeKeysWhileTyping.add(key); + } } private int mMaxHeightCount = 0; private int mMaxWidthCount = 0; - private final Map<Integer, Integer> mHeightHistogram = new HashMap<Integer, Integer>(); - private final Map<Integer, Integer> mWidthHistogram = new HashMap<Integer, Integer>(); + private final HashMap<Integer, Integer> mHeightHistogram = new HashMap<Integer, Integer>(); + private final HashMap<Integer, Integer> mWidthHistogram = new HashMap<Integer, Integer>(); private void clearHistogram() { mMostCommonKeyHeight = 0; @@ -325,7 +329,8 @@ public class Keyboard { mWidthHistogram.clear(); } - private static int updateHistogramCounter(Map<Integer, Integer> histogram, Integer key) { + private static int updateHistogramCounter(HashMap<Integer, Integer> histogram, + Integer key) { final int count = (histogram.containsKey(key) ? histogram.get(key) : 0) + 1; histogram.put(key, count); return count; diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index 7a9915be0..607b33bb4 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -25,8 +25,6 @@ import com.android.inputmethod.keyboard.internal.PointerTrackerQueue; import com.android.inputmethod.latin.LatinImeLogger; import java.util.ArrayList; -import java.util.List; -import java.util.Set; public class PointerTracker { private static final String TAG = PointerTracker.class.getSimpleName(); @@ -109,7 +107,7 @@ public class PointerTracker { private static LatinKeyboardView.PointerTrackerParams sParams; private static int sTouchNoiseThresholdDistanceSquared; - private static final List<PointerTracker> sTrackers = new ArrayList<PointerTracker>(); + private static final ArrayList<PointerTracker> sTrackers = new ArrayList<PointerTracker>(); private static PointerTrackerQueue sPointerTrackerQueue; public final int mPointerId; @@ -120,7 +118,6 @@ public class PointerTracker { private KeyboardActionListener mListener = EMPTY_LISTENER; private Keyboard mKeyboard; - private Set<Key> mKeys; private int mKeyQuarterWidthSquared; private final TextView mKeyPreviewText; @@ -180,7 +177,7 @@ public class PointerTracker { } public static PointerTracker getPointerTracker(final int id, KeyEventHandler handler) { - final List<PointerTracker> trackers = sTrackers; + final ArrayList<PointerTracker> trackers = sTrackers; // Create pointer trackers until we can get 'id+1'-th tracker, if needed. for (int i = trackers.size(); i <= id; i++) { @@ -303,7 +300,6 @@ public class PointerTracker { private void setKeyDetectorInner(KeyDetector keyDetector) { mKeyDetector = keyDetector; mKeyboard = keyDetector.getKeyboard(); - mKeys = mKeyboard.mKeys; final int keyQuarterWidth = mKeyboard.mMostCommonKeyWidth / 4; mKeyQuarterWidthSquared = keyQuarterWidth * keyQuarterWidth; } @@ -326,57 +322,76 @@ public class PointerTracker { private void setReleasedKeyGraphics(Key key) { mDrawingProxy.dismissKeyPreview(this); - if (key != null && key.isEnabled()) { - key.onReleased(); - mDrawingProxy.invalidateKey(key); - - if (key.isShift()) { - for (final Key shiftKey : mKeyboard.mShiftKeys) { - if (shiftKey != key) { - shiftKey.onReleased(); - mDrawingProxy.invalidateKey(shiftKey); - } + if (key == null || !key.isEnabled()) { + return; + } + + updateReleaseKeyGraphics(key); + + if (key.isShift()) { + for (final Key shiftKey : mKeyboard.mShiftKeys) { + if (shiftKey != key) { + updateReleaseKeyGraphics(shiftKey); } } + } - if (key.altCodeWhileTyping()) { - final Key altKey = mKeyboard.getKey(key.mAltCode); - if (altKey != null) { - altKey.onReleased(); - mDrawingProxy.invalidateKey(altKey); + if (key.altCodeWhileTyping()) { + final int altCode = key.mAltCode; + final Key altKey = mKeyboard.getKey(altCode); + if (altKey != null) { + updateReleaseKeyGraphics(altKey); + } + for (final Key k : mKeyboard.mAltCodeKeysWhileTyping) { + if (k != key && k.mAltCode == altCode) { + updateReleaseKeyGraphics(k); } } } } private void setPressedKeyGraphics(Key key) { - if (key != null && key.isEnabled()) { - if (!key.noKeyPreview()) { - mDrawingProxy.showKeyPreview(this); - } - key.onPressed(); - mDrawingProxy.invalidateKey(key); - - if (key.isShift()) { - for (final Key shiftKey : mKeyboard.mShiftKeys) { - if (shiftKey != key) { - shiftKey.onPressed(); - mDrawingProxy.invalidateKey(shiftKey); - } + if (key == null || !key.isEnabled()) { + return; + } + + if (!key.noKeyPreview()) { + mDrawingProxy.showKeyPreview(this); + } + updatePressKeyGraphics(key); + + if (key.isShift()) { + for (final Key shiftKey : mKeyboard.mShiftKeys) { + if (shiftKey != key) { + updatePressKeyGraphics(shiftKey); } } + } - if (key.altCodeWhileTyping() && mTimerProxy.isTyping()) { - final Key altKey = mKeyboard.getKey(key.mAltCode); - if (altKey != null) { - // TODO: Show altKey's preview. - altKey.onPressed(); - mDrawingProxy.invalidateKey(altKey); + if (key.altCodeWhileTyping() && mTimerProxy.isTyping()) { + final int altCode = key.mAltCode; + final Key altKey = mKeyboard.getKey(altCode); + if (altKey != null) { + updatePressKeyGraphics(altKey); + } + for (final Key k : mKeyboard.mAltCodeKeysWhileTyping) { + if (k != key && k.mAltCode == altCode) { + updatePressKeyGraphics(k); } } } } + private void updateReleaseKeyGraphics(Key key) { + key.onReleased(); + mDrawingProxy.invalidateKey(key); + } + + private void updatePressKeyGraphics(Key key) { + key.onPressed(); + mDrawingProxy.invalidateKey(key); + } + public int getLastX() { return mLastX; } @@ -691,7 +706,7 @@ public class PointerTracker { } private boolean isMajorEnoughMoveToBeOnNewKey(int x, int y, Key newKey) { - if (mKeys == null || mKeyDetector == null) + if (mKeyDetector == null) throw new NullPointerException("keyboard and/or key detector not set"); Key curKey = mCurrentKey; if (newKey == curKey) { diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java index 8a65a5fc6..e2a48306a 100644 --- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java +++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java @@ -28,7 +28,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; public class ProximityInfo { public static final int MAX_PROXIMITY_CHARS_SIZE = 16; @@ -50,8 +49,8 @@ public class ProximityInfo { private final String mLocaleStr; ProximityInfo(String localeStr, int gridWidth, int gridHeight, int minWidth, int height, - int mostCommonKeyWidth, - int mostCommonKeyHeight, Set<Key> keys, TouchPositionCorrection touchPositionCorrection, + int mostCommonKeyWidth, int mostCommonKeyHeight, final Key[] keys, + TouchPositionCorrection touchPositionCorrection, Map<Integer, List<Integer>> additionalProximityChars) { if (TextUtils.isEmpty(localeStr)) { mLocaleStr = ""; @@ -77,8 +76,8 @@ public class ProximityInfo { } public static ProximityInfo createDummyProximityInfo() { - return new ProximityInfo("", 1, 1, 1, 1, 1, 1, Collections.<Key> emptySet(), - null, Collections.<Integer, List<Integer>> emptyMap()); + return new ProximityInfo("", 1, 1, 1, 1, 1, 1, EMPTY_KEY_ARRAY, null, + Collections.<Integer, List<Integer>> emptyMap()); } public static ProximityInfo createSpellCheckerProximityInfo(final int[] proximity) { @@ -106,8 +105,7 @@ public class ProximityInfo { private native void releaseProximityInfoNative(long nativeProximityInfo); private final void setProximityInfo(Key[][] gridNeighborKeys, int keyboardWidth, - int keyboardHeight, Set<Key> keys, - TouchPositionCorrection touchPositionCorrection) { + int keyboardHeight, final Key[] keys, TouchPositionCorrection touchPositionCorrection) { final int[] proximityCharsArray = new int[mGridSize * MAX_PROXIMITY_CHARS_SIZE]; Arrays.fill(proximityCharsArray, KeyDetector.NOT_A_CODE); for (int i = 0; i < mGridSize; ++i) { @@ -117,7 +115,7 @@ public class ProximityInfo { gridNeighborKeys[i][j].mCode; } } - final int keyCount = keys.size(); + final int keyCount = keys.length; final int[] keyXCoordinates = new int[keyCount]; final int[] keyYCoordinates = new int[keyCount]; final int[] keyWidths = new int[keyCount]; @@ -132,8 +130,8 @@ public class ProximityInfo { sweetSpotCenterYs = new float[keyCount]; sweetSpotRadii = new float[keyCount]; calculateSweetSpotParams = true; - int i = 0; - for (final Key key : keys) { + for (int i = 0; i < keyCount; i++) { + final Key key = keys[i]; keyXCoordinates[i] = key.mX; keyYCoordinates[i] = key.mY; keyWidths[i] = key.mWidth; @@ -156,7 +154,6 @@ public class ProximityInfo { hitBoxWidth * hitBoxWidth + hitBoxHeight * hitBoxHeight); } } - i++; } } else { sweetSpotCenterXs = sweetSpotCenterYs = sweetSpotRadii = null; @@ -186,17 +183,17 @@ public class ProximityInfo { } } - private void computeNearestNeighbors(int defaultWidth, Set<Key> keys, + private void computeNearestNeighbors(int defaultWidth, final Key[] keys, TouchPositionCorrection touchPositionCorrection, Map<Integer, List<Integer>> additionalProximityChars) { - final Map<Integer, Key> keyCodeMap = new HashMap<Integer, Key>(); + final HashMap<Integer, Key> keyCodeMap = new HashMap<Integer, Key>(); for (final Key key : keys) { keyCodeMap.put(key.mCode, key); } final int thresholdBase = (int) (defaultWidth * SEARCH_DISTANCE); final int threshold = thresholdBase * thresholdBase; // Round-up so we don't have any pixels outside the grid - final Key[] neighborKeys = new Key[keys.size()]; + final Key[] neighborKeys = new Key[keys.length]; final int gridWidth = mGridWidth * mCellWidth; final int gridHeight = mGridHeight * mCellHeight; for (int x = 0; x < gridWidth; x += mCellWidth) { diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java index ca711ec7d..9b9c86179 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java @@ -24,7 +24,6 @@ import android.util.Log; import com.android.inputmethod.latin.R; import java.util.HashMap; -import java.util.Map; public class KeyboardIconsSet { private static final String TAG = KeyboardIconsSet.class.getSimpleName(); @@ -35,8 +34,9 @@ public class KeyboardIconsSet { private final Drawable[] mIcons = new Drawable[NUM_ICONS + 1]; - private static final Map<Integer, Integer> ATTR_ID_TO_ICON_ID = new HashMap<Integer, Integer>(); - private static final Map<String, Integer> NAME_TO_ICON_ID = new HashMap<String, Integer>(); + private static final HashMap<Integer, Integer> ATTR_ID_TO_ICON_ID + = new HashMap<Integer, Integer>(); + private static final HashMap<String, Integer> NAME_TO_ICON_ID = new HashMap<String, Integer>(); private static final String[] ICON_NAMES = new String[NUM_ICONS + 1]; private static final int ATTR_UNDEFINED = 0; |