aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/res/values-es/donottranslate-altchars.xml2
-rw-r--r--java/res/values-hr/donottranslate-altchars.xml27
-rw-r--r--java/res/values-sw600dp-land/dimens.xml7
-rw-r--r--java/res/values-sw600dp/dimens.xml8
-rw-r--r--java/res/values-sw768dp-land/dimens.xml6
-rw-r--r--java/res/values-sw768dp/dimens.xml7
-rw-r--r--java/res/values/attrs.xml2
-rw-r--r--java/res/values/strings.xml6
-rw-r--r--java/res/values/styles.xml9
-rw-r--r--java/res/xml-ar/kbd_qwerty.xml10
-rw-r--r--java/res/xml-cs/kbd_qwerty.xml10
-rw-r--r--java/res/xml-da/kbd_qwerty.xml10
-rw-r--r--java/res/xml-de/kbd_qwerty.xml10
-rw-r--r--java/res/xml-en/kbd_qwerty.xml37
-rw-r--r--java/res/xml-es/kbd_qwerty.xml10
-rw-r--r--java/res/xml-fi/kbd_qwerty.xml10
-rw-r--r--java/res/xml-fr-rCA/kbd_qwerty.xml10
-rw-r--r--java/res/xml-fr-rCH/kbd_qwerty.xml10
-rw-r--r--java/res/xml-fr/kbd_qwerty.xml10
-rw-r--r--java/res/xml-hr/kbd_qwerty.xml (renamed from java/res/xml-sw600dp/kbd_qwerty.xml)12
-rw-r--r--java/res/xml-hu/kbd_qwerty.xml10
-rw-r--r--java/res/xml-iw/kbd_qwerty.xml10
-rw-r--r--java/res/xml-nb/kbd_qwerty.xml10
-rw-r--r--java/res/xml-pl/kbd_qwerty.xml10
-rw-r--r--java/res/xml-pt/kbd_qwerty.xml10
-rw-r--r--java/res/xml-ru/kbd_qwerty.xml10
-rw-r--r--java/res/xml-sr/kbd_qwerty.xml10
-rw-r--r--java/res/xml-sv/kbd_qwerty.xml10
-rw-r--r--java/res/xml-sw600dp/kbd_number.xml7
-rw-r--r--java/res/xml-sw600dp/kbd_phone.xml7
-rw-r--r--java/res/xml-sw600dp/kbd_phone_symbols.xml7
-rw-r--r--java/res/xml-sw600dp/kbd_rows_arabic.xml134
-rw-r--r--java/res/xml-sw600dp/kbd_rows_azerty.xml (renamed from java/res/xml-sw600dp/kbd_azerty_rows.xml)9
-rw-r--r--java/res/xml-sw600dp/kbd_rows_hebrew.xml122
-rw-r--r--java/res/xml-sw600dp/kbd_rows_qwerty.xml (renamed from java/res/xml-sw600dp/kbd_qwerty_rows.xml)0
-rw-r--r--java/res/xml-sw600dp/kbd_rows_qwertz.xml (renamed from java/res/xml-sw600dp/kbd_qwertz_rows.xml)0
-rw-r--r--java/res/xml-sw600dp/kbd_rows_russian.xml (renamed from java/res/xml-sw600dp/kbd_ru_rows.xml)0
-rw-r--r--java/res/xml-sw600dp/kbd_rows_scandinavian.xml (renamed from java/res/xml-sw600dp/kbd_qwerty_rows_scandinavia.xml)62
-rw-r--r--java/res/xml-sw600dp/kbd_rows_serbian.xml (renamed from java/res/xml-sw600dp/kbd_sr_rows.xml)0
-rw-r--r--java/res/xml-sw600dp/kbd_rows_spanish.xml69
-rw-r--r--java/res/xml-sw600dp/kbd_symbols.xml7
-rw-r--r--java/res/xml-sw600dp/kbd_symbols_shift.xml7
-rw-r--r--java/res/xml-sw768dp/kbd_number.xml8
-rw-r--r--java/res/xml-sw768dp/kbd_phone.xml8
-rw-r--r--java/res/xml-sw768dp/kbd_phone_symbols.xml8
-rw-r--r--java/res/xml-sw768dp/kbd_rows_arabic.xml (renamed from java/res/xml-sw768dp/kbd_ar_rows.xml)0
-rw-r--r--java/res/xml-sw768dp/kbd_rows_azerty.xml (renamed from java/res/xml-sw768dp/kbd_azerty_rows.xml)0
-rw-r--r--java/res/xml-sw768dp/kbd_rows_hebrew.xml (renamed from java/res/xml-sw768dp/kbd_iw_rows.xml)0
-rw-r--r--java/res/xml-sw768dp/kbd_rows_qwerty.xml (renamed from java/res/xml-sw768dp/kbd_qwerty_rows.xml)0
-rw-r--r--java/res/xml-sw768dp/kbd_rows_qwertz.xml (renamed from java/res/xml-sw768dp/kbd_qwertz_rows.xml)0
-rw-r--r--java/res/xml-sw768dp/kbd_rows_russian.xml (renamed from java/res/xml-sw768dp/kbd_ru_rows.xml)0
-rw-r--r--java/res/xml-sw768dp/kbd_rows_scandinavian.xml (renamed from java/res/xml-sw768dp/kbd_qwerty_rows_scandinavia.xml)0
-rw-r--r--java/res/xml-sw768dp/kbd_rows_serbian.xml (renamed from java/res/xml-sw768dp/kbd_sr_rows.xml)0
-rw-r--r--java/res/xml-sw768dp/kbd_rows_spanish.xml72
-rw-r--r--java/res/xml-sw768dp/kbd_symbols.xml8
-rw-r--r--java/res/xml-sw768dp/kbd_symbols_shift.xml8
-rw-r--r--java/res/xml/kbd_number.xml8
-rw-r--r--java/res/xml/kbd_phone.xml8
-rw-r--r--java/res/xml/kbd_phone_symbols.xml8
-rw-r--r--java/res/xml/kbd_qwerty.xml10
-rw-r--r--java/res/xml/kbd_qwerty_f1.xml2
-rw-r--r--java/res/xml/kbd_qwerty_row4.xml2
-rw-r--r--java/res/xml/kbd_rows_arabic.xml (renamed from java/res/xml/kbd_ar_rows.xml)0
-rw-r--r--java/res/xml/kbd_rows_azerty.xml (renamed from java/res/xml/kbd_azerty_rows.xml)0
-rw-r--r--java/res/xml/kbd_rows_hebrew.xml (renamed from java/res/xml/kbd_iw_rows.xml)0
-rw-r--r--java/res/xml/kbd_rows_qwerty.xml (renamed from java/res/xml/kbd_qwerty_rows.xml)0
-rw-r--r--java/res/xml/kbd_rows_qwertz.xml (renamed from java/res/xml/kbd_qwertz_rows.xml)0
-rw-r--r--java/res/xml/kbd_rows_russian.xml (renamed from java/res/xml/kbd_ru_rows.xml)0
-rw-r--r--java/res/xml/kbd_rows_scandinavian.xml (renamed from java/res/xml/kbd_qwerty_rows_scandinavia.xml)0
-rw-r--r--java/res/xml/kbd_rows_serbian.xml (renamed from java/res/xml/kbd_sr_rows.xml)0
-rw-r--r--java/res/xml/kbd_rows_spanish.xml64
-rw-r--r--java/res/xml/kbd_symbols.xml8
-rw-r--r--java/res/xml/kbd_symbols_shift.xml8
-rw-r--r--java/res/xml/method.xml17
-rw-r--r--java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java2
-rw-r--r--java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java6
-rw-r--r--java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java21
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java8
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardId.java17
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardParser.java18
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java65
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java8
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboard.java37
-rw-r--r--java/src/com/android/inputmethod/keyboard/PointerTracker.java2
-rw-r--r--java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java11
-rw-r--r--java/src/com/android/inputmethod/latin/CandidateView.java6
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java18
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java49
-rw-r--r--native/Android.mk2
-rw-r--r--native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp36
-rw-r--r--native/jni/com_android_inputmethod_keyboard_ProximityInfo.h2
-rw-r--r--native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp36
-rw-r--r--native/jni/com_android_inputmethod_latin_BinaryDictionary.h2
-rw-r--r--native/jni/jni_common.cpp (renamed from native/jni/onload.cpp)23
-rw-r--r--native/jni/jni_common.h30
-rw-r--r--native/src/bigram_dictionary.h5
-rw-r--r--native/src/char_utils.h2
-rw-r--r--native/src/debug.h3
-rw-r--r--native/src/dictionary.h5
-rw-r--r--native/src/proximity_info.cpp4
-rw-r--r--native/src/proximity_info.h4
-rw-r--r--native/src/unigram_dictionary.cpp74
-rw-r--r--native/src/unigram_dictionary.h20
103 files changed, 883 insertions, 604 deletions
diff --git a/java/res/values-es/donottranslate-altchars.xml b/java/res/values-es/donottranslate-altchars.xml
index 99f1663a1..16111ec42 100644
--- a/java/res/values-es/donottranslate-altchars.xml
+++ b/java/res/values-es/donottranslate-altchars.xml
@@ -25,4 +25,6 @@
<string name="alternates_for_u">7,ú,ü,ù,û,ū</string>
<string name="alternates_for_n">ñ,ń</string>
<string name="alternates_for_c">ç,ć,č</string>
+ <string name="alternates_for_punctuation">"\\,,\?,!,¿,¡,:,-,\',\",),(,/,;,+,&amp;,\@"</string>
+ <string name="alternates_for_web_tab_punctuation">".,\\,,\?,!,¿,¡,:,-,\',\",),(,/,;,+,&amp;,\@"</string>
</resources>
diff --git a/java/res/values-hr/donottranslate-altchars.xml b/java/res/values-hr/donottranslate-altchars.xml
new file mode 100644
index 000000000..d0c9d4049
--- /dev/null
+++ b/java/res/values-hr/donottranslate-altchars.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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">
+ <string name="alternates_for_s">š,ś,ß</string>
+ <string name="alternates_for_n">ñ,ń</string>
+ <string name="alternates_for_y"></string>
+ <string name="alternates_for_z">6,ž,ź,ż</string>
+ <string name="alternates_for_c">č,ć,ç</string>
+ <string name="alternates_for_d">đ</string>
+</resources>
diff --git a/java/res/values-sw600dp-land/dimens.xml b/java/res/values-sw600dp-land/dimens.xml
index beb5263f6..a7167af76 100644
--- a/java/res/values-sw600dp-land/dimens.xml
+++ b/java/res/values-sw600dp-land/dimens.xml
@@ -21,6 +21,7 @@
<resources>
<!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
<dimen name="keyboardHeight">45.0mm</dimen>
+ <fraction name="minKeyboardHeight">45%p</fraction>
<!-- key_height + key_bottom_gap = popup_key_height -->
<!-- <dimen name="key_height">14.5mm</dimen> -->
<dimen name="key_bottom_gap">1.3mm</dimen>
@@ -31,10 +32,10 @@
<!-- key_height x 1.0 -->
<dimen name="key_preview_height">13.0mm</dimen>
- <fraction name="key_letter_ratio">30.7%</fraction>
- <fraction name="key_label_ratio">21.9%</fraction>
+ <fraction name="key_letter_ratio">45%</fraction>
+ <fraction name="key_label_ratio">32%</fraction>
<fraction name="key_hint_letter_ratio">23%</fraction>
- <fraction name="key_uppercase_letter_ratio">25%</fraction>
+ <fraction name="key_uppercase_letter_ratio">29%</fraction>
<!-- left or right padding of label alignment -->
<dimen name="key_label_horizontal_alignment_padding">18dip</dimen>
<dimen name="candidate_strip_padding">40.0mm</dimen>
diff --git a/java/res/values-sw600dp/dimens.xml b/java/res/values-sw600dp/dimens.xml
index 62ab0d286..8ecf542eb 100644
--- a/java/res/values-sw600dp/dimens.xml
+++ b/java/res/values-sw600dp/dimens.xml
@@ -22,7 +22,7 @@
<!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
<dimen name="keyboardHeight">48.0mm</dimen>
<fraction name="maxKeyboardHeight">50%p</fraction>
- <fraction name="minKeyboardHeight">-61.8%p</fraction>
+ <fraction name="minKeyboardHeight">-35.0%p</fraction>
<!-- key_height + key_bottom_gap = popup_key_height -->
<!-- <dimen name="key_height">14.5mm</dimen> -->
<dimen name="key_bottom_gap">1.0mm</dimen>
@@ -39,10 +39,10 @@
<!-- popup_key_height x -1.0 -->
<dimen name="mini_keyboard_vertical_correction">-13.0mm</dimen>
- <fraction name="key_letter_ratio">45%</fraction>
- <fraction name="key_label_ratio">29%</fraction>
+ <fraction name="key_letter_ratio">37%</fraction>
+ <fraction name="key_label_ratio">22%</fraction>
<fraction name="key_hint_letter_ratio">23%</fraction>
- <fraction name="key_uppercase_letter_ratio">35%</fraction>
+ <fraction name="key_uppercase_letter_ratio">25%</fraction>
<fraction name="key_preview_text_ratio">82%</fraction>
<!-- left or right padding of label alignment -->
<dimen name="key_label_horizontal_alignment_padding">6dip</dimen>
diff --git a/java/res/values-sw768dp-land/dimens.xml b/java/res/values-sw768dp-land/dimens.xml
index 81d91cebf..73885c2af 100644
--- a/java/res/values-sw768dp-land/dimens.xml
+++ b/java/res/values-sw768dp-land/dimens.xml
@@ -31,10 +31,10 @@
<dimen name="keyboard_bottom_padding">0.0mm</dimen>
<dimen name="keyboard_horizontal_edges_padding">0.0mm</dimen>
- <fraction name="key_letter_ratio">30.7%</fraction>
- <fraction name="key_label_ratio">21.9%</fraction>
+ <fraction name="key_letter_ratio">38%</fraction>
+ <fraction name="key_label_ratio">26%</fraction>
<fraction name="key_hint_letter_ratio">23%</fraction>
- <fraction name="key_uppercase_letter_ratio">25%</fraction>
+ <fraction name="key_uppercase_letter_ratio">24%</fraction>
<!-- left or right padding of label alignment -->
<dimen name="key_label_horizontal_alignment_padding">18dip</dimen>
<dimen name="key_preview_height_holo">26.5mm</dimen>
diff --git a/java/res/values-sw768dp/dimens.xml b/java/res/values-sw768dp/dimens.xml
index 74eab5f28..d8d133264 100644
--- a/java/res/values-sw768dp/dimens.xml
+++ b/java/res/values-sw768dp/dimens.xml
@@ -21,6 +21,7 @@
<resources>
<!-- keyboardHeight = key_height*4 + key_bottom_gap*3, key_height=12mm -->
<dimen name="keyboardHeight">48.0mm</dimen>
+ <fraction name="maxKeyboardHeight">50%p</fraction>
<fraction name="minKeyboardHeight">-35.0%p</fraction>
<!-- key_height + key_bottom_gap = popup_key_height -->
<!-- <dimen name="key_height">14.5mm</dimen> -->
@@ -38,10 +39,10 @@
<!-- popup_key_height x -1.0 -->
<dimen name="mini_keyboard_vertical_correction">-13.0mm</dimen>
- <fraction name="key_letter_ratio">34.4%</fraction>
- <fraction name="key_label_ratio">21.2%</fraction>
+ <fraction name="key_letter_ratio">38%</fraction>
+ <fraction name="key_label_ratio">26%</fraction>
<fraction name="key_hint_letter_ratio">23%</fraction>
- <fraction name="key_uppercase_letter_ratio">28%</fraction>
+ <fraction name="key_uppercase_letter_ratio">25%</fraction>
<!-- left or right padding of label alignment -->
<dimen name="key_label_horizontal_alignment_padding">6dip</dimen>
<fraction name="key_preview_text_ratio">26.3%</fraction>
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 2db529ea2..73f62c6f1 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -221,7 +221,7 @@
<enum name="phone" value="4" />
<enum name="number" value="5" />
</attr>
- <attr name="webInput" format="boolean" />
+ <attr name="navigateAction" format="boolean" />
<attr name="passwordInput" format="boolean" />
<attr name="hasSettingsKey" format="boolean" />
<attr name="voiceKeyEnabled" format="boolean" />
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 3d03271ad..93da13756 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -258,12 +258,18 @@
<string name="subtype_mode_en_US_keyboard">English (US) Keyboard</string>
<!-- Description for Spanish keyboard subtype [CHAR LIMIT=35] -->
<string name="subtype_mode_es_keyboard">Spanish Keyboard</string>
+ <!-- Description for Finnish keyboard subtype [CHAR LIMIT=35] -->
+ <string name="subtype_mode_fi_keyboard">Finnish Keyboard</string>
<!-- Description for French keyboard subtype [CHAR LIMIT=35] -->
<string name="subtype_mode_fr_keyboard">French Keyboard</string>
<!-- Description for French (Canada) keyboard subtype [CHAR LIMIT=35] -->
<string name="subtype_mode_fr_CA_keyboard">French (Canada) Keyboard</string>
<!-- Description for French (Switzerland) keyboard subtype [CHAR LIMIT=35] -->
<string name="subtype_mode_fr_CH_keyboard">French (Switzerland) Keyboard</string>
+ <!-- Description for Croatian keyboard subtype [CHAR LIMIT=35] -->
+ <string name="subtype_mode_hr_keyboard">Croatian Keyboard</string>
+ <!-- Description for Hungarian keyboard subtype [CHAR LIMIT=35] -->
+ <string name="subtype_mode_hu_keyboard">Hungarian Keyboard</string>
<!-- Description for Hebrew keyboard subtype [CHAR LIMIT=35] -->
<!-- Java uses the deprecated "iw" code instead of the standard "he" code -->
<string name="subtype_mode_iw_keyboard">Hebrew Keyboard</string>
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index 6f973d9e5..3780fe3d2 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -17,6 +17,14 @@
<resources>
<!-- Theme "Basic" -->
<style name="Keyboard">
+ <item name="rowHeight">25%p</item>
+ <item name="keyboardHeight">@dimen/keyboardHeight</item>
+ <item name="maxKeyboardHeight">@fraction/maxKeyboardHeight</item>
+ <item name="minKeyboardHeight">@fraction/minKeyboardHeight</item>
+ <item name="popupKeyboardTemplate">@xml/kbd_popup_template</item>
+ <item name="horizontalGap">@dimen/key_horizontal_gap</item>
+ <item name="verticalGap">@dimen/key_bottom_gap</item>
+ <item name="maxPopupKeyboardColumn">@integer/config_max_popup_keyboard_column</item>
</style>
<style name="LatinKeyboard">
<item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item>
@@ -76,6 +84,7 @@
<item name="android:background">@drawable/candidate_feedback_background</item>
</style>
<style name="CandidateViewStyle" parent="SuggestionsStripBackgroundStyle">
+ <item name="autoCorrectHighlight">autoCorrectBold</item>
<item name="colorTypedWord">#FFFFFFFF</item>
<item name="colorAutoCorrect">#FFFCAE00</item>
<item name="colorSuggested">#FFFCAE00</item>
diff --git a/java/res/xml-ar/kbd_qwerty.xml b/java/res/xml-ar/kbd_qwerty.xml
index 57823c9ac..57a6d2caf 100644
--- a/java/res/xml-ar/kbd_qwerty.xml
+++ b/java/res/xml-ar/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="ar"
>
<include
- latin:keyboardLayout="@xml/kbd_ar_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_arabic" />
</Keyboard>
diff --git a/java/res/xml-cs/kbd_qwerty.xml b/java/res/xml-cs/kbd_qwerty.xml
index 9ead49c3b..9991ea2d2 100644
--- a/java/res/xml-cs/kbd_qwerty.xml
+++ b/java/res/xml-cs/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="cs"
>
<include
- latin:keyboardLayout="@xml/kbd_qwertz_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_qwertz" />
</Keyboard>
diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml
index 12ea33c13..37a50fdfd 100644
--- a/java/res/xml-da/kbd_qwerty.xml
+++ b/java/res/xml-da/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="da"
>
<include
- latin:keyboardLayout="@xml/kbd_qwerty_rows_scandinavia" />
+ latin:keyboardLayout="@xml/kbd_rows_scandinavian" />
</Keyboard>
diff --git a/java/res/xml-de/kbd_qwerty.xml b/java/res/xml-de/kbd_qwerty.xml
index 5c51bbdae..89e10b26d 100644
--- a/java/res/xml-de/kbd_qwerty.xml
+++ b/java/res/xml-de/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="de"
>
<include
- latin:keyboardLayout="@xml/kbd_qwertz_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_qwertz" />
</Keyboard>
diff --git a/java/res/xml-en/kbd_qwerty.xml b/java/res/xml-en/kbd_qwerty.xml
deleted file mode 100644
index 33e24d373..000000000
--- a/java/res/xml-en/kbd_qwerty.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2011, 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.
-*/
--->
-
-<!-- TODO: This is work around to avoid resource selection issue. This file must be removed when the
- issue is sorted out. -->
-<Keyboard
- xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
- latin:keyboardLocale="en,en_US,en_GB"
->
- <include
- latin:keyboardLayout="@xml/kbd_qwerty_rows" />
-</Keyboard>
diff --git a/java/res/xml-es/kbd_qwerty.xml b/java/res/xml-es/kbd_qwerty.xml
index f98649177..568f4d652 100644
--- a/java/res/xml-es/kbd_qwerty.xml
+++ b/java/res/xml-es/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="es,es_US"
>
<include
- latin:keyboardLayout="@xml/kbd_qwerty_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_spanish" />
</Keyboard>
diff --git a/java/res/xml-fi/kbd_qwerty.xml b/java/res/xml-fi/kbd_qwerty.xml
index e35ab2b41..75721e057 100644
--- a/java/res/xml-fi/kbd_qwerty.xml
+++ b/java/res/xml-fi/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="fi"
>
<include
- latin:keyboardLayout="@xml/kbd_qwerty_rows_scandinavia" />
+ latin:keyboardLayout="@xml/kbd_rows_scandinavian" />
</Keyboard>
diff --git a/java/res/xml-fr-rCA/kbd_qwerty.xml b/java/res/xml-fr-rCA/kbd_qwerty.xml
index 7f25848e2..7bdfbadf1 100644
--- a/java/res/xml-fr-rCA/kbd_qwerty.xml
+++ b/java/res/xml-fr-rCA/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="fr_CA"
>
<include
- latin:keyboardLayout="@xml/kbd_qwerty_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_qwerty" />
</Keyboard>
diff --git a/java/res/xml-fr-rCH/kbd_qwerty.xml b/java/res/xml-fr-rCH/kbd_qwerty.xml
index 2baed3ce5..41b701d83 100644
--- a/java/res/xml-fr-rCH/kbd_qwerty.xml
+++ b/java/res/xml-fr-rCH/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="fr_CH"
>
<include
- latin:keyboardLayout="@xml/kbd_qwertz_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_qwertz" />
</Keyboard>
diff --git a/java/res/xml-fr/kbd_qwerty.xml b/java/res/xml-fr/kbd_qwerty.xml
index 1b1065516..8c730a24f 100644
--- a/java/res/xml-fr/kbd_qwerty.xml
+++ b/java/res/xml-fr/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="fr"
>
<include
- latin:keyboardLayout="@xml/kbd_azerty_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_azerty" />
</Keyboard>
diff --git a/java/res/xml-sw600dp/kbd_qwerty.xml b/java/res/xml-hr/kbd_qwerty.xml
index 9541e13fd..ca92e86a7 100644
--- a/java/res/xml-sw600dp/kbd_qwerty.xml
+++ b/java/res/xml-hr/kbd_qwerty.xml
@@ -20,15 +20,9 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
- latin:rowHeight="25%p"
- latin:keyWidth="10%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
+ latin:keyboardLocale="hr"
>
+ <!-- TODO: Dedicated Croatian layout especially for tablet. -->
<include
- latin:keyboardLayout="@xml/kbd_qwerty_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_qwertz" />
</Keyboard>
diff --git a/java/res/xml-hu/kbd_qwerty.xml b/java/res/xml-hu/kbd_qwerty.xml
index 250b4553f..3195d5b1f 100644
--- a/java/res/xml-hu/kbd_qwerty.xml
+++ b/java/res/xml-hu/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="hu"
>
<include
- latin:keyboardLayout="@xml/kbd_qwertz_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_qwertz" />
</Keyboard>
diff --git a/java/res/xml-iw/kbd_qwerty.xml b/java/res/xml-iw/kbd_qwerty.xml
index e93927f1a..dc2c5d35a 100644
--- a/java/res/xml-iw/kbd_qwerty.xml
+++ b/java/res/xml-iw/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="iw"
>
<include
- latin:keyboardLayout="@xml/kbd_iw_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_hebrew" />
</Keyboard>
diff --git a/java/res/xml-nb/kbd_qwerty.xml b/java/res/xml-nb/kbd_qwerty.xml
index e7a743ca9..1f4e86e89 100644
--- a/java/res/xml-nb/kbd_qwerty.xml
+++ b/java/res/xml-nb/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="nb"
>
<include
- latin:keyboardLayout="@xml/kbd_qwerty_rows_scandinavia" />
+ latin:keyboardLayout="@xml/kbd_rows_scandinavian" />
</Keyboard>
diff --git a/java/res/xml-pl/kbd_qwerty.xml b/java/res/xml-pl/kbd_qwerty.xml
index 7d9476d7b..44312c52c 100644
--- a/java/res/xml-pl/kbd_qwerty.xml
+++ b/java/res/xml-pl/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="pl"
>
<include
- latin:keyboardLayout="@xml/kbd_qwerty_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_qwerty" />
</Keyboard>
diff --git a/java/res/xml-pt/kbd_qwerty.xml b/java/res/xml-pt/kbd_qwerty.xml
index 1a8995510..f5dcbc61b 100644
--- a/java/res/xml-pt/kbd_qwerty.xml
+++ b/java/res/xml-pt/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="pt"
>
<include
- latin:keyboardLayout="@xml/kbd_qwerty_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_qwerty" />
</Keyboard>
diff --git a/java/res/xml-ru/kbd_qwerty.xml b/java/res/xml-ru/kbd_qwerty.xml
index 826818c46..aee1b1bfc 100644
--- a/java/res/xml-ru/kbd_qwerty.xml
+++ b/java/res/xml-ru/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="ru"
>
<include
- latin:keyboardLayout="@xml/kbd_ru_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_russian" />
</Keyboard>
diff --git a/java/res/xml-sr/kbd_qwerty.xml b/java/res/xml-sr/kbd_qwerty.xml
index 6116c7536..58fc187c2 100644
--- a/java/res/xml-sr/kbd_qwerty.xml
+++ b/java/res/xml-sr/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="sr"
>
<include
- latin:keyboardLayout="@xml/kbd_sr_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_serbian" />
</Keyboard>
diff --git a/java/res/xml-sv/kbd_qwerty.xml b/java/res/xml-sv/kbd_qwerty.xml
index 69f0b3fa0..e29d9abce 100644
--- a/java/res/xml-sv/kbd_qwerty.xml
+++ b/java/res/xml-sv/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="sv"
>
<include
- latin:keyboardLayout="@xml/kbd_qwerty_rows_scandinavia" />
+ latin:keyboardLayout="@xml/kbd_rows_scandinavian" />
</Keyboard>
diff --git a/java/res/xml-sw600dp/kbd_number.xml b/java/res/xml-sw600dp/kbd_number.xml
index f9096fc2c..0ff1da9bc 100644
--- a/java/res/xml-sw600dp/kbd_number.xml
+++ b/java/res/xml-sw600dp/kbd_number.xml
@@ -20,14 +20,7 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
- latin:rowHeight="25%p"
latin:keyWidth="16.75%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml-sw600dp/kbd_phone.xml b/java/res/xml-sw600dp/kbd_phone.xml
index cf0e5236c..20b284923 100644
--- a/java/res/xml-sw600dp/kbd_phone.xml
+++ b/java/res/xml-sw600dp/kbd_phone.xml
@@ -20,14 +20,7 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
- latin:rowHeight="25%p"
latin:keyWidth="16.75%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml-sw600dp/kbd_phone_symbols.xml b/java/res/xml-sw600dp/kbd_phone_symbols.xml
index 356528538..a5ae9456c 100644
--- a/java/res/xml-sw600dp/kbd_phone_symbols.xml
+++ b/java/res/xml-sw600dp/kbd_phone_symbols.xml
@@ -20,14 +20,7 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
- latin:rowHeight="25%p"
latin:keyWidth="16.75%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml-sw600dp/kbd_rows_arabic.xml b/java/res/xml-sw600dp/kbd_rows_arabic.xml
new file mode 100644
index 000000000..bc37d5a9f
--- /dev/null
+++ b/java/res/xml-sw600dp/kbd_rows_arabic.xml
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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.
+*/
+-->
+
+<!-- This file for Arabic layout is an alpha version. It allows to enter -->
+<!-- some right-to-left text, but it has gone through no study whatsoever, -->
+<!-- and needs to be run through UX. -->
+<merge
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+ <include
+ latin:keyboardLayout="@xml/kbd_key_styles" />
+ <Row
+ latin:keyWidth="8.0%p"
+ >
+ <Key
+ latin:keyLabel="ض"
+ latin:keyEdgeFlags="left" />
+ <Key
+ latin:keyLabel="ص" />
+ <Key
+ latin:keyLabel="ث" />
+ <Key
+ latin:keyLabel="ق" />
+ <Key
+ latin:keyLabel="ف"
+ latin:popupCharacters="ف,ڤ" />
+ <Key
+ latin:keyLabel="غ" />
+ <Key
+ latin:keyLabel="ع" />
+ <Key
+ latin:keyLabel="ه"
+ latin:popupCharacters="ه,هـ" />
+ <Key
+ latin:keyLabel="خ" />
+ <Key
+ latin:keyLabel="ح" />
+ <Key
+ latin:keyLabel="ج"
+ latin:popupCharacters="ج,چ" />
+ <Key
+ latin:keyStyle="deleteKeyStyle"
+ latin:keyXPos="-10.0%p"
+ latin:keyWidth="fillBoth"
+ latin:keyEdgeFlags="right" />
+ </Row>
+ <Row
+ latin:keyWidth="8.0%p"
+ >
+ <Key
+ latin:keyLabel="ش"
+ latin:keyXPos="3.0%p" />
+ <Key
+ latin:keyLabel="س" />
+ <Key
+ latin:keyLabel="ي" />
+ <Key
+ latin:keyLabel="ب"
+ latin:popupCharacters="ب,پ" />
+ <Key
+ latin:keyLabel="ل"
+ latin:popupCharacters="ل,لا" />
+ <Key
+ latin:keyLabel="ا"
+ latin:popupCharacters="ا,أ,إ,آ" />
+ <Key
+ latin:keyLabel="ت" />
+ <Key
+ latin:keyLabel="ن" />
+ <Key
+ latin:keyLabel="م" />
+ <Key
+ latin:keyLabel="ك"
+ latin:popupCharacters="ك,گ" />
+ <Key
+ latin:keyLabel="ط" />
+ <Key
+ latin:keyStyle="returnKeyStyle"
+ latin:keyXPos="-14.6%p"
+ latin:keyWidth="fillBoth"
+ latin:keyEdgeFlags="right" />
+ </Row>
+ <Row
+ latin:keyWidth="7.65%p"
+ >
+ <Key
+ latin:keyStyle="shiftKeyStyle"
+ latin:keyWidth="8.0%p"
+ latin:keyEdgeFlags="left" />
+ <Key
+ latin:keyLabel="ئ" />
+ <Key
+ latin:keyLabel="ء" />
+ <Key
+ latin:keyLabel="ؤ" />
+ <Key
+ latin:keyLabel="ر" />
+ <Key
+ latin:keyLabel="ذ" />
+ <Key
+ latin:keyLabel="ى" />
+ <Key
+ latin:keyLabel="ة" />
+ <Key
+ latin:keyLabel="و" />
+ <Key
+ latin:keyLabel="ز"
+ latin:popupCharacters="ز,ژ" />
+ <Key
+ latin:keyLabel="ظ" />
+ <Key
+ latin:keyLabel="د" />
+ <include
+ latin:keyboardLayout="@xml/kbd_row3_right" />
+ </Row>
+ <include latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+</merge>
diff --git a/java/res/xml-sw600dp/kbd_azerty_rows.xml b/java/res/xml-sw600dp/kbd_rows_azerty.xml
index 269c6ef8f..b53bbbbf9 100644
--- a/java/res/xml-sw600dp/kbd_azerty_rows.xml
+++ b/java/res/xml-sw600dp/kbd_rows_azerty.xml
@@ -24,7 +24,7 @@
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
<Row
- latin:keyWidth="9.0%p"
+ latin:keyWidth="8.5%p"
latin:rowEdgeFlags="top"
>
<Key
@@ -65,11 +65,12 @@
latin:keyEdgeFlags="right" />
</Row>
<Row
- latin:keyWidth="9.0%p"
+ latin:keyWidth="8.5%p"
>
<Key
latin:keyLabel="q"
latin:popupCharacters="@string/alternates_for_q"
+ latin:keyXPos="5.0%p"
latin:keyEdgeFlags="left" />
<Key
latin:keyLabel="s"
@@ -101,7 +102,7 @@
latin:keyEdgeFlags="right" />
</Row>
<Row
- latin:keyWidth="8.9%p"
+ latin:keyWidth="8.5%p"
>
<Key
latin:keyStyle="shiftKeyStyle"
@@ -149,7 +150,7 @@
</switch>
<include
latin:keyboardLayout="@xml/kbd_row3_right" />
- </Row>
+ </Row>
<include
latin:keyboardLayout="@xml/kbd_qwerty_row4" />
</merge>
diff --git a/java/res/xml-sw600dp/kbd_rows_hebrew.xml b/java/res/xml-sw600dp/kbd_rows_hebrew.xml
new file mode 100644
index 000000000..a1475376b
--- /dev/null
+++ b/java/res/xml-sw600dp/kbd_rows_hebrew.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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/kbd_key_styles" />
+ <Row
+ latin:keyWidth="8.600%p"
+ latin:rowEdgeFlags="top"
+ >
+ <Key
+ latin:keyLabel="," />
+ <Key
+ latin:keyLabel="." />
+ <Key
+ latin:keyLabel="ק" />
+ <Key
+ latin:keyLabel="ר" />
+ <Key
+ latin:keyLabel="א" />
+ <Key
+ latin:keyLabel="ט" />
+ <Key
+ latin:keyLabel="ו" />
+ <Key
+ latin:keyLabel="ן" />
+ <Key
+ latin:keyLabel="ם" />
+ <Key
+ latin:keyLabel="פ" />
+ <Key
+ latin:keyStyle="deleteKeyStyle"
+ latin:keyXPos="-12.000%p"
+ latin:keyWidth="fillBoth"
+ latin:keyEdgeFlags="right" />
+ </Row>
+ <Row
+ latin:keyWidth="8.600%p"
+ >
+ <Key
+ latin:keyLabel="ש"
+ latin:keyXPos="4.000%p" />
+ <Key
+ latin:keyLabel="ד" />
+ <Key
+ latin:keyLabel="ג"
+ latin:popupCharacters="ג,ג׳" />
+ <Key
+ latin:keyLabel="כ" />
+ <Key
+ latin:keyLabel="ע" />
+ <Key
+ latin:keyLabel="י"
+ latin:popupCharacters="י,ײַ" />
+ <Key
+ latin:keyLabel="ח"
+ latin:popupCharacters="ח,ח׳" />
+ <Key
+ latin:keyLabel="ל" />
+ <Key
+ latin:keyLabel="ך" />
+ <Key
+ latin:keyLabel="ף" />
+ <Key
+ latin:keyStyle="returnKeyStyle"
+ latin:keyXPos="-10.400%p"
+ latin:keyWidth="fillBoth"
+ latin:keyEdgeFlags="right" />
+ </Row>
+ <Row
+ latin:keyWidth="8.600%p"
+ >
+ <Key
+ latin:keyStyle="shiftKeyStyle"
+ latin:keyWidth="10.000%p"
+ latin:keyEdgeFlags="left" />
+ <Key
+ latin:keyLabel="ז"
+ latin:popupCharacters="ז,ז׳" />
+ <Key
+ latin:keyLabel="ס" />
+ <Key
+ latin:keyLabel="ב" />
+ <Key
+ latin:keyLabel="ה" />
+ <Key
+ latin:keyLabel="נ" />
+ <Key
+ latin:keyLabel="מ" />
+ <Key
+ latin:keyLabel="צ"
+ latin:popupCharacters="צ,צ׳" />
+ <Key
+ latin:keyLabel="ת"
+ latin:popupCharacters="ת,ת׳" />
+ <Key
+ latin:keyLabel="ץ"
+ latin:popupCharacters="ץ,ץ׳" />
+ <include
+ latin:keyboardLayout="@xml/kbd_row3_right" />
+ </Row>
+ <include latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+</merge>
diff --git a/java/res/xml-sw600dp/kbd_qwerty_rows.xml b/java/res/xml-sw600dp/kbd_rows_qwerty.xml
index a2d26b3de..a2d26b3de 100644
--- a/java/res/xml-sw600dp/kbd_qwerty_rows.xml
+++ b/java/res/xml-sw600dp/kbd_rows_qwerty.xml
diff --git a/java/res/xml-sw600dp/kbd_qwertz_rows.xml b/java/res/xml-sw600dp/kbd_rows_qwertz.xml
index 7ea9b0f37..7ea9b0f37 100644
--- a/java/res/xml-sw600dp/kbd_qwertz_rows.xml
+++ b/java/res/xml-sw600dp/kbd_rows_qwertz.xml
diff --git a/java/res/xml-sw600dp/kbd_ru_rows.xml b/java/res/xml-sw600dp/kbd_rows_russian.xml
index 43fa665e6..43fa665e6 100644
--- a/java/res/xml-sw600dp/kbd_ru_rows.xml
+++ b/java/res/xml-sw600dp/kbd_rows_russian.xml
diff --git a/java/res/xml-sw600dp/kbd_qwerty_rows_scandinavia.xml b/java/res/xml-sw600dp/kbd_rows_scandinavian.xml
index 0bdcd21f4..3666ead51 100644
--- a/java/res/xml-sw600dp/kbd_qwerty_rows_scandinavia.xml
+++ b/java/res/xml-sw600dp/kbd_rows_scandinavian.xml
@@ -24,13 +24,12 @@
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
<Row
- latin:keyWidth="8.0%p"
+ latin:keyWidth="7.9%p"
latin:rowEdgeFlags="top"
>
<Key
latin:keyLabel="q"
latin:popupCharacters="@string/alternates_for_q"
- latin:keyXPos="2.15%p"
latin:keyEdgeFlags="left" />
<Key
latin:keyLabel="w"
@@ -68,10 +67,11 @@
latin:keyEdgeFlags="right" />
</Row>
<Row
- latin:keyWidth="8.0%p"
+ latin:keyWidth="7.9%p"
>
<Key
latin:keyLabel="a"
+ latin:keyXPos="3.5%p"
latin:popupCharacters="@string/alternates_for_a"
latin:keyEdgeFlags="left" />
<Key
@@ -107,8 +107,60 @@
latin:keyWidth="fillBoth"
latin:keyEdgeFlags="right" />
</Row>
- <include
- latin:keyboardLayout="@xml/kbd_qwerty_row3" />
+ <Row
+ latin:keyWidth="7.9%p"
+ >
+ <Key
+ latin:keyStyle="shiftKeyStyle"
+ latin:keyWidth="10.0%p"
+ latin:keyEdgeFlags="left" />
+ <Spacer
+ latin:keyWidth="4.35%p" />
+ <Key
+ latin:keyLabel="z"
+ latin:popupCharacters="@string/alternates_for_z" />
+ <Key
+ latin:keyLabel="x" />
+ <Key
+ latin:keyLabel="c"
+ latin:popupCharacters="@string/alternates_for_c" />
+ <Key
+ latin:keyLabel="v"
+ latin:popupCharacters="@string/alternates_for_v" />
+ <Key
+ latin:keyLabel="b" />
+ <Key
+ latin:keyLabel="n"
+ latin:popupCharacters="@string/alternates_for_n" />
+ <Key
+ latin:keyLabel="m" />
+ <switch>
+ <case
+ latin:mode="email"
+ >
+ <Key
+ latin:keyLabel="," />
+ <Key
+ latin:keyLabel="." />
+ </case>
+ <default>
+ <Key
+ latin:keyLabel=","
+ latin:keyLabelOption="hasUppercaseLetter"
+ latin:keyHintLetter="!"
+ latin:popupCharacters="!" />
+ <Key
+ latin:keyLabel="."
+ latin:keyLabelOption="hasUppercaseLetter"
+ latin:keyHintLetter="\?"
+ latin:popupCharacters="\?" />
+ </default>
+ </switch>
+ <Spacer
+ latin:keyWidth="4.35%p" />
+ <include
+ latin:keyboardLayout="@xml/kbd_row3_right" />
+ </Row>
<include
latin:keyboardLayout="@xml/kbd_qwerty_row4" />
</merge>
diff --git a/java/res/xml-sw600dp/kbd_sr_rows.xml b/java/res/xml-sw600dp/kbd_rows_serbian.xml
index 80debdadb..80debdadb 100644
--- a/java/res/xml-sw600dp/kbd_sr_rows.xml
+++ b/java/res/xml-sw600dp/kbd_rows_serbian.xml
diff --git a/java/res/xml-sw600dp/kbd_rows_spanish.xml b/java/res/xml-sw600dp/kbd_rows_spanish.xml
new file mode 100644
index 000000000..7ef44bb53
--- /dev/null
+++ b/java/res/xml-sw600dp/kbd_rows_spanish.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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/kbd_key_styles" />
+ <include
+ latin:keyboardLayout="@xml/kbd_qwerty_row1" />
+ <Row
+ latin:keyWidth="8.5%p"
+ >
+ <Key
+ latin:keyLabel="a"
+ latin:popupCharacters="@string/alternates_for_a"
+ latin:keyXPos="5.0%p"
+ latin:keyEdgeFlags="left" />
+ <Key
+ latin:keyLabel="s"
+ latin:popupCharacters="@string/alternates_for_s" />
+ <Key
+ latin:keyLabel="d"
+ latin:popupCharacters="@string/alternates_for_d" />
+ <Key
+ latin:keyLabel="f" />
+ <Key
+ latin:keyLabel="g"
+ latin:popupCharacters="@string/alternates_for_g" />
+ <Key
+ latin:keyLabel="h" />
+ <Key
+ latin:keyLabel="j" />
+ <Key
+ latin:keyLabel="k"
+ latin:popupCharacters="@string/alternates_for_k" />
+ <Key
+ latin:keyLabel="l"
+ latin:popupCharacters="@string/alternates_for_l" />
+ <Key
+ latin:keyLabel="ñ" />
+ <Key
+ latin:keyStyle="returnKeyStyle"
+ latin:keyXPos="-14.6%p"
+ latin:keyWidth="fillBoth"
+ latin:keyEdgeFlags="right" />
+ </Row>
+ <include
+ latin:keyboardLayout="@xml/kbd_qwerty_row3" />
+ <include
+ latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+</merge>
diff --git a/java/res/xml-sw600dp/kbd_symbols.xml b/java/res/xml-sw600dp/kbd_symbols.xml
index 3593c7788..4d3e7d3a2 100644
--- a/java/res/xml-sw600dp/kbd_symbols.xml
+++ b/java/res/xml-sw600dp/kbd_symbols.xml
@@ -20,13 +20,6 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml-sw600dp/kbd_symbols_shift.xml b/java/res/xml-sw600dp/kbd_symbols_shift.xml
index 4cef3a78f..1743c0ff2 100644
--- a/java/res/xml-sw600dp/kbd_symbols_shift.xml
+++ b/java/res/xml-sw600dp/kbd_symbols_shift.xml
@@ -20,13 +20,6 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml-sw768dp/kbd_number.xml b/java/res/xml-sw768dp/kbd_number.xml
index faab38ade..4f33e4154 100644
--- a/java/res/xml-sw768dp/kbd_number.xml
+++ b/java/res/xml-sw768dp/kbd_number.xml
@@ -20,15 +20,7 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
latin:keyWidth="13.250%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml-sw768dp/kbd_phone.xml b/java/res/xml-sw768dp/kbd_phone.xml
index 0c6523383..69169ffd1 100644
--- a/java/res/xml-sw768dp/kbd_phone.xml
+++ b/java/res/xml-sw768dp/kbd_phone.xml
@@ -20,15 +20,7 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
latin:keyWidth="13.250%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml-sw768dp/kbd_phone_symbols.xml b/java/res/xml-sw768dp/kbd_phone_symbols.xml
index da2ac6552..e95579c0a 100644
--- a/java/res/xml-sw768dp/kbd_phone_symbols.xml
+++ b/java/res/xml-sw768dp/kbd_phone_symbols.xml
@@ -20,15 +20,7 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
latin:keyWidth="13.250%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml-sw768dp/kbd_ar_rows.xml b/java/res/xml-sw768dp/kbd_rows_arabic.xml
index c1810026b..c1810026b 100644
--- a/java/res/xml-sw768dp/kbd_ar_rows.xml
+++ b/java/res/xml-sw768dp/kbd_rows_arabic.xml
diff --git a/java/res/xml-sw768dp/kbd_azerty_rows.xml b/java/res/xml-sw768dp/kbd_rows_azerty.xml
index 3bcba0042..3bcba0042 100644
--- a/java/res/xml-sw768dp/kbd_azerty_rows.xml
+++ b/java/res/xml-sw768dp/kbd_rows_azerty.xml
diff --git a/java/res/xml-sw768dp/kbd_iw_rows.xml b/java/res/xml-sw768dp/kbd_rows_hebrew.xml
index 5275a1f15..5275a1f15 100644
--- a/java/res/xml-sw768dp/kbd_iw_rows.xml
+++ b/java/res/xml-sw768dp/kbd_rows_hebrew.xml
diff --git a/java/res/xml-sw768dp/kbd_qwerty_rows.xml b/java/res/xml-sw768dp/kbd_rows_qwerty.xml
index 6237712f6..6237712f6 100644
--- a/java/res/xml-sw768dp/kbd_qwerty_rows.xml
+++ b/java/res/xml-sw768dp/kbd_rows_qwerty.xml
diff --git a/java/res/xml-sw768dp/kbd_qwertz_rows.xml b/java/res/xml-sw768dp/kbd_rows_qwertz.xml
index 8d5f1e6d4..8d5f1e6d4 100644
--- a/java/res/xml-sw768dp/kbd_qwertz_rows.xml
+++ b/java/res/xml-sw768dp/kbd_rows_qwertz.xml
diff --git a/java/res/xml-sw768dp/kbd_ru_rows.xml b/java/res/xml-sw768dp/kbd_rows_russian.xml
index ee91481c1..ee91481c1 100644
--- a/java/res/xml-sw768dp/kbd_ru_rows.xml
+++ b/java/res/xml-sw768dp/kbd_rows_russian.xml
diff --git a/java/res/xml-sw768dp/kbd_qwerty_rows_scandinavia.xml b/java/res/xml-sw768dp/kbd_rows_scandinavian.xml
index 7e9f604f5..7e9f604f5 100644
--- a/java/res/xml-sw768dp/kbd_qwerty_rows_scandinavia.xml
+++ b/java/res/xml-sw768dp/kbd_rows_scandinavian.xml
diff --git a/java/res/xml-sw768dp/kbd_sr_rows.xml b/java/res/xml-sw768dp/kbd_rows_serbian.xml
index 4997dabb9..4997dabb9 100644
--- a/java/res/xml-sw768dp/kbd_sr_rows.xml
+++ b/java/res/xml-sw768dp/kbd_rows_serbian.xml
diff --git a/java/res/xml-sw768dp/kbd_rows_spanish.xml b/java/res/xml-sw768dp/kbd_rows_spanish.xml
new file mode 100644
index 000000000..300592e6a
--- /dev/null
+++ b/java/res/xml-sw768dp/kbd_rows_spanish.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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/kbd_key_styles" />
+ <include
+ latin:keyboardLayout="@xml/kbd_qwerty_row1" />
+ <Row
+ latin:keyWidth="8.125%p"
+ >
+ <Key
+ latin:keyStyle="toSymbolKeyStyle"
+ latin:keyLabelOption="alignLeft"
+ latin:keyWidth="10.167%p"
+ latin:keyEdgeFlags="left" />
+ <Key
+ latin:keyLabel="a"
+ latin:popupCharacters="@string/alternates_for_a" />
+ <Key
+ latin:keyLabel="s"
+ latin:popupCharacters="@string/alternates_for_s" />
+ <Key
+ latin:keyLabel="d"
+ latin:popupCharacters="@string/alternates_for_d" />
+ <Key
+ latin:keyLabel="f" />
+ <Key
+ latin:keyLabel="g"
+ latin:popupCharacters="@string/alternates_for_g" />
+ <Key
+ latin:keyLabel="h" />
+ <Key
+ latin:keyLabel="j" />
+ <Key
+ latin:keyLabel="k"
+ latin:popupCharacters="@string/alternates_for_k" />
+ <Key
+ latin:keyLabel="l"
+ latin:popupCharacters="@string/alternates_for_l" />
+ <Key
+ latin:keyLabel="ñ" />
+ <Key
+ latin:keyStyle="returnKeyStyle"
+ latin:keyXPos="-15.704%p"
+ latin:keyWidth="fillBoth"
+ latin:keyEdgeFlags="right" />
+ </Row>
+ <include
+ latin:keyboardLayout="@xml/kbd_qwerty_row3" />
+ <include
+ latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+</merge>
diff --git a/java/res/xml-sw768dp/kbd_symbols.xml b/java/res/xml-sw768dp/kbd_symbols.xml
index 5b359bfbf..d1a83c479 100644
--- a/java/res/xml-sw768dp/kbd_symbols.xml
+++ b/java/res/xml-sw768dp/kbd_symbols.xml
@@ -20,14 +20,6 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml-sw768dp/kbd_symbols_shift.xml b/java/res/xml-sw768dp/kbd_symbols_shift.xml
index 94bd761ba..dde144fdf 100644
--- a/java/res/xml-sw768dp/kbd_symbols_shift.xml
+++ b/java/res/xml-sw768dp/kbd_symbols_shift.xml
@@ -20,14 +20,6 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml/kbd_number.xml b/java/res/xml/kbd_number.xml
index 23b88a5bd..429b81846 100644
--- a/java/res/xml/kbd_number.xml
+++ b/java/res/xml/kbd_number.xml
@@ -20,15 +20,7 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
latin:keyWidth="26.67%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml/kbd_phone.xml b/java/res/xml/kbd_phone.xml
index e1d1ee8d0..211f7b7f7 100644
--- a/java/res/xml/kbd_phone.xml
+++ b/java/res/xml/kbd_phone.xml
@@ -20,15 +20,7 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
latin:keyWidth="26.67%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml/kbd_phone_symbols.xml b/java/res/xml/kbd_phone_symbols.xml
index 2af218cfe..c6513632c 100644
--- a/java/res/xml/kbd_phone_symbols.xml
+++ b/java/res/xml/kbd_phone_symbols.xml
@@ -20,15 +20,7 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
latin:keyWidth="26.67%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml/kbd_qwerty.xml b/java/res/xml/kbd_qwerty.xml
index f0c1fa7fc..40917b921 100644
--- a/java/res/xml/kbd_qwerty.xml
+++ b/java/res/xml/kbd_qwerty.xml
@@ -20,16 +20,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
latin:keyboardLocale="en_GB,en_US"
>
<include
- latin:keyboardLayout="@xml/kbd_qwerty_rows" />
+ latin:keyboardLayout="@xml/kbd_rows_qwerty" />
</Keyboard>
diff --git a/java/res/xml/kbd_qwerty_f1.xml b/java/res/xml/kbd_qwerty_f1.xml
index e89d02d91..88dfab116 100644
--- a/java/res/xml/kbd_qwerty_f1.xml
+++ b/java/res/xml/kbd_qwerty_f1.xml
@@ -46,7 +46,7 @@
</case>
<!-- latin:hasVoiceKey="false" -->
<case
- latin:webInput="true"
+ latin:navigateAction="true"
>
<Key
latin:keyLabel="."
diff --git a/java/res/xml/kbd_qwerty_row4.xml b/java/res/xml/kbd_qwerty_row4.xml
index dfe5de359..95be66dfa 100644
--- a/java/res/xml/kbd_qwerty_row4.xml
+++ b/java/res/xml/kbd_qwerty_row4.xml
@@ -56,7 +56,7 @@
</switch>
<switch>
<case
- latin:webInput="true"
+ latin:navigateAction="true"
>
<Key
latin:keyStyle="tabKeyStyle"
diff --git a/java/res/xml/kbd_ar_rows.xml b/java/res/xml/kbd_rows_arabic.xml
index a548775a4..a548775a4 100644
--- a/java/res/xml/kbd_ar_rows.xml
+++ b/java/res/xml/kbd_rows_arabic.xml
diff --git a/java/res/xml/kbd_azerty_rows.xml b/java/res/xml/kbd_rows_azerty.xml
index 9825c4a10..9825c4a10 100644
--- a/java/res/xml/kbd_azerty_rows.xml
+++ b/java/res/xml/kbd_rows_azerty.xml
diff --git a/java/res/xml/kbd_iw_rows.xml b/java/res/xml/kbd_rows_hebrew.xml
index c3c8f7d3e..c3c8f7d3e 100644
--- a/java/res/xml/kbd_iw_rows.xml
+++ b/java/res/xml/kbd_rows_hebrew.xml
diff --git a/java/res/xml/kbd_qwerty_rows.xml b/java/res/xml/kbd_rows_qwerty.xml
index 6237712f6..6237712f6 100644
--- a/java/res/xml/kbd_qwerty_rows.xml
+++ b/java/res/xml/kbd_rows_qwerty.xml
diff --git a/java/res/xml/kbd_qwertz_rows.xml b/java/res/xml/kbd_rows_qwertz.xml
index 0d70b2637..0d70b2637 100644
--- a/java/res/xml/kbd_qwertz_rows.xml
+++ b/java/res/xml/kbd_rows_qwertz.xml
diff --git a/java/res/xml/kbd_ru_rows.xml b/java/res/xml/kbd_rows_russian.xml
index ff9fef409..ff9fef409 100644
--- a/java/res/xml/kbd_ru_rows.xml
+++ b/java/res/xml/kbd_rows_russian.xml
diff --git a/java/res/xml/kbd_qwerty_rows_scandinavia.xml b/java/res/xml/kbd_rows_scandinavian.xml
index 2d7dcde7a..2d7dcde7a 100644
--- a/java/res/xml/kbd_qwerty_rows_scandinavia.xml
+++ b/java/res/xml/kbd_rows_scandinavian.xml
diff --git a/java/res/xml/kbd_sr_rows.xml b/java/res/xml/kbd_rows_serbian.xml
index 9f4b6a203..9f4b6a203 100644
--- a/java/res/xml/kbd_sr_rows.xml
+++ b/java/res/xml/kbd_rows_serbian.xml
diff --git a/java/res/xml/kbd_rows_spanish.xml b/java/res/xml/kbd_rows_spanish.xml
new file mode 100644
index 000000000..c5ead10da
--- /dev/null
+++ b/java/res/xml/kbd_rows_spanish.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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/kbd_key_styles" />
+ <include
+ latin:keyboardLayout="@xml/kbd_qwerty_row1" />
+ <Row
+ latin:keyWidth="10%p"
+ >
+ <Key
+ latin:keyLabel="a"
+ latin:popupCharacters="@string/alternates_for_a"
+ latin:keyEdgeFlags="left" />
+ <Key
+ latin:keyLabel="s"
+ latin:popupCharacters="@string/alternates_for_s" />
+ <Key
+ latin:keyLabel="d"
+ latin:popupCharacters="@string/alternates_for_d" />
+ <Key
+ latin:keyLabel="f" />
+ <Key
+ latin:keyLabel="g"
+ latin:popupCharacters="@string/alternates_for_g" />
+ <Key
+ latin:keyLabel="h" />
+ <Key
+ latin:keyLabel="j" />
+ <Key
+ latin:keyLabel="k"
+ latin:popupCharacters="@string/alternates_for_k" />
+ <Key
+ latin:keyLabel="l"
+ latin:popupCharacters="@string/alternates_for_l" />
+ <Key
+ latin:keyLabel="ñ"
+ latin:keyEdgeFlags="right" />
+ </Row>
+ <include
+ latin:keyboardLayout="@xml/kbd_qwerty_row3" />
+ <include
+ latin:keyboardLayout="@xml/kbd_qwerty_row4" />
+</merge>
diff --git a/java/res/xml/kbd_symbols.xml b/java/res/xml/kbd_symbols.xml
index a58a51874..8e9124f74 100644
--- a/java/res/xml/kbd_symbols.xml
+++ b/java/res/xml/kbd_symbols.xml
@@ -20,15 +20,7 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
latin:keyWidth="10%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml/kbd_symbols_shift.xml b/java/res/xml/kbd_symbols_shift.xml
index 96e741bbc..f22d45aff 100644
--- a/java/res/xml/kbd_symbols_shift.xml
+++ b/java/res/xml/kbd_symbols_shift.xml
@@ -20,15 +20,7 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
- latin:minKeyboardHeight="@fraction/minKeyboardHeight"
- latin:rowHeight="25%p"
latin:keyWidth="10%p"
- latin:horizontalGap="@dimen/key_horizontal_gap"
- latin:verticalGap="@dimen/key_bottom_gap"
- latin:popupKeyboardTemplate="@xml/kbd_popup_template"
- latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index aba6974a8..9c416170d 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -20,7 +20,7 @@
<!-- The attributes in this XML file provide configuration information -->
<!-- for the Input Method Manager. -->
-<!-- Keyboard: en_US, en_GB, cs, da, de, es, es_US, fr, fr_CA, fr_CH, it, nb, nl, sr, sv -->
+<!-- Keyboard: en_US, en_GB, ar, cs, da, de, es, es_US, fi, fr, fr_CA, fr_CH, hr, hu, it, iw, nb, nl, pl, pt, ru, sr, sv -->
<!-- Voice: af, cs, da, de, en, es, fr, it, ja, ko, nl, pl, pt, ru, tr, yue, zh, zu -->
<!-- TODO: use <lang>_keyboard icon instead of a common keyboard icon. -->
<!-- TODO: use <lang>_mic icon instead of a common mic icon. -->
@@ -91,6 +91,11 @@
<!-- android:imeSubtypeExtraValue="excludeFromLastInputMethod,requireNetworkConnectivity" -->
<!-- /> -->
<subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:label="@string/subtype_mode_fi_keyboard"
+ android:imeSubtypeLocale="fi"
+ android:imeSubtypeMode="keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_mode_fr_keyboard"
android:imeSubtypeLocale="fr"
android:imeSubtypeMode="keyboard"
@@ -112,6 +117,16 @@
android:imeSubtypeMode="keyboard"
/>
<subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:label="@string/subtype_mode_hr_keyboard"
+ android:imeSubtypeLocale="hr"
+ android:imeSubtypeMode="keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:label="@string/subtype_mode_hu_keyboard"
+ android:imeSubtypeLocale="hu"
+ android:imeSubtypeMode="keyboard"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_mode_it_keyboard"
android:imeSubtypeLocale="it"
android:imeSubtypeMode="keyboard"
diff --git a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
index 2789bcb39..bcdcef7dc 100644
--- a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java
@@ -27,7 +27,7 @@ public class EditorInfoCompatUtils {
private static final Field FIELD_IME_FLAG_NAVIGATE_PREVIOUS = CompatUtils.getField(
EditorInfo.class, "IME_FLAG_NAVIGATE_PREVIOUS");
private static final Field FIELD_IME_ACTION_PREVIOUS = CompatUtils.getField(
- EditorInfo.class, "IME_FLAG_ACTION_PREVIOUS");
+ EditorInfo.class, "IME_ACTION_PREVIOUS");
private static final Integer OBJ_IME_FLAG_NAVIGATE_NEXT = (Integer) CompatUtils
.getFieldValue(null, null, FIELD_IME_FLAG_NAVIGATE_NEXT);
private static final Integer OBJ_IME_FLAG_NAVIGATE_PREVIOUS = (Integer) CompatUtils
diff --git a/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
index 828aea41f..7d8c745c3 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodServiceCompatWrapper.java
@@ -16,12 +16,12 @@
package com.android.inputmethod.compat;
-import com.android.inputmethod.deprecated.LanguageSwitcherProxy;
-import com.android.inputmethod.latin.SubtypeSwitcher;
-
import android.inputmethodservice.InputMethodService;
import android.view.inputmethod.InputMethodSubtype;
+import com.android.inputmethod.deprecated.LanguageSwitcherProxy;
+import com.android.inputmethod.latin.SubtypeSwitcher;
+
public class InputMethodServiceCompatWrapper extends InputMethodService {
// CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED needs to be false if the API level is 10
// or previous. Note that InputMethodSubtype was added in the API level 11.
diff --git a/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java b/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
index 5d89669b7..4929dd948 100644
--- a/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
+++ b/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
@@ -30,12 +30,14 @@ import java.util.ArrayList;
import java.util.Locale;
public class SuggestionSpanUtils {
+ // TODO: Use reflection to get field values
public static final String ACTION_SUGGESTION_PICKED =
"android.text.style.SUGGESTION_PICKED";
public static final String SUGGESTION_SPAN_PICKED_AFTER = "after";
public static final String SUGGESTION_SPAN_PICKED_BEFORE = "before";
public static final String SUGGESTION_SPAN_PICKED_HASHCODE = "hashcode";
public static final int SUGGESTION_MAX_SIZE = 5;
+ public static final boolean SUGGESTION_SPAN_IS_SUPPORTED;
private static final Class<?> CLASS_SuggestionSpan = CompatUtils
.getClass("android.text.style.SuggestionSpan");
@@ -43,24 +45,23 @@ public class SuggestionSpanUtils {
Context.class, Locale.class, String[].class, int.class, Class.class };
private static final Constructor<?> CONSTRUCTOR_SuggestionSpan = CompatUtils
.getConstructor(CLASS_SuggestionSpan, INPUT_TYPE_SuggestionSpan);
- public static final boolean SUGGESTION_SPAN_IS_SUPPORTED;
static {
SUGGESTION_SPAN_IS_SUPPORTED =
CLASS_SuggestionSpan != null && CONSTRUCTOR_SuggestionSpan != null;
}
public static CharSequence getTextWithSuggestionSpan(Context context,
- CharSequence suggestion, SuggestedWords suggestedWords) {
- if (TextUtils.isEmpty(suggestion) || CONSTRUCTOR_SuggestionSpan == null
+ CharSequence pickedWord, SuggestedWords suggestedWords) {
+ if (TextUtils.isEmpty(pickedWord) || CONSTRUCTOR_SuggestionSpan == null
|| suggestedWords == null || suggestedWords.size() == 0) {
- return suggestion;
+ return pickedWord;
}
final Spannable spannable;
- if (suggestion instanceof Spannable) {
- spannable = (Spannable) suggestion;
+ if (pickedWord instanceof Spannable) {
+ spannable = (Spannable) pickedWord;
} else {
- spannable = new SpannableString(suggestion);
+ spannable = new SpannableString(pickedWord);
}
final ArrayList<String> suggestionsList = new ArrayList<String>();
for (int i = 0; i < suggestedWords.size(); ++i) {
@@ -68,7 +69,7 @@ public class SuggestionSpanUtils {
break;
}
final CharSequence word = suggestedWords.getWord(i);
- if (!TextUtils.equals(suggestion, word)) {
+ if (!TextUtils.equals(pickedWord, word)) {
suggestionsList.add(word.toString());
}
}
@@ -78,9 +79,9 @@ public class SuggestionSpanUtils {
(Class<?>) SuggestionSpanPickedNotificationReceiver.class };
final Object ss = CompatUtils.newInstance(CONSTRUCTOR_SuggestionSpan, args);
if (ss == null) {
- return suggestion;
+ return pickedWord;
}
- spannable.setSpan(ss, 0, suggestion.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+ spannable.setSpan(ss, 0, pickedWord.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return spannable;
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 3db214ec9..58629ba51 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -18,7 +18,6 @@ package com.android.inputmethod.keyboard;
import android.content.Context;
import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.Log;
@@ -173,11 +172,6 @@ public class Keyboard {
mDefaultHeight = mDefaultWidth;
mId = id;
mProximityInfo = new ProximityInfo(GRID_WIDTH, GRID_HEIGHT);
-
- final TypedArray attrs = context.obtainStyledAttributes(
- null, R.styleable.Keyboard, R.attr.keyboardStyle, R.style.Keyboard);
- attrs.recycle();
-
loadKeyboard(context, xmlLayoutResId);
}
@@ -440,7 +434,7 @@ public class Keyboard {
private void loadKeyboard(Context context, int xmlLayoutResId) {
try {
- KeyboardParser parser = new KeyboardParser(this, context.getResources());
+ KeyboardParser parser = new KeyboardParser(this, context);
parser.parseKeyboard(xmlLayoutResId);
// mMinWidth is the width of this keyboard which is maximum width of row.
mMinWidth = parser.getMaxRowWidth();
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
index 7c03ec71e..d97bb6730 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
@@ -16,12 +16,12 @@
package com.android.inputmethod.keyboard;
+import android.view.inputmethod.EditorInfo;
+
import com.android.inputmethod.compat.EditorInfoCompatUtils;
import com.android.inputmethod.compat.InputTypeCompatUtils;
import com.android.inputmethod.latin.R;
-import android.view.inputmethod.EditorInfo;
-
import java.util.Arrays;
import java.util.Locale;
@@ -43,7 +43,7 @@ public class KeyboardId {
public final int mMode;
public final int mXmlId;
public final int mColorScheme;
- public final boolean mWebInput;
+ public final boolean mNavigateAction;
public final boolean mPasswordInput;
public final boolean mHasSettingsKey;
public final boolean mVoiceKeyEnabled;
@@ -67,7 +67,10 @@ public class KeyboardId {
this.mMode = mode;
this.mXmlId = xmlId;
this.mColorScheme = colorScheme;
- this.mWebInput = InputTypeCompatUtils.isWebInputType(inputType);
+ // Note: Turn off checking navigation flag to show TAB key for now.
+ this.mNavigateAction = InputTypeCompatUtils.isWebInputType(inputType);
+// || EditorInfoCompatUtils.hasFlagNavigateNext(imeOptions)
+// || EditorInfoCompatUtils.hasFlagNavigatePrevious(imeOptions);
this.mPasswordInput = InputTypeCompatUtils.isPasswordInputType(inputType)
|| InputTypeCompatUtils.isVisiblePasswordInputType(inputType);
this.mHasSettingsKey = hasSettingsKey;
@@ -89,7 +92,7 @@ public class KeyboardId {
mode,
xmlId,
colorScheme,
- mWebInput,
+ mNavigateAction,
mPasswordInput,
hasSettingsKey,
voiceKeyEnabled,
@@ -143,7 +146,7 @@ public class KeyboardId {
&& other.mMode == this.mMode
&& other.mXmlId == this.mXmlId
&& other.mColorScheme == this.mColorScheme
- && other.mWebInput == this.mWebInput
+ && other.mNavigateAction == this.mNavigateAction
&& other.mPasswordInput == this.mPasswordInput
&& other.mHasSettingsKey == this.mHasSettingsKey
&& other.mVoiceKeyEnabled == this.mVoiceKeyEnabled
@@ -166,7 +169,7 @@ public class KeyboardId {
modeName(mMode),
EditorInfoCompatUtils.imeOptionsName(mImeAction),
colorSchemeName(mColorScheme),
- (mWebInput ? " webInput" : ""),
+ (mNavigateAction ? " navigateAction" : ""),
(mPasswordInput ? " passwordInput" : ""),
(mHasSettingsKey ? " hasSettingsKey" : ""),
(mVoiceKeyEnabled ? " voiceKeyEnabled" : ""),
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
index 07166b1db..20af12bc5 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
@@ -121,6 +121,7 @@ public class KeyboardParser {
public static final String TAG_KEY_STYLE = "key-style";
private final Keyboard mKeyboard;
+ private final Context mContext;
private final Resources mResources;
private int mHorizontalEdgesPadding;
@@ -131,8 +132,10 @@ public class KeyboardParser {
private Row mCurrentRow = null;
private final KeyStyles mKeyStyles = new KeyStyles();
- public KeyboardParser(Keyboard keyboard, Resources res) {
+ public KeyboardParser(Keyboard keyboard, Context context) {
mKeyboard = keyboard;
+ mContext = context;
+ final Resources res = context.getResources();
mResources = res;
mHorizontalEdgesPadding = (int)res.getDimension(R.dimen.keyboard_horizontal_edges_padding);
}
@@ -187,8 +190,9 @@ public class KeyboardParser {
private void parseKeyboardAttributes(XmlResourceParser parser) {
final Keyboard keyboard = mKeyboard;
- final TypedArray keyboardAttr = mResources.obtainAttributes(Xml.asAttributeSet(parser),
- R.styleable.Keyboard);
+ final TypedArray keyboardAttr = mContext.obtainStyledAttributes(
+ Xml.asAttributeSet(parser), R.styleable.Keyboard, R.attr.keyboardStyle,
+ R.style.Keyboard);
final TypedArray keyAttr = mResources.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.Keyboard_Key);
try {
@@ -469,8 +473,8 @@ public class KeyboardParser {
try {
final boolean modeMatched = matchTypedValue(a,
R.styleable.Keyboard_Case_mode, id.mMode, KeyboardId.modeName(id.mMode));
- final boolean webInputMatched = matchBoolean(a,
- R.styleable.Keyboard_Case_webInput, id.mWebInput);
+ final boolean navigateActionMatched = matchBoolean(a,
+ R.styleable.Keyboard_Case_navigateAction, id.mNavigateAction);
final boolean passwordInputMatched = matchBoolean(a,
R.styleable.Keyboard_Case_passwordInput, id.mPasswordInput);
final boolean settingsKeyMatched = matchBoolean(a,
@@ -493,7 +497,7 @@ public class KeyboardParser {
R.styleable.Keyboard_Case_languageCode, id.mLocale.getLanguage());
final boolean countryCodeMatched = matchString(a,
R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
- final boolean selected = modeMatched && webInputMatched && passwordInputMatched
+ final boolean selected = modeMatched && navigateActionMatched && passwordInputMatched
&& settingsKeyMatched && voiceEnabledMatched && voiceKeyMatched
&& colorSchemeMatched && imeActionMatched && localeCodeMatched
&& languageCodeMatched && countryCodeMatched;
@@ -503,7 +507,7 @@ public class KeyboardParser {
textAttr(KeyboardId.colorSchemeName(
viewAttr.getInt(
R.styleable.KeyboardView_colorScheme, -1)), "colorScheme"),
- booleanAttr(a, R.styleable.Keyboard_Case_webInput, "webInput"),
+ booleanAttr(a, R.styleable.Keyboard_Case_navigateAction, "navigateAction"),
booleanAttr(a, R.styleable.Keyboard_Case_passwordInput, "passwordInput"),
booleanAttr(a, R.styleable.Keyboard_Case_hasSettingsKey, "hasSettingsKey"),
booleanAttr(a, R.styleable.Keyboard_Case_voiceKeyEnabled, "voiceKeyEnabled"),
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 50c61ffae..8657768ee 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -43,7 +43,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private static final boolean DEBUG_CACHE = LatinImeLogger.sDBG;
public static final boolean DEBUG_STATE = false;
- private static String sConfigDefaultKeyboardThemeId;
public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20100902";
private static final int[] KEYBOARD_THEMES = {
R.style.KeyboardTheme,
@@ -102,7 +101,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
// Default is SETTINGS_KEY_MODE_AUTO.
private static final int DEFAULT_SETTINGS_KEY_MODE = SETTINGS_KEY_MODE_AUTO;
- private int mThemeIndex;
+ private int mThemeIndex = -1;
+ private Context mThemeContext;
private int mKeyboardWidth;
private static final KeyboardSwitcher sInstance = new KeyboardSwitcher();
@@ -119,17 +119,30 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
sInstance.mInputMethodService = ims;
sInstance.mPrefs = prefs;
sInstance.mSubtypeSwitcher = SubtypeSwitcher.getInstance();
+ sInstance.setContextThemeWrapper(ims, getKeyboardThemeIndex(ims, prefs));
+ prefs.registerOnSharedPreferenceChangeListener(sInstance);
+ }
+ private static int getKeyboardThemeIndex(Context context, SharedPreferences prefs) {
+ final String defaultThemeId = context.getString(R.string.config_default_keyboard_theme_id);
+ final String themeId = prefs.getString(PREF_KEYBOARD_LAYOUT, defaultThemeId);
try {
- sConfigDefaultKeyboardThemeId = ims.getString(
- R.string.config_default_keyboard_theme_id);
- sInstance.mThemeIndex = Integer.valueOf(
- prefs.getString(PREF_KEYBOARD_LAYOUT, sConfigDefaultKeyboardThemeId));
+ final int themeIndex = Integer.valueOf(themeId);
+ if (themeIndex >= 0 && themeIndex < KEYBOARD_THEMES.length)
+ return themeIndex;
} catch (NumberFormatException e) {
- sConfigDefaultKeyboardThemeId = "0";
- sInstance.mThemeIndex = 0;
+ // Format error, keyboard theme is default to 0.
+ }
+ Log.w(TAG, "Illegal keyboard theme in preference: " + themeId + ", default to 0");
+ return 0;
+ }
+
+ private void setContextThemeWrapper(Context context, int themeIndex) {
+ if (mThemeIndex != themeIndex) {
+ mThemeIndex = themeIndex;
+ mThemeContext = new ContextThemeWrapper(context, KEYBOARD_THEMES[themeIndex]);
+ mKeyboardCache.clear();
}
- prefs.registerOnSharedPreferenceChangeListener(sInstance);
}
public void loadKeyboard(EditorInfo attribute, boolean voiceKeyEnabled,
@@ -202,9 +215,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
final Locale savedLocale = Utils.setSystemLocale(res,
mSubtypeSwitcher.getInputLocale());
- final Context themeContext = new ContextThemeWrapper(mInputMethodService,
- KEYBOARD_THEMES[mThemeIndex]);
- keyboard = new LatinKeyboard(themeContext, id, id.mWidth);
+ keyboard = new LatinKeyboard(mThemeContext, id, id.mWidth);
if (id.mEnableShiftLock) {
keyboard.enableShiftLock();
@@ -724,30 +735,29 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
if (mKeyboardView != null) {
mKeyboardView.closing();
}
- final int themeIndex = (newThemeIndex < KEYBOARD_THEMES.length) ? newThemeIndex
- : Integer.valueOf(sConfigDefaultKeyboardThemeId);
+ final int oldThemeIndex = mThemeIndex;
Utils.GCUtils.getInstance().reset();
boolean tryGC = true;
for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
try {
- final Context themeContext = new ContextThemeWrapper(mInputMethodService,
- KEYBOARD_THEMES[themeIndex]);
- mCurrentInputView = LayoutInflater.from(themeContext).inflate(
+ setContextThemeWrapper(mInputMethodService, newThemeIndex);
+ mCurrentInputView = LayoutInflater.from(mThemeContext).inflate(
R.layout.input_view, null);
tryGC = false;
} catch (OutOfMemoryError e) {
Log.w(TAG, "load keyboard failed: " + e);
- tryGC = Utils.GCUtils.getInstance().tryGCOrWait(mThemeIndex + "," + themeIndex, e);
+ tryGC = Utils.GCUtils.getInstance().tryGCOrWait(
+ oldThemeIndex + "," + newThemeIndex, e);
} catch (InflateException e) {
Log.w(TAG, "load keyboard failed: " + e);
- tryGC = Utils.GCUtils.getInstance().tryGCOrWait(mThemeIndex + "," + themeIndex, e);
+ tryGC = Utils.GCUtils.getInstance().tryGCOrWait(
+ oldThemeIndex + "," + newThemeIndex, e);
}
}
mKeyboardView = (LatinKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view);
mKeyboardView.setOnKeyboardActionListener(mInputMethodService);
- mThemeIndex = themeIndex;
return mCurrentInputView;
}
@@ -766,8 +776,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (PREF_KEYBOARD_LAYOUT.equals(key)) {
- final int layoutId = Integer.valueOf(
- sharedPreferences.getString(key, sConfigDefaultKeyboardThemeId));
+ final int layoutId = getKeyboardThemeIndex(mInputMethodService, sharedPreferences);
postSetInputView(createInputView(layoutId, false));
} else if (Settings.PREF_SETTINGS_KEY.equals(key)) {
mSettingsKeyEnabledInSettings = getSettingsKeyMode(sharedPreferences,
@@ -782,11 +791,15 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
public void onAutoCorrectionStateChanged(boolean isAutoCorrection) {
- if (isAutoCorrection != mIsAutoCorrectionActive) {
- LatinKeyboardView keyboardView = getKeyboardView();
+ if (mIsAutoCorrectionActive != isAutoCorrection) {
mIsAutoCorrectionActive = isAutoCorrection;
- keyboardView.invalidateKey(((LatinKeyboard) keyboardView.getKeyboard())
- .onAutoCorrectionStateChanged(isAutoCorrection));
+ final LatinKeyboard keyboard = getLatinKeyboard();
+ if (keyboard != null && keyboard.needsAutoCorrectionSpacebarLed()) {
+ final Key invalidatedKey = keyboard.onAutoCorrectionStateChanged(isAutoCorrection);
+ final LatinKeyboardView keyboardView = getKeyboardView();
+ if (keyboardView != null)
+ keyboardView.invalidateKey(invalidatedKey);
+ }
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 44f2ff3ff..f73cdc083 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -626,8 +626,14 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
mDirtyRect.union(0, 0, width, height);
}
if (mBuffer == null || mBuffer.getWidth() != width || mBuffer.getHeight() != height) {
+ if (mBuffer != null)
+ mBuffer.recycle();
mBuffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
- mCanvas = new Canvas(mBuffer);
+ if (mCanvas != null) {
+ mCanvas.setBitmap(mBuffer);
+ } else {
+ mCanvas = new Canvas(mBuffer);
+ }
}
final Canvas canvas = mCanvas;
canvas.clipRect(mDirtyRect, Op.REPLACE);
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
index a6ac76751..473006deb 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
@@ -16,9 +16,6 @@
package com.android.inputmethod.keyboard;
-import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.SubtypeSwitcher;
-
import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
@@ -36,6 +33,9 @@ import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
+import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.SubtypeSwitcher;
+
import java.lang.ref.SoftReference;
import java.util.Arrays;
import java.util.HashMap;
@@ -49,7 +49,8 @@ public class LatinKeyboard extends Keyboard {
public static final int CODE_NEXT_LANGUAGE = -100;
public static final int CODE_PREV_LANGUAGE = -101;
- private final Context mContext;
+ private final Resources mRes;
+ private final Theme mTheme;
private final SubtypeSwitcher mSubtypeSwitcher = SubtypeSwitcher.getInstance();
/* Space key and its icons, drawables and colors. */
@@ -65,7 +66,7 @@ public class LatinKeyboard extends Keyboard {
private float mSpacebarTextFadeFactor = 0.0f;
private final int mSpacebarLanguageSwitchThreshold;
private int mSpacebarSlidingLanguageSwitchDiff;
- private SlidingLocaleDrawable mSlidingLocaleIcon;
+ private final SlidingLocaleDrawable mSlidingLocaleIcon;
private final HashMap<Integer, SoftReference<BitmapDrawable>> mSpaceDrawableCache =
new HashMap<Integer, SoftReference<BitmapDrawable>>();
@@ -90,7 +91,8 @@ public class LatinKeyboard extends Keyboard {
public LatinKeyboard(Context context, KeyboardId id, int width) {
super(context, id.getXmlId(), id, width);
- mContext = context;
+ mRes = context.getResources();
+ mTheme = context.getTheme();
final List<Key> keys = getKeys();
int spaceKeyIndex = -1;
@@ -133,6 +135,13 @@ public class LatinKeyboard extends Keyboard {
// The threshold is "key width" x 1.25
mSpacebarLanguageSwitchThreshold = (getMostCommonKeyWidth() * 5) / 4;
+
+ final int spaceKeyWidth = Math.max(mSpaceKey.mWidth,
+ (int)(getMinWidth() * SPACEBAR_POPUP_MIN_RATIO));
+ final int spaceKeyheight = mSpacePreviewIcon.getIntrinsicHeight();
+ mSlidingLocaleIcon = new SlidingLocaleDrawable(
+ context, mSpacePreviewIcon, spaceKeyWidth, spaceKeyheight);
+ mSlidingLocaleIcon.setBounds(0, 0, spaceKeyWidth, spaceKeyheight);
}
public void setSpacebarTextFadeFactor(float fadeFactor, LatinKeyboardView view) {
@@ -250,7 +259,7 @@ public class LatinKeyboard extends Keyboard {
final SoftReference<BitmapDrawable> ref = mSpaceDrawableCache.get(hashCode);
BitmapDrawable drawable = (ref == null) ? null : ref.get();
if (drawable == null) {
- drawable = new BitmapDrawable(mContext.getResources(), drawSpacebar(
+ drawable = new BitmapDrawable(mRes, drawSpacebar(
locale, isAutoCorrection, mSpacebarTextFadeFactor));
mSpaceDrawableCache.put(hashCode, new SoftReference<BitmapDrawable>(drawable));
}
@@ -263,7 +272,7 @@ public class LatinKeyboard extends Keyboard {
final int height = mSpaceIcon != null ? mSpaceIcon.getIntrinsicHeight() : mSpaceKey.mHeight;
final Bitmap buffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(buffer);
- final Resources res = mContext.getResources();
+ final Resources res = mRes;
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
// If application locales are explicitly selected.
@@ -287,7 +296,7 @@ public class LatinKeyboard extends Keyboard {
final String language = layoutSpacebar(paint, inputLocale,
mSpacebarArrowLeftIcon, mSpacebarArrowRightIcon, width, height,
- getTextSizeFromTheme(mContext.getTheme(), textStyle, defaultTextSize));
+ getTextSizeFromTheme(mTheme, textStyle, defaultTextSize));
// Draw language text with shadow
// In case there is no space icon, we will place the language text at the center of
@@ -341,14 +350,6 @@ public class LatinKeyboard extends Keyboard {
if (mSpacebarSlidingLanguageSwitchDiff == diff)
return;
mSpacebarSlidingLanguageSwitchDiff = diff;
- if (mSlidingLocaleIcon == null) {
- final int width = Math.max(mSpaceKey.mWidth,
- (int)(getMinWidth() * SPACEBAR_POPUP_MIN_RATIO));
- final int height = mSpacePreviewIcon.getIntrinsicHeight();
- mSlidingLocaleIcon =
- new SlidingLocaleDrawable(mContext, mSpacePreviewIcon, width, height);
- mSlidingLocaleIcon.setBounds(0, 0, width, height);
- }
mSlidingLocaleIcon.setDiff(diff);
if (Math.abs(diff) == Integer.MAX_VALUE) {
mSpaceKey.setPreviewIcon(mSpacePreviewIcon);
@@ -403,7 +404,7 @@ public class LatinKeyboard extends Keyboard {
Math.max(0, Math.min(y, getHeight() - 1)));
}
- private static int getTextSizeFromTheme(Theme theme, int style, int defValue) {
+ public static int getTextSizeFromTheme(Theme theme, int style, int defValue) {
TypedArray array = theme.obtainStyledAttributes(
style, new int[] { android.R.attr.textSize });
int textSize = array.getDimensionPixelSize(array.getResourceId(0, 0), defValue);
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index 397ac7eec..0a727ad42 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -615,7 +615,7 @@ public class PointerTracker {
// The modifier key, such as shift key, should not show its key preview.
private boolean isKeyPreviewNotRequired(int keyIndex) {
final Key key = getKey(keyIndex);
- if (!key.mEnabled)
+ if (key == null || !key.mEnabled)
return true;
// Such as spacebar sliding language switch.
if (mKeyboard.needSpacebarPreview(keyIndex))
diff --git a/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java b/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java
index a20bf1cd3..dd271de64 100644
--- a/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java
+++ b/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java
@@ -60,8 +60,8 @@ public class SlidingLocaleDrawable extends Drawable {
mWidth = width;
mHeight = height;
final TextPaint textPaint = new TextPaint();
- textPaint.setTextSize(getTextSizeFromTheme(
- context, android.R.style.TextAppearance_Medium, 18));
+ textPaint.setTextSize(LatinKeyboard.getTextSizeFromTheme(
+ context.getTheme(), android.R.style.TextAppearance_Medium, 18));
textPaint.setColor(Color.TRANSPARENT);
textPaint.setTextAlign(Align.CENTER);
textPaint.setAntiAlias(true);
@@ -78,13 +78,6 @@ public class SlidingLocaleDrawable extends Drawable {
mThreshold = ViewConfiguration.get(context).getScaledTouchSlop();
}
- private static int getTextSizeFromTheme(Context context, int style, int defValue) {
- TypedArray array = context.getTheme().obtainStyledAttributes(
- style, new int[] { android.R.attr.textSize });
- int textSize = array.getDimensionPixelSize(array.getResourceId(0, 0), defValue);
- return textSize;
- }
-
void setDiff(int diff) {
if (diff == Integer.MAX_VALUE) {
mHitThreshold = false;
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java
index 2a29e1f8f..92d26a01c 100644
--- a/java/src/com/android/inputmethod/latin/CandidateView.java
+++ b/java/src/com/android/inputmethod/latin/CandidateView.java
@@ -349,9 +349,9 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
dv.setTextColor(0xff808080);
dv.setText(info.getDebugString());
// TODO: debug view for candidate strip needed.
- mCandidatesPane.addView(dv);
- LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)dv.getLayoutParams();
- lp.gravity = Gravity.BOTTOM;
+// mCandidatesPane.addView(dv);
+// LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)dv.getLayoutParams();
+// lp.gravity = Gravity.BOTTOM;
}
}
if (x != 0) {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 87912eb00..fd4a47c39 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -518,8 +518,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
LatinKeyboardView inputView = switcher.getKeyboardView();
if (DEBUG) {
- Log.d(TAG, "onStartInputView: inputType=" + ((attribute == null) ? "none"
- : String.format("0x%08x", attribute.inputType)));
+ Log.d(TAG, "onStartInputView: attribute:" + ((attribute == null) ? "none"
+ : String.format("inputType=0x%08x imeOptions=0x%08x",
+ attribute.inputType, attribute.imeOptions)));
}
// In landscape mode, this method gets called without the input view being created.
if (inputView == null) {
@@ -1458,16 +1459,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
public void setSuggestions(SuggestedWords words) {
-// if (mVoiceProxy.getAndResetIsShowingHint()) {
-// setCandidatesView(mCandidateViewContainer);
-// }
-
if (mCandidateView != null) {
mCandidateView.setSuggestions(words);
- if (mKeyboardSwitcher.getLatinKeyboard().needsAutoCorrectionSpacebarLed()) {
- mKeyboardSwitcher.onAutoCorrectionStateChanged(
- words.hasWordAboveAutoCorrectionScoreThreshold());
- }
+ mKeyboardSwitcher.onAutoCorrectionStateChanged(
+ words.hasWordAboveAutoCorrectionScoreThreshold());
}
}
@@ -1876,7 +1871,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
// The following is necessary because on API levels < 10, we don't get notified when
// subtype changes.
- onRefreshKeyboard();
+ if (!CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED)
+ onRefreshKeyboard();
}
@Override
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 62788fb9e..d01e3e9c2 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -117,30 +117,31 @@ public class Suggest implements Dictionary.WordCallback {
}
private void init(Context context, Dictionary mainDict) {
- if (mainDict != null) {
- mMainDict = mainDict;
- mUnigramDictionaries.put(DICT_KEY_MAIN, mainDict);
- mBigramDictionaries.put(DICT_KEY_MAIN, mainDict);
- }
+ mMainDict = mainDict;
+ addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_MAIN, mainDict);
+ addOrReplaceDictionary(mBigramDictionaries, DICT_KEY_MAIN, mainDict);
mWhiteListDictionary = WhitelistDictionary.init(context);
- if (mWhiteListDictionary != null) {
- mUnigramDictionaries.put(DICT_KEY_WHITELIST, mWhiteListDictionary);
- }
+ addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_WHITELIST, mWhiteListDictionary);
mAutoCorrection = new AutoCorrection();
initPool();
}
+ private void addOrReplaceDictionary(Map<String, Dictionary> dictionaries, String key,
+ Dictionary dict) {
+ final Dictionary oldDict = (dict == null)
+ ? dictionaries.remove(key)
+ : dictionaries.put(key, dict);
+ if (oldDict != null && dict != oldDict) {
+ oldDict.close();
+ }
+ }
+
public void resetMainDict(Context context, int dictionaryResId, Locale locale) {
final Dictionary newMainDict = DictionaryFactory.createDictionaryFromManager(
context, locale, dictionaryResId);
mMainDict = newMainDict;
- if (null == newMainDict) {
- mUnigramDictionaries.remove(DICT_KEY_MAIN);
- mBigramDictionaries.remove(DICT_KEY_MAIN);
- } else {
- mUnigramDictionaries.put(DICT_KEY_MAIN, newMainDict);
- mBigramDictionaries.put(DICT_KEY_MAIN, newMainDict);
- }
+ addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_MAIN, newMainDict);
+ addOrReplaceDictionary(mBigramDictionaries, DICT_KEY_MAIN, newMainDict);
}
private void initPool() {
@@ -179,8 +180,7 @@ public class Suggest implements Dictionary.WordCallback {
* before the main dictionary, if set.
*/
public void setUserDictionary(Dictionary userDictionary) {
- if (userDictionary != null)
- mUnigramDictionaries.put(DICT_KEY_USER, userDictionary);
+ addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_USER, userDictionary);
}
/**
@@ -189,23 +189,16 @@ public class Suggest implements Dictionary.WordCallback {
* won't be used.
*/
public void setContactsDictionary(Dictionary contactsDictionary) {
- if (contactsDictionary != null) {
- mUnigramDictionaries.put(DICT_KEY_CONTACTS, contactsDictionary);
- mBigramDictionaries.put(DICT_KEY_CONTACTS, contactsDictionary);
- } else {
- mUnigramDictionaries.remove(DICT_KEY_CONTACTS);
- mBigramDictionaries.remove(DICT_KEY_CONTACTS);
- }
+ addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_CONTACTS, contactsDictionary);
+ addOrReplaceDictionary(mBigramDictionaries, DICT_KEY_CONTACTS, contactsDictionary);
}
public void setAutoDictionary(Dictionary autoDictionary) {
- if (autoDictionary != null)
- mUnigramDictionaries.put(DICT_KEY_AUTO, autoDictionary);
+ addOrReplaceDictionary(mUnigramDictionaries, DICT_KEY_AUTO, autoDictionary);
}
public void setUserBigramDictionary(Dictionary userBigramDictionary) {
- if (userBigramDictionary != null)
- mBigramDictionaries.put(DICT_KEY_USER_BIGRAM, userBigramDictionary);
+ addOrReplaceDictionary(mBigramDictionaries, DICT_KEY_USER_BIGRAM, userBigramDictionary);
}
public void setAutoCorrectionThreshold(double threshold) {
diff --git a/native/Android.mk b/native/Android.mk
index 4727b1e39..d9f4f1d38 100644
--- a/native/Android.mk
+++ b/native/Android.mk
@@ -11,7 +11,7 @@ LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
LOCAL_SRC_FILES := \
jni/com_android_inputmethod_keyboard_ProximityInfo.cpp \
jni/com_android_inputmethod_latin_BinaryDictionary.cpp \
- jni/onload.cpp \
+ jni/jni_common.cpp \
src/bigram_dictionary.cpp \
src/char_utils.cpp \
src/dictionary.cpp \
diff --git a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
index 3db89edf1..f3e2a7e60 100644
--- a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
+++ b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
@@ -19,28 +19,15 @@
#include "com_android_inputmethod_keyboard_ProximityInfo.h"
#include "jni.h"
+#include "jni_common.h"
#include "proximity_info.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
-// ----------------------------------------------------------------------------
-
namespace latinime {
-//
-// helper function to throw an exception
-//
-static void throwException(JNIEnv *env, const char* ex, const char* fmt, int data) {
- if (jclass cls = env->FindClass(ex)) {
- char msg[1000];
- snprintf(msg, sizeof(msg), fmt, data);
- env->ThrowNew(cls, msg);
- env->DeleteLocalRef(cls);
- }
-}
-
static jint latinime_Keyboard_setProximityInfo(JNIEnv *env, jobject object,
jint maxProximityCharsSize, jint displayWidth, jint displayHeight, jint gridWidth,
jint gridHeight, jintArray proximityCharsArray) {
@@ -57,34 +44,15 @@ static void latinime_Keyboard_release(JNIEnv *env, jobject object, jint proximit
delete pi;
}
-// ----------------------------------------------------------------------------
-
static JNINativeMethod sKeyboardMethods[] = {
{"setProximityInfoNative", "(IIIII[I)I", (void*)latinime_Keyboard_setProximityInfo},
{"releaseProximityInfoNative", "(I)V", (void*)latinime_Keyboard_release}
};
-static int registerNativeMethods(JNIEnv* env, const char* className, JNINativeMethod* gMethods,
- int numMethods) {
- jclass clazz;
-
- clazz = env->FindClass(className);
- if (clazz == NULL) {
- LOGE("Native registration unable to find class '%s'", className);
- return JNI_FALSE;
- }
- if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
- LOGE("RegisterNatives failed for '%s'", className);
- return JNI_FALSE;
- }
-
- return JNI_TRUE;
-}
-
int register_ProximityInfo(JNIEnv *env) {
const char* const kClassPathName = "com/android/inputmethod/keyboard/ProximityInfo";
return registerNativeMethods(env, kClassPathName, sKeyboardMethods,
sizeof(sKeyboardMethods) / sizeof(sKeyboardMethods[0]));
}
-}; // namespace latinime
+} // namespace latinime
diff --git a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
index bdeeb8f37..4a1e83b09 100644
--- a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
+++ b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
@@ -21,7 +21,9 @@
#include "jni.h"
namespace latinime {
+
int register_ProximityInfo(JNIEnv *env);
+
}
#endif // _COM_ANDROID_INPUTMETHOD_KEYBOARD_PROXIMITYINFO_H
diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
index 4b61c1414..ce874d8d4 100644
--- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
+++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
@@ -20,6 +20,7 @@
#include "com_android_inputmethod_latin_BinaryDictionary.h"
#include "dictionary.h"
#include "jni.h"
+#include "jni_common.h"
#include "proximity_info.h"
#include <assert.h>
@@ -35,22 +36,8 @@
#include <stdlib.h>
#endif // USE_MMAP_FOR_DICTIONARY
-// ----------------------------------------------------------------------------
-
namespace latinime {
-//
-// helper function to throw an exception
-//
-static void throwException(JNIEnv *env, const char* ex, const char* fmt, int data) {
- if (jclass cls = env->FindClass(ex)) {
- char msg[1000];
- snprintf(msg, sizeof(msg), fmt, data);
- env->ThrowNew(cls, msg);
- env->DeleteLocalRef(cls);
- }
-}
-
static jint latinime_BinaryDictionary_open(JNIEnv *env, jobject object,
jstring sourceDir, jlong dictOffset, jlong dictSize,
jint typedLetterMultiplier, jint fullWordMultiplier, jint maxWordLength, jint maxWords,
@@ -208,8 +195,6 @@ static void latinime_BinaryDictionary_close(JNIEnv *env, jobject object, jint di
delete dictionary;
}
-// ----------------------------------------------------------------------------
-
static JNINativeMethod sMethods[] = {
{"openNative", "(Ljava/lang/String;JJIIIII)I", (void*)latinime_BinaryDictionary_open},
{"closeNative", "(I)V", (void*)latinime_BinaryDictionary_close},
@@ -218,27 +203,10 @@ static JNINativeMethod sMethods[] = {
{"getBigramsNative", "(I[CI[II[C[IIII)I", (void*)latinime_BinaryDictionary_getBigrams}
};
-static int registerNativeMethods(JNIEnv* env, const char* className, JNINativeMethod* gMethods,
- int numMethods) {
- jclass clazz;
-
- clazz = env->FindClass(className);
- if (clazz == NULL) {
- LOGE("Native registration unable to find class '%s'", className);
- return JNI_FALSE;
- }
- if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
- LOGE("RegisterNatives failed for '%s'", className);
- return JNI_FALSE;
- }
-
- return JNI_TRUE;
-}
-
int register_BinaryDictionary(JNIEnv *env) {
const char* const kClassPathName = "com/android/inputmethod/latin/BinaryDictionary";
return registerNativeMethods(env, kClassPathName, sMethods,
sizeof(sMethods) / sizeof(sMethods[0]));
}
-}; // namespace latinime
+} // namespace latinime
diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.h b/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
index f7cd81fa7..1b1ba7f0f 100644
--- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
+++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
@@ -21,7 +21,9 @@
#include "jni.h"
namespace latinime {
+
int register_BinaryDictionary(JNIEnv *env);
+
}
#endif // _COM_ANDROID_INPUTMETHOD_LATIN_BINARYDICTIONARY_H
diff --git a/native/jni/onload.cpp b/native/jni/jni_common.cpp
index f02c9a052..8643f723f 100644
--- a/native/jni/onload.cpp
+++ b/native/jni/jni_common.cpp
@@ -26,11 +26,8 @@
#include <errno.h>
#include <stdio.h>
-// ----------------------------------------------------------------------------
-
using namespace latinime;
-
/*
* Returns the JNI version on success, -1 on failure.
*/
@@ -60,3 +57,23 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) {
bail:
return result;
}
+
+namespace latinime {
+
+int registerNativeMethods(JNIEnv* env, const char* className, JNINativeMethod* methods,
+ int numMethods) {
+ jclass clazz = env->FindClass(className);
+ if (clazz == NULL) {
+ LOGE("Native registration unable to find class '%s'", className);
+ return JNI_FALSE;
+ }
+ if (env->RegisterNatives(clazz, methods, numMethods) < 0) {
+ LOGE("RegisterNatives failed for '%s'", className);
+ env->DeleteLocalRef(clazz);
+ return JNI_FALSE;
+ }
+ env->DeleteLocalRef(clazz);
+ return JNI_TRUE;
+}
+
+} // namespace latinime
diff --git a/native/jni/jni_common.h b/native/jni/jni_common.h
new file mode 100644
index 000000000..c502fa3a8
--- /dev/null
+++ b/native/jni/jni_common.h
@@ -0,0 +1,30 @@
+/*
+**
+** Copyright 2011, 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.
+*/
+
+#ifndef LATINIME_JNI_COMMON_H
+#define LATINIME_JNI_COMMON_H
+
+#include "jni.h"
+
+namespace latinime {
+
+int registerNativeMethods(JNIEnv* env, const char* className, JNINativeMethod* methods,
+ int numMethods);
+
+} // namespace latinime
+
+#endif // LATINIME_JNI_COMMON_H
diff --git a/native/src/bigram_dictionary.h b/native/src/bigram_dictionary.h
index d658b93e6..c07458a38 100644
--- a/native/src/bigram_dictionary.h
+++ b/native/src/bigram_dictionary.h
@@ -50,6 +50,7 @@ private:
int *mInputCodes;
int mInputLength;
};
-// ----------------------------------------------------------------------------
-}; // namespace latinime
+
+} // namespace latinime
+
#endif // LATINIME_BIGRAM_DICTIONARY_H
diff --git a/native/src/char_utils.h b/native/src/char_utils.h
index 921ecb4a5..a69a35e7a 100644
--- a/native/src/char_utils.h
+++ b/native/src/char_utils.h
@@ -21,6 +21,6 @@ namespace latinime {
unsigned short latin_tolower(unsigned short c);
-}; // namespace latinime
+} // namespace latinime
#endif // LATINIME_CHAR_UTILS_H
diff --git a/native/src/debug.h b/native/src/debug.h
index ae629b222..38b2f107a 100644
--- a/native/src/debug.h
+++ b/native/src/debug.h
@@ -28,6 +28,7 @@ static inline unsigned char* convertToUnibyteString(unsigned short* input, unsig
output[i] = 0;
return output;
}
+
static inline unsigned char* convertToUnibyteStringAndReplaceLastChar(unsigned short* input,
unsigned char* output, const unsigned int length, unsigned char c) {
int i = 0;
@@ -37,6 +38,7 @@ static inline unsigned char* convertToUnibyteStringAndReplaceLastChar(unsigned s
output[i] = 0;
return output;
}
+
static inline void LOGI_S16(unsigned short* string, const unsigned int length) {
unsigned char tmp_buffer[length];
convertToUnibyteString(string, tmp_buffer, length);
@@ -46,6 +48,7 @@ static inline void LOGI_S16(unsigned short* string, const unsigned int length) {
// TODO : refactor this in a blocking log or something.
// usleep(10);
}
+
static inline void LOGI_S16_PLUS(unsigned short* string, const unsigned int length,
unsigned char c) {
unsigned char tmp_buffer[length+1];
diff --git a/native/src/dictionary.h b/native/src/dictionary.h
index 1b41f69dd..3dc577a56 100644
--- a/native/src/dictionary.h
+++ b/native/src/dictionary.h
@@ -81,7 +81,6 @@ private:
BigramDictionary *mBigramDictionary;
};
-// ----------------------------------------------------------------------------
// public static utility methods
// static inline methods should be defined in the header file
inline unsigned short Dictionary::getChar(const unsigned char *dict, int *pos) {
@@ -134,7 +133,6 @@ inline int Dictionary::getFreq(const unsigned char *dict,
return freq;
}
-
inline int Dictionary::wideStrLen(unsigned short *str) {
if (!str) return 0;
unsigned short *end = str;
@@ -158,5 +156,6 @@ inline int Dictionary::setDictionaryValues(const unsigned char *dict,
return position;
}
-}; // namespace latinime
+} // namespace latinime
+
#endif // LATINIME_DICTIONARY_H
diff --git a/native/src/proximity_info.cpp b/native/src/proximity_info.cpp
index 102123c3c..209c31e6e 100644
--- a/native/src/proximity_info.cpp
+++ b/native/src/proximity_info.cpp
@@ -22,6 +22,7 @@
#include "proximity_info.h"
namespace latinime {
+
ProximityInfo::ProximityInfo(const int maxProximityCharsSize, const int keyboardWidth,
const int keyboardHeight, const int gridWidth, const int gridHeight,
const uint32_t *proximityCharsArray)
@@ -61,4 +62,5 @@ bool ProximityInfo::hasSpaceProximity(const int x, const int y) const {
}
return false;
}
-} // namespace latinime
+
+} // namespace latinime
diff --git a/native/src/proximity_info.h b/native/src/proximity_info.h
index c2062e8c5..327cd0940 100644
--- a/native/src/proximity_info.h
+++ b/native/src/proximity_info.h
@@ -41,5 +41,7 @@ private:
const int CELL_HEIGHT;
uint32_t *mProximityCharsArray;
};
-}; // namespace latinime
+
+} // namespace latinime
+
#endif // LATINIME_PROXIMITY_INFO_H
diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp
index c294cf3b5..ef52ceb7c 100644
--- a/native/src/unigram_dictionary.cpp
+++ b/native/src/unigram_dictionary.cpp
@@ -272,6 +272,7 @@ static inline void registerNextLetter(unsigned short c, int *nextLetters, int ne
}
// TODO: We need to optimize addWord by using STL or something
+// TODO: This needs to take an const unsigned short* and not tinker with its contents
bool UnigramDictionary::addWord(unsigned short *word, int length, int frequency) {
word[length] = 0;
if (DEBUG_DICT && DEBUG_SHOW_FOUND_WORD) {
@@ -321,6 +322,16 @@ bool UnigramDictionary::addWord(unsigned short *word, int length, int frequency)
return false;
}
+inline void UnigramDictionary::addWordAlternatesSpellings(const uint8_t* const root, int pos,
+ int depth, int finalFreq) {
+ // TODO: actually add alternates when the format supports it.
+}
+
+static inline bool hasAlternateSpellings(uint8_t flags) {
+ // TODO: when the format supports it, return the actual value.
+ return false;
+}
+
static inline unsigned short toBaseLowerCase(unsigned short c) {
if (c < sizeof(BASE_CHARS) / sizeof(BASE_CHARS[0])) {
c = BASE_CHARS[c];
@@ -333,7 +344,7 @@ static inline unsigned short toBaseLowerCase(unsigned short c) {
return c;
}
-bool UnigramDictionary::sameAsTyped(unsigned short *word, int length) {
+bool UnigramDictionary::sameAsTyped(const unsigned short *word, int length) const {
if (length != mInputLength) {
return false;
}
@@ -579,7 +590,6 @@ void UnigramDictionary::getWordsRec(const int childrenCount, const int pos, cons
for (int i = 0; i < childrenCount; ++i) {
int newCount;
int newChildPosition;
- const int newDepth = depth + 1;
bool newTraverseAllNodes;
int newMatchRate;
int newInputIndex;
@@ -595,7 +605,7 @@ void UnigramDictionary::getWordsRec(const int childrenCount, const int pos, cons
siblingPos = newSiblingPos;
if (needsToTraverseChildrenNodes) {
- getWordsRec(newCount, newChildPosition, newDepth, maxDepth, newTraverseAllNodes,
+ getWordsRec(newCount, newChildPosition, newOutputIndex, maxDepth, newTraverseAllNodes,
newMatchRate, newInputIndex, newDiffs, skipPos, excessivePos, transposedPos,
nextLetters, nextLettersSize);
}
@@ -657,28 +667,6 @@ inline int UnigramDictionary::calculateFinalFreq(const int inputIndex, const int
return finalFreq;
}
-inline void UnigramDictionary::onTerminalWhenUserTypedLengthIsGreaterThanInputLength(
- unsigned short *word, const int inputIndex, const int depth, const int matchWeight,
- int *nextLetters, const int nextLettersSize, const int skipPos, const int excessivePos,
- const int transposedPos, const int freq) {
- const int finalFreq = calculateFinalFreq(inputIndex, depth, matchWeight, skipPos, excessivePos,
- transposedPos, freq, false);
- if (depth >= MIN_SUGGEST_DEPTH) addWord(word, depth + 1, finalFreq);
- if (depth >= mInputLength && skipPos < 0) {
- registerNextLetter(mWord[mInputLength], nextLetters, nextLettersSize);
- }
-}
-
-inline void UnigramDictionary::onTerminalWhenUserTypedLengthIsSameAsInputLength(
- unsigned short *word, const int inputIndex, const int depth, const int matchWeight,
- const int skipPos, const int excessivePos, const int transposedPos, const int freq) {
- if (sameAsTyped(word, depth + 1)) return;
- const int finalFreq = calculateFinalFreq(inputIndex, depth, matchWeight, skipPos,
- excessivePos, transposedPos, freq, true);
- // Proximity collection will promote a word of the same length as what user typed.
- if (depth >= MIN_SUGGEST_DEPTH) addWord(word, depth + 1, finalFreq);
-}
-
inline bool UnigramDictionary::needsToSkipCurrentNode(const unsigned short c,
const int inputIndex, const int skipPos, const int depth) {
const unsigned short userTypedChar = getInputCharsAt(inputIndex)[0];
@@ -709,7 +697,6 @@ inline bool UnigramDictionary::existsAdjacentProximityChars(const int inputIndex
return false;
}
-
// In the following function, c is the current character of the dictionary word
// currently examined.
// currentChars is an array containing the keys close to the character the
@@ -752,6 +739,30 @@ inline UnigramDictionary::ProximityType UnigramDictionary::getMatchedProximityId
return UNRELATED_CHAR;
}
+inline void UnigramDictionary::onTerminal(unsigned short int* word, const int depth,
+ const uint8_t* const root, const uint8_t flags, int pos,
+ const int inputIndex, const int matchWeight, const int skipPos,
+ const int excessivePos, const int transposedPos, const int freq, const bool sameLength,
+ int* nextLetters, const int nextLettersSize) {
+
+ const bool isSameAsTyped = sameLength ? sameAsTyped(word, depth + 1) : false;
+ const bool hasAlternates = hasAlternateSpellings(flags);
+ if (isSameAsTyped && !hasAlternates) return;
+
+ if (depth >= MIN_SUGGEST_DEPTH) {
+ const int finalFreq = calculateFinalFreq(inputIndex, depth, matchWeight, skipPos,
+ excessivePos, transposedPos, freq, sameLength);
+ if (!isSameAsTyped)
+ addWord(word, depth + 1, finalFreq);
+ if (hasAlternates)
+ addWordAlternatesSpellings(DICT_ROOT, pos, flags, finalFreq);
+ }
+
+ if (sameLength && depth >= mInputLength && skipPos < 0) {
+ registerNextLetter(word[mInputLength], nextLetters, nextLettersSize);
+ }
+}
+
inline bool UnigramDictionary::processCurrentNode(const int pos, const int depth,
const int maxDepth, const bool traverseAllNodes, int matchWeight, int inputIndex,
const int diffs, const int skipPos, const int excessivePos, const int transposedPos,
@@ -771,6 +782,8 @@ inline bool UnigramDictionary::processCurrentNode(const int pos, const int depth
int freq;
bool isSameAsUserTypedLength = false;
+ const uint8_t flags = 0; // No flags for now
+
if (excessivePos == depth && inputIndex < mInputLength - 1) ++inputIndex;
*nextSiblingPosition = Dictionary::setDictionaryValues(DICT_ROOT, IS_LATEST_DICT_VERSION, pos,
@@ -783,9 +796,8 @@ inline bool UnigramDictionary::processCurrentNode(const int pos, const int depth
if (traverseAllNodes || needsToSkipCurrentNode(c, inputIndex, skipPos, depth)) {
mWord[depth] = c;
if (traverseAllNodes && terminal) {
- onTerminalWhenUserTypedLengthIsGreaterThanInputLength(mWord, inputIndex, depth,
- matchWeight, nextLetters, nextLettersSize, skipPos, excessivePos, transposedPos,
- freq);
+ onTerminal(mWord, depth, DICT_ROOT, flags, pos, inputIndex, matchWeight, skipPos,
+ excessivePos, transposedPos, freq, false, nextLetters, nextLettersSize);
}
if (!needsToTraverseChildrenNodes) return false;
*newTraverseAllNodes = traverseAllNodes;
@@ -812,8 +824,8 @@ inline bool UnigramDictionary::processCurrentNode(const int pos, const int depth
bool isSameAsUserTypedLength = mInputLength == inputIndex + 1
|| (excessivePos == mInputLength - 1 && inputIndex == mInputLength - 2);
if (isSameAsUserTypedLength && terminal) {
- onTerminalWhenUserTypedLengthIsSameAsInputLength(mWord, inputIndex, depth, matchWeight,
- skipPos, excessivePos, transposedPos, freq);
+ onTerminal(mWord, depth, DICT_ROOT, flags, pos, inputIndex, matchWeight, skipPos,
+ excessivePos, transposedPos, freq, true, nextLetters, nextLettersSize);
}
if (!needsToTraverseChildrenNodes) return false;
// Start traversing all nodes after the index exceeds the user typed length
diff --git a/native/src/unigram_dictionary.h b/native/src/unigram_dictionary.h
index c47db1ad2..154ac9b36 100644
--- a/native/src/unigram_dictionary.h
+++ b/native/src/unigram_dictionary.h
@@ -64,9 +64,9 @@ private:
bool checkIfDictVersionIsLatest();
int getAddress(int *pos);
int getFreq(int *pos);
- int wideStrLen(unsigned short *str);
- bool sameAsTyped(unsigned short *word, int length);
+ bool sameAsTyped(const unsigned short *word, int length) const;
bool addWord(unsigned short *word, int length, int frequency);
+ void addWordAlternatesSpellings(const uint8_t* const root, int pos, int depth, int finalFreq);
void getWordsRec(const int childrenCount, const int pos, const int depth, const int maxDepth,
const bool traverseAllNodes, const int snr, const int inputIndex, const int diffs,
const int skipPos, const int excessivePos, const int transposedPos, int *nextLetters,
@@ -83,13 +83,11 @@ private:
int calculateFinalFreq(const int inputIndex, const int depth, const int snr, const int skipPos,
const int excessivePos, const int transposedPos, const int freq,
const bool sameLength) const;
- void onTerminalWhenUserTypedLengthIsGreaterThanInputLength(unsigned short *word,
- const int inputIndex, const int depth, const int snr, int *nextLetters,
- const int nextLettersSize, const int skipPos, const int excessivePos,
- const int transposedPos, const int freq);
- void onTerminalWhenUserTypedLengthIsSameAsInputLength(unsigned short *word,
- const int inputIndex, const int depth, const int snr, const int skipPos,
- const int excessivePos, const int transposedPos, const int freq);
+ void onTerminal(unsigned short int* word, const int depth,
+ const uint8_t* const root, const uint8_t flags, int pos,
+ const int inputIndex, const int matchWeight, const int skipPos,
+ const int excessivePos, const int transposedPos, const int freq, const bool sameLength,
+ int *nextLetters, const int nextLettersSize);
bool needsToSkipCurrentNode(const unsigned short c,
const int inputIndex, const int skipPos, const int depth);
ProximityType getMatchedProximityId(const int *currentChars, const unsigned short c,
@@ -149,8 +147,6 @@ private:
int mNextLettersFrequency[NEXT_LETTERS_SIZE];
};
-// ----------------------------------------------------------------------------
-
-}; // namespace latinime
+} // namespace latinime
#endif // LATINIME_UNIGRAM_DICTIONARY_H