aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/layout/research_splash.xml88
-rw-r--r--java/res/values-land/dimens.xml7
-rw-r--r--java/res/values-sw600dp-land/dimens.xml7
-rw-r--r--java/res/values-sw600dp/dimens.xml7
-rw-r--r--java/res/values-sw768dp-land/dimens.xml7
-rw-r--r--java/res/values-sw768dp/dimens.xml7
-rw-r--r--java/res/values/attrs.xml22
-rw-r--r--java/res/values/dimens.xml7
-rw-r--r--java/res/values/research_strings.xml (renamed from java/res/xml-sw768dp-land/kbd_thai_symbols_shift.xml)15
-rw-r--r--java/res/values/strings.xml13
-rw-r--r--java/res/xml-sw600dp-land/kbd_thai.xml32
-rw-r--r--java/res/xml-sw600dp/kbd_thai.xml32
-rw-r--r--java/res/xml-sw600dp/rowkeys_arabic1.xml33
-rw-r--r--java/res/xml-sw600dp/rowkeys_arabic2.xml33
-rw-r--r--java/res/xml-sw600dp/rowkeys_arabic3.xml33
-rw-r--r--java/res/xml-sw600dp/rowkeys_farsi1.xml36
-rw-r--r--java/res/xml-sw600dp/rowkeys_farsi2.xml33
-rw-r--r--java/res/xml-sw600dp/rowkeys_farsi3.xml30
-rw-r--r--java/res/xml-sw600dp/rowkeys_thai1.xml97
-rw-r--r--java/res/xml-sw600dp/rowkeys_thai2.xml108
-rw-r--r--java/res/xml-sw600dp/rowkeys_thai3.xml97
-rw-r--r--java/res/xml-sw600dp/rowkeys_thai4.xml89
-rw-r--r--java/res/xml-sw600dp/rows_thai.xml9
-rw-r--r--java/res/xml-sw768dp-land/kbd_thai_symbols.xml29
-rw-r--r--java/res/xml-sw768dp/kbd_thai.xml32
-rw-r--r--java/res/xml-sw768dp/kbd_thai_symbols.xml4
-rw-r--r--java/res/xml-sw768dp/kbd_thai_symbols_shift.xml4
-rw-r--r--java/res/xml-sw768dp/rowkeys_thai_digits.xml30
-rw-r--r--java/res/xml-sw768dp/rows_thai.xml6
-rw-r--r--java/res/xml/kbd_arabic.xml1
-rw-r--r--java/res/xml/kbd_pcqwerty.xml4
-rw-r--r--java/res/xml/kbd_pcqwerty_symbols.xml4
-rw-r--r--java/res/xml/kbd_thai.xml6
-rw-r--r--java/res/xml/key_thai_kho_khuat.xml (renamed from java/res/xml-sw768dp-land/kbd_thai.xml)28
-rw-r--r--java/res/xml/method.xml7
-rw-r--r--java/res/xml/rowkeys_arabic1.xml30
-rw-r--r--java/res/xml/rowkeys_arabic2.xml29
-rw-r--r--java/res/xml/rowkeys_arabic3.xml24
-rw-r--r--java/res/xml/rowkeys_farsi1.xml30
-rw-r--r--java/res/xml/rowkeys_farsi2.xml30
-rw-r--r--java/res/xml/rowkeys_farsi3.xml24
-rw-r--r--java/res/xml/rowkeys_qwerty1.xml9
-rw-r--r--java/res/xml/rowkeys_qwerty3.xml3
-rw-r--r--java/res/xml/rowkeys_spanish2.xml2
-rw-r--r--java/res/xml/rowkeys_thai1.xml132
-rw-r--r--java/res/xml/rowkeys_thai2.xml171
-rw-r--r--java/res/xml/rowkeys_thai3.xml125
-rw-r--r--java/res/xml/rowkeys_thai4.xml122
-rw-r--r--java/res/xml/rows_thai.xml27
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java115
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java16
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java306
-rw-r--r--java/src/com/android/inputmethod/keyboard/MainKeyboardView.java98
-rw-r--r--java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java5
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java213
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyPreviewDrawParams.java60
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java130
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java14
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java8
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java218
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java4
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java2
-rw-r--r--java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java193
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java154
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java76
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/Word.java15
-rw-r--r--java/src/com/android/inputmethod/research/ResearchLogger.java128
67 files changed, 1977 insertions, 1533 deletions
diff --git a/java/res/layout/research_splash.xml b/java/res/layout/research_splash.xml
deleted file mode 100644
index 56fd7024f..000000000
--- a/java/res/layout/research_splash.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:id="@+id/research_splash_screen_layout">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <com.android.internal.widget.DialogTitle
- style="?android:attr/windowTitleStyle"
- android:singleLine="true"
- android:ellipsize="end"
- android:layout_width="match_parent"
- android:layout_height="64dip"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:gravity="center_vertical|left"
- android:text="@string/research_splash_title" />
- <View android:layout_width="match_parent"
- android:layout_height="2dip"
- android:background="@android:color/holo_blue_light" />
- </LinearLayout>
-
- <TextView
- android:text="@string/research_splash_content"
- android:layout_height="fill_parent"
- android:layout_width="match_parent"
- android:layout_gravity="fill_horizontal|center_vertical"
- android:layout_marginLeft="16dip"
- android:layout_marginRight="16dip"
- android:layout_marginBottom="16dip"
- android:layout_marginTop="16dip"/>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:divider="?android:attr/dividerHorizontal"
- android:showDividers="beginning"
- android:dividerPadding="0dip">
- <LinearLayout
- style="?android:attr/buttonBarStyle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:measureWithLargestChild="true">
- <Button
- android:layout_width="0dip"
- android:layout_gravity="left"
- android:layout_weight="1"
- android:maxLines="2"
- stype="?android:attr/buttonBarButtonStyle"
- android:textSize="14sp"
- android:text="@string/research_dont_send_usage_info"
- android:layout_height="wrap_content"
- android:id="@+id/research_do_not_log_button" />
- <Button
- android:layout_width="0dip"
- android:layout_gravity="right"
- android:layout_weight="1"
- android:maxLines="2"
- style="?android:attr/buttonBarButtonStyle"
- android:textSize="14sp"
- android:text="@string/research_send_usage_info"
- android:layout_height="wrap_content"
- android:id="@+id/research_do_log_button" />
- </LinearLayout>
- </LinearLayout>
-</LinearLayout>
diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml
index fbfbb512c..a1546f11d 100644
--- a/java/res/values-land/dimens.xml
+++ b/java/res/values-land/dimens.xml
@@ -53,10 +53,13 @@
<fraction name="key_uppercase_letter_ratio">40%</fraction>
<fraction name="key_preview_text_ratio">90%</fraction>
<fraction name="spacebar_text_ratio">40.000%</fraction>
- <fraction name="key_letter_ratio_5rows">78%</fraction>
- <fraction name="key_uppercase_letter_ratio_5rows">48%</fraction>
<dimen name="key_preview_offset">0.0dp</dimen>
+ <!-- For 5-row keyboard -->
+ <fraction name="key_bottom_gap_5row">3.20%p</fraction>
+ <fraction name="key_letter_ratio_5row">78%</fraction>
+ <fraction name="key_uppercase_letter_ratio_5row">48%</fraction>
+
<dimen name="key_preview_offset_ics">1.6dp</dimen>
<!-- popup_key_height x -0.5 -->
<dimen name="more_keys_keyboard_vertical_correction_ics">-22.4dp</dimen>
diff --git a/java/res/values-sw600dp-land/dimens.xml b/java/res/values-sw600dp-land/dimens.xml
index 8283cd9fb..9664bf9ed 100644
--- a/java/res/values-sw600dp-land/dimens.xml
+++ b/java/res/values-sw600dp-land/dimens.xml
@@ -51,10 +51,13 @@
<fraction name="key_hint_label_ratio">34%</fraction>
<fraction name="key_uppercase_letter_ratio">29%</fraction>
<fraction name="spacebar_text_ratio">30.0%</fraction>
- <fraction name="key_letter_ratio_5rows">62%</fraction>
- <fraction name="key_uppercase_letter_ratio_5rows">36%</fraction>
<dimen name="key_uppercase_letter_padding">4dp</dimen>
+ <!-- For 5-row keyboard -->
+ <fraction name="key_bottom_gap_5row">3.20%p</fraction>
+ <fraction name="key_letter_ratio_5row">62%</fraction>
+ <fraction name="key_uppercase_letter_ratio_5row">36%</fraction>
+
<dimen name="suggestions_strip_padding">252.0dp</dimen>
<integer name="max_more_suggestions_row">5</integer>
<fraction name="min_more_suggestions_width">50%</fraction>
diff --git a/java/res/values-sw600dp/dimens.xml b/java/res/values-sw600dp/dimens.xml
index 78aa60533..e608f7d7b 100644
--- a/java/res/values-sw600dp/dimens.xml
+++ b/java/res/values-sw600dp/dimens.xml
@@ -63,11 +63,14 @@
<fraction name="key_uppercase_letter_ratio">22%</fraction>
<fraction name="key_preview_text_ratio">50%</fraction>
<fraction name="spacebar_text_ratio">28.0%</fraction>
- <fraction name="key_letter_ratio_5rows">52%</fraction>
- <fraction name="key_uppercase_letter_ratio_5rows">27%</fraction>
<dimen name="key_preview_height">94.5dp</dimen>
<dimen name="key_preview_offset">16.0dp</dimen>
+ <!-- For 5-row keyboard -->
+ <fraction name="key_bottom_gap_5row">3.20%p</fraction>
+ <fraction name="key_letter_ratio_5row">52%</fraction>
+ <fraction name="key_uppercase_letter_ratio_5row">27%</fraction>
+
<dimen name="key_preview_offset_ics">8.0dp</dimen>
<!-- popup_key_height x -0.5 -->
<dimen name="more_keys_keyboard_vertical_correction_ics">-31.5dp</dimen>
diff --git a/java/res/values-sw768dp-land/dimens.xml b/java/res/values-sw768dp-land/dimens.xml
index ac94c9293..511217068 100644
--- a/java/res/values-sw768dp-land/dimens.xml
+++ b/java/res/values-sw768dp-land/dimens.xml
@@ -53,10 +53,13 @@
<fraction name="key_hint_label_ratio">28%</fraction>
<fraction name="key_uppercase_letter_ratio">24%</fraction>
<fraction name="spacebar_text_ratio">24.00%</fraction>
- <fraction name="key_letter_ratio_5rows">53%</fraction>
- <fraction name="key_uppercase_letter_ratio_5rows">30%</fraction>
<dimen name="key_preview_height">107.1dp</dimen>
+ <!-- For 5-row keyboard -->
+ <fraction name="key_bottom_gap_5row">2.65%p</fraction>
+ <fraction name="key_letter_ratio_5row">53%</fraction>
+ <fraction name="key_uppercase_letter_ratio_5row">30%</fraction>
+
<dimen name="key_preview_offset_ics">8.0dp</dimen>
<dimen name="suggestions_strip_padding">252.0dp</dimen>
diff --git a/java/res/values-sw768dp/dimens.xml b/java/res/values-sw768dp/dimens.xml
index 0fd9cedcb..ec9d75988 100644
--- a/java/res/values-sw768dp/dimens.xml
+++ b/java/res/values-sw768dp/dimens.xml
@@ -64,11 +64,14 @@
<fraction name="key_uppercase_letter_ratio">26%</fraction>
<fraction name="key_preview_text_ratio">50%</fraction>
<fraction name="spacebar_text_ratio">29.03%</fraction>
- <fraction name="key_letter_ratio_5rows">51%</fraction>
- <fraction name="key_uppercase_letter_ratio_5rows">33%</fraction>
<dimen name="key_preview_height">94.5dp</dimen>
<dimen name="key_preview_offset">16.0dp</dimen>
+ <!-- For 5-row keyboard -->
+ <fraction name="key_bottom_gap_5row">2.95%p</fraction>
+ <fraction name="key_letter_ratio_5row">51%</fraction>
+ <fraction name="key_uppercase_letter_ratio_5row">33%</fraction>
+
<dimen name="key_preview_offset_ics">8.0dp</dimen>
<!-- popup_key_height x -0.5 -->
<dimen name="more_keys_keyboard_vertical_correction_ics">-31.5dp</dimen>
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index a44f84b9c..c8f64351c 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -41,6 +41,17 @@
checkable+checked+pressed. -->
<attr name="keyBackground" format="reference" />
+ <!-- Horizontal padding of left/right aligned key label to the edge of the key. -->
+ <attr name="keyLabelHorizontalPadding" format="dimension" />
+ <!-- Right padding of hint letter to the edge of the key.-->
+ <attr name="keyHintLetterPadding" format="dimension" />
+ <!-- Bottom padding of popup hint letter "..." to the edge of the key.-->
+ <attr name="keyPopupHintLetterPadding" format="dimension" />
+ <!-- Right padding of shifted letter hint to the edge of the key.-->
+ <attr name="keyShiftedLetterHintPadding" format="dimension" />
+ <!-- Blur radius of key text shadow. -->
+ <attr name="keyTextShadowRadius" format="float" />
+
<!-- Layout resource for key press feedback.-->
<attr name="keyPreviewLayout" format="reference" />
<!-- The background for key press feedback. -->
@@ -307,19 +318,10 @@
<!-- Size of the text for hint label, in the proportion of key height. -->
<attr name="keyHintLabelRatio" format="fraction" />
<!-- Size of the text for shifted letter hint, in the proportion of key height. -->
- <attr name="keyShiftedLetterHintRatio" format="dimension|fraction" />
- <!-- Horizontal padding of left/right aligned key label to the edge of the key. -->
- <attr name="keyLabelHorizontalPadding" format="dimension" />
- <!-- Right padding of hint letter to the edge of the key.-->
- <attr name="keyHintLetterPadding" format="dimension" />
- <!-- Bottom padding of popup hint letter "..." to the edge of the key.-->
- <attr name="keyPopupHintLetterPadding" format="dimension" />
- <!-- Right padding of shifted letter hint to the edge of the key.-->
- <attr name="keyShiftedLetterHintPadding" format="dimension" />
+ <attr name="keyShiftedLetterHintRatio" format="fraction" />
<!-- Color to use for the label in a key. -->
<attr name="keyTextColor" format="color" />
<attr name="keyTextShadowColor" format="color" />
- <attr name="keyTextShadowRadius" format="float" />
<!-- Color to use for the label in a key when in inactivated state. -->
<attr name="keyTextInactivatedColor" format="color" />
<!-- Key hint letter (= one character hint label) color -->
diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml
index e0fcd5e2d..aa16c7770 100644
--- a/java/res/values/dimens.xml
+++ b/java/res/values/dimens.xml
@@ -65,8 +65,6 @@
<fraction name="key_uppercase_letter_ratio">35%</fraction>
<fraction name="key_preview_text_ratio">82%</fraction>
<fraction name="spacebar_text_ratio">33.735%</fraction>
- <fraction name="key_letter_ratio_5rows">64%</fraction>
- <fraction name="key_uppercase_letter_ratio_5rows">41%</fraction>
<dimen name="key_preview_height">80dp</dimen>
<dimen name="key_preview_offset">-8.0dp</dimen>
@@ -75,6 +73,11 @@
<dimen name="key_popup_hint_letter_padding">2dp</dimen>
<dimen name="key_uppercase_letter_padding">2dp</dimen>
+ <!-- For 5-row keyboard -->
+ <fraction name="key_bottom_gap_5row">3.20%p</fraction>
+ <fraction name="key_letter_ratio_5row">64%</fraction>
+ <fraction name="key_uppercase_letter_ratio_5row">41%</fraction>
+
<dimen name="key_preview_offset_ics">8.0dp</dimen>
<!-- popup_key_height x -0.5 -->
<dimen name="more_keys_keyboard_vertical_correction_ics">-26.4dp</dimen>
diff --git a/java/res/xml-sw768dp-land/kbd_thai_symbols_shift.xml b/java/res/values/research_strings.xml
index fa30f24c0..2cad15eb0 100644
--- a/java/res/xml-sw768dp-land/kbd_thai_symbols_shift.xml
+++ b/java/res/values/research_strings.xml
@@ -17,13 +17,8 @@
** limitations under the License.
*/
-->
-
-<Keyboard
- xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:rowHeight="20%p"
- latin:verticalGap="2.65%p"
- latin:touchPositionCorrectionData="@null"
->
- <include
- latin:keyboardLayout="@xml/rows_thai_symbols_shift" />
-</Keyboard>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Contents of note explaining what data is collected and how. -->
+ <!-- TODO: remove translatable=false attribute once text is stable -->
+ <string name="research_splash_content" translatable="false"></string>
+</resources>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 35cbcf3c4..bd60844a3 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -278,16 +278,11 @@
<!-- Title of dialog shown at start informing users about contributing research usage data-->
<!-- TODO: remove translatable=false attribute once text is stable -->
- <string name="research_splash_title" translatable="false">Usage Participation</string>
- <!-- Contents of note explaining what data is collected and how. -->
- <!-- TODO: remove translatable=false attribute once text is stable -->
- <string name="research_splash_content" translatable="false">Thank you for dogfooding this keyboard.\n\nIf you like it, please help us make it better by sending us usage information. When enabled, the keyboard uploads general statistics, such as how fast you type, and also occasional samples of how you type words.\n\nNo passwords or non-dictionary words are ever automatically uploaded, and words are sampled infrequently enough so that reconstructing the meaning of what you typed is highly unlikely.\n\nYou can disable and reenable logging through the RLog menu by long-pressing on the microphone or settings key.\n</string>
- <!-- Button label text for opting out of research usage data collection [CHAR LIMIT=50] -->
- <!-- TODO: remove translatable=false attribute once text is stable -->
- <string name="research_dont_send_usage_info" translatable="false">Do not send\nusage info</string>
- <!-- Button label text for opting into research usage data collection [CHAR LIMIT=50] -->
+ <string name="research_splash_title" translatable="false">Warning</string>
+
+ <!-- Toast message informing users that logging has been disabled -->
<!-- TODO: remove translatable=false attribute once text is stable -->
- <string name="research_send_usage_info" translatable="false">Send usage info</string>
+ <string name="research_logging_disabled" translatable="false">Logging Disabled</string>
<!-- Name for the research uploading service to be displayed to users. [CHAR LIMIT=50] -->
<!-- TODO: remove translatable=false attribute once text is stable -->
diff --git a/java/res/xml-sw600dp-land/kbd_thai.xml b/java/res/xml-sw600dp-land/kbd_thai.xml
deleted file mode 100644
index a7763f2c7..000000000
--- a/java/res/xml-sw600dp-land/kbd_thai.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<Keyboard
- xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:rowHeight="20%p"
- latin:verticalGap="3.20%p"
- latin:keyTypeface="normal"
- latin:keyLetterSize="@fraction/key_letter_ratio_5rows"
- latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5rows"
- latin:touchPositionCorrectionData="@null"
->
- <include
- latin:keyboardLayout="@xml/rows_thai" />
-</Keyboard>
diff --git a/java/res/xml-sw600dp/kbd_thai.xml b/java/res/xml-sw600dp/kbd_thai.xml
deleted file mode 100644
index a7763f2c7..000000000
--- a/java/res/xml-sw600dp/kbd_thai.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<Keyboard
- xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:rowHeight="20%p"
- latin:verticalGap="3.20%p"
- latin:keyTypeface="normal"
- latin:keyLetterSize="@fraction/key_letter_ratio_5rows"
- latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5rows"
- latin:touchPositionCorrectionData="@null"
->
- <include
- latin:keyboardLayout="@xml/rows_thai" />
-</Keyboard>
diff --git a/java/res/xml-sw600dp/rowkeys_arabic1.xml b/java/res/xml-sw600dp/rowkeys_arabic1.xml
index 44fdc676d..6a0e25786 100644
--- a/java/res/xml-sw600dp/rowkeys_arabic1.xml
+++ b/java/res/xml-sw600dp/rowkeys_arabic1.xml
@@ -23,19 +23,23 @@
>
<!-- U+0636: "ض" ARABIC LETTER DAD -->
<Key
- latin:keyLabel="&#x0636;" />
+ latin:keyLabel="&#x0636;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0635: "ص" ARABIC LETTER SAD -->
<Key
- latin:keyLabel="&#x0635;" />
+ latin:keyLabel="&#x0635;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062B: "ث" ARABIC LETTER THEH -->
<Key
- latin:keyLabel="&#x062B;" />
+ latin:keyLabel="&#x062B;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0642: "ق" ARABIC LETTER QAF
U+06A8: "ڨ" ARABIC LETTER QAF WITH THREE DOTS ABOVE -->
<!-- TODO: DroidSansArabic lacks the glyph of U+06A8 ARABIC LETTER QAF WITH THREE DOTS ABOVE -->
<Key
latin:keyLabel="&#x0642;"
- latin:moreKeys="&#x06A8;" />
+ latin:moreKeys="&#x06A8;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0641: "ف" ARABIC LETTER FEH
U+06A4: "ڤ" ARABIC LETTER VEH
U+06A2: "ڢ" ARABIC LETTER FEH WITH DOT MOVED BELOW
@@ -44,28 +48,35 @@
<!-- TODO: DroidSansArabic lacks the glyph of U+06A5 ARABIC LETTER FEH WITH THREE DOTS BELOW -->
<Key
latin:keyLabel="&#x0641;"
- latin:moreKeys="&#x06A4;,&#x06A2;,&#x06A5;" />
+ latin:moreKeys="&#x06A4;,&#x06A2;,&#x06A5;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+063A: "غ" ARABIC LETTER GHAIN -->
<Key
- latin:keyLabel="&#x063A;" />
+ latin:keyLabel="&#x063A;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0639: "ع" ARABIC LETTER AIN -->
<Key
- latin:keyLabel="&#x0639;" />
+ latin:keyLabel="&#x0639;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0647: "ه" ARABIC LETTER HEH
U+FEEB: "ﻫ" ARABIC LETTER HEH INITIAL FORM
U+0647 U+200D: ARABIC LETTER HEH + ZERO WIDTH JOINER -->
<Key
latin:keyLabel="&#x0647;"
- latin:moreKeys="&#xFEEB;|&#x0647;&#x200D;" />
+ latin:moreKeys="&#xFEEB;|&#x0647;&#x200D;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062E: "خ" ARABIC LETTER KHAH -->
<Key
- latin:keyLabel="&#x062E;" />
+ latin:keyLabel="&#x062E;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062D: "ح" ARABIC LETTER HAH -->
<Key
- latin:keyLabel="&#x062D;" />
+ latin:keyLabel="&#x062D;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062C: "ج" ARABIC LETTER JEEM
U+0686: "چ" ARABIC LETTER TCHEH -->
<Key
latin:keyLabel="&#x062C;"
- latin:moreKeys="&#x0686;" />
+ latin:moreKeys="&#x0686;"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_arabic2.xml b/java/res/xml-sw600dp/rowkeys_arabic2.xml
index 3eba2fbf3..00e69ace7 100644
--- a/java/res/xml-sw600dp/rowkeys_arabic2.xml
+++ b/java/res/xml-sw600dp/rowkeys_arabic2.xml
@@ -26,21 +26,25 @@
<!-- TODO: DroidSansArabic lacks the glyph of U+069C ARABIC LETTER SEEN WITH THREE DOTS BELOW AND THREE DOTS ABOVE -->
<Key
latin:keyLabel="&#x0634;"
- latin:moreKeys="&#x069C;" />
+ latin:moreKeys="&#x069C;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0633: "س" ARABIC LETTER SEEN -->
<Key
- latin:keyLabel="&#x0633;" />
+ latin:keyLabel="&#x0633;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+064A: "ي" ARABIC LETTER YEH
U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE
U+0649: "ى" ARABIC LETTER ALEF MAKSURA -->
<Key
latin:keyLabel="&#x064A;"
- latin:moreKeys="&#x0626;,&#x0649;" />
+ latin:moreKeys="&#x0626;,&#x0649;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0628: "ب" ARABIC LETTER BEH
U+067E: "پ" ARABIC LETTER PEH -->
<Key
latin:keyLabel="&#x0628;"
- latin:moreKeys="&#x067E;" />
+ latin:moreKeys="&#x067E;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0644: "ل" ARABIC LETTER LAM
U+FEFB: "ﻻ" ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM
U+0627: "ا" ARABIC LETTER ALEF
@@ -52,7 +56,8 @@
U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE -->
<Key
latin:keyLabel="&#x0644;"
- latin:moreKeys="&#xFEFB;|&#x0644;&#x0627;,&#xFEF7;|&#x0644;&#x0623;,&#xFEF9;|&#x0644;&#x0625;,&#xFEF5;|&#x0644;&#x0622;" />
+ latin:moreKeys="&#xFEFB;|&#x0644;&#x0627;,&#xFEF7;|&#x0644;&#x0623;,&#xFEF9;|&#x0644;&#x0625;,&#xFEF5;|&#x0644;&#x0622;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0627: "ا" ARABIC LETTER ALEF
U+0621: "ء" ARABIC LETTER HAMZA
U+0671: "ٱ" ARABIC LETTER ALEF WASLA
@@ -61,23 +66,29 @@
U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE -->
<Key
latin:keyLabel="&#x0627;"
- latin:moreKeys="&#x0621;,&#x0671;,&#x0623;,&#x0625;,&#x0622;" />
+ latin:moreKeys="&#x0621;,&#x0671;,&#x0623;,&#x0625;,&#x0622;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062A: "ت" ARABIC LETTER TEH -->
<Key
- latin:keyLabel="&#x062A;" />
+ latin:keyLabel="&#x062A;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0646: "ن" ARABIC LETTER NOON -->
<Key
- latin:keyLabel="&#x0646;" />
+ latin:keyLabel="&#x0646;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0645: "م" ARABIC LETTER MEEM -->
<Key
- latin:keyLabel="&#x0645;" />
+ latin:keyLabel="&#x0645;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0643: "ك" ARABIC LETTER KAF
U+06AF: "گ" ARABIC LETTER GAF
U+06A9: "ک" ARABIC LETTER KEHEH -->
<Key
latin:keyLabel="&#x0643;"
- latin:moreKeys="&#x06AF;,&#x06A9;" />
+ latin:moreKeys="&#x06AF;,&#x06A9;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0637: "ط" ARABIC LETTER TAH -->
<Key
- latin:keyLabel="&#x0637;" />
+ latin:keyLabel="&#x0637;"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_arabic3.xml b/java/res/xml-sw600dp/rowkeys_arabic3.xml
index 911550f4a..b0bcd78d6 100644
--- a/java/res/xml-sw600dp/rowkeys_arabic3.xml
+++ b/java/res/xml-sw600dp/rowkeys_arabic3.xml
@@ -23,37 +23,48 @@
>
<!-- U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE -->
<Key
- latin:keyLabel="&#x0626;" />
+ latin:keyLabel="&#x0626;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0621: "ء" ARABIC LETTER HAMZA -->
<Key
- latin:keyLabel="&#x0621;" />
+ latin:keyLabel="&#x0621;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0624: "ؤ" ARABIC LETTER WAW WITH HAMZA ABOVE -->
<Key
- latin:keyLabel="&#x0624;" />
+ latin:keyLabel="&#x0624;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0631: "ر" ARABIC LETTER REH -->
<Key
- latin:keyLabel="&#x0631;" />
+ latin:keyLabel="&#x0631;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0630: "ذ" ARABIC LETTER THAL -->
<Key
- latin:keyLabel="&#x0630;" />
+ latin:keyLabel="&#x0630;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0649: "ى" ARABIC LETTER ALEF MAKSURA -->
<Key
- latin:keyLabel="&#x0649;" />
+ latin:keyLabel="&#x0649;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0629: "ة" ARABIC LETTER TEH MARBUTA -->
<Key
- latin:keyLabel="&#x0629;" />
+ latin:keyLabel="&#x0629;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0648: "و" ARABIC LETTER WAW -->
<Key
- latin:keyLabel="&#x0648;" />
+ latin:keyLabel="&#x0648;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0632: "ز" ARABIC LETTER ZAIN
U+0698: "ژ" ARABIC LETTER JEH -->
<Key
latin:keyLabel="&#x0632;"
- latin:moreKeys="&#x0698;" />
+ latin:moreKeys="&#x0698;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0638: "ظ" ARABIC LETTER ZAH -->
<Key
- latin:keyLabel="&#x0638;" />
+ latin:keyLabel="&#x0638;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062F: "د" ARABIC LETTER DAL -->
<Key
- latin:keyLabel="&#x062F;" />
+ latin:keyLabel="&#x062F;"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_farsi1.xml b/java/res/xml-sw600dp/rowkeys_farsi1.xml
index 53208f286..7b312404a 100644
--- a/java/res/xml-sw600dp/rowkeys_farsi1.xml
+++ b/java/res/xml-sw600dp/rowkeys_farsi1.xml
@@ -23,25 +23,32 @@
>
<!-- U+0636: "ض" ARABIC LETTER DAD -->
<Key
- latin:keyLabel="&#x0636;" />
+ latin:keyLabel="&#x0636;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0635: "ص" ARABIC LETTER SAD -->
<Key
- latin:keyLabel="&#x0635;" />
+ latin:keyLabel="&#x0635;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062B: "ث" ARABIC LETTER THEH -->
<Key
- latin:keyLabel="&#x062B;" />
+ latin:keyLabel="&#x062B;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0642: "ق" ARABIC LETTER QAF -->
<Key
- latin:keyLabel="&#x0642;" />
+ latin:keyLabel="&#x0642;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0641: "ف" ARABIC LETTER FEH -->
<Key
- latin:keyLabel="&#x0641;" />
+ latin:keyLabel="&#x0641;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+063A: "غ" ARABIC LETTER GHAIN -->
<Key
- latin:keyLabel="&#x063A;" />
+ latin:keyLabel="&#x063A;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0639: "ع" ARABIC LETTER AIN -->
<Key
- latin:keyLabel="&#x0639;" />
+ latin:keyLabel="&#x0639;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0647: "ه" ARABIC LETTER HEH
U+FEEB: "ﻫ" ARABIC LETTER HEH INITIAL FORM
U+0647/U+200D: ARABIC LETTER HEH + ZERO WIDTH JOINER
@@ -49,17 +56,22 @@
U+0629: "ة" ARABIC LETTER TEH MARBUTA -->
<Key
latin:keyLabel="&#x0647;"
- latin:moreKeys="&#xFEEB;|&#x0647;&#x200D;,&#x0647;&#x0654;,&#x0629;,%" />
+ latin:moreKeys="&#xFEEB;|&#x0647;&#x200D;,&#x0647;&#x0654;,&#x0629;,%"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062E: "خ" ARABIC LETTER KHAH -->
<Key
- latin:keyLabel="&#x062E;" />
+ latin:keyLabel="&#x062E;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062D: "ح" ARABIC LETTER HAH -->
<Key
- latin:keyLabel="&#x062D;" />
+ latin:keyLabel="&#x062D;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062C: "ج" ARABIC LETTER JEEM -->
<Key
- latin:keyLabel="&#x062C;" />
+ latin:keyLabel="&#x062C;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0686: "چ" ARABIC LETTER TCHEH -->
<Key
- latin:keyLabel="&#x0686;" />
+ latin:keyLabel="&#x0686;"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_farsi2.xml b/java/res/xml-sw600dp/rowkeys_farsi2.xml
index 234f98430..3b759b66c 100644
--- a/java/res/xml-sw600dp/rowkeys_farsi2.xml
+++ b/java/res/xml-sw600dp/rowkeys_farsi2.xml
@@ -23,10 +23,12 @@
>
<!-- U+0634: "ش" ARABIC LETTER SHEEN -->
<Key
- latin:keyLabel="&#x0634;" />
+ latin:keyLabel="&#x0634;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0633: "س" ARABIC LETTER SEEN -->
<Key
- latin:keyLabel="&#x0633;" />
+ latin:keyLabel="&#x0633;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+06CC: "ی" ARABIC LETTER FARSI YEH
U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE
U+064A: "ي" ARABIC LETTER YEH
@@ -34,13 +36,16 @@
U+0649: "ى" ARABIC LETTER ALEF MAKSURA -->
<Key
latin:keyLabel="&#x06CC;"
- latin:moreKeys="&#x0626;,&#x064A;,&#xFBE8;|&#x0649;" />
+ latin:moreKeys="&#x0626;,&#x064A;,&#xFBE8;|&#x0649;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0628: "ب" ARABIC LETTER BEH -->
<Key
- latin:keyLabel="&#x0628;" />
+ latin:keyLabel="&#x0628;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0644: "ل" ARABIC LETTER LAM -->
<Key
- latin:keyLabel="&#x0644;" />
+ latin:keyLabel="&#x0644;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0627: "ا" ARABIC LETTER ALEF
U+0621: "ء" ARABIC LETTER HAMZA
U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE
@@ -49,25 +54,31 @@
U+0625: "إ" ARABIC LETTER ALEF WITH HAMZA BELOW -->
<Key
latin:keyLabel="&#x0627;"
- latin:moreKeys="&#x0621;,&#x0622;,&#x0623;,&#x0671;,&#x0625;" />
+ latin:moreKeys="&#x0621;,&#x0622;,&#x0623;,&#x0671;,&#x0625;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062A: "ت" ARABIC LETTER TEH
U+062B: "ﺙ" ARABIC LETTER THEH
U+0629: "ة": ARABIC LETTER TEH MARBUTA -->
<Key
latin:keyLabel="&#x062A;"
- latin:moreKeys="&#x062B;,&#x0629;" />
+ latin:moreKeys="&#x062B;,&#x0629;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0646: "ن" ARABIC LETTER NOON -->
<Key
- latin:keyLabel="&#x0646;" />
+ latin:keyLabel="&#x0646;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0645: "م" ARABIC LETTER MEEM -->
<Key
- latin:keyLabel="&#x0645;" />
+ latin:keyLabel="&#x0645;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+06A9: "ک" ARABIC LETTER KEHEH
U+0643: "ك" ARABIC LETTER KAF -->
<Key
latin:keyLabel="&#x06A9;"
- latin:moreKeys="&#x0643;" />
+ latin:moreKeys="&#x0643;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+06AF: "گ" ARABIC LETTER GAF -->
<Key
- latin:keyLabel="&#x06AF;" />
+ latin:keyLabel="&#x06AF;"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_farsi3.xml b/java/res/xml-sw600dp/rowkeys_farsi3.xml
index 998ba72d6..3597618ce 100644
--- a/java/res/xml-sw600dp/rowkeys_farsi3.xml
+++ b/java/res/xml-sw600dp/rowkeys_farsi3.xml
@@ -23,34 +23,44 @@
>
<!-- U+0638: "ظ" ARABIC LETTER ZAH -->
<Key
- latin:keyLabel="&#x0638;" />
+ latin:keyLabel="&#x0638;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0637: "ط" ARABIC LETTER TAH -->
<Key
- latin:keyLabel="&#x0637;" />
+ latin:keyLabel="&#x0637;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0698: "ژ" ARABIC LETTER JEH -->
<Key
- latin:keyLabel="&#x0698;" />
+ latin:keyLabel="&#x0698;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0632: "ز" ARABIC LETTER ZAIN -->
<Key
- latin:keyLabel="&#x0632;" />
+ latin:keyLabel="&#x0632;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0631: "ر" ARABIC LETTER REH -->
<Key
- latin:keyLabel="&#x0631;" />
+ latin:keyLabel="&#x0631;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0630: "ذ" ARABIC LETTER THAL -->
<Key
- latin:keyLabel="&#x0630;" />
+ latin:keyLabel="&#x0630;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062F: "د" ARABIC LETTER DAL -->
<Key
- latin:keyLabel="&#x062F;" />
+ latin:keyLabel="&#x062F;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+067E: "پ" ARABIC LETTER PEH -->
<Key
- latin:keyLabel="&#x067E;" />
+ latin:keyLabel="&#x067E;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0648: "و" ARABIC LETTER WAW
U+0624: "ؤ" ARABIC LETTER WAW WITH HAMZA ABOVE -->
<Key
latin:keyLabel="&#x0648;"
- latin:moreKeys="&#x0624;" />
+ latin:moreKeys="&#x0624;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE -->
<Key
- latin:keyLabel="&#x0622;" />
+ latin:keyLabel="&#x0622;"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_thai1.xml b/java/res/xml-sw600dp/rowkeys_thai1.xml
deleted file mode 100644
index 6aec7c2c5..000000000
--- a/java/res/xml-sw600dp/rowkeys_thai1.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<merge
- xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
->
- <switch>
- <case
- latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
- >
- <!-- U+0E51: "๑" THAI DIGIT ONE -->
- <Key
- latin:keyLabel="&#x0E51;" />
- <!-- U+0E52: "๒" THAI DIGIT TWO -->
- <Key
- latin:keyLabel="&#x0E52;" />
- <!-- U+0E53: "๓" THAI DIGIT THREE -->
- <Key
- latin:keyLabel="&#x0E53;" />
- <!-- U+0E54: "๔" THAI DIGIT FOUR -->
- <Key
- latin:keyLabel="&#x0E54;" />
- <!-- U+0E39: " ู" THAI CHARACTER SARA UU -->
- <Key
- latin:keyLabel="&#x0E39;" />
- <!-- U+0E3F: "฿" THAI CURRENCY SYMBOL BAHT -->
- <Key
- latin:keyLabel="&#x0E3F;" />
- <!-- U+0E55: "๕" THAI DIGIT FIVE -->
- <Key
- latin:keyLabel="&#x0E55;" />
- <!-- U+0E56: "๖" THAI DIGIT SIX -->
- <Key
- latin:keyLabel="&#x0E56;" />
- <!-- U+0E57: "๗" THAI DIGIT SEVEN -->
- <Key
- latin:keyLabel="&#x0E57;" />
- <!-- U+0E58: "๘" THAI DIGIT EIGHT -->
- <Key
- latin:keyLabel="&#x0E58;" />
- <!-- U+0E59: "๙" THAI DIGIT NINE -->
- <Key
- latin:keyLabel="&#x0E59;" />
- </case>
- <default>
- <!-- U+0E45: "ๅ" THAI CHARACTER LAKKHANGYAO -->
- <Key
- latin:keyLabel="&#x0E45;" />
- <Key
- latin:keyLabel="/" />
- <!-- U+0E20: "ภ" THAI CHARACTER PHO SAMPHAO -->
- <Key
- latin:keyLabel="&#x0E20;" />
- <!-- U+0E16: "ถ" THAI CHARACTER THO THUNG -->
- <Key
- latin:keyLabel="&#x0E16;" />
- <!-- U+0E38: " ุ" THAI CHARACTER SARA U -->
- <Key
- latin:keyLabel="&#x0E38;" />
- <!-- U+0E36: " ึ" THAI CHARACTER SARA UE -->
- <Key
- latin:keyLabel="&#x0E36;" />
- <!-- U+0E04: "ค" THAI CHARACTER KHO KHWAI -->
- <Key
- latin:keyLabel="&#x0E04;" />
- <!-- U+0E15: "ต" THAI CHARACTER TO TAO -->
- <Key
- latin:keyLabel="&#x0E15;" />
- <!-- U+0E08: "จ" THAI CHARACTER CHO CHAN -->
- <Key
- latin:keyLabel="&#x0E08;" />
- <!-- U+0E02: "ข" THAI CHARACTER KHO KHAI -->
- <Key
- latin:keyLabel="&#x0E02;" />
- <!-- U+0E0A: "ช" THAI CHARACTER CHO CHANG -->
- <Key
- latin:keyLabel="&#x0E0A;" />
- </default>
- </switch>
-</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_thai2.xml b/java/res/xml-sw600dp/rowkeys_thai2.xml
deleted file mode 100644
index edb759a89..000000000
--- a/java/res/xml-sw600dp/rowkeys_thai2.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<merge
- xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
->
- <switch>
- <case
- latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
- >
- <!-- U+0E50: "๐" THAI DIGIT ZERO -->
- <Key
- latin:keyLabel="&#x0E50;" />
- <Key
- latin:keyLabel="&quot;" />
- <!-- U+0E0E: "ฎ" THAI CHARACTER DO CHADA -->
- <Key
- latin:keyLabel="&#x0E0E;" />
- <!-- U+0E11: "ฑ" THAI CHARACTER THO NANGMONTHO -->
- <Key
- latin:keyLabel="&#x0E11;" />
- <!-- U+0E18: "ธ" THAI CHARACTER THO THONG -->
- <Key
- latin:keyLabel="&#x0E18;" />
- <!-- U+0E4D: " ํ" THAI CHARACTER THANTHAKHAT -->
- <Key
- latin:keyLabel="&#x0E4D;" />
- <!-- U+0E4A: " ๊" THAI CHARACTER MAI TRI -->
- <Key
- latin:keyLabel="&#x0E4A;" />
- <!-- U+0E13: "ณ" THAI CHARACTER NO NEN -->
- <Key
- latin:keyLabel="&#x0E13;" />
- <!-- U+0E2F: "ฯ" THAI CHARACTER PAIYANNOI -->
- <Key
- latin:keyLabel="&#x0E2F;" />
- <!-- U+0E0D: "ญ" THAI CHARACTER YO YING -->
- <Key
- latin:keyLabel="&#x0E0D;" />
- <!-- U+0E10: "ฐ" THAI CHARACTER THO THAN -->
- <Key
- latin:keyLabel="&#x0E10;" />
- <Key
- latin:keyLabel="," />
- <!-- U+0E05: "ฅ" THAI CHARACTER KHO KHON -->
- <Key
- latin:keyLabel="&#x0E05;" />
- </case>
- <default>
- <!-- U+0E46: "ๆ" THAI CHARACTER MAIYAMOK -->
- <Key
- latin:keyLabel="&#x0E46;" />
- <!-- U+0E44: "ไ" THAI CHARACTER SARA AI MAIMALAI -->
- <Key
- latin:keyLabel="&#x0E44;" />
- <!-- U+0E33: "ำ" THAI CHARACTER SARA AM -->
- <Key
- latin:keyLabel="&#x0E33;" />
- <!-- U+0E1E: "พ" THAI CHARACTER PHO PHAN -->
- <Key
- latin:keyLabel="&#x0E1E;" />
- <!-- U+0E30: "ะ" THAI CHARACTER SARA A -->
- <Key
- latin:keyLabel="&#x0E30;" />
- <!-- U+0E31: " ั" THAI CHARACTER MAI HAN-AKAT -->
- <Key
- latin:keyLabel="&#x0E31;" />
- <!-- U+0E35: " ี" HAI CHARACTER SARA II -->
- <Key
- latin:keyLabel="&#x0E35;" />
- <!-- U+0E23: "ร" THAI CHARACTER RO RUA -->
- <Key
- latin:keyLabel="&#x0E23;" />
- <!-- U+0E19: "น" THAI CHARACTER NO NU -->
- <Key
- latin:keyLabel="&#x0E19;" />
- <!-- U+0E22: "ย" THAI CHARACTER YO YAK -->
- <Key
- latin:keyLabel="&#x0E22;" />
- <!-- U+0E1A: "บ" THAI CHARACTER BO BAIMAI -->
- <Key
- latin:keyLabel="&#x0E1A;" />
- <!-- U+0E25: "ล" THAI CHARACTER LO LING -->
- <Key
- latin:keyLabel="&#x0E25;" />
- <!-- U+0E03: "ฃ" THAI CHARACTER KHO KHUAT -->
- <Key
- latin:keyLabel="&#x0E03;" />
- </default>
- </switch>
-</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_thai3.xml b/java/res/xml-sw600dp/rowkeys_thai3.xml
deleted file mode 100644
index 7507dde86..000000000
--- a/java/res/xml-sw600dp/rowkeys_thai3.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<merge
- xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
->
- <switch>
- <case
- latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
- >
- <!-- U+0E24: "ฤ" THAI CHARACTER RU -->
- <Key
- latin:keyLabel="&#x0E24;" />
- <!-- U+0E06: "ฆ" THAI CHARACTER KHO RAKHANG -->
- <Key
- latin:keyLabel="&#x0E06;" />
- <!-- U+0E0F: "ฏ" THAI CHARACTER TO PATAK -->
- <Key
- latin:keyLabel="&#x0E0F;" />
- <!-- U+0E42: "โ" THAI CHARACTER SARA O -->
- <Key
- latin:keyLabel="&#x0E42;" />
- <!-- U+0E0C: "ฌ" THAI CHARACTER CHO CHOE -->
- <Key
- latin:keyLabel="&#x0E0C;" />
- <!-- U+0E47: " ็" THAI CHARACTER MAITAIKHU -->
- <Key
- latin:keyLabel="&#x0E47;" />
- <!-- U+0E4B: " ๋" THAI CHARACTER MAI CHATTAWA -->
- <Key
- latin:keyLabel="&#x0E4B;" />
- <!-- U+0E29: "ษ" THAI CHARACTER SO RUSI -->
- <Key
- latin:keyLabel="&#x0E29;" />
- <!-- U+0E28: "ศ" THAI CHARACTER SO SALA -->
- <Key
- latin:keyLabel="&#x0E28;" />
- <!-- U+0E0B: "ซ" THAI CHARACTER SO SO -->
- <Key
- latin:keyLabel="&#x0E0B;" />
- <Key
- latin:keyLabel="." />
- </case>
- <default>
- <!-- U+0E1F: "ฟ" THAI CHARACTER FO FAN -->
- <Key
- latin:keyLabel="&#x0E1F;" />
- <!-- U+0E2B: "ห" THAI CHARACTER HO HIP -->
- <Key
- latin:keyLabel="&#x0E2B;" />
- <!-- U+0E01: "ก" THAI CHARACTER KO KAI -->
- <Key
- latin:keyLabel="&#x0E01;" />
- <!-- U+0E14: "ด" THAI CHARACTER DO DEK -->
- <Key
- latin:keyLabel="&#x0E14;" />
- <!-- U+0E40: "เ" THAI CHARACTER SARA E -->
- <Key
- latin:keyLabel="&#x0E40;" />
- <!-- U+0E49: " ้" THAI CHARACTER MAI THO -->
- <Key
- latin:keyLabel="&#x0E49;" />
- <!-- U+0E48: " ฺ" THAI CHARACTER MAI EK -->
- <Key
- latin:keyLabel="&#x0E48;" />
- <!-- U+0E32: "า" THAI CHARACTER SARA AA -->
- <Key
- latin:keyLabel="&#x0E32;" />
- <!-- U+0E2A: "ส" THAI CHARACTER SO SUA -->
- <Key
- latin:keyLabel="&#x0E2A;" />
- <!-- U+0E27: "ว" THAI CHARACTER WO WAEN -->
- <Key
- latin:keyLabel="&#x0E27;" />
- <!-- U+0E07: "ง" THAI CHARACTER NGO NGU -->
- <Key
- latin:keyLabel="&#x0E07;" />
- </default>
- </switch>
-</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_thai4.xml b/java/res/xml-sw600dp/rowkeys_thai4.xml
deleted file mode 100644
index 64549bdce..000000000
--- a/java/res/xml-sw600dp/rowkeys_thai4.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<merge
- xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
->
- <switch>
- <case
- latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
- >
- <Key
- latin:keyLabel="(" />
- <Key
- latin:keyLabel=")" />
- <!-- U+0E09: "ฉ" THAI CHARACTER CHO CHING -->
- <Key
- latin:keyLabel="&#x0E09;" />
- <!-- U+0E2E: "ฮ" THAI CHARACTER HO NOKHUK -->
- <Key
- latin:keyLabel="&#x0E2E;" />
- <!-- U+0E3A: " ฺ" THAI CHARACTER PHINTHU -->
- <Key
- latin:keyLabel="&#x0E3A;" />
- <!-- U+0E4C: " ์" THAI CHARACTER THANTHAKHAT -->
- <Key
- latin:keyLabel="&#x0E4C;" />
- <Key
- latin:keyLabel="\?" />
- <!-- U+0E12: "ฒ" THAI CHARACTER THO PHUTHAO -->
- <Key
- latin:keyLabel="&#x0E12;" />
- <!-- U+0E2C: "ฬ" THAI CHARACTER LO CHULA -->
- <Key
- latin:keyLabel="&#x0E2C;" />
- <!-- U+0E26: "ฦ" THAI CHARACTER LU -->
- <Key
- latin:keyLabel="&#x0E26;" />
- </case>
- <default>
- <!-- U+0E1C: "ผ" THAI CHARACTER PHO PHUNG -->
- <Key
- latin:keyLabel="&#x0E1C;" />
- <!-- U+0E1B: "ป" THAI CHARACTER PO PLA -->
- <Key
- latin:keyLabel="&#x0E1B;" />
- <!-- U+0E41: "แ" THAI CHARACTER SARA AE -->
- <Key
- latin:keyLabel="&#x0E41;" />
- <!-- U+0E2D: "อ" THAI CHARACTER O ANG -->
- <Key
- latin:keyLabel="&#x0E2D;" />
- <!-- U+0E34: " ิ" THAI CHARACTER SARA I -->
- <Key
- latin:keyLabel="&#x0E34;" />
- <!-- U+0E37: " ื" THAI CHARACTER SARA UEE -->
- <Key
- latin:keyLabel="&#x0E37;" />
- <!-- U+0E17: "ท" THAI CHARACTER THO THAHAN -->
- <Key
- latin:keyLabel="&#x0E17;" />
- <!-- U+0E21: "ม" THAI CHARACTER MO MA -->
- <Key
- latin:keyLabel="&#x0E21;" />
- <!-- U+0E43: "ใ" THAI CHARACTER SARA AI MAIMUAN -->
- <Key
- latin:keyLabel="&#x0E43;" />
- <!-- U+0E1D: "ฝ" THAI CHARACTER FO FA -->
- <Key
- latin:keyLabel="&#x0E1D;" />
- </default>
- </switch>
-</merge>
diff --git a/java/res/xml-sw600dp/rows_thai.xml b/java/res/xml-sw600dp/rows_thai.xml
index c1fe55b39..bc89640ac 100644
--- a/java/res/xml-sw600dp/rows_thai.xml
+++ b/java/res/xml-sw600dp/rows_thai.xml
@@ -27,8 +27,7 @@
latin:keyWidth="7.5%p"
>
<include
- latin:keyboardLayout="@xml/rowkeys_thai1"
- latin:keyXPos="3.75%p" />
+ latin:keyboardLayout="@xml/rowkeys_thai1" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />
@@ -38,14 +37,16 @@
>
<include
latin:keyboardLayout="@xml/rowkeys_thai2"
- latin:keyXPos="0.719%p" />
+ latin:keyXPos="2.5%p" />
+ <include
+ latin:keyboardLayout="@xml/key_thai_kho_khuat" />
</Row>
<Row
latin:keyWidth="7.5%p"
>
<include
latin:keyboardLayout="@xml/rowkeys_thai3"
- latin:keyXPos="3.75%p" />
+ latin:keyXPos="5.0%p" />
<Key
latin:keyStyle="enterKeyStyle"
latin:keyWidth="fillRight" />
diff --git a/java/res/xml-sw768dp-land/kbd_thai_symbols.xml b/java/res/xml-sw768dp-land/kbd_thai_symbols.xml
deleted file mode 100644
index 1531458ea..000000000
--- a/java/res/xml-sw768dp-land/kbd_thai_symbols.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<Keyboard
- xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:rowHeight="20%p"
- latin:verticalGap="2.65%p"
- latin:touchPositionCorrectionData="@null"
->
- <include
- latin:keyboardLayout="@xml/rows_thai_symbols" />
-</Keyboard>
diff --git a/java/res/xml-sw768dp/kbd_thai.xml b/java/res/xml-sw768dp/kbd_thai.xml
deleted file mode 100644
index 7e4451455..000000000
--- a/java/res/xml-sw768dp/kbd_thai.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<Keyboard
- xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:rowHeight="20%p"
- latin:verticalGap="2.95%p"
- latin:keyTypeface="normal"
- latin:keyLetterSize="@fraction/key_letter_ratio_5rows"
- latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5rows"
- latin:touchPositionCorrectionData="@null"
->
- <include
- latin:keyboardLayout="@xml/rows_thai" />
-</Keyboard>
diff --git a/java/res/xml-sw768dp/kbd_thai_symbols.xml b/java/res/xml-sw768dp/kbd_thai_symbols.xml
index e2e5f5d56..0cd9a61ea 100644
--- a/java/res/xml-sw768dp/kbd_thai_symbols.xml
+++ b/java/res/xml-sw768dp/kbd_thai_symbols.xml
@@ -21,7 +21,9 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:rowHeight="20%p"
- latin:verticalGap="2.95%p"
+ latin:verticalGap="@fraction/key_bottom_gap_5row"
+ latin:keyLetterSize="@fraction/key_letter_ratio_5row"
+ latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
latin:touchPositionCorrectionData="@null"
>
<include
diff --git a/java/res/xml-sw768dp/kbd_thai_symbols_shift.xml b/java/res/xml-sw768dp/kbd_thai_symbols_shift.xml
index a1358d4a2..a68fec458 100644
--- a/java/res/xml-sw768dp/kbd_thai_symbols_shift.xml
+++ b/java/res/xml-sw768dp/kbd_thai_symbols_shift.xml
@@ -21,7 +21,9 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:rowHeight="20%p"
- latin:verticalGap="2.95%p"
+ latin:verticalGap="@fraction/key_bottom_gap_5row"
+ latin:keyLetterSize="@fraction/key_letter_ratio_5row"
+ latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
latin:touchPositionCorrectionData="@null"
>
<include
diff --git a/java/res/xml-sw768dp/rowkeys_thai_digits.xml b/java/res/xml-sw768dp/rowkeys_thai_digits.xml
index 512283096..55196ebc3 100644
--- a/java/res/xml-sw768dp/rowkeys_thai_digits.xml
+++ b/java/res/xml-sw768dp/rowkeys_thai_digits.xml
@@ -23,32 +23,42 @@
>
<!-- U+0E51: "๑" THAI DIGIT ONE -->
<Key
- latin:keyLabel="&#x0E51;" />
+ latin:keyLabel="&#x0E51;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E52: "๒" THAI DIGIT TWO -->
<Key
- latin:keyLabel="&#x0E52;" />
+ latin:keyLabel="&#x0E52;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E53: "๓" THAI DIGIT THREE -->
<Key
- latin:keyLabel="&#x0E53;" />
+ latin:keyLabel="&#x0E53;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E54: "๔" THAI DIGIT FOUR -->
<Key
- latin:keyLabel="&#x0E54;" />
+ latin:keyLabel="&#x0E54;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E55: "๕" THAI DIGIT FIVE -->
<Key
- latin:keyLabel="&#x0E55;" />
+ latin:keyLabel="&#x0E55;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E56: "๖" THAI DIGIT SIX -->
<Key
- latin:keyLabel="&#x0E56;" />
+ latin:keyLabel="&#x0E56;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E57: "๗" THAI DIGIT SEVEN -->
<Key
- latin:keyLabel="&#x0E57;" />
+ latin:keyLabel="&#x0E57;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E58: "๘" THAI DIGIT EIGHT -->
<Key
- latin:keyLabel="&#x0E58;" />
+ latin:keyLabel="&#x0E58;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E59: "๙" THAI DIGIT NINE -->
<Key
- latin:keyLabel="&#x0E59;" />
+ latin:keyLabel="&#x0E59;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E50: "๐" THAI DIGIT ZERO -->
<Key
- latin:keyLabel="&#x0E50;" />
+ latin:keyLabel="&#x0E50;"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml-sw768dp/rows_thai.xml b/java/res/xml-sw768dp/rows_thai.xml
index 7721bc5a9..5f9b383f8 100644
--- a/java/res/xml-sw768dp/rows_thai.xml
+++ b/java/res/xml-sw768dp/rows_thai.xml
@@ -28,7 +28,7 @@
>
<include
latin:keyboardLayout="@xml/rowkeys_thai1"
- latin:keyXPos="11.508%p" />
+ latin:keyXPos="3.799%p" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight"/>
@@ -42,9 +42,11 @@
latin:keyWidth="7.969%p" />
<include
latin:keyboardLayout="@xml/rowkeys_thai2" />
+ <include
+ latin:keyboardLayout="@xml/key_thai_kho_khuat" />
</Row>
<Row
- latin:keyWidth="7.125%p"
+ latin:keyWidth="7.079%p"
>
<Key
latin:keyStyle="toSymbolKeyStyle"
diff --git a/java/res/xml/kbd_arabic.xml b/java/res/xml/kbd_arabic.xml
index e3b90b07b..ce5f30b2f 100644
--- a/java/res/xml/kbd_arabic.xml
+++ b/java/res/xml/kbd_arabic.xml
@@ -20,7 +20,6 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyTypeface="normal"
>
<include
latin:keyboardLayout="@xml/rows_arabic" />
diff --git a/java/res/xml/kbd_pcqwerty.xml b/java/res/xml/kbd_pcqwerty.xml
index cebca4ff7..777c71af3 100644
--- a/java/res/xml/kbd_pcqwerty.xml
+++ b/java/res/xml/kbd_pcqwerty.xml
@@ -21,7 +21,9 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:rowHeight="20%p"
- latin:verticalGap="3.20%p"
+ latin:verticalGap="@fraction/key_bottom_gap_5row"
+ latin:keyLetterSize="@fraction/key_letter_ratio_5row"
+ latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
latin:touchPositionCorrectionData="@null"
>
<include
diff --git a/java/res/xml/kbd_pcqwerty_symbols.xml b/java/res/xml/kbd_pcqwerty_symbols.xml
index fd64e5bf4..a2297f702 100644
--- a/java/res/xml/kbd_pcqwerty_symbols.xml
+++ b/java/res/xml/kbd_pcqwerty_symbols.xml
@@ -21,7 +21,9 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:rowHeight="20%p"
- latin:verticalGap="3.20%p"
+ latin:verticalGap="@fraction/key_bottom_gap_5row"
+ latin:keyLetterSize="@fraction/key_letter_ratio_5row"
+ latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
latin:touchPositionCorrectionData="@null"
>
<include
diff --git a/java/res/xml/kbd_thai.xml b/java/res/xml/kbd_thai.xml
index b015d7063..b4a4a0b92 100644
--- a/java/res/xml/kbd_thai.xml
+++ b/java/res/xml/kbd_thai.xml
@@ -20,7 +20,11 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:keyTypeface="normal"
+ latin:rowHeight="20%p"
+ latin:verticalGap="@fraction/key_bottom_gap_5row"
+ latin:keyLetterSize="@fraction/key_letter_ratio_5row"
+ latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
+ latin:touchPositionCorrectionData="@null"
>
<include
latin:keyboardLayout="@xml/rows_thai" />
diff --git a/java/res/xml-sw768dp-land/kbd_thai.xml b/java/res/xml/key_thai_kho_khuat.xml
index 0f8516f5d..0ffd0f924 100644
--- a/java/res/xml-sw768dp-land/kbd_thai.xml
+++ b/java/res/xml/key_thai_kho_khuat.xml
@@ -18,15 +18,23 @@
*/
-->
-<Keyboard
+<merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
- latin:rowHeight="20%p"
- latin:verticalGap="2.65%p"
- latin:keyTypeface="normal"
- latin:keyLetterSize="@fraction/key_letter_ratio_5rows"
- latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5rows"
- latin:touchPositionCorrectionData="@null"
>
- <include
- latin:keyboardLayout="@xml/rows_thai" />
-</Keyboard>
+ <switch>
+ <case
+ latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+ >
+ <!-- U+0E05: "ฅ" THAI CHARACTER KHO KHON -->
+ <Key
+ latin:keyLabel="&#x0E05;"
+ latin:keyLabelFlags="fontNormal" />
+ </case>
+ <default>
+ <!-- U+0E03: "ฃ" THAI CHARACTER KHO KHUAT -->
+ <Key
+ latin:keyLabel="&#x0E03;"
+ latin:keyLabelFlags="fontNormal" />
+ </default>
+ </switch>
+</merge>
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index acdf7645f..613e9f6c4 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -34,6 +34,7 @@
el: Greek/greek
en_US: English United States/qwerty
en_GB: English Great Britain/qwerty
+ eo: Esperanto/spanish
es: Spanish/spanish
et: Estonian/nordic
fa: Persian/arabic
@@ -154,6 +155,12 @@
/>
<subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic"
+ android:imeSubtypeLocale="eo"
+ android:imeSubtypeMode="keyboard"
+ android:imeSubtypeExtraValue="KeyboardLayoutSet=spanish"
+ />
+ <subtype android:icon="@drawable/ic_subtype_keyboard"
+ android:label="@string/subtype_generic"
android:imeSubtypeLocale="es"
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
diff --git a/java/res/xml/rowkeys_arabic1.xml b/java/res/xml/rowkeys_arabic1.xml
index b1bf790e4..a4bef83c6 100644
--- a/java/res/xml/rowkeys_arabic1.xml
+++ b/java/res/xml/rowkeys_arabic1.xml
@@ -26,13 +26,15 @@
<Key
latin:keyLabel="&#x0636;"
latin:keyHintLabel="1"
- latin:additionalMoreKeys="1,&#x0661;" />
+ latin:additionalMoreKeys="1,&#x0661;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0635: "ص" ARABIC LETTER SAD
U+0662: "٢" ARABIC-INDIC DIGIT TWO -->
<Key
latin:keyLabel="&#x0635;"
latin:keyHintLabel="2"
- latin:additionalMoreKeys="2,&#x0662;" />
+ latin:additionalMoreKeys="2,&#x0662;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0642: "ق" ARABIC LETTER QAF
U+06A8: "ڨ" ARABIC LETTER QAF WITH THREE DOTS ABOVE
U+0663: "٣" ARABIC-INDIC DIGIT THREE -->
@@ -41,7 +43,8 @@
latin:keyLabel="&#x0642;"
latin:keyHintLabel="3"
latin:additionalMoreKeys="3,&#x0663;"
- latin:moreKeys="&#x06A8;" />
+ latin:moreKeys="&#x06A8;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0641: "ف" ARABIC LETTER FEH
U+06A4: "ڤ" ARABIC LETTER VEH
U+06A2: "ڢ" ARABIC LETTER FEH WITH DOT MOVED BELOW
@@ -53,19 +56,22 @@
latin:keyLabel="&#x0641;"
latin:keyHintLabel="4"
latin:additionalMoreKeys="4,&#x0664;"
- latin:moreKeys="&#x06A4;,&#x06A2;,&#x06A5;" />
+ latin:moreKeys="&#x06A4;,&#x06A2;,&#x06A5;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+063A: "غ" ARABIC LETTER GHAIN
U+0665: "٥" ARABIC-INDIC DIGIT FIVE -->
<Key
latin:keyLabel="&#x063A;"
latin:keyHintLabel="5"
- latin:additionalMoreKeys="5,&#x0665;" />
+ latin:additionalMoreKeys="5,&#x0665;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0639: "ع" ARABIC LETTER AIN
U+0666: "٦" ARABIC-INDIC DIGIT SIX -->
<Key
latin:keyLabel="&#x0639;"
latin:keyHintLabel="6"
- latin:additionalMoreKeys="6,&#x0666;" />
+ latin:additionalMoreKeys="6,&#x0666;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0647: "ه" ARABIC LETTER HEH
U+FEEB: "ﻫ" ARABIC LETTER HEH INITIAL FORM
U+0647 U+200D: ARABIC LETTER HEH + ZERO WIDTH JOINER
@@ -74,19 +80,22 @@
latin:keyLabel="&#x0647;"
latin:keyHintLabel="7"
latin:additionalMoreKeys="7,&#x0667;"
- latin:moreKeys="&#xFEEB;|&#x0647;&#x200D;" />
+ latin:moreKeys="&#xFEEB;|&#x0647;&#x200D;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062E: "خ" ARABIC LETTER KHAH
U+0668: "٨" ARABIC-INDIC DIGIT EIGHT -->
<Key
latin:keyLabel="&#x062E;"
latin:keyHintLabel="8"
- latin:additionalMoreKeys="8,&#x0668;" />
+ latin:additionalMoreKeys="8,&#x0668;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062D: "ح" ARABIC LETTER HAH
U+0669: "٩" ARABIC-INDIC DIGIT NINE -->
<Key
latin:keyLabel="&#x062D;"
latin:keyHintLabel="9"
- latin:additionalMoreKeys="9,&#x0669;" />
+ latin:additionalMoreKeys="9,&#x0669;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062C: "ج" ARABIC LETTER JEEM
U+0686: "چ" ARABIC LETTER TCHEH
U+0660: "٠" ARABIC-INDIC DIGIT ZERO -->
@@ -94,5 +103,6 @@
latin:keyLabel="&#x062C;"
latin:keyHintLabel="0"
latin:additionalMoreKeys="0,&#x0660;"
- latin:moreKeys="&#x0686;" />
+ latin:moreKeys="&#x0686;"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml/rowkeys_arabic2.xml b/java/res/xml/rowkeys_arabic2.xml
index f86aae014..d733f6411 100644
--- a/java/res/xml/rowkeys_arabic2.xml
+++ b/java/res/xml/rowkeys_arabic2.xml
@@ -26,21 +26,25 @@
<!-- TODO: DroidSansArabic lacks the glyph of U+069C ARABIC LETTER SEEN WITH THREE DOTS BELOW AND THREE DOTS ABOVE -->
<Key
latin:keyLabel="&#x0634;"
- latin:moreKeys="&#x069C;" />
+ latin:moreKeys="&#x069C;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0633: "س" ARABIC LETTER SEEN -->
<Key
- latin:keyLabel="&#x0633;" />
+ latin:keyLabel="&#x0633;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+064A: "ي" ARABIC LETTER YEH
U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE
U+0649: "ى" ARABIC LETTER ALEF MAKSURA -->
<Key
latin:keyLabel="&#x064A;"
- latin:moreKeys="&#x0626;,&#x0649;" />
+ latin:moreKeys="&#x0626;,&#x0649;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0628: "ب" ARABIC LETTER BEH
U+067E: "پ" ARABIC LETTER PEH -->
<Key
latin:keyLabel="&#x0628;"
- latin:moreKeys="&#x067E;" />
+ latin:moreKeys="&#x067E;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0644: "ل" ARABIC LETTER LAM
U+FEFB: "ﻻ" ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM
U+0627: "ا" ARABIC LETTER ALEF
@@ -52,7 +56,8 @@
U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE -->
<Key
latin:keyLabel="&#x0644;"
- latin:moreKeys="&#xFEFB;|&#x0644;&#x0627;,&#xFEF7;|&#x0644;&#x0623;,&#xFEF9;|&#x0644;&#x0625;,&#xFEF5;|&#x0644;&#x0622;" />
+ latin:moreKeys="&#xFEFB;|&#x0644;&#x0627;,&#xFEF7;|&#x0644;&#x0623;,&#xFEF9;|&#x0644;&#x0625;,&#xFEF5;|&#x0644;&#x0622;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0627: "ا" ARABIC LETTER ALEF
U+0621: "ء" ARABIC LETTER HAMZA
U+0671: "ٱ" ARABIC LETTER ALEF WASLA
@@ -61,23 +66,27 @@
U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE -->
<Key
latin:keyLabel="&#x0627;"
- latin:moreKeys="&#x0621;,&#x0671;,&#x0623;,&#x0625;,&#x0622;" />
+ latin:moreKeys="&#x0621;,&#x0671;,&#x0623;,&#x0625;,&#x0622;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062A: "ت" ARABIC LETTER TEH
U+062B: "ﺙ" ARABIC LETTER THEH -->
<Key
latin:keyLabel="&#x062A;"
- latin:moreKeys="&#x062B;" />
+ latin:moreKeys="&#x062B;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0646: "ن" ARABIC LETTER NOON -->
<Key
- latin:keyLabel="&#x0646;" />
+ latin:keyLabel="&#x0646;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0645: "م" ARABIC LETTER MEEM -->
<Key
- latin:keyLabel="&#x0645;" />
+ latin:keyLabel="&#x0645;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0643: "ك" ARABIC LETTER KAF
U+06AF: "گ" ARABIC LETTER GAF
U+06A9: "ک" ARABIC LETTER KEHEH -->
<Key
latin:keyLabel="&#x0643;"
latin:moreKeys="&#x06AF;,&#x06A9;"
- latin:keyWidth="fillRight" />
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml/rowkeys_arabic3.xml b/java/res/xml/rowkeys_arabic3.xml
index 9e9eac0d9..e4e694812 100644
--- a/java/res/xml/rowkeys_arabic3.xml
+++ b/java/res/xml/rowkeys_arabic3.xml
@@ -23,30 +23,38 @@
>
<!-- U+0638: "ظ" ARABIC LETTER ZAH -->
<Key
- latin:keyLabel="&#x0638;" />
+ latin:keyLabel="&#x0638;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0637: "ط" ARABIC LETTER TAH -->
<Key
- latin:keyLabel="&#x0637;" />
+ latin:keyLabel="&#x0637;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0630: "ذ" ARABIC LETTER THAL -->
<Key
- latin:keyLabel="&#x0630;" />
+ latin:keyLabel="&#x0630;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062F: "د" ARABIC LETTER DAL -->
<Key
- latin:keyLabel="&#x062F;" />
+ latin:keyLabel="&#x062F;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0632: "ز" ARABIC LETTER ZAIN
U+0698: "ژ" ARABIC LETTER JEH -->
<Key
latin:keyLabel="&#x0632;"
- latin:moreKeys="&#x0698;" />
+ latin:moreKeys="&#x0698;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0631: "ر" ARABIC LETTER REH -->
<Key
- latin:keyLabel="&#x0631;" />
+ latin:keyLabel="&#x0631;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0629: "ة" ARABIC LETTER TEH MARBUTA -->
<Key
- latin:keyLabel="&#x0629;" />
+ latin:keyLabel="&#x0629;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0648: "و" ARABIC LETTER WAW
U+0624: "ﺅ" ARABIC LETTER WAW WITH HAMZA ABOVE -->
<Key
latin:keyLabel="&#x0648;"
- latin:moreKeys="&#x0624;" />
+ latin:moreKeys="&#x0624;"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml/rowkeys_farsi1.xml b/java/res/xml/rowkeys_farsi1.xml
index 840b048f7..0ccf1ab54 100644
--- a/java/res/xml/rowkeys_farsi1.xml
+++ b/java/res/xml/rowkeys_farsi1.xml
@@ -28,31 +28,36 @@
latin:keyLabel="&#x0635;"
latin:moreKeys="&#x0636;,%"
latin:keyHintLabel="&#x06F1;"
- latin:additionalMoreKeys="&#x06F1;,1" />
+ latin:additionalMoreKeys="&#x06F1;,1"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0642: "ق" ARABIC LETTER QAF
U+06F2: "۲" EXTENDED ARABIC-INDIC DIGIT TWO -->
<Key
latin:keyLabel="&#x0642;"
latin:keyHintLabel="&#x06F2;"
- latin:additionalMoreKeys="&#x06F2;,2" />
+ latin:additionalMoreKeys="&#x06F2;,2"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0641: "ف" ARABIC LETTER FEH
U+06F3: "۳" EXTENDED ARABIC-INDIC DIGIT THREE -->
<Key
latin:keyLabel="&#x0641;"
latin:keyHintLabel="&#x06F3;"
- latin:additionalMoreKeys="&#x06F3;,3" />
+ latin:additionalMoreKeys="&#x06F3;,3"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+063A: "غ" ARABIC LETTER GHAIN
U+06F4: "۴" EXTENDED ARABIC-INDIC DIGIT FOUR -->
<Key
latin:keyLabel="&#x063A;"
latin:keyHintLabel="&#x06F4;"
- latin:additionalMoreKeys="&#x06F4;,4" />
+ latin:additionalMoreKeys="&#x06F4;,4"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0639: "ع" ARABIC LETTER AIN
U+06F5: "۵" EXTENDED ARABIC-INDIC DIGIT FIVE -->
<Key
latin:keyLabel="&#x0639;"
latin:keyHintLabel="&#x06F5;"
- latin:additionalMoreKeys="&#x06F5;,5" />
+ latin:additionalMoreKeys="&#x06F5;,5"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0647: "ه" ARABIC LETTER HEH
U+FEEB: "ﻫ" ARABIC LETTER HEH INITIAL FORM
U+0647/U+200D: ARABIC LETTER HEH + ZERO WIDTH JOINER
@@ -63,29 +68,34 @@
latin:keyLabel="&#x0647;"
latin:moreKeys="&#xFEEB;|&#x0647;&#x200D;,&#x0647;&#x0654;,&#x0629;,%"
latin:keyHintLabel="&#x06F6;"
- latin:additionalMoreKeys="&#x06F6;,6" />
+ latin:additionalMoreKeys="&#x06F6;,6"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062E: "خ" ARABIC LETTER KHAH
U+06F7: "۷" EXTENDED ARABIC-INDIC DIGIT SEVEN -->
<Key
latin:keyLabel="&#x062E;"
latin:keyHintLabel="&#x06F7;"
- latin:additionalMoreKeys="&#x06F7;,7" />
+ latin:additionalMoreKeys="&#x06F7;,7"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062D: "ح" ARABIC LETTER HAH
U+06F8: "۸" EXTENDED ARABIC-INDIC DIGIT EIGHT -->
<Key
latin:keyLabel="&#x062D;"
latin:keyHintLabel="&#x06F8;"
- latin:additionalMoreKeys="&#x06F8;,8" />
+ latin:additionalMoreKeys="&#x06F8;,8"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062C: "ج" ARABIC LETTER JEEM
U+06F9: "۹" EXTENDED ARABIC-INDIC DIGIT NINE -->
<Key
latin:keyLabel="&#x062C;"
latin:keyHintLabel="&#x06F9;"
- latin:additionalMoreKeys="&#x06F9;,9" />
+ latin:additionalMoreKeys="&#x06F9;,9"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0686: "چ" ARABIC LETTER TCHEH
U+06F0: "۰" EXTENDED ARABIC-INDIC DIGIT ZERO -->
<Key
latin:keyLabel="&#x0686;"
latin:keyHintLabel="&#x06F0;"
- latin:additionalMoreKeys="&#x06F0;,0" />
+ latin:additionalMoreKeys="&#x06F0;,0"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml/rowkeys_farsi2.xml b/java/res/xml/rowkeys_farsi2.xml
index 21548936e..4b6abe2ab 100644
--- a/java/res/xml/rowkeys_farsi2.xml
+++ b/java/res/xml/rowkeys_farsi2.xml
@@ -23,12 +23,14 @@
>
<!-- U+0634: "ش" ARABIC LETTER SHEEN -->
<Key
- latin:keyLabel="&#x0634;" />
+ latin:keyLabel="&#x0634;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0633: "س" ARABIC LETTER SEEN
U+0636: "ض" ARABIC LETTER DAD -->
<Key
latin:keyLabel="&#x0633;"
- latin:moreKeys="&#x0636;" />
+ latin:moreKeys="&#x0636;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+06CC: "ی" ARABIC LETTER FARSI YEH
U+0626: "ئ" ARABIC LETTER YEH WITH HAMZA ABOVE
U+064A: "ي" ARABIC LETTER YEH
@@ -36,13 +38,16 @@
U+0649: "ى" ARABIC LETTER ALEF MAKSURA -->
<Key
latin:keyLabel="&#x06CC;"
- latin:moreKeys="&#x0626;,&#x064A;,&#xFBE8;|&#x0649;" />
+ latin:moreKeys="&#x0626;,&#x064A;,&#xFBE8;|&#x0649;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0628: "ب" ARABIC LETTER BEH -->
<Key
- latin:keyLabel="&#x0628;" />
+ latin:keyLabel="&#x0628;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0644: "ل" ARABIC LETTER LAM -->
<Key
- latin:keyLabel="&#x0644;" />
+ latin:keyLabel="&#x0644;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0627: "ا" ARABIC LETTER ALEF
U+0621: "ء" ARABIC LETTER HAMZA
U+0622: "آ" ARABIC LETTER ALEF WITH MADDA ABOVE
@@ -51,22 +56,27 @@
U+0625: "إ" ARABIC LETTER ALEF WITH HAMZA BELOW -->
<Key
latin:keyLabel="&#x0627;"
- latin:moreKeys="&#x0621;,&#x0622;,&#x0623;,&#x0671;,&#x0625;" />
+ latin:moreKeys="&#x0621;,&#x0622;,&#x0623;,&#x0671;,&#x0625;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062A: "ت" ARABIC LETTER TEH
U+062B: "ﺙ" ARABIC LETTER THEH
U+0629: "ة": ARABIC LETTER TEH MARBUTA -->
<Key
latin:keyLabel="&#x062A;"
- latin:moreKeys="&#x062B;,&#x0629;" />
+ latin:moreKeys="&#x062B;,&#x0629;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0646: "ن" ARABIC LETTER NOON -->
<Key
- latin:keyLabel="&#x0646;" />
+ latin:keyLabel="&#x0646;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0645: "م" ARABIC LETTER MEEM -->
<Key
- latin:keyLabel="&#x0645;" />
+ latin:keyLabel="&#x0645;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+06A9: "ک" ARABIC LETTER KEHEH
U+0643: "ك" ARABIC LETTER KAF -->
<Key
latin:keyLabel="&#x06A9;"
- latin:moreKeys="&#x0643;" />
+ latin:moreKeys="&#x0643;"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml/rowkeys_farsi3.xml b/java/res/xml/rowkeys_farsi3.xml
index 29c35134c..7d2e81f7d 100644
--- a/java/res/xml/rowkeys_farsi3.xml
+++ b/java/res/xml/rowkeys_farsi3.xml
@@ -25,30 +25,38 @@
U+0638: "ظ" ARABIC LETTER ZAH -->
<Key
latin:keyLabel="&#x0637;"
- latin:moreKeys="&#x0638;" />
+ latin:moreKeys="&#x0638;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0632: "ز" ARABIC LETTER ZAIN
U+0698: "ژ" ARABIC LETTER JEH -->
<Key
latin:keyLabel="&#x0632;"
- latin:moreKeys="&#x0698;" />
+ latin:moreKeys="&#x0698;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0631: "ر" ARABIC LETTER REH -->
<Key
- latin:keyLabel="&#x0631;" />
+ latin:keyLabel="&#x0631;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0630: "ذ" ARABIC LETTER THAL -->
<Key
- latin:keyLabel="&#x0630;" />
+ latin:keyLabel="&#x0630;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+062F: "د" ARABIC LETTER DAL -->
<Key
- latin:keyLabel="&#x062F;" />
+ latin:keyLabel="&#x062F;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+067E: "پ" ARABIC LETTER PEH -->
<Key
- latin:keyLabel="&#x067E;" />
+ latin:keyLabel="&#x067E;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0648: "و" ARABIC LETTER WAW
U+0624: "ؤ" ARABIC LETTER WAW WITH HAMZA ABOVE -->
<Key
latin:keyLabel="&#x0648;"
- latin:moreKeys="&#x0624;" />
+ latin:moreKeys="&#x0624;"
+ latin:keyLabelFlags="fontNormal" />
<!-- U+06AF: "گ" ARABIC LETTER GAF -->
<Key
- latin:keyLabel="&#x06AF;" />
+ latin:keyLabel="&#x06AF;"
+ latin:keyLabelFlags="fontNormal" />
</merge>
diff --git a/java/res/xml/rowkeys_qwerty1.xml b/java/res/xml/rowkeys_qwerty1.xml
index 84d613460..e7c9b590b 100644
--- a/java/res/xml/rowkeys_qwerty1.xml
+++ b/java/res/xml/rowkeys_qwerty1.xml
@@ -22,11 +22,12 @@
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
>
<Key
- latin:keyLabel="q"
+ latin:keyLabel="!text/keylabel_for_q"
latin:keyHintLabel="1"
- latin:additionalMoreKeys="1" />
+ latin:additionalMoreKeys="1"
+ latin:moreKeys="!text/more_keys_for_q" />
<Key
- latin:keyLabel="w"
+ latin:keyLabel="!text/keylabel_for_w"
latin:keyHintLabel="2"
latin:additionalMoreKeys="2"
latin:moreKeys="!text/more_keys_for_w" />
@@ -46,7 +47,7 @@
latin:additionalMoreKeys="5"
latin:moreKeys="!text/more_keys_for_t" />
<Key
- latin:keyLabel="y"
+ latin:keyLabel="!text/keylabel_for_y"
latin:keyHintLabel="6"
latin:additionalMoreKeys="6"
latin:moreKeys="!text/more_keys_for_y" />
diff --git a/java/res/xml/rowkeys_qwerty3.xml b/java/res/xml/rowkeys_qwerty3.xml
index a74aeb842..b70fd729f 100644
--- a/java/res/xml/rowkeys_qwerty3.xml
+++ b/java/res/xml/rowkeys_qwerty3.xml
@@ -25,7 +25,8 @@
latin:keyLabel="z"
latin:moreKeys="!text/more_keys_for_z" />
<Key
- latin:keyLabel="x" />
+ latin:keyLabel="!text/keylabel_for_x"
+ latin:moreKeys="!text/more_keys_for_x" />
<Key
latin:keyLabel="c"
latin:moreKeys="!text/more_keys_for_c" />
diff --git a/java/res/xml/rowkeys_spanish2.xml b/java/res/xml/rowkeys_spanish2.xml
index 4c7e57997..335dff33c 100644
--- a/java/res/xml/rowkeys_spanish2.xml
+++ b/java/res/xml/rowkeys_spanish2.xml
@@ -25,5 +25,5 @@
latin:keyboardLayout="@xml/rowkeys_qwerty2" />
<!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE -->
<Key
- latin:keyLabel="&#x00F1;" />
+ latin:keyLabel="!text/keylabel_for_spanish_row2_10" />
</merge>
diff --git a/java/res/xml/rowkeys_thai1.xml b/java/res/xml/rowkeys_thai1.xml
index 4b49da171..950d2a456 100644
--- a/java/res/xml/rowkeys_thai1.xml
+++ b/java/res/xml/rowkeys_thai1.xml
@@ -25,100 +25,110 @@
<case
latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
>
- <!-- U+0E0E: "ฎ" THAI CHARACTER DO CHADA -->
<Key
- latin:keyLabel="&#x0E0E;" />
- <!-- U+0E11: "ฑ" THAI CHARACTER THO NANGMONTHO -->
+ latin:keyLabel="+" />
+ <!-- U+0E51: "๑" THAI DIGIT ONE -->
<Key
- latin:keyLabel="&#x0E11;" />
- <!-- U+0E18: "ธ" THAI CHARACTER THO THONG -->
- <Key
- latin:keyLabel="&#x0E18;" />
- <!-- U+0E13: "ณ" THAI CHARACTER NO NEN -->
+ latin:keyLabel="&#x0E51;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E52: "๒" THAI DIGIT TWO -->
<Key
- latin:keyLabel="&#x0E13;" />
- <!-- U+0E0D: "ญ" THAI CHARACTER YO YING -->
+ latin:keyLabel="&#x0E52;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E53: "๓" THAI DIGIT THREE -->
<Key
- latin:keyLabel="&#x0E0D;" />
- <!-- U+0E10: "ฐ" THAI CHARACTER THO THAN -->
+ latin:keyLabel="&#x0E53;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E54: "๔" THAI DIGIT FOUR -->
<Key
- latin:keyLabel="&#x0E10;" />
- <!-- U+0E03: "ฃ" THAI CHARACTER KHO KHUAT -->
+ latin:keyLabel="&#x0E54;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0020: " " SPACE
+ U+0E39: " ู" THAI CHARACTER SARA UU -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
<Key
- latin:keyLabel="&#x0E03;" />
- <!-- U+0E05: "ฅ" THAI CHARACTER KHO KHON -->
+ latin:keyLabel="&#x20;&#x0E39;"
+ latin:code="0x0E39"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0E3F: "฿" THAI CURRENCY SYMBOL BAHT -->
<Key
- latin:keyLabel="&#x0E05;" />
- <!-- U+0E51: "๑" THAI DIGIT ONE
- U+0E52: "๒" THAI DIGIT TWO
- U+0E53: "๓" THAI DIGIT THREE
- U+0E54: "๔" THAI DIGIT FOUR
- U+0E55: "๕" THAI DIGIT FIVE -->
+ latin:keyLabel="&#x0E3F;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E55: "๕" THAI DIGIT FIVE -->
<Key
- latin:keyLabel="&#x0E51;"
- latin:moreKeys="!fixedColumnOrder!4,&#x0E52;,&#x0E53;,&#x0E54;,&#x0E55;" />
- <!-- U+0E56: "๖" THAI DIGIT SIX
- U+0E57: "๗" THAI DIGIT SEVEN
- U+0E58: "๘" THAI DIGIT EIGHT
- U+0E59: "๙" THAI DIGIT NINE
- U+0E50: "๐" THAI DIGIT ZERO -->
+ latin:keyLabel="&#x0E55;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E56: "๖" THAI DIGIT SIX -->
<Key
latin:keyLabel="&#x0E56;"
- latin:moreKeys="!fixedColumnOrder!4,&#x0E57;,&#x0E58;,&#x0E59;,&#x0E50;" />
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E57: "๗" THAI DIGIT SEVEN -->
+ <Key
+ latin:keyLabel="&#x0E57;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E58: "๘" THAI DIGIT EIGHT -->
+ <Key
+ latin:keyLabel="&#x0E58;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E59: "๙" THAI DIGIT NINE -->
+ <Key
+ latin:keyLabel="&#x0E59;"
+ latin:keyLabelFlags="fontNormal" />
</case>
<default>
+ <!-- U+0E45: "ๅ" THAI CHARACTER LAKKHANGYAO -->
+ <Key
+ latin:keyLabel="&#x0E45;"
+ latin:keyLabelFlags="fontNormal" />
+ <Key
+ latin:keyLabel="/" />
+ <Key
+ latin:keyLabel="_" />
<!-- U+0E20: "ภ" THAI CHARACTER PHO SAMPHAO -->
<Key
latin:keyLabel="&#x0E20;"
- latin:keyHintLabel="1"
- latin:additionalMoreKeys="1,&#x0E51;" />
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E16: "ถ" THAI CHARACTER THO THUNG -->
<Key
latin:keyLabel="&#x0E16;"
- latin:keyHintLabel="2"
- latin:additionalMoreKeys="2,&#x0E52;" />
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0020: " " SPACE
+ U+0E38: " ุ" THAI CHARACTER SARA U -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E38;"
+ latin:code="0x0E38"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0020: " " SPACE
+ U+0E36: " ึ" THAI CHARACTER SARA UE -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E36;"
+ latin:code="0x0E36"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
<!-- U+0E04: "ค" THAI CHARACTER KHO KHWAI -->
<Key
latin:keyLabel="&#x0E04;"
- latin:keyHintLabel="3"
- latin:additionalMoreKeys="3,&#x0E53;" />
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E15: "ต" THAI CHARACTER TO TAO -->
<Key
latin:keyLabel="&#x0E15;"
- latin:keyHintLabel="4"
- latin:additionalMoreKeys="4,&#x0E54;" />
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E08: "จ" THAI CHARACTER CHO CHAN -->
<Key
latin:keyLabel="&#x0E08;"
- latin:keyHintLabel="5"
- latin:additionalMoreKeys="5,&#x0E55;" />
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E02: "ข" THAI CHARACTER KHO KHAI -->
<Key
latin:keyLabel="&#x0E02;"
- latin:keyHintLabel="6"
- latin:additionalMoreKeys="6,&#x0E56;" />
+ latin:keyLabelFlags="fontNormal" />
<!-- U+0E0A: "ช" THAI CHARACTER CHO CHANG -->
<Key
latin:keyLabel="&#x0E0A;"
- latin:keyHintLabel="7"
- latin:additionalMoreKeys="7,&#x0E57;" />
- <!-- U+0E23: "ร" THAI CHARACTER RO RUA
- U+0E25: "ล" THAI CHARACTER LO LING -->
- <Key
- latin:keyLabel="&#x0E23;"
- latin:moreKeys="&#x0E25;"
- latin:keyHintLabel="8"
- latin:additionalMoreKeys="8,&#x0E58;" />
- <!-- U+0E19: "น" THAI CHARACTER NO NU -->
- <Key
- latin:keyLabel="&#x0E19;"
- latin:keyHintLabel="9"
- latin:additionalMoreKeys="9,&#x0E59;" />
- <!-- U+0E22: "ย" THAI CHARACTER YO YAK -->
- <Key
- latin:keyLabel="&#x0E22;"
- latin:keyHintLabel="0"
- latin:additionalMoreKeys="0,&#x0E50;" />
+ latin:keyLabelFlags="fontNormal" />
</default>
</switch>
</merge>
diff --git a/java/res/xml/rowkeys_thai2.xml b/java/res/xml/rowkeys_thai2.xml
index 80e3563f8..f602994b9 100644
--- a/java/res/xml/rowkeys_thai2.xml
+++ b/java/res/xml/rowkeys_thai2.xml
@@ -25,83 +25,116 @@
<case
latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
>
- <!-- U+0E24: "ฤ" THAI CHARACTER RU -->
- <Key
- latin:keyLabel="&#x0E24;" />
- <!-- U+0E06: "ฆ" THAI CHARACTER KHO RAKHANG -->
- <Key
- latin:keyLabel="&#x0E06;" />
- <!-- U+0E0F: "ฏ" THAI CHARACTER TO PATAK -->
- <Key
- latin:keyLabel="&#x0E0F;" />
- <!-- U+0E0C: "ฌ" THAI CHARACTER CHO CHOE -->
- <Key
- latin:keyLabel="&#x0E0C;" />
- <!-- U+0E29: "ษ" THAI CHARACTER SO RUSI -->
- <Key
- latin:keyLabel="&#x0E29;" />
- <!-- U+0E28: "ศ" THAI CHARACTER SO SALA -->
- <Key
- latin:keyLabel="&#x0E28;" />
- <!-- U+0E0B: "ซ" THAI CHARACTER SO SO -->
- <Key
- latin:keyLabel="&#x0E0B;" />
- <!-- U+0E3F: "฿" THAI CURRENCY SYMBOL BAHT
- U+0E45: "ๅ" THAI CHARACTER LAKKHANGYAO -->
- <Key
- latin:keyLabel="&#x0E3F;"
- latin:moreKeys="&#x0E45;" />
- <!-- U+0E46: "ๆ" THAI CHARACTER MAIYAMOK
- U+0E2F: "ฯ" THAI CHARACTER PAIYANNOI -->
- <Key
- latin:keyLabel="&#x0E46;"
- latin:moreKeys="&#x0E2F;" />
+ <!-- U+0E50: "๐" THAI DIGIT ZERO -->
+ <Key
+ latin:keyLabel="&#x0E50;"
+ latin:keyLabelFlags="fontNormal" />
+ <Key
+ latin:keyLabel="&quot;" />
+ <!-- U+0E0E: "ฎ" THAI CHARACTER DO CHADA -->
+ <Key
+ latin:keyLabel="&#x0E0E;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E11: "ฑ" THAI CHARACTER THO NANGMONTHO -->
+ <Key
+ latin:keyLabel="&#x0E11;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E18: "ธ" THAI CHARACTER THO THONG -->
+ <Key
+ latin:keyLabel="&#x0E18;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0020: " " SPACE
+ U+0E4D: " ํ" THAI CHARACTER THANTHAKHAT -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E4D;"
+ latin:code="0x0E4D"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0020: " " SPACE
+ U+0E4A: " ๊" THAI CHARACTER MAI TRI -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E4A;"
+ latin:code="0x0E4A"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0E13: "ณ" THAI CHARACTER NO NEN -->
+ <Key
+ latin:keyLabel="&#x0E13;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E2F: "ฯ" THAI CHARACTER PAIYANNOI -->
+ <Key
+ latin:keyLabel="&#x0E2F;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E0D: "ญ" THAI CHARACTER YO YING -->
+ <Key
+ latin:keyLabel="&#x0E0D;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E10: "ฐ" THAI CHARACTER THO THAN -->
+ <Key
+ latin:keyLabel="&#x0E10;"
+ latin:keyLabelFlags="fontNormal" />
+ <Key
+ latin:keyLabel="," />
</case>
<default>
- <!-- U+0E1F: "ฟ" THAI CHARACTER FO FAN
- U+0E1E: "พ" THAI CHARACTER PHO PHAN -->
- <Key
- latin:keyLabel="&#x0E1F;"
- latin:moreKeys="&#x0E1E;" />
- <!-- U+0E2B: "ห" THAI CHARACTER HO HIP -->
+ <!-- U+0E46: "ๆ" THAI CHARACTER MAIYAMOK -->
<Key
- latin:keyLabel="&#x0E2B;" />
- <!-- U+0E01: "ก" THAI CHARACTER KO KAI -->
- <Key
- latin:keyLabel="&#x0E01;" />
- <!-- U+0E14: "ด" THAI CHARACTER DO DEK -->
- <Key
- latin:keyLabel="&#x0E14;" />
- <!-- U+0E2A: "ส" THAI CHARACTER SO SUA -->
+ latin:keyLabel="&#x0E46;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E44: "ไ" THAI CHARACTER SARA AI MAIMALAI -->
<Key
- latin:keyLabel="&#x0E2A;" />
- <!-- U+0E27: "ว" THAI CHARACTER WO WAEN -->
+ latin:keyLabel="&#x0E44;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E33: "ำ" THAI CHARACTER SARA AM -->
<Key
- latin:keyLabel="&#x0E27;" />
- <!-- U+0E07: "ง" THAI CHARACTER NGO NGU -->
+ latin:keyLabel="&#x0E33;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E1E: "พ" THAI CHARACTER PHO PHAN -->
<Key
- latin:keyLabel="&#x0E07;" />
- <!-- U+0E30: "ะ" THAI CHARACTER SARA A
- U+0E32: "า" THAI CHARACTER SARA AA
- U+0E33: " ำ" THAI CHARACTER SARA AM
- U+0E40: "เ" THAI CHARACTER SARA E
- U+0E41: "แ" THAI CHARACTER SARA AE
- U+0E43: "ใ" THAI CHARACTER SARA AI MAIMUAN
- U+0E44: "ไ" THAI CHARACTER SARA AI MAIMALAI
- U+0E42: "โ" THAI CHARACTER SARA O -->
+ latin:keyLabel="&#x0E1E;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E30: "ะ" THAI CHARACTER SARA A -->
<Key
latin:keyLabel="&#x0E30;"
- latin:moreKeys="&#x0E32;,&#x0E33;,&#x0E40;,&#x0E41;,&#x0E43;,&#x0E44;,&#x0E42;" />
- <!-- U+0E31: " ั" THAI CHARACTER MAI HAN-AKAT
- U+0E34: " ิ" THAI CHARACTER SARA I
- U+0E35: " ี" THAI CHARACTER SARA II
- U+0E36: " ึ" THAI CHARACTER SARA UE
- U+0E37: " ื" THAI CHARACTER SARA UEE
- U+0E38: " ุ" THAI CHARACTER SARA U
- U+0E39: " ู" THAI CHARACTER SARA UU -->
- <Key
- latin:keyLabel="&#x0E31;"
- latin:moreKeys="&#x0E34;,&#x0E35;,&#x0E36;,&#x0E37;,&#x0E38;,&#x0E39;" />
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0020: " " SPACE
+ U+0E31: " ั" THAI CHARACTER MAI HAN-AKAT -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E31;"
+ latin:code="0x0E31"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0020: " " SPACE
+ U+0E35: " ี" HAI CHARACTER SARA II -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E35;"
+ latin:code="0x0E35"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0E23: "ร" THAI CHARACTER RO RUA -->
+ <Key
+ latin:keyLabel="&#x0E23;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E19: "น" THAI CHARACTER NO NU -->
+ <Key
+ latin:keyLabel="&#x0E19;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E22: "ย" THAI CHARACTER YO YAK -->
+ <Key
+ latin:keyLabel="&#x0E22;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E1A: "บ" THAI CHARACTER BO BAIMAI -->
+ <Key
+ latin:keyLabel="&#x0E1A;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E25: "ล" THAI CHARACTER LO LING -->
+ <Key
+ latin:keyLabel="&#x0E25;"
+ latin:keyLabelFlags="fontNormal" />
</default>
</switch>
</merge>
diff --git a/java/res/xml/rowkeys_thai3.xml b/java/res/xml/rowkeys_thai3.xml
index b8338073c..7b6e6372e 100644
--- a/java/res/xml/rowkeys_thai3.xml
+++ b/java/res/xml/rowkeys_thai3.xml
@@ -25,59 +25,110 @@
<case
latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
>
- <!-- U+0E09: "ฉ" THAI CHARACTER CHO CHING -->
+ <!-- U+0E24: "ฤ" THAI CHARACTER RU -->
<Key
- latin:keyLabel="&#x0E09;" />
- <!-- U+0E2E: "ฮ" THAI CHARACTER HO NOKHUK -->
+ latin:keyLabel="&#x0E24;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E06: "ฆ" THAI CHARACTER KHO RAKHANG -->
<Key
- latin:keyLabel="&#x0E2E;" />
- <!-- U+0E12: "ฒ" THAI CHARACTER THO PHUTHAO -->
+ latin:keyLabel="&#x0E06;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E0F: "ฏ" THAI CHARACTER TO PATAK -->
<Key
- latin:keyLabel="&#x0E12;" />
- <!-- U+0E2C: "ฬ" THAI CHARACTER LO CHULA -->
+ latin:keyLabel="&#x0E0F;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E42: "โ" THAI CHARACTER SARA O -->
<Key
- latin:keyLabel="&#x0E2C;" />
- <!-- U+0E26: "ฦ" THAI CHARACTER LU -->
+ latin:keyLabel="&#x0E42;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E0C: "ฌ" THAI CHARACTER CHO CHOE -->
<Key
- latin:keyLabel="&#x0E26;" />
- <!-- U+0E4C: " ์" THAI CHARACTER THANTHAKHAT
- U+0E4D: " ํ" THAI CHARACTER NIKHAHIT
- U+0E3A: " ฺ" THAI CHARACTER PHINTHU -->
+ latin:keyLabel="&#x0E0C;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0020: " " SPACE
+ U+0E47: " ็" THAI CHARACTER MAITAIKHU -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
<Key
- latin:keyLabel="&#x0E4C;"
- latin:moreKeys="&#x0E4D;,&#x0E3A;" />
- <!-- U+0E47: " ็" THAI CHARACTER MAITAIKHU -->
+ latin:keyLabel="&#x20;&#x0E47;"
+ latin:code="0x0E47"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0020: " " SPACE
+ U+0E4B: " ๋" THAI CHARACTER MAI CHATTAWA -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E4B;"
+ latin:code="0x0E4B"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0E29: "ษ" THAI CHARACTER SO RUSI -->
+ <Key
+ latin:keyLabel="&#x0E29;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E28: "ศ" THAI CHARACTER SO SALA -->
+ <Key
+ latin:keyLabel="&#x0E28;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E0B: "ซ" THAI CHARACTER SO SO -->
+ <Key
+ latin:keyLabel="&#x0E0B;"
+ latin:keyLabelFlags="fontNormal" />
<Key
- latin:keyLabel="&#x0E47;" />
+ latin:keyLabel="." />
</case>
<default>
- <!-- U+0E1C: "ผ" THAI CHARACTER PHO PHUNG -->
+ <!-- U+0E1F: "ฟ" THAI CHARACTER FO FAN -->
<Key
- latin:keyLabel="&#x0E1C;" />
- <!-- U+0E1B: "ป" THAI CHARACTER PO PLA
- U+0E1A: "บ" THAI CHARACTER BO BAIMAI -->
+ latin:keyLabel="&#x0E1F;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E2B: "ห" THAI CHARACTER HO HIP -->
<Key
- latin:keyLabel="&#x0E1B;"
- latin:moreKeys="&#x0E1A;" />
- <!-- U+0E2D: "อ" THAI CHARACTER O ANG -->
+ latin:keyLabel="&#x0E2B;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E01: "ก" THAI CHARACTER KO KAI -->
<Key
- latin:keyLabel="&#x0E2D;" />
- <!-- U+0E17: "ท" THAI CHARACTER THO THAHAN -->
+ latin:keyLabel="&#x0E01;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E14: "ด" THAI CHARACTER DO DEK -->
<Key
- latin:keyLabel="&#x0E17;" />
- <!-- U+0E21: "ม" THAI CHARACTER MO MA -->
+ latin:keyLabel="&#x0E14;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E40: "เ" THAI CHARACTER SARA E -->
<Key
- latin:keyLabel="&#x0E21;" />
- <!-- U+0E1D: "ฝ" THAI CHARACTER FO FA -->
+ latin:keyLabel="&#x0E40;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0020: " " SPACE
+ U+0E49: " ้" THAI CHARACTER MAI THO -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
<Key
- latin:keyLabel="&#x0E1D;" />
- <!-- U+0E48: " ่" THAI CHARACTER MAI EK
- U+0E49: " ้" THAI CHARACTER MAI THO
- U+0E4A: " ๊" THAI CHARACTER MAI TRI
- U+0E4B: " ๋" THAI CHARACTER MAI CHATTAWA -->
+ latin:keyLabel="&#x20;&#x0E49;"
+ latin:code="0x0E49"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0020: " " SPACE
+ U+0E48: " ่" THAI CHARACTER MAI EK -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E48;"
+ latin:code="0x0E48"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0E32: "า" THAI CHARACTER SARA AA -->
+ <Key
+ latin:keyLabel="&#x0E32;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E2A: "ส" THAI CHARACTER SO SUA -->
+ <Key
+ latin:keyLabel="&#x0E2A;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E27: "ว" THAI CHARACTER WO WAEN -->
+ <Key
+ latin:keyLabel="&#x0E27;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E07: "ง" THAI CHARACTER NGO NGU -->
<Key
- latin:keyLabel="&#x0E48;"
- latin:moreKeys="&#x0E49;,&#x0E4A;,&#x0E4B;" />
+ latin:keyLabel="&#x0E07;"
+ latin:keyLabelFlags="fontNormal" />
</default>
</switch>
</merge>
diff --git a/java/res/xml/rowkeys_thai4.xml b/java/res/xml/rowkeys_thai4.xml
new file mode 100644
index 000000000..8a784242c
--- /dev/null
+++ b/java/res/xml/rowkeys_thai4.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<merge
+ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+>
+ <switch>
+ <case
+ latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+ >
+ <Key
+ latin:keyLabel="(" />
+ <Key
+ latin:keyLabel=")" />
+ <!-- U+0E09: "ฉ" THAI CHARACTER CHO CHING -->
+ <Key
+ latin:keyLabel="&#x0E09;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E2E: "ฮ" THAI CHARACTER HO NOKHUK -->
+ <Key
+ latin:keyLabel="&#x0E2E;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0020: " " SPACE
+ U+0E3A: " ฺ" THAI CHARACTER PHINTHU -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E3A;"
+ latin:code="0x0E3A"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0020: " " SPACE
+ U+0E4C: " ์" THAI CHARACTER THANTHAKHAT -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E4C;"
+ latin:code="0x0E4C"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <Key
+ latin:keyLabel="\?" />
+ <!-- U+0E12: "ฒ" THAI CHARACTER THO PHUTHAO -->
+ <Key
+ latin:keyLabel="&#x0E12;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E2C: "ฬ" THAI CHARACTER LO CHULA -->
+ <Key
+ latin:keyLabel="&#x0E2C;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E26: "ฦ" THAI CHARACTER LU -->
+ <Key
+ latin:keyLabel="&#x0E26;"
+ latin:keyLabelFlags="fontNormal" />
+ </case>
+ <default>
+ <!-- U+0E1C: "ผ" THAI CHARACTER PHO PHUNG -->
+ <Key
+ latin:keyLabel="&#x0E1C;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E1B: "ป" THAI CHARACTER PO PLA -->
+ <Key
+ latin:keyLabel="&#x0E1B;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E41: "แ" THAI CHARACTER SARA AE -->
+ <Key
+ latin:keyLabel="&#x0E41;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E2D: "อ" THAI CHARACTER O ANG -->
+ <Key
+ latin:keyLabel="&#x0E2D;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0020: " " SPACE
+ U+0E34: " ิ" THAI CHARACTER SARA I -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E34;"
+ latin:code="0x0E34"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0020: " " SPACE
+ U+0E37: " ื" THAI CHARACTER SARA UEE -->
+ <!-- Note: The space character is needed as a preceding letter to draw some Thai
+ composing characters correctly. -->
+ <Key
+ latin:keyLabel="&#x20;&#x0E37;"
+ latin:code="0x0E37"
+ latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+ <!-- U+0E17: "ท" THAI CHARACTER THO THAHAN -->
+ <Key
+ latin:keyLabel="&#x0E17;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E21: "ม" THAI CHARACTER MO MA -->
+ <Key
+ latin:keyLabel="&#x0E21;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E43: "ใ" THAI CHARACTER SARA AI MAIMUAN -->
+ <Key
+ latin:keyLabel="&#x0E43;"
+ latin:keyLabelFlags="fontNormal" />
+ <!-- U+0E1D: "ฝ" THAI CHARACTER FO FA -->
+ <Key
+ latin:keyLabel="&#x0E1D;"
+ latin:keyLabelFlags="fontNormal" />
+ </default>
+ </switch>
+</merge>
diff --git a/java/res/xml/rows_thai.xml b/java/res/xml/rows_thai.xml
index 6b80df640..108b7e1fc 100644
--- a/java/res/xml/rows_thai.xml
+++ b/java/res/xml/rows_thai.xml
@@ -24,31 +24,34 @@
<include
latin:keyboardLayout="@xml/key_styles_common" />
<Row
- latin:keyWidth="10%p"
+ latin:keyWidth="8.3333%p"
>
<include
latin:keyboardLayout="@xml/rowkeys_thai1" />
</Row>
<Row
- latin:keyWidth="10%p"
+ latin:keyWidth="8.3333%p"
>
<include
- latin:keyboardLayout="@xml/rowkeys_thai2"
- latin:keyXPos="5%p" />
+ latin:keyboardLayout="@xml/rowkeys_thai2" />
</Row>
<Row
- latin:keyWidth="10%p"
+ latin:keyWidth="8.3333%p"
>
- <Key
- latin:keyStyle="shiftKeyStyle"
- latin:keyWidth="15%p"
- latin:visualInsetsRight="1%p" />
<include
latin:keyboardLayout="@xml/rowkeys_thai3" />
+ <include
+ latin:keyboardLayout="@xml/key_thai_kho_khuat" />
+ </Row>
+ <Row
+ latin:keyWidth="8.3333%p"
+ >
+ <Key
+ latin:keyStyle="shiftKeyStyle" />
+ <include
+ latin:keyboardLayout="@xml/rowkeys_thai4" />
<Key
- latin:keyStyle="deleteKeyStyle"
- latin:keyWidth="fillRight"
- latin:visualInsetsLeft="1%p" />
+ latin:keyStyle="deleteKeyStyle" />
</Row>
<include
latin:keyboardLayout="@xml/row_qwerty4" />
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index e941cc7fc..03c216474 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -31,8 +31,10 @@ import android.text.TextUtils;
import android.util.Log;
import android.util.Xml;
+import com.android.inputmethod.keyboard.internal.KeyDrawParams;
import com.android.inputmethod.keyboard.internal.KeySpecParser;
import com.android.inputmethod.keyboard.internal.KeyStyle;
+import com.android.inputmethod.keyboard.internal.KeyVisualAttributes;
import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.keyboard.internal.KeyboardParams;
import com.android.inputmethod.keyboard.internal.KeyboardRow;
@@ -132,6 +134,8 @@ public class Key {
private static final int ACTION_FLAGS_ALT_CODE_WHILE_TYPING = 0x04;
private static final int ACTION_FLAGS_ENABLE_LONG_PRESS = 0x08;
+ public final KeyVisualAttributes mKeyVisualAttributes;
+
private final OptionalAttributes mOptionalAttributes;
private static class OptionalAttributes {
@@ -202,6 +206,7 @@ public class Key {
mX = x + params.mHorizontalGap / 2;
mY = y;
mHitBox.set(x, y, x + width + 1, y + height);
+ mKeyVisualAttributes = null;
mHashCode = computeHashCode(this);
}
@@ -357,11 +362,9 @@ public class Key {
disabledIconId, previewIconId,
visualInsetsLeft, visualInsetsRight);
}
-
- mHashCode = computeHashCode(this);
-
+ mKeyVisualAttributes = KeyVisualAttributes.newInstance(keyAttr);
keyAttr.recycle();
-
+ mHashCode = computeHashCode(this);
if (hasShiftedLetterHint() && TextUtils.isEmpty(mHintLabel)) {
Log.w(TAG, "hasShiftedLetterHint specified without keyHintLabel: " + this);
}
@@ -478,133 +481,161 @@ public class Key {
return this instanceof Spacer;
}
- public boolean isShift() {
+ public final boolean isShift() {
return mCode == CODE_SHIFT;
}
- public boolean isModifier() {
+ public final boolean isModifier() {
return mCode == CODE_SHIFT || mCode == CODE_SWITCH_ALPHA_SYMBOL;
}
- public boolean isRepeatable() {
+ public final boolean isRepeatable() {
return (mActionFlags & ACTION_FLAGS_IS_REPEATABLE) != 0;
}
- public boolean noKeyPreview() {
+ public final boolean noKeyPreview() {
return (mActionFlags & ACTION_FLAGS_NO_KEY_PREVIEW) != 0;
}
- public boolean altCodeWhileTyping() {
+ public final boolean altCodeWhileTyping() {
return (mActionFlags & ACTION_FLAGS_ALT_CODE_WHILE_TYPING) != 0;
}
- public boolean isLongPressEnabled() {
+ public final boolean isLongPressEnabled() {
// We need not start long press timer on the key which has activated shifted letter.
return (mActionFlags & ACTION_FLAGS_ENABLE_LONG_PRESS) != 0
&& (mLabelFlags & LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED) == 0;
}
- public Typeface selectTypeface(final Typeface defaultTypeface) {
+ public final Typeface selectTypeface(final KeyDrawParams params) {
// TODO: Handle "bold" here too?
if ((mLabelFlags & LABEL_FLAGS_FONT_NORMAL) != 0) {
return Typeface.DEFAULT;
} else if ((mLabelFlags & LABEL_FLAGS_FONT_MONO_SPACE) != 0) {
return Typeface.MONOSPACE;
} else {
- return defaultTypeface;
+ return params.mTypeface;
}
}
- public int selectTextSize(final int letterSize, final int largeLetterSize, final int labelSize,
- final int largeLabelSize, final int hintLabelSize) {
+ public final int selectTextSize(final KeyDrawParams params) {
switch (mLabelFlags & LABEL_FLAGS_FOLLOW_KEY_TEXT_RATIO_MASK) {
case LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO:
- return letterSize;
+ return params.mLetterSize;
case LABEL_FLAGS_FOLLOW_KEY_LARGE_LETTER_RATIO:
- return largeLetterSize;
+ return params.mLargeLetterSize;
case LABEL_FLAGS_FOLLOW_KEY_LABEL_RATIO:
- return labelSize;
+ return params.mLabelSize;
case LABEL_FLAGS_FOLLOW_KEY_LARGE_LABEL_RATIO:
- return largeLabelSize;
+ return params.mLargeLabelSize;
case LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO:
- return hintLabelSize;
+ return params.mHintLabelSize;
default: // No follow key ratio flag specified.
- return StringUtils.codePointCount(mLabel) == 1 ? letterSize : labelSize;
+ return StringUtils.codePointCount(mLabel) == 1 ? params.mLetterSize : params.mLabelSize;
+ }
+ }
+
+ public final int selectTextColor(final KeyDrawParams params) {
+ return isShiftedLetterActivated() ? params.mTextInactivatedColor : params.mTextColor;
+ }
+
+ public final int selectHintTextSize(final KeyDrawParams params) {
+ if (hasHintLabel()) {
+ return params.mHintLabelSize;
+ } else if (hasShiftedLetterHint()) {
+ return params.mShiftedLetterHintSize;
+ } else {
+ return params.mHintLetterSize;
}
}
- public boolean isAlignLeft() {
+ public final int selectHintTextColor(final KeyDrawParams params) {
+ if (hasHintLabel()) {
+ return params.mHintLabelColor;
+ } else if (hasShiftedLetterHint()) {
+ return isShiftedLetterActivated() ? params.mShiftedLetterHintActivatedColor
+ : params.mShiftedLetterHintInactivatedColor;
+ } else {
+ return params.mHintLetterColor;
+ }
+ }
+
+ public final int selectMoreKeyTextSize(final KeyDrawParams params) {
+ return hasLabelsInMoreKeys() ? params.mLabelSize : params.mLetterSize;
+ }
+
+ public final boolean isAlignLeft() {
return (mLabelFlags & LABEL_FLAGS_ALIGN_LEFT) != 0;
}
- public boolean isAlignRight() {
+ public final boolean isAlignRight() {
return (mLabelFlags & LABEL_FLAGS_ALIGN_RIGHT) != 0;
}
- public boolean isAlignLeftOfCenter() {
+ public final boolean isAlignLeftOfCenter() {
return (mLabelFlags & LABEL_FLAGS_ALIGN_LEFT_OF_CENTER) != 0;
}
- public boolean hasPopupHint() {
+ public final boolean hasPopupHint() {
return (mLabelFlags & LABEL_FLAGS_HAS_POPUP_HINT) != 0;
}
- public boolean hasShiftedLetterHint() {
+ public final boolean hasShiftedLetterHint() {
return (mLabelFlags & LABEL_FLAGS_HAS_SHIFTED_LETTER_HINT) != 0;
}
- public boolean hasHintLabel() {
+ public final boolean hasHintLabel() {
return (mLabelFlags & LABEL_FLAGS_HAS_HINT_LABEL) != 0;
}
- public boolean hasLabelWithIconLeft() {
+ public final boolean hasLabelWithIconLeft() {
return (mLabelFlags & LABEL_FLAGS_WITH_ICON_LEFT) != 0;
}
- public boolean hasLabelWithIconRight() {
+ public final boolean hasLabelWithIconRight() {
return (mLabelFlags & LABEL_FLAGS_WITH_ICON_RIGHT) != 0;
}
- public boolean needsXScale() {
+ public final boolean needsXScale() {
return (mLabelFlags & LABEL_FLAGS_AUTO_X_SCALE) != 0;
}
- public boolean isShiftedLetterActivated() {
+ public final boolean isShiftedLetterActivated() {
return (mLabelFlags & LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED) != 0;
}
- public int getMoreKeysColumn() {
+ public final int getMoreKeysColumn() {
return mMoreKeysColumnAndFlags & MORE_KEYS_COLUMN_MASK;
}
- public boolean isFixedColumnOrderMoreKeys() {
+ public final boolean isFixedColumnOrderMoreKeys() {
return (mMoreKeysColumnAndFlags & MORE_KEYS_FLAGS_FIXED_COLUMN_ORDER) != 0;
}
- public boolean hasLabelsInMoreKeys() {
+ public final boolean hasLabelsInMoreKeys() {
return (mMoreKeysColumnAndFlags & MORE_KEYS_FLAGS_HAS_LABELS) != 0;
}
- public int getMoreKeyLabelFlags() {
+ public final int getMoreKeyLabelFlags() {
return hasLabelsInMoreKeys()
? LABEL_FLAGS_FOLLOW_KEY_LABEL_RATIO
: LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO;
}
- public boolean needsDividersInMoreKeys() {
+ public final boolean needsDividersInMoreKeys() {
return (mMoreKeysColumnAndFlags & MORE_KEYS_FLAGS_NEEDS_DIVIDERS) != 0;
}
- public boolean hasEmbeddedMoreKey() {
+ public final boolean hasEmbeddedMoreKey() {
return (mMoreKeysColumnAndFlags & MORE_KEYS_FLAGS_EMBEDDED_MORE_KEY) != 0;
}
- public String getOutputText() {
+ public final String getOutputText() {
final OptionalAttributes attrs = mOptionalAttributes;
return (attrs != null) ? attrs.mOutputText : null;
}
- public int getAltCode() {
+ public final int getAltCode() {
final OptionalAttributes attrs = mOptionalAttributes;
return (attrs != null) ? attrs.mAltCode : CODE_UNSPECIFIED;
}
@@ -627,12 +658,12 @@ public class Key {
? iconSet.getIconDrawable(previewIconId) : iconSet.getIconDrawable(mIconId);
}
- public int getDrawX() {
+ public final int getDrawX() {
final OptionalAttributes attrs = mOptionalAttributes;
return (attrs == null) ? mX : mX + attrs.mVisualInsetsLeft;
}
- public int getDrawWidth() {
+ public final int getDrawWidth() {
final OptionalAttributes attrs = mOptionalAttributes;
return (attrs == null) ? mWidth
: mWidth - attrs.mVisualInsetsLeft - attrs.mVisualInsetsRight;
@@ -656,7 +687,7 @@ public class Key {
mPressed = false;
}
- public boolean isEnabled() {
+ public final boolean isEnabled() {
return mEnabled;
}
@@ -748,7 +779,7 @@ public class Key {
* @return the drawable state of the key.
* @see android.graphics.drawable.StateListDrawable#setState(int[])
*/
- public int[] getCurrentDrawableState() {
+ public final int[] getCurrentDrawableState() {
switch (mBackgroundType) {
case BACKGROUND_TYPE_FUNCTIONAL:
return mPressed ? KEY_STATE_FUNCTIONAL_PRESSED : KEY_STATE_FUNCTIONAL_NORMAL;
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index c1b007d2e..261d1eba7 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -16,10 +16,10 @@
package com.android.inputmethod.keyboard;
-import android.graphics.Typeface;
import android.util.Log;
import android.util.SparseArray;
+import com.android.inputmethod.keyboard.internal.KeyVisualAttributes;
import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.keyboard.internal.KeyboardParams;
import com.android.inputmethod.latin.CollectionUtils;
@@ -97,11 +97,7 @@ public class Keyboard {
public final int mVerticalGap;
/** Per keyboard key visual parameters */
- public final Typeface mKeyTypeface;
- public final float mKeyLetterRatio;
- public final int mKeyLetterSize;
- public final float mKeyHintLetterRatio;
- public final float mKeyShiftedLetterHintRatio;
+ public final KeyVisualAttributes mKeyVisualAttributes;
public final int mMostCommonKeyHeight;
public final int mMostCommonKeyWidth;
@@ -132,13 +128,7 @@ public class Keyboard {
mMostCommonKeyWidth = params.mMostCommonKeyWidth;
mMoreKeysTemplate = params.mMoreKeysTemplate;
mMaxMoreKeysKeyboardColumn = params.mMaxMoreKeysKeyboardColumn;
-
- mKeyTypeface = params.mKeyTypeface;
- mKeyLetterRatio = params.mKeyLetterRatio;
- mKeyLetterSize = params.mKeyLetterSize;
- mKeyHintLetterRatio = params.mKeyHintLetterRatio;
- mKeyShiftedLetterHintRatio = params.mKeyShiftedLetterHintRatio;
-
+ mKeyVisualAttributes = params.mKeyVisualAttributes;
mTopPadding = params.mTopPadding;
mVerticalGap = params.mVerticalGap;
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 1e5ca9bf9..5b02f9f5a 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -40,6 +40,7 @@ import android.widget.TextView;
import com.android.inputmethod.keyboard.internal.KeyDrawParams;
import com.android.inputmethod.keyboard.internal.KeyPreviewDrawParams;
+import com.android.inputmethod.keyboard.internal.KeyVisualAttributes;
import com.android.inputmethod.keyboard.internal.PreviewPlacerView;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants;
@@ -55,31 +56,54 @@ import java.util.HashSet;
/**
* A view that renders a virtual {@link Keyboard}.
*
- * @attr ref R.styleable#KeyboardView_backgroundDimAlpha
* @attr ref R.styleable#KeyboardView_keyBackground
- * @attr ref R.styleable#KeyboardView_keyLetterRatio
- * @attr ref R.styleable#KeyboardView_keyLargeLetterRatio
- * @attr ref R.styleable#KeyboardView_keyLabelRatio
- * @attr ref R.styleable#KeyboardView_keyHintLetterRatio
- * @attr ref R.styleable#KeyboardView_keyShiftedLetterHintRatio
- * @attr ref R.styleable#KeyboardView_keyHintLabelRatio
+ * @attr ref R.styleable#KeyboardView_moreKeysLayout
+ * @attr ref R.styleable#KeyboardView_keyPreviewLayout
+ * @attr ref R.styleable#KeyboardView_keyPreviewBackground
+ * @attr ref R.styleable#KeyboardView_keyPreviewLeftBackground
+ * @attr ref R.styleable#KeyboardView_keyPreviewRightBackground
+ * @attr ref R.styleable#KeyboardView_keyPreviewOffset
+ * @attr ref R.styleable#KeyboardView_keyPreviewHeight
+ * @attr ref R.styleable#KeyboardView_keyPreviewLingerTimeout
* @attr ref R.styleable#KeyboardView_keyLabelHorizontalPadding
* @attr ref R.styleable#KeyboardView_keyHintLetterPadding
* @attr ref R.styleable#KeyboardView_keyPopupHintLetterPadding
* @attr ref R.styleable#KeyboardView_keyShiftedLetterHintPadding
- * @attr ref R.styleable#KeyboardView_keyTypeface
- * @attr ref R.styleable#KeyboardView_keyPreviewLayout
- * @attr ref R.styleable#KeyboardView_keyPreviewTextRatio
- * @attr ref R.styleable#KeyboardView_keyPreviewOffset
- * @attr ref R.styleable#KeyboardView_keyPreviewHeight
- * @attr ref R.styleable#KeyboardView_keyTextColor
- * @attr ref R.styleable#KeyboardView_keyTextColorDisabled
- * @attr ref R.styleable#KeyboardView_keyHintLetterColor
- * @attr ref R.styleable#KeyboardView_keyHintLabelColor
- * @attr ref R.styleable#KeyboardView_keyShiftedLetterHintInactivatedColor
- * @attr ref R.styleable#KeyboardView_keyShiftedLetterHintActivatedColor
- * @attr ref R.styleable#KeyboardView_shadowColor
- * @attr ref R.styleable#KeyboardView_shadowRadius
+ * @attr ref R.styleable#KeyboardView_keyTextShadowRadius
+ * @attr ref R.styleable#KeyboardView_backgroundDimAlpha
+ * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewTextSize
+ * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewTextColor
+ * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewTextOffset
+ * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewTextShadingColor
+ * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewTextShadingBorder
+ * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewTextShadowColor
+ * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewTextShadowBorder
+ * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewTextConnectorColor
+ * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewTextConnectorWidth
+ * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewTextLingerTimeout
+ * @attr ref R.styleable#KeyboardView_gesturePreviewTrailFadeoutStartDelay
+ * @attr ref R.styleable#KeyboardView_gesturePreviewTrailFadeoutDuration
+ * @attr ref R.styleable#KeyboardView_gesturePreviewTrailUpdateInterval
+ * @attr ref R.styleable#KeyboardView_gesturePreviewTrailColor
+ * @attr ref R.styleable#KeyboardView_gesturePreviewTrailWidth
+ * @attr ref R.styleable#KeyboardView_verticalCorrection
+ * @attr ref R.styleable#Keyboard_Key_keyTypeface
+ * @attr ref R.styleable#Keyboard_Key_keyLetterSize
+ * @attr ref R.styleable#Keyboard_Key_keyLabelSize
+ * @attr ref R.styleable#Keyboard_Key_keyLargeLetterRatio
+ * @attr ref R.styleable#Keyboard_Key_keyLargeLabelRatio
+ * @attr ref R.styleable#Keyboard_Key_keyHintLetterRatio
+ * @attr ref R.styleable#Keyboard_Key_keyShiftedLetterHintRatio
+ * @attr ref R.styleable#Keyboard_Key_keyHintLabelRatio
+ * @attr ref R.styleable#Keyboard_Key_keyPreviewTextRatio
+ * @attr ref R.styleable#Keyboard_Key_keyTextColor
+ * @attr ref R.styleable#Keyboard_Key_keyTextColorDisabled
+ * @attr ref R.styleable#Keyboard_Key_keyTextShadowColor
+ * @attr ref R.styleable#Keyboard_Key_keyHintLetterColor
+ * @attr ref R.styleable#Keyboard_Key_keyHintLabelColor
+ * @attr ref R.styleable#Keyboard_Key_keyShiftedLetterHintInactivatedColor
+ * @attr ref R.styleable#Keyboard_Key_keyShiftedLetterHintActivatedColor
+ * @attr ref R.styleable#Keyboard_Key_keyPreviewTextColor
*/
public class KeyboardView extends View implements PointerTracker.DrawingProxy {
private static final String TAG = KeyboardView.class.getSimpleName();
@@ -88,8 +112,16 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
private static final int[] LONG_PRESSABLE_STATE_SET = { android.R.attr.state_long_pressable };
// XML attributes
+ private final KeyVisualAttributes mKeyVisualAttributes;
+ private final int mKeyLabelHorizontalPadding;
+ private final float mKeyHintLetterPadding;
+ private final float mKeyPopupHintLetterPadding;
+ private final float mKeyShiftedLetterHintPadding;
+ private final float mKeyTextShadowRadius;
protected final float mVerticalCorrection;
protected final int mMoreKeysLayout;
+ protected final Drawable mKeyBackground;
+ protected final Rect mKeyBackgroundPadding = new Rect();
private final int mBackgroundDimAlpha;
// HORIZONTAL ELLIPSIS "...", character for popup hint.
@@ -105,12 +137,19 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
// Main keyboard
private Keyboard mKeyboard;
- protected final KeyDrawParams mKeyDrawParams;
+ protected final KeyDrawParams mKeyDrawParams = new KeyDrawParams();
// Key preview
+ private static final int PREVIEW_ALPHA = 240;
private final int mKeyPreviewLayoutId;
+ private final Drawable mPreviewBackground;
+ private final Drawable mPreviewLeftBackground;
+ private final Drawable mPreviewRightBackground;
+ private final int mPreviewOffset;
+ private final int mPreviewHeight;
+ private final int mPreviewLingerTimeout;
private final SparseArray<TextView> mKeyPreviewTexts = CollectionUtils.newSparseArray();
- protected final KeyPreviewDrawParams mKeyPreviewDrawParams;
+ protected final KeyPreviewDrawParams mKeyPreviewDrawParams = new KeyPreviewDrawParams();
private boolean mShowKeyPreviewPopup = true;
private int mDelayAfterPreview;
private final PreviewPlacerView mPreviewPlacerView;
@@ -144,12 +183,12 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
public static class DrawingHandler extends StaticInnerHandlerWrapper<KeyboardView> {
private static final int MSG_DISMISS_KEY_PREVIEW = 0;
- public DrawingHandler(KeyboardView outerInstance) {
+ public DrawingHandler(final KeyboardView outerInstance) {
super(outerInstance);
}
@Override
- public void handleMessage(Message msg) {
+ public void handleMessage(final Message msg) {
final KeyboardView keyboardView = getOuterInstance();
if (keyboardView == null) return;
final PointerTracker tracker = (PointerTracker) msg.obj;
@@ -163,11 +202,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
}
- public void dismissKeyPreview(long delay, PointerTracker tracker) {
+ public void dismissKeyPreview(final long delay, final PointerTracker tracker) {
sendMessageDelayed(obtainMessage(MSG_DISMISS_KEY_PREVIEW, tracker), delay);
}
- public void cancelDismissKeyPreview(PointerTracker tracker) {
+ public void cancelDismissKeyPreview(final PointerTracker tracker) {
removeMessages(MSG_DISMISS_KEY_PREVIEW, tracker);
}
@@ -180,38 +219,76 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
}
- public KeyboardView(Context context, AttributeSet attrs) {
+ public KeyboardView(final Context context, final AttributeSet attrs) {
this(context, attrs, R.attr.keyboardViewStyle);
}
- public KeyboardView(Context context, AttributeSet attrs, int defStyle) {
+ public KeyboardView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
final TypedArray keyboardViewAttr = context.obtainStyledAttributes(attrs,
R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
- final TypedArray keyAttr = context.obtainStyledAttributes(attrs,
- R.styleable.Keyboard_Key, defStyle, R.style.KeyboardView);
- mKeyDrawParams = new KeyDrawParams(keyboardViewAttr, keyAttr);
- mKeyPreviewDrawParams = new KeyPreviewDrawParams(keyboardViewAttr, keyAttr);
- mDelayAfterPreview = mKeyPreviewDrawParams.mLingerTimeout;
+ mKeyBackground = keyboardViewAttr.getDrawable(R.styleable.KeyboardView_keyBackground);
+ mKeyBackground.getPadding(mKeyBackgroundPadding);
+ mPreviewBackground = keyboardViewAttr.getDrawable(
+ R.styleable.KeyboardView_keyPreviewBackground);
+ mPreviewLeftBackground = keyboardViewAttr.getDrawable(
+ R.styleable.KeyboardView_keyPreviewLeftBackground);
+ mPreviewRightBackground = keyboardViewAttr.getDrawable(
+ R.styleable.KeyboardView_keyPreviewRightBackground);
+ setAlpha(mPreviewBackground, PREVIEW_ALPHA);
+ setAlpha(mPreviewLeftBackground, PREVIEW_ALPHA);
+ setAlpha(mPreviewRightBackground, PREVIEW_ALPHA);
+ mPreviewOffset = keyboardViewAttr.getDimensionPixelOffset(
+ R.styleable.KeyboardView_keyPreviewOffset, 0);
+ mPreviewHeight = keyboardViewAttr.getDimensionPixelSize(
+ R.styleable.KeyboardView_keyPreviewHeight, 80);
+ mPreviewLingerTimeout = keyboardViewAttr.getInt(
+ R.styleable.KeyboardView_keyPreviewLingerTimeout, 0);
+ mDelayAfterPreview = mPreviewLingerTimeout;
+ mKeyLabelHorizontalPadding = keyboardViewAttr.getDimensionPixelOffset(
+ R.styleable.KeyboardView_keyLabelHorizontalPadding, 0);
+ mKeyHintLetterPadding = keyboardViewAttr.getDimension(
+ R.styleable.KeyboardView_keyHintLetterPadding, 0);
+ mKeyPopupHintLetterPadding = keyboardViewAttr.getDimension(
+ R.styleable.KeyboardView_keyPopupHintLetterPadding, 0);
+ mKeyShiftedLetterHintPadding = keyboardViewAttr.getDimension(
+ R.styleable.KeyboardView_keyShiftedLetterHintPadding, 0);
+ mKeyTextShadowRadius = keyboardViewAttr.getFloat(
+ R.styleable.KeyboardView_keyTextShadowRadius, 0.0f);
mKeyPreviewLayoutId = keyboardViewAttr.getResourceId(
R.styleable.KeyboardView_keyPreviewLayout, 0);
if (mKeyPreviewLayoutId == 0) {
mShowKeyPreviewPopup = false;
}
- mVerticalCorrection = keyboardViewAttr.getDimensionPixelOffset(
+ mVerticalCorrection = keyboardViewAttr.getDimension(
R.styleable.KeyboardView_verticalCorrection, 0);
mMoreKeysLayout = keyboardViewAttr.getResourceId(
R.styleable.KeyboardView_moreKeysLayout, 0);
mBackgroundDimAlpha = keyboardViewAttr.getInt(
R.styleable.KeyboardView_backgroundDimAlpha, 0);
keyboardViewAttr.recycle();
+
+ final TypedArray keyAttr = context.obtainStyledAttributes(attrs,
+ R.styleable.Keyboard_Key, defStyle, R.style.KeyboardView);
+ mKeyVisualAttributes = KeyVisualAttributes.newInstance(keyAttr);
keyAttr.recycle();
mPreviewPlacerView = new PreviewPlacerView(context, attrs);
mPaint.setAntiAlias(true);
}
+ private static void setAlpha(final Drawable drawable, final int alpha) {
+ if (drawable == null) return;
+ drawable.setAlpha(alpha);
+ }
+
+ private static void blendAlpha(final Paint paint, final int alpha) {
+ final int color = paint.getColor();
+ paint.setARGB((paint.getAlpha() * alpha) / Constants.Color.ALPHA_OPAQUE,
+ Color.red(color), Color.green(color), Color.blue(color));
+ }
+
/**
* Attaches a keyboard to this view. The keyboard can be switched at any time and the
* view will re-layout itself to accommodate the keyboard.
@@ -219,13 +296,14 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
* @see #getKeyboard()
* @param keyboard the keyboard to display in this view
*/
- public void setKeyboard(Keyboard keyboard) {
+ public void setKeyboard(final Keyboard keyboard) {
mKeyboard = keyboard;
LatinImeLogger.onSetKeyboard(keyboard);
requestLayout();
invalidateAllKeys();
- mKeyDrawParams.updateParams(keyboard);
- mKeyPreviewDrawParams.updateParams(keyboard, mKeyDrawParams);
+ final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap;
+ mKeyDrawParams.updateParams(keyHeight, mKeyVisualAttributes);
+ mKeyDrawParams.updateParams(keyHeight, keyboard.mKeyVisualAttributes);
}
/**
@@ -244,7 +322,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
* @param delay the delay after which the preview is dismissed
* @see #isKeyPreviewPopupEnabled()
*/
- public void setKeyPreviewPopupEnabled(boolean previewEnabled, int delay) {
+ public void setKeyPreviewPopupEnabled(final boolean previewEnabled, final int delay) {
mShowKeyPreviewPopup = previewEnabled;
mDelayAfterPreview = delay;
}
@@ -258,14 +336,14 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
return mShowKeyPreviewPopup;
}
- public void setGesturePreviewMode(boolean drawsGesturePreviewTrail,
- boolean drawsGestureFloatingPreviewText) {
+ public void setGesturePreviewMode(final boolean drawsGesturePreviewTrail,
+ final boolean drawsGestureFloatingPreviewText) {
mPreviewPlacerView.setGesturePreviewMode(
drawsGesturePreviewTrail, drawsGestureFloatingPreviewText);
}
@Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
if (mKeyboard != null) {
// The main keyboard expands to the display width.
final int height = mKeyboard.mOccupiedHeight + getPaddingTop() + getPaddingBottom();
@@ -276,7 +354,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
@Override
- public void onDraw(Canvas canvas) {
+ public void onDraw(final Canvas canvas) {
super.onDraw(canvas);
if (canvas.isHardwareAccelerated()) {
onDrawKeyboard(canvas);
@@ -331,7 +409,6 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
final int width = getWidth();
final int height = getHeight();
final Paint paint = mPaint;
- final KeyDrawParams params = mKeyDrawParams;
// Calculate clip region and set.
final boolean drawAllKeys = mInvalidateAllKeys || mInvalidatedKeys.isEmpty();
@@ -364,13 +441,13 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
if (drawAllKeys || isHardwareAccelerated) {
// Draw all keys.
for (final Key key : mKeyboard.mKeys) {
- onDrawKey(key, canvas, paint, params);
+ onDrawKey(key, canvas, paint);
}
} else {
// Draw invalidated keys.
for (final Key key : mInvalidatedKeys) {
if (mKeyboard.hasKey(key)) {
- onDrawKey(key, canvas, paint, params);
+ onDrawKey(key, canvas, paint);
}
}
}
@@ -394,7 +471,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
mInvalidateAllKeys = false;
}
- public void dimEntireKeyboard(boolean dimmed) {
+ public void dimEntireKeyboard(final boolean dimmed) {
final boolean needsRedrawing = mNeedsToDimEntireKeyboard != dimmed;
mNeedsToDimEntireKeyboard = dimmed;
if (needsRedrawing) {
@@ -402,14 +479,18 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
}
- private void onDrawKey(Key key, Canvas canvas, Paint paint, KeyDrawParams params) {
+ private void onDrawKey(final Key key, final Canvas canvas, final Paint paint) {
final int keyDrawX = key.getDrawX() + getPaddingLeft();
final int keyDrawY = key.mY + getPaddingTop();
canvas.translate(keyDrawX, keyDrawY);
+ final int keyHeight = mKeyboard.mMostCommonKeyHeight - mKeyboard.mVerticalGap;
+ final KeyVisualAttributes attr = key.mKeyVisualAttributes;
+ final KeyDrawParams params = mKeyDrawParams.mayCloneAndUpdateParams(keyHeight, attr);
params.mAnimAlpha = Constants.Color.ALPHA_OPAQUE;
+
if (!key.isSpacer()) {
- onDrawKeyBackground(key, canvas, params);
+ onDrawKeyBackground(key, canvas);
}
onDrawKeyTopVisuals(key, canvas, paint, params);
@@ -417,13 +498,14 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
// Draw key background.
- protected void onDrawKeyBackground(Key key, Canvas canvas, KeyDrawParams params) {
- final int bgWidth = key.getDrawWidth() + params.mPadding.left + params.mPadding.right;
- final int bgHeight = key.mHeight + params.mPadding.top + params.mPadding.bottom;
- final int bgX = -params.mPadding.left;
- final int bgY = -params.mPadding.top;
+ protected void onDrawKeyBackground(Key key, Canvas canvas) {
+ final Rect padding = mKeyBackgroundPadding;
+ final int bgWidth = key.getDrawWidth() + padding.left + padding.right;
+ final int bgHeight = key.mHeight + padding.top + padding.bottom;
+ final int bgX = -padding.left;
+ final int bgY = -padding.top;
final int[] drawableState = key.getCurrentDrawableState();
- final Drawable background = params.mKeyBackground;
+ final Drawable background = mKeyBackground;
background.setState(drawableState);
final Rect bounds = background.getBounds();
if (bgWidth != bounds.right || bgHeight != bounds.bottom) {
@@ -453,12 +535,8 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
float positionX = centerX;
if (key.mLabel != null) {
final String label = key.mLabel;
- // For characters, use large font. For labels like "Done", use smaller font.
- paint.setTypeface(key.selectTypeface(params.mKeyTypeface));
- final int labelSize = key.selectTextSize(params.mKeyLetterSize,
- params.mKeyLargeLetterSize, params.mKeyLabelSize, params.mKeyLargeLabelSize,
- params.mKeyHintLabelSize);
- paint.setTextSize(labelSize);
+ paint.setTypeface(key.selectTypeface(params));
+ paint.setTextSize(key.selectTextSize(params));
final float labelCharHeight = getCharHeight(KEY_LABEL_REFERENCE_CHAR, paint);
final float labelCharWidth = getCharWidth(KEY_LABEL_REFERENCE_CHAR, paint);
@@ -468,10 +546,10 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
// Horizontal label text alignment
float labelWidth = 0;
if (key.isAlignLeft()) {
- positionX = (int)params.mKeyLabelHorizontalPadding;
+ positionX = mKeyLabelHorizontalPadding;
paint.setTextAlign(Align.LEFT);
} else if (key.isAlignRight()) {
- positionX = keyWidth - (int)params.mKeyLabelHorizontalPadding;
+ positionX = keyWidth - mKeyLabelHorizontalPadding;
paint.setTextAlign(Align.RIGHT);
} else if (key.isAlignLeftOfCenter()) {
// TODO: Parameterise this?
@@ -496,16 +574,15 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
Math.min(1.0f, (keyWidth * MAX_LABEL_RATIO) / getLabelWidth(label, paint)));
}
- paint.setColor(key.isShiftedLetterActivated()
- ? params.mKeyTextInactivatedColor : params.mKeyTextColor);
+ paint.setColor(key.selectTextColor(params));
if (key.isEnabled()) {
// Set a drop shadow for the text
- paint.setShadowLayer(params.mKeyTextShadowRadius, 0, 0, params.mKeyTextShadowColor);
+ paint.setShadowLayer(mKeyTextShadowRadius, 0, 0, params.mTextShadowColor);
} else {
// Make label invisible
paint.setColor(Color.TRANSPARENT);
}
- params.blendAlpha(paint);
+ blendAlpha(paint, params.mAnimAlpha);
canvas.drawText(label, 0, label.length(), positionX, baseline, paint);
// Turn off drop shadow and reset x-scale.
paint.setShadowLayer(0, 0, 0, 0);
@@ -533,25 +610,10 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
// Draw hint label.
if (key.mHintLabel != null) {
- final String hint = key.mHintLabel;
- final int hintColor;
- final int hintSize;
- if (key.hasHintLabel()) {
- hintColor = params.mKeyHintLabelColor;
- hintSize = params.mKeyHintLabelSize;
- paint.setTypeface(Typeface.DEFAULT);
- } else if (key.hasShiftedLetterHint()) {
- hintColor = key.isShiftedLetterActivated()
- ? params.mKeyShiftedLetterHintActivatedColor
- : params.mKeyShiftedLetterHintInactivatedColor;
- hintSize = params.mKeyShiftedLetterHintSize;
- } else { // key.hasHintLetter()
- hintColor = params.mKeyHintLetterColor;
- hintSize = params.mKeyHintLetterSize;
- }
- paint.setColor(hintColor);
- params.blendAlpha(paint);
- paint.setTextSize(hintSize);
+ final String hintLabel = key.mHintLabel;
+ paint.setTextSize(key.selectHintTextSize(params));
+ paint.setColor(key.selectHintTextColor(params));
+ blendAlpha(paint, params.mAnimAlpha);
final float hintX, hintY;
if (key.hasHintLabel()) {
// The hint label is placed just right of the key label. Used mainly on
@@ -562,19 +624,19 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
paint.setTextAlign(Align.LEFT);
} else if (key.hasShiftedLetterHint()) {
// The hint label is placed at top-right corner of the key. Used mainly on tablet.
- hintX = keyWidth - params.mKeyShiftedLetterHintPadding
+ hintX = keyWidth - mKeyShiftedLetterHintPadding
- getCharWidth(KEY_LABEL_REFERENCE_CHAR, paint) / 2;
paint.getFontMetrics(mFontMetrics);
hintY = -mFontMetrics.top;
paint.setTextAlign(Align.CENTER);
} else { // key.hasHintLetter()
// The hint letter is placed at top-right corner of the key. Used mainly on phone.
- hintX = keyWidth - params.mKeyHintLetterPadding
+ hintX = keyWidth - mKeyHintLetterPadding
- getCharWidth(KEY_NUMERIC_HINT_LABEL_REFERENCE_CHAR, paint) / 2;
hintY = -paint.ascent();
paint.setTextAlign(Align.CENTER);
}
- canvas.drawText(hint, 0, hint.length(), hintX, hintY, paint);
+ canvas.drawText(hintLabel, 0, hintLabel.length(), hintX, hintY, paint);
if (LatinImeLogger.sVISUALDEBUG) {
final Paint line = new Paint();
@@ -585,15 +647,15 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
// Draw key icon.
if (key.mLabel == null && icon != null) {
- final int iconWidth = icon.getIntrinsicWidth();
+ final int iconWidth = Math.min(icon.getIntrinsicWidth(), keyWidth);
final int iconHeight = icon.getIntrinsicHeight();
final int iconX, alignX;
final int iconY = (keyHeight - iconHeight) / 2;
if (key.isAlignLeft()) {
- iconX = (int)params.mKeyLabelHorizontalPadding;
+ iconX = mKeyLabelHorizontalPadding;
alignX = iconX;
} else if (key.isAlignRight()) {
- iconX = keyWidth - (int)params.mKeyLabelHorizontalPadding - iconWidth;
+ iconX = keyWidth - mKeyLabelHorizontalPadding - iconWidth;
alignX = iconX + iconWidth;
} else { // Align center
iconX = (keyWidth - iconWidth) / 2;
@@ -618,13 +680,13 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
final int keyWidth = key.getDrawWidth();
final int keyHeight = key.mHeight;
- paint.setTypeface(params.mKeyTypeface);
- paint.setTextSize(params.mKeyHintLetterSize);
- paint.setColor(params.mKeyHintLabelColor);
+ paint.setTypeface(params.mTypeface);
+ paint.setTextSize(params.mHintLetterSize);
+ paint.setColor(params.mHintLabelColor);
paint.setTextAlign(Align.CENTER);
- final float hintX = keyWidth - params.mKeyHintLetterPadding
+ final float hintX = keyWidth - mKeyHintLetterPadding
- getCharWidth(KEY_LABEL_REFERENCE_CHAR, paint) / 2;
- final float hintY = keyHeight - params.mKeyPopupHintLetterPadding;
+ final float hintY = keyHeight - mKeyPopupHintLetterPadding;
canvas.drawText(POPUP_HINT_CHAR, hintX, hintY, paint);
if (LatinImeLogger.sVISUALDEBUG) {
@@ -717,8 +779,8 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
public Paint newDefaultLabelPaint() {
final Paint paint = new Paint();
paint.setAntiAlias(true);
- paint.setTypeface(mKeyDrawParams.mKeyTypeface);
- paint.setTextSize(mKeyDrawParams.mKeyLabelSize);
+ paint.setTypeface(mKeyDrawParams.mTypeface);
+ paint.setTextSize(mKeyDrawParams.mLabelSize);
return paint;
}
@@ -756,11 +818,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
@Override
- public void dismissKeyPreview(PointerTracker tracker) {
+ public void dismissKeyPreview(final PointerTracker tracker) {
mDrawingHandler.dismissKeyPreview(mDelayAfterPreview, tracker);
}
- private void addKeyPreview(TextView keyPreview) {
+ private void addKeyPreview(final TextView keyPreview) {
locatePreviewPlacerView();
mPreviewPlacerView.addView(
keyPreview, ViewLayoutUtils.newLayoutParam(mPreviewPlacerView, 0, 0));
@@ -798,17 +860,17 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
@Override
- public void showGesturePreviewTrail(PointerTracker tracker) {
+ public void showGesturePreviewTrail(final PointerTracker tracker) {
locatePreviewPlacerView();
mPreviewPlacerView.invalidatePointer(tracker);
}
@SuppressWarnings("deprecation") // setBackgroundDrawable is replaced by setBackground in API16
@Override
- public void showKeyPreview(PointerTracker tracker) {
- final KeyPreviewDrawParams params = mKeyPreviewDrawParams;
+ public void showKeyPreview(final PointerTracker tracker) {
+ final KeyPreviewDrawParams previewParams = mKeyPreviewDrawParams;
if (!mShowKeyPreviewPopup) {
- params.mPreviewVisibleOffset = -mKeyboard.mVerticalGap;
+ previewParams.mPreviewVisibleOffset = -mKeyboard.mVerticalGap;
return;
}
@@ -827,17 +889,18 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
if (key == null)
return;
+ final KeyDrawParams drawParams = mKeyDrawParams;
final String label = key.isShiftedLetterActivated() ? key.mHintLabel : key.mLabel;
// What we show as preview should match what we show on a key top in onDraw().
if (label != null) {
// TODO Should take care of temporaryShiftLabel here.
previewText.setCompoundDrawables(null, null, null, null);
if (StringUtils.codePointCount(label) > 1) {
- previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mKeyLetterSize);
+ previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, drawParams.mLetterSize);
previewText.setTypeface(Typeface.DEFAULT_BOLD);
} else {
- previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mPreviewTextSize);
- previewText.setTypeface(params.mKeyTypeface);
+ previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, drawParams.mPreviewTextSize);
+ previewText.setTypeface(key.selectTypeface(drawParams));
}
previewText.setText(label);
} else {
@@ -845,47 +908,48 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
key.getPreviewIcon(mKeyboard.mIconsSet));
previewText.setText(null);
}
- previewText.setBackgroundDrawable(params.mPreviewBackground);
+ previewText.setBackgroundDrawable(mPreviewBackground);
previewText.measure(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
final int keyDrawWidth = key.getDrawWidth();
final int previewWidth = previewText.getMeasuredWidth();
- final int previewHeight = params.mPreviewHeight;
+ final int previewHeight = mPreviewHeight;
// The width and height of visible part of the key preview background. The content marker
// of the background 9-patch have to cover the visible part of the background.
- params.mPreviewVisibleWidth = previewWidth - previewText.getPaddingLeft()
+ previewParams.mPreviewVisibleWidth = previewWidth - previewText.getPaddingLeft()
- previewText.getPaddingRight();
- params.mPreviewVisibleHeight = previewHeight - previewText.getPaddingTop()
+ previewParams.mPreviewVisibleHeight = previewHeight - previewText.getPaddingTop()
- previewText.getPaddingBottom();
// The distance between the top edge of the parent key and the bottom of the visible part
// of the key preview background.
- params.mPreviewVisibleOffset = params.mPreviewOffset - previewText.getPaddingBottom();
- getLocationInWindow(params.mCoordinates);
+ previewParams.mPreviewVisibleOffset = mPreviewOffset - previewText.getPaddingBottom();
+ getLocationInWindow(previewParams.mCoordinates);
// The key preview is horizontally aligned with the center of the visible part of the
// parent key. If it doesn't fit in this {@link KeyboardView}, it is moved inward to fit and
// the left/right background is used if such background is specified.
- int previewX = key.getDrawX() - (previewWidth - keyDrawWidth) / 2 + params.mCoordinates[0];
+ int previewX = key.getDrawX() - (previewWidth - keyDrawWidth) / 2
+ + previewParams.mCoordinates[0];
if (previewX < 0) {
previewX = 0;
- if (params.mPreviewLeftBackground != null) {
- previewText.setBackgroundDrawable(params.mPreviewLeftBackground);
+ if (mPreviewLeftBackground != null) {
+ previewText.setBackgroundDrawable(mPreviewLeftBackground);
}
} else if (previewX > getWidth() - previewWidth) {
previewX = getWidth() - previewWidth;
- if (params.mPreviewRightBackground != null) {
- previewText.setBackgroundDrawable(params.mPreviewRightBackground);
+ if (mPreviewRightBackground != null) {
+ previewText.setBackgroundDrawable(mPreviewRightBackground);
}
}
// The key preview is placed vertically above the top edge of the parent key with an
// arbitrary offset.
- final int previewY = key.mY - previewHeight + params.mPreviewOffset
- + params.mCoordinates[1];
+ final int previewY = key.mY - previewHeight + mPreviewOffset
+ + previewParams.mCoordinates[1];
// Set the preview background state
previewText.getBackground().setState(
key.mMoreKeys != null ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET);
- previewText.setTextColor(params.mPreviewTextColor);
+ previewText.setTextColor(drawParams.mPreviewTextColor);
ViewLayoutUtils.placeViewAt(
previewText, previewX, previewY, previewWidth, previewHeight);
previewText.setVisibility(VISIBLE);
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 2da2f6dc6..06973ef99 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -63,9 +63,25 @@ import java.util.WeakHashMap;
/**
* A view that is responsible for detecting key presses and touch movements.
*
- * @attr ref R.styleable#KeyboardView_keyHysteresisDistance
- * @attr ref R.styleable#KeyboardView_verticalCorrection
- * @attr ref R.styleable#KeyboardView_popupLayout
+ * @attr ref R.styleable#MainKeyboardView_autoCorrectionSpacebarLedEnabled
+ * @attr ref R.styleable#MainKeyboardView_autoCorrectionSpacebarLedIcon
+ * @attr ref R.styleable#MainKeyboardView_spacebarTextRatio
+ * @attr ref R.styleable#MainKeyboardView_spacebarTextColor
+ * @attr ref R.styleable#MainKeyboardView_spacebarTextShadowColor
+ * @attr ref R.styleable#MainKeyboardView_languageOnSpacebarFinalAlpha
+ * @attr ref R.styleable#MainKeyboardView_languageOnSpacebarFadeoutAnimator
+ * @attr ref R.styleable#MainKeyboardView_altCodeKeyWhileTypingFadeoutAnimator
+ * @attr ref R.styleable#MainKeyboardView_altCodeKeyWhileTypingFadeinAnimator
+ * @attr ref R.styleable#MainKeyboardView_keyHysteresisDistance
+ * @attr ref R.styleable#MainKeyboardView_touchNoiseThresholdTime
+ * @attr ref R.styleable#MainKeyboardView_touchNoiseThresholdDistance
+ * @attr ref R.styleable#MainKeyboardView_slidingKeyInputEnable
+ * @attr ref R.styleable#MainKeyboardView_keyRepeatStartTimeout
+ * @attr ref R.styleable#MainKeyboardView_keyRepeatInterval
+ * @attr ref R.styleable#MainKeyboardView_longPressKeyTimeout
+ * @attr ref R.styleable#MainKeyboardView_longPressShiftKeyTimeout
+ * @attr ref R.styleable#MainKeyboardView_ignoreAltCodeKeyTimeout
+ * @attr ref R.styleable#MainKeyboardView_showMoreKeysKeyboardAtTouchPoint
*/
public class MainKeyboardView extends KeyboardView implements PointerTracker.KeyEventHandler,
SuddenJumpingTouchEventHandler.ProcessMotionEvent {
@@ -150,7 +166,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
@Override
- public void handleMessage(Message msg) {
+ public void handleMessage(final Message msg) {
final MainKeyboardView keyboardView = getOuterInstance();
final PointerTracker tracker = (PointerTracker) msg.obj;
switch (msg.what) {
@@ -174,14 +190,14 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
}
- private void startKeyRepeatTimer(PointerTracker tracker, long delay) {
+ private void startKeyRepeatTimer(final PointerTracker tracker, final long delay) {
final Key key = tracker.getKey();
if (key == null) return;
sendMessageDelayed(obtainMessage(MSG_REPEAT_KEY, key.mCode, 0, tracker), delay);
}
@Override
- public void startKeyRepeatTimer(PointerTracker tracker) {
+ public void startKeyRepeatTimer(final PointerTracker tracker) {
startKeyRepeatTimer(tracker, mKeyRepeatStartTimeout);
}
@@ -195,7 +211,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
@Override
- public void startLongPressTimer(int code) {
+ public void startLongPressTimer(final int code) {
cancelLongPressTimer();
final int delay;
switch (code) {
@@ -212,7 +228,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
@Override
- public void startLongPressTimer(PointerTracker tracker) {
+ public void startLongPressTimer(final PointerTracker tracker) {
cancelLongPressTimer();
if (tracker == null) {
return;
@@ -266,7 +282,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
@Override
- public void startTypingStateTimer(Key typedKey) {
+ public void startTypingStateTimer(final Key typedKey) {
if (typedKey.isModifier() || typedKey.altCodeWhileTyping()) {
return;
}
@@ -322,11 +338,11 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
}
- public MainKeyboardView(Context context, AttributeSet attrs) {
+ public MainKeyboardView(final Context context, final AttributeSet attrs) {
this(context, attrs, R.attr.mainKeyboardViewStyle);
}
- public MainKeyboardView(Context context, AttributeSet attrs, int defStyle) {
+ public MainKeyboardView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
mTouchScreenRegulator = new SuddenJumpingTouchEventHandler(getContext(), this);
@@ -377,7 +393,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
altCodeKeyWhileTypingFadeinAnimatorResId, this);
}
- private ObjectAnimator loadObjectAnimator(int resId, Object target) {
+ private ObjectAnimator loadObjectAnimator(final int resId, final Object target) {
if (resId == 0) return null;
final ObjectAnimator animator = (ObjectAnimator)AnimatorInflater.loadAnimator(
getContext(), resId);
@@ -392,7 +408,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
return mLanguageOnSpacebarAnimAlpha;
}
- public void setLanguageOnSpacebarAnimAlpha(int alpha) {
+ public void setLanguageOnSpacebarAnimAlpha(final int alpha) {
mLanguageOnSpacebarAnimAlpha = alpha;
invalidateKey(mSpaceKey);
}
@@ -401,12 +417,12 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
return mAltCodeKeyWhileTypingAnimAlpha;
}
- public void setAltCodeKeyWhileTypingAnimAlpha(int alpha) {
+ public void setAltCodeKeyWhileTypingAnimAlpha(final int alpha) {
mAltCodeKeyWhileTypingAnimAlpha = alpha;
updateAltCodeKeyWhileTyping();
}
- public void setKeyboardActionListener(KeyboardActionListener listener) {
+ public void setKeyboardActionListener(final KeyboardActionListener listener) {
mKeyboardActionListener = listener;
PointerTracker.setKeyboardActionListener(listener);
}
@@ -443,7 +459,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
* @param keyboard the keyboard to display in this view
*/
@Override
- public void setKeyboard(Keyboard keyboard) {
+ public void setKeyboard(final Keyboard keyboard) {
// Remove any pending messages, except dismissing preview and key repeat.
mKeyTimerHandler.cancelLongPressTimer();
super.setKeyboard(keyboard);
@@ -468,11 +484,11 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
// Note that this method is called from a non-UI thread.
- public void setMainDictionaryAvailability(boolean mainDictionaryAvailable) {
+ public void setMainDictionaryAvailability(final boolean mainDictionaryAvailable) {
PointerTracker.setMainDictionaryAvailability(mainDictionaryAvailable);
}
- public void setGestureHandlingEnabledByUser(boolean gestureHandlingEnabledByUser) {
+ public void setGestureHandlingEnabledByUser(final boolean gestureHandlingEnabledByUser) {
PointerTracker.setGestureHandlingEnabledByUser(gestureHandlingEnabledByUser);
}
@@ -484,7 +500,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
return mHasDistinctMultitouch;
}
- public void setDistinctMultitouch(boolean hasDistinctMultitouch) {
+ public void setDistinctMultitouch(final boolean hasDistinctMultitouch) {
mHasDistinctMultitouch = hasDistinctMultitouch;
}
@@ -515,7 +531,8 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
super.cancelAllMessages();
}
- private boolean openMoreKeysKeyboardIfRequired(Key parentKey, PointerTracker tracker) {
+ private boolean openMoreKeysKeyboardIfRequired(final Key parentKey,
+ final PointerTracker tracker) {
// Check if we have a popup layout specified first.
if (mMoreKeysLayout == 0) {
return false;
@@ -530,7 +547,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
// This default implementation returns a more keys panel.
- protected MoreKeysPanel onCreateMoreKeysPanel(Key parentKey) {
+ protected MoreKeysPanel onCreateMoreKeysPanel(final Key parentKey) {
if (parentKey.mMoreKeys == null)
return null;
@@ -556,7 +573,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
* @return true if the long press is handled, false otherwise. Subclasses should call the
* method on the base class if the subclass doesn't wish to handle the call.
*/
- protected boolean onLongPress(Key parentKey, PointerTracker tracker) {
+ protected boolean onLongPress(final Key parentKey, final PointerTracker tracker) {
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.mainKeyboardView_onLongPress();
}
@@ -580,20 +597,20 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
return openMoreKeysPanel(parentKey, tracker);
}
- private boolean invokeCustomRequest(int code) {
+ private boolean invokeCustomRequest(final int code) {
return mKeyboardActionListener.onCustomRequest(code);
}
- private void invokeCodeInput(int primaryCode) {
+ private void invokeCodeInput(final int primaryCode) {
mKeyboardActionListener.onCodeInput(
primaryCode, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
}
- private void invokeReleaseKey(int primaryCode) {
+ private void invokeReleaseKey(final int primaryCode) {
mKeyboardActionListener.onReleaseKey(primaryCode, false);
}
- private boolean openMoreKeysPanel(Key parentKey, PointerTracker tracker) {
+ private boolean openMoreKeysPanel(final Key parentKey, final PointerTracker tracker) {
MoreKeysPanel moreKeysPanel = mMoreKeysPanelCache.get(parentKey);
if (moreKeysPanel == null) {
moreKeysPanel = onCreateMoreKeysPanel(parentKey);
@@ -644,7 +661,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
@Override
- public boolean onTouchEvent(MotionEvent me) {
+ public boolean onTouchEvent(final MotionEvent me) {
if (getKeyboard() == null) {
return false;
}
@@ -652,7 +669,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
@Override
- public boolean processMotionEvent(MotionEvent me) {
+ public boolean processMotionEvent(final MotionEvent me) {
final boolean nonDistinctMultitouch = !mHasDistinctMultitouch;
final int action = me.getActionMasked();
final int pointerCount = me.getPointerCount();
@@ -819,7 +836,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
* otherwise
*/
@Override
- public boolean dispatchHoverEvent(MotionEvent event) {
+ public boolean dispatchHoverEvent(final MotionEvent event) {
if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
final PointerTracker tracker = PointerTracker.getPointerTracker(0, this);
return AccessibleKeyboardViewProxy.getInstance().dispatchHoverEvent(event, tracker);
@@ -829,7 +846,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
return false;
}
- public void updateShortcutKey(boolean available) {
+ public void updateShortcutKey(final boolean available) {
final Keyboard keyboard = getKeyboard();
if (keyboard == null) return;
final Key shortcutKey = keyboard.getKey(Keyboard.CODE_SHORTCUT);
@@ -846,8 +863,8 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
}
- public void startDisplayLanguageOnSpacebar(boolean subtypeChanged,
- boolean needsToDisplayLanguage, boolean hasMultipleEnabledIMEsOrSubtypes) {
+ public void startDisplayLanguageOnSpacebar(final boolean subtypeChanged,
+ final boolean needsToDisplayLanguage, final boolean hasMultipleEnabledIMEsOrSubtypes) {
mNeedsToDisplayLanguage = needsToDisplayLanguage;
mHasMultipleEnabledIMEsOrSubtypes = hasMultipleEnabledIMEsOrSubtypes;
final ObjectAnimator animator = mLanguageOnSpacebarFadeoutAnimator;
@@ -869,14 +886,15 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
invalidateKey(mSpaceKey);
}
- public void updateAutoCorrectionState(boolean isAutoCorrection) {
+ public void updateAutoCorrectionState(final boolean isAutoCorrection) {
if (!mAutoCorrectionSpacebarLedEnabled) return;
mAutoCorrectionSpacebarLedOn = isAutoCorrection;
invalidateKey(mSpaceKey);
}
@Override
- protected void onDrawKeyTopVisuals(Key key, Canvas canvas, Paint paint, KeyDrawParams params) {
+ protected void onDrawKeyTopVisuals(final Key key, final Canvas canvas, final Paint paint,
+ final KeyDrawParams params) {
if (key.altCodeWhileTyping() && key.isEnabled()) {
params.mAnimAlpha = mAltCodeKeyWhileTypingAnimAlpha;
}
@@ -894,7 +912,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
}
- private boolean fitsTextIntoWidth(final int width, String text, Paint paint) {
+ private boolean fitsTextIntoWidth(final int width, final String text, final Paint paint) {
paint.setTextScaleX(1.0f);
final float textWidth = getLabelWidth(text, paint);
if (textWidth < width) return true;
@@ -907,7 +925,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
// Layout language name on spacebar.
- private String layoutLanguageOnSpacebar(Paint paint, InputMethodSubtype subtype,
+ private String layoutLanguageOnSpacebar(final Paint paint, final InputMethodSubtype subtype,
final int width) {
// Choose appropriate language name to fit into the width.
String text = getFullDisplayName(subtype, getResources());
@@ -928,7 +946,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
return "";
}
- private void drawSpacebar(Key key, Canvas canvas, Paint paint) {
+ private void drawSpacebar(final Key key, final Canvas canvas, final Paint paint) {
final int width = key.mWidth;
final int height = key.mHeight;
@@ -983,7 +1001,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
// zz azerty T AZERTY AZERTY
// Get InputMethodSubtype's full display name in its locale.
- static String getFullDisplayName(InputMethodSubtype subtype, Resources res) {
+ static String getFullDisplayName(final InputMethodSubtype subtype, final Resources res) {
if (SubtypeLocale.isNoLanguage(subtype)) {
return SubtypeLocale.getKeyboardLayoutSetDisplayName(subtype);
}
@@ -992,7 +1010,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
// Get InputMethodSubtype's short display name in its locale.
- static String getShortDisplayName(InputMethodSubtype subtype) {
+ static String getShortDisplayName(final InputMethodSubtype subtype) {
if (SubtypeLocale.isNoLanguage(subtype)) {
return "";
}
@@ -1001,7 +1019,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
// Get InputMethodSubtype's middle display name in its locale.
- static String getMiddleDisplayName(InputMethodSubtype subtype) {
+ static String getMiddleDisplayName(final InputMethodSubtype subtype) {
if (SubtypeLocale.isNoLanguage(subtype)) {
return SubtypeLocale.getKeyboardLayoutSetDisplayName(subtype);
}
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
index 51b157c28..c9af888f9 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
@@ -311,9 +311,8 @@ public class MoreKeysKeyboard extends Keyboard {
.getDimension(R.dimen.more_keys_keyboard_key_horizontal_padding)
+ (parentKey.hasLabelsInMoreKeys() ? minKeyWidth * LABEL_PADDING_RATIO : 0));
final Paint paint = view.newDefaultLabelPaint();
- paint.setTextSize(parentKey.hasLabelsInMoreKeys()
- ? view.mKeyDrawParams.mKeyLabelSize
- : view.mKeyDrawParams.mKeyLetterSize);
+ paint.setTypeface(parentKey.selectTypeface(view.mKeyDrawParams));
+ paint.setTextSize(parentKey.selectMoreKeyTextSize(view.mKeyDrawParams));
int maxWidth = minKeyWidth;
for (final MoreKeySpec spec : parentKey.mMoreKeys) {
final String label = spec.mLabel;
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java
index 971020bab..203bab6ff 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java
@@ -16,125 +16,100 @@
package com.android.inputmethod.keyboard.internal;
-import android.content.res.TypedArray;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Rect;
import android.graphics.Typeface;
-import android.graphics.drawable.Drawable;
-import com.android.inputmethod.keyboard.Keyboard;
-import com.android.inputmethod.latin.Constants;
-import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResourceUtils;
public class KeyDrawParams {
- // XML attributes
- public final int mKeyTextColor;
- public final int mKeyTextInactivatedColor;
- public final float mKeyLabelHorizontalPadding;
- public final float mKeyHintLetterPadding;
- public final float mKeyPopupHintLetterPadding;
- public final float mKeyShiftedLetterHintPadding;
- public final int mKeyTextShadowColor;
- public final float mKeyTextShadowRadius;
- public final Drawable mKeyBackground;
- public final int mKeyHintLetterColor;
- public final int mKeyHintLabelColor;
- public final int mKeyShiftedLetterHintInactivatedColor;
- public final int mKeyShiftedLetterHintActivatedColor;
-
- private final Typeface mKeyTypefaceFromKeyboardView;
- private final float mKeyLetterRatio;
- private final int mKeyLetterSizeFromKeyboardView;
- private final float mKeyLargeLetterRatio;
- private final float mKeyLabelRatio;
- private final float mKeyLargeLabelRatio;
- private final float mKeyHintLetterRatio;
- private final float mKeyShiftedLetterHintRatio;
- private final float mKeyHintLabelRatio;
-
- public final Rect mPadding = new Rect();
- public Typeface mKeyTypeface;
- public int mKeyLetterSize;
- public int mKeyLargeLetterSize;
- public int mKeyLabelSize;
- public int mKeyLargeLabelSize;
- public int mKeyHintLetterSize;
- public int mKeyShiftedLetterHintSize;
- public int mKeyHintLabelSize;
+ public Typeface mTypeface;
+
+ public int mLetterSize;
+ public int mLabelSize;
+ public int mLargeLetterSize;
+ public int mLargeLabelSize;
+ public int mHintLetterSize;
+ public int mShiftedLetterHintSize;
+ public int mHintLabelSize;
+ public int mPreviewTextSize;
+
+ public int mTextColor;
+ public int mTextInactivatedColor;
+ public int mTextShadowColor;
+ public int mHintLetterColor;
+ public int mHintLabelColor;
+ public int mShiftedLetterHintInactivatedColor;
+ public int mShiftedLetterHintActivatedColor;
+ public int mPreviewTextColor;
+
public int mAnimAlpha;
- public KeyDrawParams(final TypedArray keyboardViewAttr, final TypedArray keyAttr) {
- mKeyBackground = keyboardViewAttr.getDrawable(R.styleable.KeyboardView_keyBackground);
- mKeyBackground.getPadding(mPadding);
-
- mKeyLetterRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyLetterSize);
- mKeyLetterSizeFromKeyboardView = ResourceUtils.getDimensionPixelSize(keyAttr,
- R.styleable.Keyboard_Key_keyLetterSize);
- mKeyLabelRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyLabelSize);
- mKeyLabelSize = ResourceUtils.getDimensionPixelSize(keyAttr,
- R.styleable.Keyboard_Key_keyLabelSize);
- mKeyLargeLabelRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyLargeLabelRatio);
- mKeyLargeLetterRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyLargeLetterRatio);
- mKeyHintLetterRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyHintLetterRatio);
- mKeyShiftedLetterHintRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyShiftedLetterHintRatio);
- mKeyHintLabelRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyHintLabelRatio);
- mKeyLabelHorizontalPadding = keyAttr.getDimension(
- R.styleable.Keyboard_Key_keyLabelHorizontalPadding, 0);
- mKeyHintLetterPadding = keyAttr.getDimension(
- R.styleable.Keyboard_Key_keyHintLetterPadding, 0);
- mKeyPopupHintLetterPadding = keyAttr.getDimension(
- R.styleable.Keyboard_Key_keyPopupHintLetterPadding, 0);
- mKeyShiftedLetterHintPadding = keyAttr.getDimension(
- R.styleable.Keyboard_Key_keyShiftedLetterHintPadding, 0);
- mKeyTextColor = keyAttr.getColor(
- R.styleable.Keyboard_Key_keyTextColor, Color.WHITE);
- mKeyTextInactivatedColor = keyAttr.getColor(
- R.styleable.Keyboard_Key_keyTextInactivatedColor, Color.WHITE);
- mKeyHintLetterColor = keyAttr.getColor(
- R.styleable.Keyboard_Key_keyHintLetterColor, Color.TRANSPARENT);
- mKeyHintLabelColor = keyAttr.getColor(
- R.styleable.Keyboard_Key_keyHintLabelColor, Color.TRANSPARENT);
- mKeyShiftedLetterHintInactivatedColor = keyAttr.getColor(
- R.styleable.Keyboard_Key_keyShiftedLetterHintInactivatedColor, Color.TRANSPARENT);
- mKeyShiftedLetterHintActivatedColor = keyAttr.getColor(
- R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor, Color.TRANSPARENT);
- mKeyTypefaceFromKeyboardView = Typeface.defaultFromStyle(
- keyAttr.getInt(R.styleable.Keyboard_Key_keyTypeface, Typeface.NORMAL));
- mKeyTextShadowColor = keyAttr.getColor(
- R.styleable.Keyboard_Key_keyTextShadowColor, Color.TRANSPARENT);
- mKeyTextShadowRadius = keyAttr.getFloat(
- R.styleable.Keyboard_Key_keyTextShadowRadius, 0f);
+ public KeyDrawParams() {}
+
+ private KeyDrawParams(final KeyDrawParams copyFrom) {
+ mTypeface = copyFrom.mTypeface;
+
+ mLetterSize = copyFrom.mLetterSize;
+ mLabelSize = copyFrom.mLabelSize;
+ mLargeLetterSize = copyFrom.mLargeLetterSize;
+ mLargeLabelSize = copyFrom.mLargeLabelSize;
+ mHintLetterSize = copyFrom.mHintLetterSize;
+ mShiftedLetterHintSize = copyFrom.mShiftedLetterHintSize;
+ mHintLabelSize = copyFrom.mHintLabelSize;
+ mPreviewTextSize = copyFrom.mPreviewTextSize;
+
+ mTextColor = copyFrom.mTextColor;
+ mTextInactivatedColor = copyFrom.mTextInactivatedColor;
+ mTextShadowColor = copyFrom.mTextShadowColor;
+ mHintLetterColor = copyFrom.mHintLetterColor;
+ mHintLabelColor = copyFrom.mHintLabelColor;
+ mShiftedLetterHintInactivatedColor = copyFrom.mShiftedLetterHintInactivatedColor;
+ mShiftedLetterHintActivatedColor = copyFrom.mShiftedLetterHintActivatedColor;
+ mPreviewTextColor = copyFrom.mPreviewTextColor;
+
+ mAnimAlpha = copyFrom.mAnimAlpha;
+ }
+
+ public void updateParams(final int keyHeight, final KeyVisualAttributes attr) {
+ if (attr == null) {
+ return;
+ }
+
+ if (attr.mTypeface != null) {
+ mTypeface = attr.mTypeface;
+ }
+
+ mLetterSize = selectTextSizeFromDimensionOrRatio(keyHeight,
+ attr.mLetterSize, attr.mLetterRatio, mLetterSize);
+ mLabelSize = selectTextSizeFromDimensionOrRatio(keyHeight,
+ attr.mLabelSize, attr.mLabelRatio, mLabelSize);
+ mLargeLabelSize = selectTextSize(keyHeight, attr.mLargeLabelRatio, mLargeLabelSize);
+ mLargeLetterSize = selectTextSize(keyHeight, attr.mLargeLetterRatio, mLargeLetterSize);
+ mHintLetterSize = selectTextSize(keyHeight, attr.mHintLetterRatio, mHintLetterSize);
+ mShiftedLetterHintSize = selectTextSize(keyHeight,
+ attr.mShiftedLetterHintRatio, mShiftedLetterHintSize);
+ mHintLabelSize = selectTextSize(keyHeight, attr.mHintLabelRatio, mHintLabelSize);
+ mPreviewTextSize = selectTextSize(keyHeight, attr.mPreviewTextRatio, mPreviewTextSize);
+
+ mTextColor = selectColor(attr.mTextColor, mTextColor);
+ mTextInactivatedColor = selectColor(attr.mTextInactivatedColor, mTextInactivatedColor);
+ mTextShadowColor = selectColor(attr.mTextShadowColor, mTextShadowColor);
+ mHintLetterColor = selectColor(attr.mHintLetterColor, mHintLetterColor);
+ mHintLabelColor = selectColor(attr.mHintLabelColor, mHintLabelColor);
+ mShiftedLetterHintInactivatedColor = selectColor(
+ attr.mShiftedLetterHintInactivatedColor, mShiftedLetterHintInactivatedColor);
+ mShiftedLetterHintActivatedColor = selectColor(
+ attr.mShiftedLetterHintActivatedColor, mShiftedLetterHintActivatedColor);
+ mPreviewTextColor = selectColor(attr.mPreviewTextColor, mPreviewTextColor);
}
- public void updateParams(final Keyboard keyboard) {
- mKeyTypeface = (keyboard.mKeyTypeface != null)
- ? keyboard.mKeyTypeface : mKeyTypefaceFromKeyboardView;
- final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap;
- mKeyLetterSize = selectTextSizeFromDimensionOrRatio(keyHeight,
- mKeyLetterSizeFromKeyboardView, mKeyLetterRatio,
- mKeyLetterSizeFromKeyboardView);
- // Override if size/ratio is specified in Keyboard.
- mKeyLetterSize = selectTextSizeFromDimensionOrRatio(keyHeight, keyboard.mKeyLetterSize,
- keyboard.mKeyLetterRatio, mKeyLetterSize);
- if (ResourceUtils.isValidFraction(mKeyLabelRatio)) {
- mKeyLabelSize = (int)(keyHeight * mKeyLabelRatio);
+ public KeyDrawParams mayCloneAndUpdateParams(final int keyHeight,
+ final KeyVisualAttributes attr) {
+ if (attr == null) {
+ return this;
}
- mKeyLargeLabelSize = (int)(keyHeight * mKeyLargeLabelRatio);
- mKeyLargeLetterSize = (int)(keyHeight * mKeyLargeLetterRatio);
- mKeyHintLetterSize = selectTextSizeFromKeyboardOrView(keyHeight,
- keyboard.mKeyHintLetterRatio, mKeyHintLetterRatio);
- mKeyShiftedLetterHintSize = selectTextSizeFromKeyboardOrView(keyHeight,
- keyboard.mKeyShiftedLetterHintRatio, mKeyShiftedLetterHintRatio);
- mKeyHintLabelSize = (int)(keyHeight * mKeyHintLabelRatio);
+ final KeyDrawParams newParams = new KeyDrawParams(this);
+ newParams.updateParams(keyHeight, attr);
+ return newParams;
}
private static final int selectTextSizeFromDimensionOrRatio(final int keyHeight,
@@ -148,16 +123,18 @@ public class KeyDrawParams {
return defaultDimens;
}
- private static final int selectTextSizeFromKeyboardOrView(final int keyHeight,
- final float ratioFromKeyboard, final float ratioFromView) {
- final float ratio = ResourceUtils.isValidFraction(ratioFromKeyboard)
- ? ratioFromKeyboard : ratioFromView;
- return (int)(keyHeight * ratio);
+ private static final int selectTextSize(final int keyHeight, final float ratio,
+ final int defaultSize) {
+ if (ResourceUtils.isValidFraction(ratio)) {
+ return (int)(keyHeight * ratio);
+ }
+ return defaultSize;
}
- public void blendAlpha(final Paint paint) {
- final int color = paint.getColor();
- paint.setARGB((paint.getAlpha() * mAnimAlpha) / Constants.Color.ALPHA_OPAQUE,
- Color.red(color), Color.green(color), Color.blue(color));
+ private static final int selectColor(final int attrColor, final int defaultColor) {
+ if (attrColor != 0) {
+ return attrColor;
+ }
+ return defaultColor;
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewDrawParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewDrawParams.java
index a3a38507f..996a722c0 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewDrawParams.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewDrawParams.java
@@ -16,26 +16,7 @@
package com.android.inputmethod.keyboard.internal;
-import android.content.res.TypedArray;
-import android.graphics.Typeface;
-import android.graphics.drawable.Drawable;
-
-import com.android.inputmethod.keyboard.Keyboard;
-import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.ResourceUtils;
-
public class KeyPreviewDrawParams {
- // XML attributes.
- public final Drawable mPreviewBackground;
- public final Drawable mPreviewLeftBackground;
- public final Drawable mPreviewRightBackground;
- public final int mPreviewTextColor;
- public final int mPreviewOffset;
- public final int mPreviewHeight;
- public final int mLingerTimeout;
-
- private final float mPreviewTextRatio;
-
// The graphical geometry of the key preview.
// <-width->
// +-------+ ^
@@ -61,46 +42,5 @@ public class KeyPreviewDrawParams {
// preview background.
public int mPreviewVisibleOffset;
- public Typeface mKeyTypeface;
- public int mPreviewTextSize;
- public int mKeyLetterSize;
public final int[] mCoordinates = new int[2];
-
- private static final int PREVIEW_ALPHA = 240;
-
- public KeyPreviewDrawParams(final TypedArray keyboardViewAttr, final TypedArray keyAttr) {
- mPreviewBackground = keyboardViewAttr.getDrawable(
- R.styleable.KeyboardView_keyPreviewBackground);
- mPreviewLeftBackground = keyboardViewAttr.getDrawable(
- R.styleable.KeyboardView_keyPreviewLeftBackground);
- mPreviewRightBackground = keyboardViewAttr.getDrawable(
- R.styleable.KeyboardView_keyPreviewRightBackground);
- setAlpha(mPreviewBackground, PREVIEW_ALPHA);
- setAlpha(mPreviewLeftBackground, PREVIEW_ALPHA);
- setAlpha(mPreviewRightBackground, PREVIEW_ALPHA);
- mPreviewOffset = keyboardViewAttr.getDimensionPixelOffset(
- R.styleable.KeyboardView_keyPreviewOffset, 0);
- mPreviewHeight = keyboardViewAttr.getDimensionPixelSize(
- R.styleable.KeyboardView_keyPreviewHeight, 80);
- mLingerTimeout = keyboardViewAttr.getInt(
- R.styleable.KeyboardView_keyPreviewLingerTimeout, 0);
-
- mPreviewTextRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyPreviewTextRatio);
- mPreviewTextColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyPreviewTextColor, 0);
- }
-
- public void updateParams(final Keyboard keyboard, final KeyDrawParams keyDrawParams) {
- final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap;
- if (ResourceUtils.isValidFraction(mPreviewTextRatio)) {
- mPreviewTextSize = (int)(keyHeight * mPreviewTextRatio);
- }
- mKeyLetterSize = keyDrawParams.mKeyLetterSize;
- mKeyTypeface = keyDrawParams.mKeyTypeface;
- }
-
- private static void setAlpha(final Drawable drawable, final int alpha) {
- if (drawable == null) return;
- drawable.setAlpha(alpha);
- }
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java b/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java
new file mode 100644
index 000000000..04cc152fe
--- /dev/null
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.keyboard.internal;
+
+import android.content.res.TypedArray;
+import android.graphics.Typeface;
+import android.util.SparseIntArray;
+
+import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.ResourceUtils;
+
+public class KeyVisualAttributes {
+ public final Typeface mTypeface;
+
+ public final float mLetterRatio;
+ public final int mLetterSize;
+ public final float mLabelRatio;
+ public final int mLabelSize;
+ public final float mLargeLetterRatio;
+ public final float mLargeLabelRatio;
+ public final float mHintLetterRatio;
+ public final float mShiftedLetterHintRatio;
+ public final float mHintLabelRatio;
+ public final float mPreviewTextRatio;
+
+ public final int mTextColor;
+ public final int mTextInactivatedColor;
+ public final int mTextShadowColor;
+ public final int mHintLetterColor;
+ public final int mHintLabelColor;
+ public final int mShiftedLetterHintInactivatedColor;
+ public final int mShiftedLetterHintActivatedColor;
+ public final int mPreviewTextColor;
+
+ private static final int[] VISUAL_ATTRIBUTE_IDS = {
+ R.styleable.Keyboard_Key_keyTypeface,
+ R.styleable.Keyboard_Key_keyLetterSize,
+ R.styleable.Keyboard_Key_keyLabelSize,
+ R.styleable.Keyboard_Key_keyLargeLetterRatio,
+ R.styleable.Keyboard_Key_keyLargeLabelRatio,
+ R.styleable.Keyboard_Key_keyHintLetterRatio,
+ R.styleable.Keyboard_Key_keyShiftedLetterHintRatio,
+ R.styleable.Keyboard_Key_keyHintLabelRatio,
+ R.styleable.Keyboard_Key_keyPreviewTextRatio,
+ R.styleable.Keyboard_Key_keyTextColor,
+ R.styleable.Keyboard_Key_keyTextInactivatedColor,
+ R.styleable.Keyboard_Key_keyTextShadowColor,
+ R.styleable.Keyboard_Key_keyHintLetterColor,
+ R.styleable.Keyboard_Key_keyHintLabelColor,
+ R.styleable.Keyboard_Key_keyShiftedLetterHintInactivatedColor,
+ R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor,
+ R.styleable.Keyboard_Key_keyPreviewTextColor,
+ };
+ private static final SparseIntArray sVisualAttributeIds = new SparseIntArray();
+ private static final int ATTR_DEFINED = 1;
+ private static final int ATTR_NOT_FOUND = 0;
+ static {
+ for (final int attrId : VISUAL_ATTRIBUTE_IDS) {
+ sVisualAttributeIds.put(attrId, ATTR_DEFINED);
+ }
+ }
+
+ public static KeyVisualAttributes newInstance(final TypedArray keyAttr) {
+ final int indexCount = keyAttr.getIndexCount();
+ for (int i = 0; i < indexCount; i++) {
+ final int attrId = keyAttr.getIndex(i);
+ if (sVisualAttributeIds.get(attrId, ATTR_NOT_FOUND) == ATTR_NOT_FOUND) {
+ continue;
+ }
+ return new KeyVisualAttributes(keyAttr);
+ }
+ return null;
+ }
+
+ private KeyVisualAttributes(final TypedArray keyAttr) {
+ if (keyAttr.hasValue(R.styleable.Keyboard_Key_keyTypeface)) {
+ mTypeface = Typeface.defaultFromStyle(
+ keyAttr.getInt(R.styleable.Keyboard_Key_keyTypeface, Typeface.NORMAL));
+ } else {
+ mTypeface = null;
+ }
+
+ mLetterRatio = ResourceUtils.getFraction(keyAttr,
+ R.styleable.Keyboard_Key_keyLetterSize);
+ mLetterSize = ResourceUtils.getDimensionPixelSize(keyAttr,
+ R.styleable.Keyboard_Key_keyLetterSize);
+ mLabelRatio = ResourceUtils.getFraction(keyAttr,
+ R.styleable.Keyboard_Key_keyLabelSize);
+ mLabelSize = ResourceUtils.getDimensionPixelSize(keyAttr,
+ R.styleable.Keyboard_Key_keyLabelSize);
+ mLargeLetterRatio = ResourceUtils.getFraction(keyAttr,
+ R.styleable.Keyboard_Key_keyLargeLetterRatio);
+ mLargeLabelRatio = ResourceUtils.getFraction(keyAttr,
+ R.styleable.Keyboard_Key_keyLargeLabelRatio);
+ mHintLetterRatio = ResourceUtils.getFraction(keyAttr,
+ R.styleable.Keyboard_Key_keyHintLetterRatio);
+ mShiftedLetterHintRatio = ResourceUtils.getFraction(keyAttr,
+ R.styleable.Keyboard_Key_keyShiftedLetterHintRatio);
+ mHintLabelRatio = ResourceUtils.getFraction(keyAttr,
+ R.styleable.Keyboard_Key_keyHintLabelRatio);
+ mPreviewTextRatio = ResourceUtils.getFraction(keyAttr,
+ R.styleable.Keyboard_Key_keyPreviewTextRatio);
+
+ mTextColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyTextColor, 0);
+ mTextInactivatedColor = keyAttr.getColor(
+ R.styleable.Keyboard_Key_keyTextInactivatedColor, 0);
+ mTextShadowColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyTextShadowColor, 0);
+ mHintLetterColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyHintLetterColor, 0);
+ mHintLabelColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyHintLabelColor, 0);
+ mShiftedLetterHintInactivatedColor = keyAttr.getColor(
+ R.styleable.Keyboard_Key_keyShiftedLetterHintInactivatedColor, 0);
+ mShiftedLetterHintActivatedColor = keyAttr.getColor(
+ R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor, 0);
+ mPreviewTextColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyPreviewTextColor, 0);
+ }
+}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
index 3d1045f88..31c7cb565 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java
@@ -20,7 +20,6 @@ import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
-import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -289,18 +288,7 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
R.styleable.Keyboard_rowHeight, params.mBaseHeight,
params.mBaseHeight / DEFAULT_KEYBOARD_ROWS);
- if (keyAttr.hasValue(R.styleable.Keyboard_Key_keyTypeface)) {
- params.mKeyTypeface = Typeface.defaultFromStyle(keyAttr.getInt(
- R.styleable.Keyboard_Key_keyTypeface, Typeface.NORMAL));
- }
- params.mKeyLetterRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyLetterSize);
- params.mKeyLetterSize = ResourceUtils.getDimensionPixelSize(keyAttr,
- R.styleable.Keyboard_Key_keyLetterSize);
- params.mKeyHintLetterRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyHintLetterRatio);
- params.mKeyShiftedLetterHintRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyShiftedLetterHintRatio);
+ params.mKeyVisualAttributes = KeyVisualAttributes.newInstance(keyAttr);
params.mMoreKeysTemplate = keyboardAttr.getResourceId(
R.styleable.Keyboard_moreKeysTemplate, 0);
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
index ff5d31528..ab5d31d42 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
@@ -16,14 +16,12 @@
package com.android.inputmethod.keyboard.internal;
-import android.graphics.Typeface;
import android.util.SparseIntArray;
import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.latin.CollectionUtils;
-import com.android.inputmethod.latin.ResourceUtils;
import java.util.ArrayList;
import java.util.HashSet;
@@ -47,11 +45,7 @@ public class KeyboardParams {
public int mHorizontalEdgesPadding;
public int mHorizontalCenterPadding;
- public Typeface mKeyTypeface = null;
- public float mKeyLetterRatio = ResourceUtils.UNDEFINED_RATIO;
- public int mKeyLetterSize = ResourceUtils.UNDEFINED_DIMENSION;
- public float mKeyHintLetterRatio = ResourceUtils.UNDEFINED_RATIO;
- public float mKeyShiftedLetterHintRatio = ResourceUtils.UNDEFINED_RATIO;
+ public KeyVisualAttributes mKeyVisualAttributes;
public int mDefaultRowHeight;
public int mDefaultKeyWidth;
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
index a608cdef0..3b7c6ad7a 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
@@ -210,22 +210,29 @@ public final class KeyboardTextsSet {
/* 103 */ "keylabel_for_apostrophe",
/* 104 */ "keyhintlabel_for_apostrophe",
/* 105 */ "more_keys_for_apostrophe",
- /* 106 */ "more_keys_for_am_pm",
- /* 107 */ "settings_as_more_key",
- /* 108 */ "shortcut_as_more_key",
- /* 109 */ "action_next_as_more_key",
- /* 110 */ "action_previous_as_more_key",
- /* 111 */ "label_to_more_symbol_key",
- /* 112 */ "label_to_more_symbol_for_tablet_key",
- /* 113 */ "label_tab_key",
- /* 114 */ "label_to_phone_numeric_key",
- /* 115 */ "label_to_phone_symbols_key",
- /* 116 */ "label_time_am",
- /* 117 */ "label_time_pm",
- /* 118 */ "label_to_symbol_key_pcqwerty",
- /* 119 */ "keylabel_for_popular_domain",
- /* 120 */ "more_keys_for_popular_domain",
- /* 121 */ "more_keys_for_smiley",
+ /* 106 */ "more_keys_for_q",
+ /* 107 */ "more_keys_for_x",
+ /* 108 */ "keylabel_for_q",
+ /* 109 */ "keylabel_for_w",
+ /* 110 */ "keylabel_for_y",
+ /* 111 */ "keylabel_for_x",
+ /* 112 */ "keylabel_for_spanish_row2_10",
+ /* 113 */ "more_keys_for_am_pm",
+ /* 114 */ "settings_as_more_key",
+ /* 115 */ "shortcut_as_more_key",
+ /* 116 */ "action_next_as_more_key",
+ /* 117 */ "action_previous_as_more_key",
+ /* 118 */ "label_to_more_symbol_key",
+ /* 119 */ "label_to_more_symbol_for_tablet_key",
+ /* 120 */ "label_tab_key",
+ /* 121 */ "label_to_phone_numeric_key",
+ /* 122 */ "label_to_phone_symbols_key",
+ /* 123 */ "label_time_am",
+ /* 124 */ "label_time_pm",
+ /* 125 */ "label_to_symbol_key_pcqwerty",
+ /* 126 */ "keylabel_for_popular_domain",
+ /* 127 */ "more_keys_for_popular_domain",
+ /* 128 */ "more_keys_for_smiley",
};
private static final String EMPTY = "";
@@ -348,33 +355,41 @@ public final class KeyboardTextsSet {
/* 103 */ "\'",
/* 104 */ "\"",
/* 105 */ "\"",
- /* 106 */ "!fixedColumnOrder!2,!hasLabels!,!text/label_time_am,!text/label_time_pm",
- /* 107 */ "!icon/settings_key|!code/key_settings",
- /* 108 */ "!icon/shortcut_key|!code/key_shortcut",
- /* 109 */ "!hasLabels!,!text/label_next_key|!code/key_action_next",
- /* 110 */ "!hasLabels!,!text/label_previous_key|!code/key_action_previous",
+ /* 106 */ EMPTY,
+ /* 107 */ EMPTY,
+ /* 108 */ "q",
+ /* 109 */ "w",
+ /* 110 */ "y",
+ /* 111 */ "x",
+ // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
+ /* 112 */ "\u00F1",
+ /* 113 */ "!fixedColumnOrder!2,!hasLabels!,!text/label_time_am,!text/label_time_pm",
+ /* 114 */ "!icon/settings_key|!code/key_settings",
+ /* 115 */ "!icon/shortcut_key|!code/key_shortcut",
+ /* 116 */ "!hasLabels!,!text/label_next_key|!code/key_action_next",
+ /* 117 */ "!hasLabels!,!text/label_previous_key|!code/key_action_previous",
// Label for "switch to more symbol" modifier key. Must be short to fit on key!
- /* 111 */ "= \\ <",
+ /* 118 */ "= \\ <",
// Label for "switch to more symbol" modifier key on tablets. Must be short to fit on key!
- /* 112 */ "~ \\ {",
+ /* 119 */ "~ \\ {",
// Label for "Tab" key. Must be short to fit on key!
- /* 113 */ "Tab",
+ /* 120 */ "Tab",
// Label for "switch to phone numeric" key. Must be short to fit on key!
- /* 114 */ "123",
+ /* 121 */ "123",
// Label for "switch to phone symbols" key. Must be short to fit on key!
// U+FF0A: "*" FULLWIDTH ASTERISK
// U+FF03: "#" FULLWIDTH NUMBER SIGN
- /* 115 */ "\uFF0A\uFF03",
+ /* 122 */ "\uFF0A\uFF03",
// Key label for "ante meridiem"
- /* 116 */ "AM",
+ /* 123 */ "AM",
// Key label for "post meridiem"
- /* 117 */ "PM",
+ /* 124 */ "PM",
// Label for "switch to symbols" key on PC QWERTY layout
- /* 118 */ "Sym",
- /* 119 */ ".com",
+ /* 125 */ "Sym",
+ /* 126 */ ".com",
// popular web domains for the locale - most popular, displayed on the keyboard
- /* 120 */ "!hasLabels!,.net,.org,.gov,.edu",
- /* 121 */ "!fixedColumnOrder!5,!hasLabels!,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ ",
+ /* 127 */ "!hasLabels!,.net,.org,.gov,.edu",
+ /* 128 */ "!fixedColumnOrder!5,!hasLabels!,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ ",
};
/* Language af: Afrikaans */
@@ -857,6 +872,144 @@ public final class KeyboardTextsSet {
/* 7 */ "\u00E7",
};
+ /* Language eo: Esperanto */
+ private static final String[] LANGUAGE_eo = {
+ // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
+ // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
+ // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
+ // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
+ // U+00E6: "æ" LATIN SMALL LETTER AE
+ // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
+ // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
+ // U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
+ // U+0103: "ă" LATIN SMALL LETTER A WITH BREVE
+ // U+0105: "ą" LATIN SMALL LETTER A WITH OGONEK
+ // U+00AA: "ª" FEMININE ORDINAL INDICATOR
+ /* 0 */ "\u00E1,\u00E0,\u00E2,\u00E4,\u00E6,\u00E3,\u00E5,\u0101,\u0103,\u0105,\u00AA",
+ // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+ // U+011B: "ě" LATIN SMALL LETTER E WITH CARON
+ // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
+ // U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
+ // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
+ // U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
+ // U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE
+ // U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
+ /* 1 */ "\u00E9,\u011B,\u00E8,\u00EA,\u00EB,\u0119,\u0117,\u0113",
+ // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+ // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+ // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
+ // U+0129: "ĩ" LATIN SMALL LETTER I WITH TILDE
+ // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
+ // U+012F: "į" LATIN SMALL LETTER I WITH OGONEK
+ // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
+ // U+0131: "ı" LATIN SMALL LETTER DOTLESS I
+ // U+0133: "ij" LATIN SMALL LIGATURE IJ
+ /* 2 */ "\u00ED,\u00EE,\u00EF,\u0129,\u00EC,\u012F,\u012B,\u0131,\u0133",
+ // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+ // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
+ // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
+ // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
+ // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
+ // U+0153: "œ" LATIN SMALL LIGATURE OE
+ // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
+ // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
+ // U+0151: "ő" LATIN SMALL LETTER O WITH DOUBLE ACUTE
+ // U+00BA: "º" MASCULINE ORDINAL INDICATOR
+ /* 3 */ "\u00F3,\u00F6,\u00F4,\u00F2,\u00F5,\u0153,\u00F8,\u014D,\u0151,\u00BA",
+ // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+ // U+016F: "ů" LATIN SMALL LETTER U WITH RING ABOVE
+ // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
+ // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
+ // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
+ // U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
+ // U+0169: "ũ" LATIN SMALL LETTER U WITH TILDE
+ // U+0171: "ű" LATIN SMALL LETTER U WITH DOUBLE ACUTE
+ // U+0173: "ų" LATIN SMALL LETTER U WITH OGONEK
+ // U+00B5: "µ" MICRO SIGN
+ /* 4 */ "\u00FA,\u016F,\u00FB,\u00FC,\u00F9,\u016B,\u0169,\u0171,\u0173,\u00B5",
+ // U+00DF: "ß" LATIN SMALL LETTER SHARP S
+ // U+0161: "š" LATIN SMALL LETTER S WITH CARON
+ // U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
+ // U+0219: "ș" LATIN SMALL LETTER S WITH COMMA BELOW
+ // U+015F: "ş" LATIN SMALL LETTER S WITH CEDILLA
+ /* 5 */ "\u00DF,\u0161,\u015B,\u0219,\u015F",
+ // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
+ // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
+ // U+0146: "ņ" LATIN SMALL LETTER N WITH CEDILLA
+ // U+0148: "ň" LATIN SMALL LETTER N WITH CARON
+ // U+0149: "ʼn" LATIN SMALL LETTER N PRECEDED BY APOSTROPHE
+ // U+014B: "ŋ" LATIN SMALL LETTER ENG
+ /* 6 */ "\u00F1,\u0144,\u0146,\u0148,\u0149,\u014B",
+ // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
+ // U+010D: "č" LATIN SMALL LETTER C WITH CARON
+ // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA
+ // U+010B: "ċ" LATIN SMALL LETTER C WITH DOT ABOVE
+ /* 7 */ "\u0107,\u010D,\u00E7,\u010B",
+ // U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE
+ // U+0177: "ŷ" LATIN SMALL LETTER Y WITH CIRCUMFLEX
+ // U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS
+ // U+00FE: "þ" LATIN SMALL LETTER THORN
+ /* 8 */ "y,\u00FD,\u0177,\u00FF,\u00FE",
+ // U+00F0: "ð" LATIN SMALL LETTER ETH
+ // U+010F: "ď" LATIN SMALL LETTER D WITH CARON
+ // U+0111: "đ" LATIN SMALL LETTER D WITH STROKE
+ /* 9 */ "\u00F0,\u010F,\u0111",
+ // U+0159: "ř" LATIN SMALL LETTER R WITH CARON
+ // U+0155: "ŕ" LATIN SMALL LETTER R WITH ACUTE
+ // U+0157: "ŗ" LATIN SMALL LETTER R WITH CEDILLA
+ /* 10 */ "\u0159,\u0155,\u0157",
+ // U+0165: "ť" LATIN SMALL LETTER T WITH CARON
+ // U+021B: "ț" LATIN SMALL LETTER T WITH COMMA BELOW
+ // U+0163: "ţ" LATIN SMALL LETTER T WITH CEDILLA
+ // U+0167: "ŧ" LATIN SMALL LETTER T WITH STROKE
+ /* 11 */ "\u0165,\u021B,\u0163,\u0167",
+ // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
+ // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
+ // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
+ /* 12 */ "\u017A,\u017C,\u017E",
+ // U+0137: "ķ" LATIN SMALL LETTER K WITH CEDILLA
+ // U+0138: "ĸ" LATIN SMALL LETTER KRA
+ /* 13 */ "\u0137,\u0138",
+ // U+013A: "ĺ" LATIN SMALL LETTER L WITH ACUTE
+ // U+013C: "ļ" LATIN SMALL LETTER L WITH CEDILLA
+ // U+013E: "ľ" LATIN SMALL LETTER L WITH CARON
+ // U+0140: "ŀ" LATIN SMALL LETTER L WITH MIDDLE DOT
+ // U+0142: "ł" LATIN SMALL LETTER L WITH STROKE
+ /* 14 */ "\u013A,\u013C,\u013E,\u0140,\u0142",
+ // U+011F: "ğ" LATIN SMALL LETTER G WITH BREVE
+ // U+0121: "ġ" LATIN SMALL LETTER G WITH DOT ABOVE
+ // U+0123: "ģ" LATIN SMALL LETTER G WITH CEDILLA
+ /* 15 */ "\u011F,\u0121,\u0123",
+ // U+0175: "ŵ" LATIN SMALL LETTER W WITH CIRCUMFLEX
+ /* 16 */ "w,\u0175",
+ // U+0125: "ĥ" LATIN SMALL LETTER H WITH CIRCUMFLEX
+ // U+0127: "ħ" LATIN SMALL LETTER H WITH STROKE
+ /* 17 */ "\u0125,\u0127",
+ /* 18 */ null,
+ // U+0175: "ŵ" LATIN SMALL LETTER W WITH CIRCUMFLEX
+ /* 19 */ "w,\u0175",
+ /* 20~ */
+ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null,
+ /* ~105 */
+ /* 106 */ "q",
+ /* 107 */ "x",
+ // U+015D: "ŝ" LATIN SMALL LETTER S WITH CIRCUMFLEX
+ /* 108 */ "\u015D",
+ // U+011D: "ĝ" LATIN SMALL LETTER G WITH CIRCUMFLEX
+ /* 109 */ "\u011D",
+ // U+016D: "ŭ" LATIN SMALL LETTER U WITH BREVE
+ /* 110 */ "\u016D",
+ // U+0109: "ĉ" LATIN SMALL LETTER C WITH CIRCUMFLEX
+ /* 111 */ "\u0109",
+ // U+0135: "ĵ" LATIN SMALL LETTER J WITH CIRCUMFLEX
+ /* 112 */ "\u0135",
+ };
+
/* Language es: Spanish */
private static final String[] LANGUAGE_es = {
// U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
@@ -2695,6 +2848,7 @@ public final class KeyboardTextsSet {
"da", LANGUAGE_da, /* Danish */
"de", LANGUAGE_de, /* German */
"en", LANGUAGE_en, /* English */
+ "eo", LANGUAGE_eo, /* Esperanto */
"es", LANGUAGE_es, /* Spanish */
"et", LANGUAGE_et, /* Estonian */
"fa", LANGUAGE_fa, /* Persian */
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
index cdf5247de..8a509be48 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
@@ -172,12 +172,12 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
// considering performance regression.
protected void addWord(final String word, final String shortcutTarget, final int frequency) {
if (shortcutTarget == null) {
- mFusionDictionary.add(word, frequency, null);
+ mFusionDictionary.add(word, frequency, null, false /* isNotAWord */);
} else {
// TODO: Do this in the subclass, with this class taking an arraylist.
final ArrayList<WeightedString> shortcutTargets = CollectionUtils.newArrayList();
shortcutTargets.add(new WeightedString(shortcutTarget, frequency));
- mFusionDictionary.add(word, frequency, shortcutTargets);
+ mFusionDictionary.add(word, frequency, shortcutTargets, false /* isNotAWord */);
}
}
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 76f495729..39c3a808f 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1309,7 +1309,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
break;
case Keyboard.CODE_RESEARCH:
if (ProductionFlag.IS_EXPERIMENTAL) {
- ResearchLogger.getInstance().presentResearchDialog(this);
+ ResearchLogger.getInstance().onResearchKeySelected(this);
}
break;
default:
diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java b/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java
new file mode 100644
index 000000000..942c82837
--- /dev/null
+++ b/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java
@@ -0,0 +1,193 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.android.inputmethod.latin;
+
+import android.util.Log;
+
+import com.android.inputmethod.latin.makedict.BinaryDictInputOutput;
+import com.android.inputmethod.latin.makedict.BinaryDictInputOutput.FusionDictionaryBufferInterface;
+import com.android.inputmethod.latin.makedict.FusionDictionary;
+import com.android.inputmethod.latin.makedict.FusionDictionary.Node;
+import com.android.inputmethod.latin.makedict.PendingAttribute;
+import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Reads and writes Binary files for a UserHistoryDictionary.
+ *
+ * All the methods in this class are static.
+ */
+public class UserHistoryDictIOUtils {
+ private static final String TAG = UserHistoryDictIOUtils.class.getSimpleName();
+ private static final boolean DEBUG = false;
+
+ public interface OnAddWordListener {
+ public void setUnigram(final String word, final String shortcutTarget, final int frequency);
+ public void setBigram(final String word1, final String word2, final int frequency);
+ }
+
+ public interface BigramDictionaryInterface {
+ public int getFrequency(final String word1, final String word2);
+ }
+
+ public static final class ByteArrayWrapper implements FusionDictionaryBufferInterface {
+ private byte[] mBuffer;
+ private int mPosition;
+
+ ByteArrayWrapper(final byte[] buffer) {
+ mBuffer = buffer;
+ mPosition = 0;
+ }
+
+ @Override
+ public int readUnsignedByte() {
+ return ((int)mBuffer[mPosition++]) & 0xFF;
+ }
+
+ @Override
+ public int readUnsignedShort() {
+ final int retval = readUnsignedByte();
+ return (retval << 8) + readUnsignedByte();
+ }
+
+ @Override
+ public int readUnsignedInt24() {
+ final int retval = readUnsignedShort();
+ return (retval << 8) + readUnsignedByte();
+ }
+
+ @Override
+ public int readInt() {
+ final int retval = readUnsignedShort();
+ return (retval << 16) + readUnsignedShort();
+ }
+
+ @Override
+ public int position() {
+ return mPosition;
+ }
+
+ @Override
+ public void position(int position) {
+ mPosition = position;
+ }
+ }
+
+ /**
+ * Writes dictionary to file.
+ */
+ public static void writeDictionaryBinary(final OutputStream destination,
+ final BigramDictionaryInterface dict, final UserHistoryDictionaryBigramList bigrams,
+ final int version) {
+
+ final FusionDictionary fusionDict = constructFusionDictionary(dict, bigrams);
+
+ try {
+ BinaryDictInputOutput.writeDictionaryBinary(destination, fusionDict, version);
+ } catch (IOException e) {
+ Log.e(TAG, "IO exception while writing file: " + e);
+ } catch (UnsupportedFormatException e) {
+ Log.e(TAG, "Unsupported fomat: " + e);
+ }
+ }
+
+ /**
+ * Constructs a new FusionDictionary from BigramDictionaryInterface.
+ */
+ /* packages for test */ static FusionDictionary constructFusionDictionary(
+ final BigramDictionaryInterface dict, final UserHistoryDictionaryBigramList bigrams) {
+
+ final FusionDictionary fusionDict = new FusionDictionary(new Node(),
+ new FusionDictionary.DictionaryOptions(
+ new HashMap<String,String>(), false, false));
+
+ for (final String word1 : bigrams.keySet()) {
+ final HashMap<String, Byte> word1Bigrams = bigrams.getBigrams(word1);
+ for (final String word2 : word1Bigrams.keySet()) {
+ final int freq = dict.getFrequency(word1, word2);
+
+ if (DEBUG) {
+ if (word1 == null) {
+ Log.d(TAG, "add unigram: " + word2 + "," + Integer.toString(freq));
+ } else {
+ Log.d(TAG, "add bigram: " + word1
+ + "," + word2 + "," + Integer.toString(freq));
+ }
+ }
+
+ if (word1 == null) { // unigram
+ fusionDict.add(word2, freq, null, false /* isNotAWord */);
+ } else { // bigram
+ fusionDict.setBigram(word1, word2, freq);
+ }
+ bigrams.updateBigram(word1, word2, (byte)freq);
+ }
+ }
+
+ return fusionDict;
+ }
+
+ /**
+ * Reads dictionary from file.
+ */
+ public static void readDictionaryBinary(final FusionDictionaryBufferInterface buffer,
+ final OnAddWordListener dict) {
+ final Map<Integer, String> unigrams = CollectionUtils.newTreeMap();
+ final Map<Integer, Integer> frequencies = CollectionUtils.newTreeMap();
+ final Map<Integer, ArrayList<PendingAttribute>> bigrams = CollectionUtils.newTreeMap();
+
+ try {
+ BinaryDictInputOutput.readUnigramsAndBigramsBinary(buffer, unigrams, frequencies,
+ bigrams);
+ addWordsFromWordMap(unigrams, frequencies, bigrams, dict);
+ } catch (IOException e) {
+ Log.e(TAG, "IO exception while reading file: " + e);
+ } catch (UnsupportedFormatException e) {
+ Log.e(TAG, "Unsupported format: " + e);
+ }
+ }
+
+ /**
+ * Adds all unigrams and bigrams in maps to OnAddWordListener.
+ */
+ /* package for test */ static void addWordsFromWordMap(final Map<Integer, String> unigrams,
+ final Map<Integer, Integer> frequencies,
+ final Map<Integer, ArrayList<PendingAttribute>> bigrams, final OnAddWordListener to) {
+
+ for (Map.Entry<Integer, String> entry : unigrams.entrySet()) {
+ final String word1 = entry.getValue();
+ final int unigramFrequency = frequencies.get(entry.getKey());
+ to.setUnigram(word1, null, unigramFrequency);
+
+ final ArrayList<PendingAttribute> attrList = bigrams.get(entry.getKey());
+
+ if (attrList != null) {
+ for (final PendingAttribute attr : attrList) {
+ to.setBigram(word1, unigrams.get(attr.mAddress),
+ BinaryDictInputOutput.reconstructBigramFrequency(unigramFrequency,
+ attr.mFrequency));
+ }
+ }
+ }
+
+ }
+} \ No newline at end of file
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
index d4f7cab5c..abc39d923 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
@@ -34,6 +34,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Stack;
import java.util.TreeMap;
/**
@@ -55,6 +56,8 @@ public class BinaryDictInputOutput {
* s | has a terminal ? 1 bit, 1 = yes, 0 = no : FLAG_IS_TERMINAL
* | has shortcut targets ? 1 bit, 1 = yes, 0 = no : FLAG_HAS_SHORTCUT_TARGETS
* | has bigrams ? 1 bit, 1 = yes, 0 = no : FLAG_HAS_BIGRAMS
+ * | is not a word ? 1 bit, 1 = yes, 0 = no : FLAG_IS_NOT_A_WORD
+ * | is blacklisted ? 1 bit, 1 = yes, 0 = no : FLAG_IS_BLACKLISTED
*
* c | IF FLAG_HAS_MULTIPLE_CHARS
* h | char, char, char, char n * (1 or 3 bytes) : use CharGroupInfo for i/o helpers
@@ -153,6 +156,8 @@ public class BinaryDictInputOutput {
private static final int FLAG_IS_TERMINAL = 0x10;
private static final int FLAG_HAS_SHORTCUT_TARGETS = 0x08;
private static final int FLAG_HAS_BIGRAMS = 0x04;
+ private static final int FLAG_IS_NOT_A_WORD = 0x02;
+ private static final int FLAG_IS_BLACKLISTED = 0x01;
private static final int FLAG_ATTRIBUTE_HAS_NEXT = 0x80;
private static final int FLAG_ATTRIBUTE_OFFSET_NEGATIVE = 0x40;
@@ -188,7 +193,7 @@ public class BinaryDictInputOutput {
// suspicion that a bug might be causing an infinite loop.
private static final int MAX_PASSES = 24;
- private interface FusionDictionaryBufferInterface {
+ public interface FusionDictionaryBufferInterface {
public int readUnsignedByte();
public int readUnsignedShort();
public int readUnsignedInt24();
@@ -197,20 +202,21 @@ public class BinaryDictInputOutput {
public void position(int newPosition);
}
- private static final class ByteBufferWrapper implements FusionDictionaryBufferInterface {
- private ByteBuffer buffer;
- ByteBufferWrapper(final ByteBuffer buffer) {
- this.buffer = buffer;
+ public static final class ByteBufferWrapper implements FusionDictionaryBufferInterface {
+ private ByteBuffer mBuffer;
+
+ public ByteBufferWrapper(final ByteBuffer buffer) {
+ mBuffer = buffer;
}
@Override
public int readUnsignedByte() {
- return ((int)buffer.get()) & 0xFF;
+ return ((int)mBuffer.get()) & 0xFF;
}
@Override
public int readUnsignedShort() {
- return ((int)buffer.getShort()) & 0xFFFF;
+ return ((int)mBuffer.getShort()) & 0xFFFF;
}
@Override
@@ -221,18 +227,17 @@ public class BinaryDictInputOutput {
@Override
public int readInt() {
- return buffer.getInt();
+ return mBuffer.getInt();
}
@Override
public int position() {
- return buffer.position();
+ return mBuffer.position();
}
@Override
public void position(int newPos) {
- buffer.position(newPos);
- return;
+ mBuffer.position(newPos);
}
}
@@ -778,6 +783,12 @@ public class BinaryDictInputOutput {
}
flags |= FLAG_HAS_BIGRAMS;
}
+ if (group.mIsNotAWord) {
+ flags |= FLAG_IS_NOT_A_WORD;
+ }
+ if (group.mIsBlacklistEntry) {
+ flags |= FLAG_IS_BLACKLISTED;
+ }
return flags;
}
@@ -1352,12 +1363,14 @@ public class BinaryDictInputOutput {
buffer.position(currentPosition);
}
nodeContents.add(
- new CharGroup(info.mCharacters, shortcutTargets,
- bigrams, info.mFrequency, children));
+ new CharGroup(info.mCharacters, shortcutTargets, bigrams, info.mFrequency,
+ 0 != (info.mFlags & FLAG_IS_NOT_A_WORD),
+ 0 != (info.mFlags & FLAG_IS_BLACKLISTED), children));
} else {
nodeContents.add(
- new CharGroup(info.mCharacters, shortcutTargets,
- bigrams, info.mFrequency));
+ new CharGroup(info.mCharacters, shortcutTargets, bigrams, info.mFrequency,
+ 0 != (info.mFlags & FLAG_IS_NOT_A_WORD),
+ 0 != (info.mFlags & FLAG_IS_BLACKLISTED)));
}
groupOffset = info.mEndAddress;
}
@@ -1367,6 +1380,105 @@ public class BinaryDictInputOutput {
return node;
}
+ // TODO: move these methods (readUnigramsAndBigramsBinary(|Inner)) and an inner class (Position)
+ // out of this class.
+ private static class Position {
+ public static final int NOT_READ_GROUPCOUNT = -1;
+
+ public int mAddress;
+ public int mNumOfCharGroup;
+ public int mPosition;
+ public int mLength;
+
+ public Position(int address, int length) {
+ mAddress = address;
+ mLength = length;
+ mNumOfCharGroup = NOT_READ_GROUPCOUNT;
+ }
+ }
+
+ /**
+ * Tours all node without recursive call.
+ */
+ private static void readUnigramsAndBigramsBinaryInner(
+ final FusionDictionaryBufferInterface buffer, final int headerSize,
+ final Map<Integer, String> words, final Map<Integer, Integer> frequencies,
+ final Map<Integer, ArrayList<PendingAttribute>> bigrams) {
+ int[] pushedChars = new int[MAX_WORD_LENGTH + 1];
+
+ Stack<Position> stack = new Stack<Position>();
+ int index = 0;
+
+ Position initPos = new Position(headerSize, 0);
+ stack.push(initPos);
+
+ while (!stack.empty()) {
+ Position p = stack.peek();
+
+ if (DBG) {
+ MakedictLog.d("read: address=" + p.mAddress + ", numOfCharGroup=" +
+ p.mNumOfCharGroup + ", position=" + p.mPosition + ", length=" + p.mLength);
+ }
+
+ if (buffer.position() != p.mAddress) buffer.position(p.mAddress);
+ if (index != p.mLength) index = p.mLength;
+
+ if (p.mNumOfCharGroup == Position.NOT_READ_GROUPCOUNT) {
+ p.mNumOfCharGroup = readCharGroupCount(buffer);
+ p.mAddress += getGroupCountSize(p.mNumOfCharGroup);
+ p.mPosition = 0;
+ }
+
+ CharGroupInfo info = readCharGroup(buffer, p.mAddress - headerSize);
+ for (int i = 0; i < info.mCharacters.length; ++i) {
+ pushedChars[index++] = info.mCharacters[i];
+ }
+ p.mPosition++;
+
+ if (info.mFrequency != FusionDictionary.CharGroup.NOT_A_TERMINAL) { // found word
+ words.put(info.mOriginalAddress, new String(pushedChars, 0, index));
+ frequencies.put(info.mOriginalAddress, info.mFrequency);
+ if (info.mBigrams != null) bigrams.put(info.mOriginalAddress, info.mBigrams);
+ }
+
+ if (p.mPosition == p.mNumOfCharGroup) {
+ stack.pop();
+ } else {
+ // the node has more groups.
+ p.mAddress = buffer.position();
+ }
+
+ if (hasChildrenAddress(info.mChildrenAddress)) {
+ Position childrenPos = new Position(info.mChildrenAddress + headerSize, index);
+ stack.push(childrenPos);
+ }
+ }
+ }
+
+ /**
+ * Reads unigrams and bigrams from the binary file.
+ * Doesn't make the memory representation of the dictionary.
+ *
+ * @param buffer the buffer to read.
+ * @param words the map to store the address as a key and the word as a value.
+ * @param frequencies the map to store the address as a key and the frequency as a value.
+ * @param bigrams the map to store the address as a key and the list of address as a value.
+ * @throws IOException
+ * @throws UnsupportedFormatException
+ */
+ public static void readUnigramsAndBigramsBinary(final FusionDictionaryBufferInterface buffer,
+ final Map<Integer, String> words, final Map<Integer, Integer> frequencies,
+ final Map<Integer, ArrayList<PendingAttribute>> bigrams) throws IOException,
+ UnsupportedFormatException {
+ // Read header
+ final int version = checkFormatVersion(buffer);
+ final int optionsFlags = buffer.readUnsignedShort();
+ final HashMap<String, String> options = new HashMap<String, String>();
+ final int headerSize = readHeader(buffer, options, version);
+
+ readUnigramsAndBigramsBinaryInner(buffer, headerSize, words, frequencies, bigrams);
+ }
+
/**
* Helper function to get the binary format version from the header.
* @throws IOException
@@ -1402,10 +1514,8 @@ public class BinaryDictInputOutput {
* @throws UnsupportedFormatException
*/
private static int readHeader(final FusionDictionaryBufferInterface buffer,
- final HashMap<String, String> options,
- final int version)
+ final HashMap<String, String> options, final int version)
throws IOException, UnsupportedFormatException {
-
final int headerSize;
if (version < FIRST_VERSION_WITH_HEADER_SIZE) {
headerSize = buffer.position();
@@ -1418,7 +1528,6 @@ public class BinaryDictInputOutput {
if (headerSize < 0) {
throw new UnsupportedFormatException("header size can't be negative.");
}
-
return headerSize;
}
@@ -1456,7 +1565,6 @@ public class BinaryDictInputOutput {
public static FusionDictionary readDictionaryBinary(
final FusionDictionaryBufferInterface buffer, final FusionDictionary dict)
throws IOException, UnsupportedFormatException {
-
// clear cache
wordCache.clear();
@@ -1478,7 +1586,11 @@ public class BinaryDictInputOutput {
0 != (optionsFlags & FRENCH_LIGATURE_PROCESSING_FLAG)));
if (null != dict) {
for (final Word w : dict) {
- newDict.add(w.mWord, w.mFrequency, w.mShortcutTargets);
+ if (w.mIsBlacklistEntry) {
+ newDict.addBlacklistEntry(w.mWord, w.mShortcutTargets, w.mIsNotAWord);
+ } else {
+ newDict.add(w.mWord, w.mFrequency, w.mShortcutTargets, w.mIsNotAWord);
+ }
}
for (final Word w : dict) {
// By construction a binary dictionary may not have bigrams pointing to
diff --git a/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
index 7c15ba54d..f1abea9ec 100644
--- a/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
+++ b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java
@@ -101,26 +101,34 @@ public class FusionDictionary implements Iterable<Word> {
ArrayList<WeightedString> mBigrams;
int mFrequency; // NOT_A_TERMINAL == mFrequency indicates this is not a terminal.
Node mChildren;
+ boolean mIsNotAWord; // Only a shortcut
+ boolean mIsBlacklistEntry;
// The two following members to help with binary generation
int mCachedSize;
int mCachedAddress;
public CharGroup(final int[] chars, final ArrayList<WeightedString> shortcutTargets,
- final ArrayList<WeightedString> bigrams, final int frequency) {
+ final ArrayList<WeightedString> bigrams, final int frequency,
+ final boolean isNotAWord, final boolean isBlacklistEntry) {
mChars = chars;
mFrequency = frequency;
mShortcutTargets = shortcutTargets;
mBigrams = bigrams;
mChildren = null;
+ mIsNotAWord = isNotAWord;
+ mIsBlacklistEntry = isBlacklistEntry;
}
public CharGroup(final int[] chars, final ArrayList<WeightedString> shortcutTargets,
- final ArrayList<WeightedString> bigrams, final int frequency, final Node children) {
+ final ArrayList<WeightedString> bigrams, final int frequency,
+ final boolean isNotAWord, final boolean isBlacklistEntry, final Node children) {
mChars = chars;
mFrequency = frequency;
mShortcutTargets = shortcutTargets;
mBigrams = bigrams;
mChildren = children;
+ mIsNotAWord = isNotAWord;
+ mIsBlacklistEntry = isBlacklistEntry;
}
public void addChild(CharGroup n) {
@@ -197,8 +205,9 @@ public class FusionDictionary implements Iterable<Word> {
* the existing ones if any. Note: unigram, bigram, and shortcut frequencies are only
* updated if they are higher than the existing ones.
*/
- public void update(int frequency, ArrayList<WeightedString> shortcutTargets,
- ArrayList<WeightedString> bigrams) {
+ public void update(final int frequency, final ArrayList<WeightedString> shortcutTargets,
+ final ArrayList<WeightedString> bigrams,
+ final boolean isNotAWord, final boolean isBlacklistEntry) {
if (frequency > mFrequency) {
mFrequency = frequency;
}
@@ -234,6 +243,8 @@ public class FusionDictionary implements Iterable<Word> {
}
}
}
+ mIsNotAWord = isNotAWord;
+ mIsBlacklistEntry = isBlacklistEntry;
}
}
@@ -296,10 +307,24 @@ public class FusionDictionary implements Iterable<Word> {
* @param word the word to add.
* @param frequency the frequency of the word, in the range [0..255].
* @param shortcutTargets a list of shortcut targets for this word, or null.
+ * @param isNotAWord true if this should not be considered a word (e.g. shortcut only)
*/
public void add(final String word, final int frequency,
- final ArrayList<WeightedString> shortcutTargets) {
- add(getCodePoints(word), frequency, shortcutTargets);
+ final ArrayList<WeightedString> shortcutTargets, final boolean isNotAWord) {
+ add(getCodePoints(word), frequency, shortcutTargets, isNotAWord,
+ false /* isBlacklistEntry */);
+ }
+
+ /**
+ * Helper method to add a blacklist entry as a string.
+ *
+ * @param word the word to add as a blacklist entry.
+ * @param shortcutTargets a list of shortcut targets for this word, or null.
+ * @param isNotAWord true if this is not a word for spellcheking purposes (shortcut only or so)
+ */
+ public void addBlacklistEntry(final String word,
+ final ArrayList<WeightedString> shortcutTargets, final boolean isNotAWord) {
+ add(getCodePoints(word), 0, shortcutTargets, isNotAWord, true /* isBlacklistEntry */);
}
/**
@@ -332,7 +357,8 @@ public class FusionDictionary implements Iterable<Word> {
if (charGroup != null) {
final CharGroup charGroup2 = findWordInTree(mRoot, word2);
if (charGroup2 == null) {
- add(getCodePoints(word2), 0, null);
+ add(getCodePoints(word2), 0, null, false /* isNotAWord */,
+ false /* isBlacklistEntry */);
}
charGroup.addBigram(word2, frequency);
} else {
@@ -349,9 +375,12 @@ public class FusionDictionary implements Iterable<Word> {
* @param word the word, as an int array.
* @param frequency the frequency of the word, in the range [0..255].
* @param shortcutTargets an optional list of shortcut targets for this word (null if none).
+ * @param isNotAWord true if this is not a word for spellcheking purposes (shortcut only or so)
+ * @param isBlacklistEntry true if this is a blacklisted word, false otherwise
*/
private void add(final int[] word, final int frequency,
- final ArrayList<WeightedString> shortcutTargets) {
+ final ArrayList<WeightedString> shortcutTargets,
+ final boolean isNotAWord, final boolean isBlacklistEntry) {
assert(frequency >= 0 && frequency <= 255);
Node currentNode = mRoot;
int charIndex = 0;
@@ -376,7 +405,7 @@ public class FusionDictionary implements Iterable<Word> {
final int insertionIndex = findInsertionIndex(currentNode, word[charIndex]);
final CharGroup newGroup = new CharGroup(
Arrays.copyOfRange(word, charIndex, word.length),
- shortcutTargets, null /* bigrams */, frequency);
+ shortcutTargets, null /* bigrams */, frequency, isNotAWord, isBlacklistEntry);
currentNode.mData.add(insertionIndex, newGroup);
if (DBG) checkStack(currentNode);
} else {
@@ -386,13 +415,15 @@ public class FusionDictionary implements Iterable<Word> {
// The new word is a prefix of an existing word, but the node on which it
// should end already exists as is. Since the old CharNode was not a terminal,
// make it one by filling in its frequency and other attributes
- currentGroup.update(frequency, shortcutTargets, null);
+ currentGroup.update(frequency, shortcutTargets, null, isNotAWord,
+ isBlacklistEntry);
} else {
// The new word matches the full old word and extends past it.
// We only have to create a new node and add it to the end of this.
final CharGroup newNode = new CharGroup(
Arrays.copyOfRange(word, charIndex + differentCharIndex, word.length),
- shortcutTargets, null /* bigrams */, frequency);
+ shortcutTargets, null /* bigrams */, frequency, isNotAWord,
+ isBlacklistEntry);
currentGroup.mChildren = new Node();
currentGroup.mChildren.mData.add(newNode);
}
@@ -400,7 +431,9 @@ public class FusionDictionary implements Iterable<Word> {
if (0 == differentCharIndex) {
// Exact same word. Update the frequency if higher. This will also add the
// new shortcuts to the existing shortcut list if it already exists.
- currentGroup.update(frequency, shortcutTargets, null);
+ currentGroup.update(frequency, shortcutTargets, null,
+ currentGroup.mIsNotAWord && isNotAWord,
+ currentGroup.mIsBlacklistEntry || isBlacklistEntry);
} else {
// Partial prefix match only. We have to replace the current node with a node
// containing the current prefix and create two new ones for the tails.
@@ -408,21 +441,26 @@ public class FusionDictionary implements Iterable<Word> {
final CharGroup newOldWord = new CharGroup(
Arrays.copyOfRange(currentGroup.mChars, differentCharIndex,
currentGroup.mChars.length), currentGroup.mShortcutTargets,
- currentGroup.mBigrams, currentGroup.mFrequency, currentGroup.mChildren);
+ currentGroup.mBigrams, currentGroup.mFrequency,
+ currentGroup.mIsNotAWord, currentGroup.mIsBlacklistEntry,
+ currentGroup.mChildren);
newChildren.mData.add(newOldWord);
final CharGroup newParent;
if (charIndex + differentCharIndex >= word.length) {
newParent = new CharGroup(
Arrays.copyOfRange(currentGroup.mChars, 0, differentCharIndex),
- shortcutTargets, null /* bigrams */, frequency, newChildren);
+ shortcutTargets, null /* bigrams */, frequency,
+ isNotAWord, isBlacklistEntry, newChildren);
} else {
newParent = new CharGroup(
Arrays.copyOfRange(currentGroup.mChars, 0, differentCharIndex),
- null /* shortcutTargets */, null /* bigrams */, -1, newChildren);
+ null /* shortcutTargets */, null /* bigrams */, -1,
+ false /* isNotAWord */, false /* isBlacklistEntry */, newChildren);
final CharGroup newWord = new CharGroup(Arrays.copyOfRange(word,
charIndex + differentCharIndex, word.length),
- shortcutTargets, null /* bigrams */, frequency);
+ shortcutTargets, null /* bigrams */, frequency,
+ isNotAWord, isBlacklistEntry);
final int addIndex = word[charIndex + differentCharIndex]
> currentGroup.mChars[differentCharIndex] ? 1 : 0;
newChildren.mData.add(addIndex, newWord);
@@ -483,7 +521,8 @@ public class FusionDictionary implements Iterable<Word> {
private static int findInsertionIndex(final Node node, int character) {
final ArrayList<CharGroup> data = node.mData;
final CharGroup reference = new CharGroup(new int[] { character },
- null /* shortcutTargets */, null /* bigrams */, 0);
+ null /* shortcutTargets */, null /* bigrams */, 0, false /* isNotAWord */,
+ false /* isBlacklistEntry */);
int result = Collections.binarySearch(data, reference, CHARGROUP_COMPARATOR);
return result >= 0 ? result : -result - 1;
}
@@ -748,7 +787,8 @@ public class FusionDictionary implements Iterable<Word> {
}
if (currentGroup.mFrequency >= 0)
return new Word(mCurrentString.toString(), currentGroup.mFrequency,
- currentGroup.mShortcutTargets, currentGroup.mBigrams);
+ currentGroup.mShortcutTargets, currentGroup.mBigrams,
+ currentGroup.mIsNotAWord, currentGroup.mIsBlacklistEntry);
} else {
mPositions.removeLast();
currentPos = mPositions.getLast();
diff --git a/java/src/com/android/inputmethod/latin/makedict/Word.java b/java/src/com/android/inputmethod/latin/makedict/Word.java
index 65fc72c40..4683ef154 100644
--- a/java/src/com/android/inputmethod/latin/makedict/Word.java
+++ b/java/src/com/android/inputmethod/latin/makedict/Word.java
@@ -31,16 +31,21 @@ public class Word implements Comparable<Word> {
public final int mFrequency;
public final ArrayList<WeightedString> mShortcutTargets;
public final ArrayList<WeightedString> mBigrams;
+ public final boolean mIsNotAWord;
+ public final boolean mIsBlacklistEntry;
private int mHashCode = 0;
public Word(final String word, final int frequency,
final ArrayList<WeightedString> shortcutTargets,
- final ArrayList<WeightedString> bigrams) {
+ final ArrayList<WeightedString> bigrams,
+ final boolean isNotAWord, final boolean isBlacklistEntry) {
mWord = word;
mFrequency = frequency;
mShortcutTargets = shortcutTargets;
mBigrams = bigrams;
+ mIsNotAWord = isNotAWord;
+ mIsBlacklistEntry = isBlacklistEntry;
}
private static int computeHashCode(Word word) {
@@ -48,7 +53,9 @@ public class Word implements Comparable<Word> {
word.mWord,
word.mFrequency,
word.mShortcutTargets.hashCode(),
- word.mBigrams.hashCode()
+ word.mBigrams.hashCode(),
+ word.mIsNotAWord,
+ word.mIsBlacklistEntry
});
}
@@ -78,7 +85,9 @@ public class Word implements Comparable<Word> {
Word w = (Word)o;
return mFrequency == w.mFrequency && mWord.equals(w.mWord)
&& mShortcutTargets.equals(w.mShortcutTargets)
- && mBigrams.equals(w.mBigrams);
+ && mBigrams.equals(w.mBigrams)
+ && mIsNotAWord == w.mIsNotAWord
+ && mIsBlacklistEntry == w.mIsBlacklistEntry;
}
@Override
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java
index 9bb81a034..5c2487195 100644
--- a/java/src/com/android/inputmethod/research/ResearchLogger.java
+++ b/java/src/com/android/inputmethod/research/ResearchLogger.java
@@ -35,6 +35,7 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.inputmethodservice.InputMethodService;
+import android.net.Uri;
import android.os.Build;
import android.os.IBinder;
import android.os.SystemClock;
@@ -43,15 +44,12 @@ import android.text.format.DateUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.CorrectionInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
-import android.widget.Button;
import android.widget.Toast;
import com.android.inputmethod.keyboard.Key;
@@ -251,44 +249,49 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
if (windowToken == null) {
return;
}
- mSplashDialog = new Dialog(mInputMethodService, android.R.style.Theme_Holo_Dialog);
- mSplashDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
- mSplashDialog.setContentView(R.layout.research_splash);
- mSplashDialog.setCancelable(true);
+ final AlertDialog.Builder builder = new AlertDialog.Builder(mInputMethodService)
+ .setTitle(R.string.research_splash_title)
+ .setMessage(R.string.research_splash_content)
+ .setPositiveButton(android.R.string.yes,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ onUserLoggingConsent();
+ mSplashDialog.dismiss();
+ }
+ })
+ .setNegativeButton(android.R.string.no,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ final String packageName = mInputMethodService.getPackageName();
+ final Uri packageUri = Uri.parse("package:" + packageName);
+ final Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE,
+ packageUri);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ mInputMethodService.startActivity(intent);
+ }
+ })
+ .setCancelable(true)
+ .setOnCancelListener(
+ new OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ mInputMethodService.requestHideSelf(0);
+ }
+ });
+ mSplashDialog = builder.create();
final Window w = mSplashDialog.getWindow();
final WindowManager.LayoutParams lp = w.getAttributes();
lp.token = windowToken;
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
w.setAttributes(lp);
w.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
- mSplashDialog.setOnCancelListener(new OnCancelListener() {
- @Override
- public void onCancel(DialogInterface dialog) {
- mInputMethodService.requestHideSelf(0);
- }
- });
- final Button doNotLogButton = (Button) mSplashDialog.findViewById(
- R.id.research_do_not_log_button);
- doNotLogButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- onUserLoggingElection(false);
- mSplashDialog.dismiss();
- }
- });
- final Button doLogButton = (Button) mSplashDialog.findViewById(R.id.research_do_log_button);
- doLogButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- onUserLoggingElection(true);
- mSplashDialog.dismiss();
- }
- });
mSplashDialog.show();
}
- public void onUserLoggingElection(final boolean enableLogging) {
- setLoggingAllowed(enableLogging);
+ public void onUserLoggingConsent() {
+ setLoggingAllowed(true);
if (mPrefs == null) {
return;
}
@@ -450,12 +453,18 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
prefsChanged(prefs);
}
- public void presentResearchDialog(final LatinIME latinIME) {
+ public void onResearchKeySelected(final LatinIME latinIME) {
if (mInFeedbackDialog) {
Toast.makeText(latinIME, R.string.research_please_exit_feedback_form,
Toast.LENGTH_LONG).show();
return;
}
+ presentFeedbackDialog(latinIME);
+ }
+
+ // TODO: currently unreachable. Remove after being sure no menu is needed.
+ /*
+ public void presentResearchDialog(final LatinIME latinIME) {
final CharSequence title = latinIME.getString(R.string.english_ime_research_log);
final boolean showEnable = mIsLoggingSuspended || !sIsLogging;
final CharSequence[] items = new CharSequence[] {
@@ -472,28 +481,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
presentFeedbackDialog(latinIME);
break;
case 1:
- if (showEnable) {
- if (!sIsLogging) {
- setLoggingAllowed(true);
- }
- resumeLogging();
- Toast.makeText(latinIME,
- R.string.research_notify_session_logging_enabled,
- Toast.LENGTH_LONG).show();
- } else {
- Toast toast = Toast.makeText(latinIME,
- R.string.research_notify_session_log_deleting,
- Toast.LENGTH_LONG);
- toast.show();
- boolean isLogDeleted = abort();
- final long currentTime = System.currentTimeMillis();
- final long resumeTime = currentTime + 1000 * 60 *
- SUSPEND_DURATION_IN_MINUTES;
- suspendLoggingUntil(resumeTime);
- toast.cancel();
- Toast.makeText(latinIME, R.string.research_notify_logging_suspended,
- Toast.LENGTH_LONG).show();
- }
+ enableOrDisable(showEnable, latinIME);
break;
}
}
@@ -504,6 +492,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
.setTitle(title);
latinIME.showOptionDialog(builder.create());
}
+ */
private boolean mInFeedbackDialog = false;
public void presentFeedbackDialog(LatinIME latinIME) {
@@ -511,6 +500,35 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
latinIME.launchKeyboardedDialogActivity(FeedbackActivity.class);
}
+ // TODO: currently unreachable. Remove after being sure enable/disable is
+ // not needed.
+ /*
+ public void enableOrDisable(final boolean showEnable, final LatinIME latinIME) {
+ if (showEnable) {
+ if (!sIsLogging) {
+ setLoggingAllowed(true);
+ }
+ resumeLogging();
+ Toast.makeText(latinIME,
+ R.string.research_notify_session_logging_enabled,
+ Toast.LENGTH_LONG).show();
+ } else {
+ Toast toast = Toast.makeText(latinIME,
+ R.string.research_notify_session_log_deleting,
+ Toast.LENGTH_LONG);
+ toast.show();
+ boolean isLogDeleted = abort();
+ final long currentTime = System.currentTimeMillis();
+ final long resumeTime = currentTime + 1000 * 60 *
+ SUSPEND_DURATION_IN_MINUTES;
+ suspendLoggingUntil(resumeTime);
+ toast.cancel();
+ Toast.makeText(latinIME, R.string.research_notify_logging_suspended,
+ Toast.LENGTH_LONG).show();
+ }
+ }
+ */
+
private static final String[] EVENTKEYS_FEEDBACK = {
"UserTimestamp", "contents"
};