aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/res/values/attrs.xml73
-rw-r--r--java/res/values/keyboard-icons-black.xml47
-rw-r--r--java/res/values/keyboard-icons-holo.xml47
-rw-r--r--java/res/values/keyboard-icons-white.xml47
-rw-r--r--java/res/values/themes-basic-highcontrast.xml30
-rw-r--r--java/res/values/themes-basic.xml30
-rw-r--r--java/res/values/themes-gingerbread.xml30
-rw-r--r--java/res/values/themes-honeycomb.xml30
-rw-r--r--java/res/values/themes-stone-bold.xml30
-rw-r--r--java/res/values/themes-stone.xml30
-rw-r--r--java/res/values/themes.xml85
-rw-r--r--java/res/xml-sw600dp/kbd_key_styles.xml167
-rw-r--r--java/res/xml-sw600dp/kbd_number.xml4
-rw-r--r--java/res/xml-sw600dp/kbd_numkey_styles.xml150
-rw-r--r--java/res/xml-sw600dp/kbd_phone.xml2
-rw-r--r--java/res/xml-sw600dp/kbd_phone_symbols.xml2
-rw-r--r--java/res/xml-sw600dp/kbd_qwerty_row4.xml2
-rw-r--r--java/res/xml-sw600dp/kbd_symbols.xml2
-rw-r--r--java/res/xml-sw600dp/kbd_symbols_shift.xml2
-rw-r--r--java/res/xml-sw768dp/kbd_key_styles.xml141
-rw-r--r--java/res/xml-sw768dp/kbd_number.xml2
-rw-r--r--java/res/xml-sw768dp/kbd_numkey_styles.xml148
-rw-r--r--java/res/xml-sw768dp/kbd_phone.xml2
-rw-r--r--java/res/xml-sw768dp/kbd_phone_symbols.xml2
-rw-r--r--java/res/xml-sw768dp/kbd_qwerty_row4.xml2
-rw-r--r--java/res/xml-sw768dp/kbd_symbols.xml2
-rw-r--r--java/res/xml-sw768dp/kbd_symbols_shift.xml2
-rw-r--r--java/res/xml/kbd_key_styles.xml255
-rw-r--r--java/res/xml/kbd_numkey_styles.xml183
-rw-r--r--java/res/xml/kbd_qwerty_f1.xml4
-rw-r--r--java/res/xml/kbd_symbols_f1.xml4
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java5
-rw-r--r--java/src/com/android/inputmethod/keyboard/PointerTracker.java10
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/Key.java26
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java36
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java147
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardParser.java2
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/MiniKeyboardBuilder.java10
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/PopupCharactersParser.java28
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/Row.java6
-rw-r--r--tests/src/com/android/inputmethod/keyboard/internal/PopupCharactersParserTests.java281
41 files changed, 980 insertions, 1128 deletions
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 73f62c6f1..c88049e14 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -141,6 +141,35 @@
<attr name="popupKeyboardTemplate" format="reference" />
<!-- Locale of the keyboard layout -->
<attr name="keyboardLocale" format="string" />
+ <!-- Icon set for key top and key preview. -->
+ <attr name="iconShiftKey" format="reference" />
+ <attr name="iconToSymbolKey" format="reference" />
+ <attr name="iconToSymbolKeyWithShortcut" format="reference" />
+ <attr name="iconDeleteKey" format="reference" />
+ <attr name="iconSettingsKey" format="reference" />
+ <attr name="iconShortcutKey" format="reference" />
+ <attr name="iconSpaceKey" format="reference" />
+ <attr name="iconReturnKey" format="reference" />
+ <attr name="iconSearchKey" format="reference" />
+ <attr name="iconTabKey" format="reference" />
+ <attr name="iconNum1Key" format="reference" />
+ <attr name="iconNum2Key" format="reference" />
+ <attr name="iconNum3Key" format="reference" />
+ <attr name="iconNum4Key" format="reference" />
+ <attr name="iconNum5Key" format="reference" />
+ <attr name="iconNum6Key" format="reference" />
+ <attr name="iconNum7Key" format="reference" />
+ <attr name="iconNum8Key" format="reference" />
+ <attr name="iconNum9Key" format="reference" />
+ <attr name="iconNum0Key" format="reference" />
+ <attr name="iconNumStarKey" format="reference" />
+ <attr name="iconNumPoundKey" format="reference" />
+ <attr name="iconNumAltKey" format="reference" />
+ <attr name="iconShiftedShiftKey" format="reference" />
+ <attr name="iconPreviewSpaceKey" format="reference" />
+ <attr name="iconPreviewTabKey" format="reference" />
+ <attr name="iconPreviewSettingsKey" format="reference" />
+ <attr name="iconPreviewShortcutKey" format="reference" />
</declare-styleable>
<declare-styleable name="Keyboard_Key">
@@ -163,8 +192,6 @@
<attr name="isSticky" format="boolean" />
<!-- Whether long-pressing on this key will make it repeat. -->
<attr name="isRepeatable" format="boolean" />
- <!-- The icon to show in the popup preview. -->
- <attr name="iconPreview" format="reference" />
<!-- The string of characters to output when this key is pressed. -->
<attr name="keyOutputText" format="string" />
<!-- The label to display on the key. -->
@@ -182,11 +209,47 @@
<flag name="hasUppercaseLetter" value="0x40" />
</attr>
<!-- The icon to display on the key instead of the label. -->
- <attr name="keyIcon" format="reference" />
+ <attr name="keyIcon" format="enum">
+ <!-- This should be aligned with KeyboardIcons.ICON_* -->
+ <enum name="iconShiftKey" value="1" />
+ <enum name="iconToSymbolKey" value="2" />
+ <enum name="iconToSymbolKeyWithShortcut" value="3" />
+ <enum name="iconDeleteKey" value="4" />
+ <enum name="iconSettingsKey" value="5" />
+ <enum name="iconShortcutKey" value="6" />
+ <enum name="iconSpaceKey" value="7" />
+ <enum name="iconReturnKey" value="8" />
+ <enum name="iconSearchKey" value="9" />
+ <enum name="iconTabKey" value="10" />
+ <enum name="iconNum1Key" value="11" />
+ <enum name="iconNum2Key" value="12" />
+ <enum name="iconNum3Key" value="13" />
+ <enum name="iconNum4Key" value="14" />
+ <enum name="iconNum5Key" value="15" />
+ <enum name="iconNum6Key" value="16" />
+ <enum name="iconNum7Key" value="17" />
+ <enum name="iconNum8Key" value="18" />
+ <enum name="iconNum9Key" value="19" />
+ <enum name="iconNum0Key" value="20" />
+ <enum name="iconNumStarKey" value="21" />
+ <enum name="iconNumPoundKey" value="22" />
+ <enum name="iconNumAltKey" value="23" />
+ </attr>
+ <!-- Shift key icon for shifted state -->
+ <attr name="keyIconShifted" format="enum">
+ <!-- This should be aligned with KeyboardIcons.ICON_SHIFTED_* -->
+ <enum name="iconShiftedShiftKey" value="24" />
+ </attr>
+ <!-- The icon to show in the popup preview. -->
+ <attr name="keyIconPreview" format="enum">
+ <!-- This should be aligned with KeyboardIcons.ICON_PREVIEW_* -->
+ <enum name="iconPreviewSpaceKey" value="25" />
+ <enum name="iconPreviewTabKey" value="26" />
+ <enum name="iconPreviewSettingsKey" value="27" />
+ <enum name="iconPreviewShortcutKey" value="28" />
+ </attr>
<!-- The key style to specify a set of key attributes defined by <key_style/> -->
<attr name="keyStyle" format="string" />
- <!-- Shift key icon for shifted state -->
- <attr name="shiftedIcon" format="reference" />
<!-- The key is enabled and responds on press. -->
<attr name="enabled" format="boolean" />
<!-- Visual insets -->
diff --git a/java/res/values/keyboard-icons-black.xml b/java/res/values/keyboard-icons-black.xml
new file mode 100644
index 000000000..f11a9c4d6
--- /dev/null
+++ b/java/res/values/keyboard-icons-black.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <style name="KeyboardIcons.Black" parent="android:Theme.Light">
+ <item name="iconShiftKey">@drawable/sym_bkeyboard_shift</item>
+ <item name="iconToSymbolKeyWithShortcut">@drawable/sym_bkeyboard_123_mic</item>
+ <item name="iconDeleteKey">@drawable/sym_bkeyboard_delete</item>
+ <item name="iconSettingsKey">@drawable/sym_bkeyboard_settings</item>
+ <item name="iconShortcutKey">@drawable/sym_bkeyboard_mic</item>
+ <item name="iconSpaceKey">@drawable/sym_bkeyboard_space</item>
+ <item name="iconReturnKey">@drawable/sym_bkeyboard_return</item>
+ <item name="iconSearchKey">@drawable/sym_bkeyboard_search</item>
+ <item name="iconTabKey">@drawable/sym_bkeyboard_tab</item>
+ <item name="iconNum1Key">@drawable/sym_bkeyboard_num1</item>
+ <item name="iconNum2Key">@drawable/sym_bkeyboard_num2</item>
+ <item name="iconNum3Key">@drawable/sym_bkeyboard_num3</item>
+ <item name="iconNum4Key">@drawable/sym_bkeyboard_num4</item>
+ <item name="iconNum5Key">@drawable/sym_bkeyboard_num5</item>
+ <item name="iconNum6Key">@drawable/sym_bkeyboard_num6</item>
+ <item name="iconNum7Key">@drawable/sym_bkeyboard_num7</item>
+ <item name="iconNum8Key">@drawable/sym_bkeyboard_num8</item>
+ <item name="iconNum9Key">@drawable/sym_bkeyboard_num9</item>
+ <item name="iconNum0Key">@drawable/sym_bkeyboard_num0</item>
+ <item name="iconNumStarKey">@drawable/sym_bkeyboard_numstar</item>
+ <item name="iconNumPoundKey">@drawable/sym_bkeyboard_numpound</item>
+ <item name="iconNumAltKey">@drawable/sym_bkeyboard_numalt</item>
+ <item name="iconShiftedShiftKey">@drawable/sym_bkeyboard_shift_locked</item>
+ <item name="iconPreviewSpaceKey">@drawable/sym_keyboard_feedback_space</item>
+ <item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
+ <item name="iconPreviewSettingsKey">@drawable/sym_keyboard_feedback_settings</item>
+ <item name="iconPreviewShortcutKey">@drawable/sym_keyboard_feedback_mic</item>
+ </style>
+</resources>
diff --git a/java/res/values/keyboard-icons-holo.xml b/java/res/values/keyboard-icons-holo.xml
new file mode 100644
index 000000000..5f396ca71
--- /dev/null
+++ b/java/res/values/keyboard-icons-holo.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <style name="KeyboardIcons.Holo" parent="android:Theme.Holo">
+ <item name="iconShiftKey">@drawable/sym_keyboard_shift_holo</item>
+<!-- <item name="iconToSymbolKeyWithShortcut">@drawable/sym_keyboard_123_mic_holo</item> -->
+ <item name="iconDeleteKey">@drawable/sym_keyboard_delete_holo</item>
+ <item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo</item>
+ <item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo</item>
+ <item name="iconSpaceKey">@drawable/sym_keyboard_space_holo</item>
+ <item name="iconReturnKey">@drawable/sym_keyboard_return_holo</item>
+<!-- <item name="iconSearchKey">@drawable/sym_keyboard_search_holo</item> -->
+ <item name="iconTabKey">@drawable/sym_keyboard_tab_holo</item>
+ <item name="iconNum1Key">@drawable/sym_keyboard_num1_holo</item>
+ <item name="iconNum2Key">@drawable/sym_keyboard_num2_holo</item>
+ <item name="iconNum3Key">@drawable/sym_keyboard_num3_holo</item>
+ <item name="iconNum4Key">@drawable/sym_keyboard_num4_holo</item>
+ <item name="iconNum5Key">@drawable/sym_keyboard_num5_holo</item>
+ <item name="iconNum6Key">@drawable/sym_keyboard_num6_holo</item>
+ <item name="iconNum7Key">@drawable/sym_keyboard_num7_holo</item>
+ <item name="iconNum8Key">@drawable/sym_keyboard_num8_holo</item>
+ <item name="iconNum9Key">@drawable/sym_keyboard_num9_holo</item>
+ <item name="iconNum0Key">@drawable/sym_keyboard_num0_holo</item>
+ <item name="iconNumStarKey">@drawable/sym_keyboard_numbstar_holo</item>
+ <item name="iconNumPoundKey">@drawable/sym_keyboard_numbpound_holo</item>
+<!-- <item name="iconNumAltKey">@drawable/sym_keyboard_numalt_holo</item> -->
+ <item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked_holo</item>
+ <item name="iconPreviewSpaceKey">@drawable/sym_keyboard_space_holo</item>
+ <item name="iconPreviewTabKey">@drawable/sym_keyboard_tab_holo</item>
+ <item name="iconPreviewSettingsKey">@drawable/sym_keyboard_settings_holo</item>
+<!-- <item name="iconPreviewShortcutKey">@drawable/sym_keyboard_feedback_voice_holo</item> -->
+ </style>
+</resources>
diff --git a/java/res/values/keyboard-icons-white.xml b/java/res/values/keyboard-icons-white.xml
new file mode 100644
index 000000000..f25f7d44a
--- /dev/null
+++ b/java/res/values/keyboard-icons-white.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <style name="KeyboardIcons" parent="android:Theme">
+ <item name="iconShiftKey">@drawable/sym_keyboard_shift</item>
+ <item name="iconToSymbolKeyWithShortcut">@drawable/sym_keyboard_123_mic</item>
+ <item name="iconDeleteKey">@drawable/sym_keyboard_delete</item>
+ <item name="iconSettingsKey">@drawable/sym_keyboard_settings</item>
+ <item name="iconShortcutKey">@drawable/sym_keyboard_mic</item>
+ <item name="iconSpaceKey">@drawable/sym_keyboard_space</item>
+ <item name="iconReturnKey">@drawable/sym_keyboard_return</item>
+ <item name="iconSearchKey">@drawable/sym_keyboard_search</item>
+ <item name="iconTabKey">@drawable/sym_keyboard_tab</item>
+ <item name="iconNum1Key">@drawable/sym_keyboard_num1</item>
+ <item name="iconNum2Key">@drawable/sym_keyboard_num2</item>
+ <item name="iconNum3Key">@drawable/sym_keyboard_num3</item>
+ <item name="iconNum4Key">@drawable/sym_keyboard_num4</item>
+ <item name="iconNum5Key">@drawable/sym_keyboard_num5</item>
+ <item name="iconNum6Key">@drawable/sym_keyboard_num6</item>
+ <item name="iconNum7Key">@drawable/sym_keyboard_num7</item>
+ <item name="iconNum8Key">@drawable/sym_keyboard_num8</item>
+ <item name="iconNum9Key">@drawable/sym_keyboard_num9</item>
+ <item name="iconNum0Key">@drawable/sym_keyboard_num0</item>
+ <item name="iconNumStarKey">@drawable/sym_keyboard_numstar</item>
+ <item name="iconNumPoundKey">@drawable/sym_keyboard_numpound</item>
+ <item name="iconNumAltKey">@drawable/sym_keyboard_numalt</item>
+ <item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked</item>
+ <item name="iconPreviewSpaceKey">@drawable/sym_keyboard_feedback_space</item>
+ <item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
+ <item name="iconPreviewSettingsKey">@drawable/sym_keyboard_feedback_settings</item>
+ <item name="iconPreviewShortcutKey">@drawable/sym_keyboard_feedback_mic</item>
+ </style>
+</resources>
diff --git a/java/res/values/themes-basic-highcontrast.xml b/java/res/values/themes-basic-highcontrast.xml
new file mode 100644
index 000000000..8122e4eb0
--- /dev/null
+++ b/java/res/values/themes-basic-highcontrast.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <style name="KeyboardTheme.HighContrast" parent="KeyboardIcons">
+ <item name="keyboardStyle">@style/Keyboard</item>
+ <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
+ <item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item>
+ <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
+ <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
+ <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+ <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
+ <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+ <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+ <item name="candidateViewStyle">@style/CandidateViewStyle</item>
+ </style>
+</resources>
diff --git a/java/res/values/themes-basic.xml b/java/res/values/themes-basic.xml
new file mode 100644
index 000000000..50b52de32
--- /dev/null
+++ b/java/res/values/themes-basic.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <style name="KeyboardTheme" parent="KeyboardIcons">
+ <item name="keyboardStyle">@style/Keyboard</item>
+ <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
+ <item name="keyboardViewStyle">@style/KeyboardView</item>
+ <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
+ <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
+ <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+ <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
+ <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+ <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+ <item name="candidateViewStyle">@style/CandidateViewStyle</item>
+ </style>
+</resources>
diff --git a/java/res/values/themes-gingerbread.xml b/java/res/values/themes-gingerbread.xml
new file mode 100644
index 000000000..cdb10c81a
--- /dev/null
+++ b/java/res/values/themes-gingerbread.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <style name="KeyboardTheme.Gingerbread" parent="KeyboardIcons">
+ <item name="keyboardStyle">@style/Keyboard</item>
+ <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
+ <item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item>
+ <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
+ <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Gingerbread</item>
+ <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+ <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
+ <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+ <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+ <item name="candidateViewStyle">@style/CandidateViewStyle</item>
+ </style>
+</resources>
diff --git a/java/res/values/themes-honeycomb.xml b/java/res/values/themes-honeycomb.xml
new file mode 100644
index 000000000..07f5b83c0
--- /dev/null
+++ b/java/res/values/themes-honeycomb.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <style name="KeyboardTheme.Honeycomb" parent="KeyboardIcons.Holo">
+ <item name="keyboardStyle">@style/Keyboard.Honeycomb</item>
+ <item name="latinKeyboardStyle">@style/LatinKeyboard.Honeycomb</item>
+ <item name="keyboardViewStyle">@style/KeyboardView.Honeycomb</item>
+ <item name="keyPreviewStyle">@style/KeyPreviewStyle.Honeycomb</item>
+ <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Honeycomb</item>
+ <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle.Honeycomb</item>
+ <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.Honeycomb</item>
+ <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.Honeycomb</item>
+ <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle.Honeycomb</item>
+ <item name="candidateViewStyle">@style/CandidateViewStyle.Honeycomb</item>
+ </style>
+</resources>
diff --git a/java/res/values/themes-stone-bold.xml b/java/res/values/themes-stone-bold.xml
new file mode 100644
index 000000000..4955f2286
--- /dev/null
+++ b/java/res/values/themes-stone-bold.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <style name="KeyboardTheme.Stone.Bold" parent="KeyboardIcons.Black">
+ <item name="keyboardStyle">@style/Keyboard</item>
+ <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
+ <item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item>
+ <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
+ <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
+ <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+ <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
+ <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+ <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+ <item name="candidateViewStyle">@style/CandidateViewStyle</item>
+ </style>
+</resources>
diff --git a/java/res/values/themes-stone.xml b/java/res/values/themes-stone.xml
new file mode 100644
index 000000000..39a011bd9
--- /dev/null
+++ b/java/res/values/themes-stone.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <style name="KeyboardTheme.Stone" parent="KeyboardIcons.Black">
+ <item name="keyboardStyle">@style/Keyboard</item>
+ <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
+ <item name="keyboardViewStyle">@style/KeyboardView.Stone</item>
+ <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
+ <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
+ <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
+ <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
+ <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
+ <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
+ <item name="candidateViewStyle">@style/CandidateViewStyle</item>
+ </style>
+</resources>
diff --git a/java/res/values/themes.xml b/java/res/values/themes.xml
deleted file mode 100644
index 728ce5a02..000000000
--- a/java/res/values/themes.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
- <style name="KeyboardTheme" parent="android:Theme">
- <item name="keyboardStyle">@style/Keyboard</item>
- <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
- <item name="keyboardViewStyle">@style/KeyboardView</item>
- <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
- <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
- <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
- <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
- <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
- <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
- <item name="candidateViewStyle">@style/CandidateViewStyle</item>
- </style>
- <style name="KeyboardTheme.HighContrast" parent="android:Theme">
- <item name="keyboardStyle">@style/Keyboard</item>
- <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
- <item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item>
- <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
- <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
- <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
- <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
- <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
- <item name="candidateViewStyle">@style/CandidateViewStyle</item>
- </style>
- <style name="KeyboardTheme.Stone" parent="android:Theme.Light">
- <item name="keyboardStyle">@style/Keyboard</item>
- <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
- <item name="keyboardViewStyle">@style/KeyboardView.Stone</item>
- <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
- <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
- <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
- <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
- <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
- <item name="candidateViewStyle">@style/CandidateViewStyle</item>
- </style>
- <style name="KeyboardTheme.Stone.Bold" parent="android:Theme.Light">
- <item name="keyboardStyle">@style/Keyboard</item>
- <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
- <item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item>
- <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
- <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
- <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
- <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
- <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
- <item name="candidateViewStyle">@style/CandidateViewStyle</item>
- </style>
- <style name="KeyboardTheme.Gingerbread" parent="android:Theme.Black">
- <item name="keyboardStyle">@style/Keyboard</item>
- <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
- <item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item>
- <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
- <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Gingerbread</item>
- <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
- <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
- <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
- <item name="candidateViewStyle">@style/CandidateViewStyle</item>
- </style>
- <style name="KeyboardTheme.Honeycomb" parent="android:Theme.Holo">
- <item name="keyboardStyle">@style/Keyboard.Honeycomb</item>
- <item name="latinKeyboardStyle">@style/LatinKeyboard.Honeycomb</item>
- <item name="keyboardViewStyle">@style/KeyboardView.Honeycomb</item>
- <item name="keyPreviewStyle">@style/KeyPreviewStyle.Honeycomb</item>
- <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Honeycomb</item>
- <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle.Honeycomb</item>
- <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.Honeycomb</item>
- <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.Honeycomb</item>
- <item name="candidateViewStyle">@style/CandidateViewStyle.Honeycomb</item>
- </style>
-</resources>
diff --git a/java/res/xml-sw600dp/kbd_key_styles.xml b/java/res/xml-sw600dp/kbd_key_styles.xml
index a38887910..988f5c490 100644
--- a/java/res/xml-sw600dp/kbd_key_styles.xml
+++ b/java/res/xml-sw600dp/kbd_key_styles.xml
@@ -38,137 +38,66 @@
</case>
</switch>
<!-- Functional key styles -->
+ <key-style
+ latin:styleName="shiftKeyStyle"
+ latin:code="@integer/key_shift"
+ latin:keyIcon="iconShiftKey"
+ latin:keyIconShifted="iconShiftedShiftKey"
+ latin:parentStyle="functionalKeyStyle"
+ latin:isSticky="true" />
+ <key-style
+ latin:styleName="deleteKeyStyle"
+ latin:code="@integer/key_delete"
+ latin:keyIcon="iconDeleteKey"
+ latin:parentStyle="functionalKeyStyle"
+ latin:isRepeatable="true" />
+ <key-style
+ latin:styleName="returnKeyStyle"
+ latin:code="@integer/key_return"
+ latin:keyIcon="iconReturnKey"
+ latin:parentStyle="functionalKeyStyle" />
+ <key-style
+ latin:styleName="spaceKeyStyle"
+ latin:code="@integer/key_space"
+ latin:keyIconPreview="iconPreviewSpaceKey" />
+ <key-style
+ latin:styleName="nonSpecialBackgroundSpaceKeyStyle"
+ latin:code="@integer/key_space"
+ latin:keyIconPreview="iconPreviewSpaceKey" />
+ <key-style
+ latin:styleName="smileyKeyStyle"
+ latin:keyLabel=":-)"
+ latin:keyOutputText=":-) "
+ latin:keyLabelOption="popupHint"
+ latin:popupCharacters="@string/alternates_for_smiley"
+ latin:maxPopupKeyboardColumn="5" />
<switch>
<case
- latin:colorScheme="white"
+ latin:voiceKeyEnabled="true"
>
<key-style
- latin:styleName="shiftKeyStyle"
- latin:code="@integer/key_shift"
- latin:keyIcon="@drawable/sym_keyboard_shift_holo"
- latin:shiftedIcon="@drawable/sym_keyboard_shift_locked_holo"
- latin:iconPreview="@drawable/sym_keyboard_feedback_shift"
- latin:parentStyle="functionalKeyStyle"
- latin:isSticky="true" />
- <key-style
- latin:styleName="deleteKeyStyle"
- latin:code="@integer/key_delete"
- latin:keyIcon="@drawable/sym_keyboard_delete_holo"
- latin:iconPreview="@drawable/sym_keyboard_feedback_delete"
- latin:parentStyle="functionalKeyStyle"
- latin:isRepeatable="true" />
- <key-style
- latin:styleName="returnKeyStyle"
- latin:code="@integer/key_return"
- latin:keyIcon="@drawable/sym_keyboard_return_holo"
- latin:iconPreview="@drawable/sym_keyboard_feedback_return"
- latin:parentStyle="functionalKeyStyle" />
- <key-style
- latin:styleName="spaceKeyStyle"
- latin:code="@integer/key_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- <key-style
- latin:styleName="nonSpecialBackgroundSpaceKeyStyle"
- latin:code="@integer/key_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- <key-style
- latin:styleName="smileyKeyStyle"
- latin:keyLabel=":-)"
- latin:keyOutputText=":-) "
+ latin:styleName="shortcutOrSettingsKeyStyle"
+ latin:code="@integer/key_shortcut"
+ latin:keyIcon="iconShortcutKey"
+ latin:keyIconPreview="iconPreviewShortcutKey"
latin:keyLabelOption="popupHint"
- latin:popupCharacters="@string/alternates_for_smiley"
- latin:maxPopupKeyboardColumn="5" />
- <switch>
- <case
- latin:voiceKeyEnabled="true"
- >
- <key-style
- latin:styleName="micOrSettingsKeyStyle"
- latin:code="@integer/key_shortcut"
- latin:keyIcon="@drawable/sym_keyboard_voice_holo"
- latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
- latin:keyLabelOption="popupHint"
- latin:popupCharacters="\@drawable/sym_keyboard_settings|\@integer/key_settings"
- latin:parentStyle="functionalKeyStyle" />
- </case>
- <default>
- <key-style
- latin:styleName="micOrSettingsKeyStyle"
- latin:code="@integer/key_settings"
- latin:keyIcon="@drawable/sym_keyboard_settings_holo"
- latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
- latin:parentStyle="functionalKeyStyle" />
- </default>
- </switch>
+ latin:popupCharacters="\@icon/5|\@integer/key_settings"
+ latin:parentStyle="functionalKeyStyle" />
</case>
- <case
- latin:colorScheme="black"
- >
- <key-style
- latin:styleName="shiftKeyStyle"
- latin:code="@integer/key_shift"
- latin:keyIcon="@drawable/sym_bkeyboard_shift"
- latin:shiftedIcon="@drawable/sym_bkeyboard_shift_locked"
- latin:iconPreview="@drawable/sym_keyboard_feedback_shift"
- latin:parentStyle="functionalKeyStyle"
- latin:isSticky="true" />
- <key-style
- latin:styleName="deleteKeyStyle"
- latin:code="@integer/key_delete"
- latin:keyIcon="@drawable/sym_bkeyboard_delete"
- latin:iconPreview="@drawable/sym_keyboard_feedback_delete"
- latin:parentStyle="functionalKeyStyle"
- latin:isRepeatable="true" />
+ <default>
<key-style
- latin:styleName="returnKeyStyle"
- latin:code="@integer/key_return"
- latin:keyIcon="@drawable/sym_bkeyboard_return"
- latin:iconPreview="@drawable/sym_keyboard_feedback_return"
+ latin:styleName="shortcutOrSettingsKeyStyle"
+ latin:code="@integer/key_settings"
+ latin:keyIcon="iconSettingsKey"
+ latin:keyIconPreview="iconPreviewSettingsKey"
latin:parentStyle="functionalKeyStyle" />
- <key-style
- latin:styleName="spaceKeyStyle"
- latin:code="@integer/key_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- <key-style
- latin:styleName="nonSpecialBackgroundSpaceKeyStyle"
- latin:code="@integer/key_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- <key-style
- latin:styleName="smileyKeyStyle"
- latin:keyLabel=":-)"
- latin:keyOutputText=":-) "
- latin:keyLabelOption="popupHint"
- latin:popupCharacters="@string/alternates_for_smiley"
- latin:maxPopupKeyboardColumn="5" />
- <switch>
- <case
- latin:voiceKeyEnabled="true"
- >
- <key-style
- latin:styleName="micOrSettingsKeyStyle"
- latin:code="@integer/key_shortcut"
- latin:keyIcon="@drawable/sym_bkeyboard_mic"
- latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
- latin:keyLabelOption="popupHint"
- latin:popupCharacters="\@drawable/sym_keyboard_settings|\@integer/key_settings"
- latin:parentStyle="functionalKeyStyle" />
- </case>
- <default>
- <key-style
- latin:styleName="micOrSettingsKeyStyle"
- latin:code="@integer/key_settings"
- latin:keyIcon="@drawable/sym_bkeyboard_settings"
- latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
- latin:parentStyle="functionalKeyStyle" />
- </default>
- </switch>
- </case>
+ </default>
</switch>
<key-style
latin:styleName="tabKeyStyle"
latin:code="@integer/key_tab"
- latin:keyIcon="@drawable/sym_keyboard_tab_holo"
- latin:iconPreview="@drawable/sym_keyboard_tab_holo"
+ latin:keyIcon="iconTabKey"
+ latin:keyIconPreview="iconPreviewTabKey"
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="toSymbolKeyStyle"
diff --git a/java/res/xml-sw600dp/kbd_number.xml b/java/res/xml-sw600dp/kbd_number.xml
index 0ff1da9bc..3a370c816 100644
--- a/java/res/xml-sw600dp/kbd_number.xml
+++ b/java/res/xml-sw600dp/kbd_number.xml
@@ -80,7 +80,7 @@
latin:keyStyle="num0KeyStyle" />
<Spacer />
<Key
- latin:keyStyle="micOrSettingsKeyStyle"
+ latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-11.00%p"
latin:keyWidth="fillRight"
latin:keyEdgeFlags="right" />
@@ -176,7 +176,7 @@
<Key
latin:keyLabel="#" />
<Key
- latin:keyStyle="micOrSettingsKeyStyle"
+ latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-11.00%p"
latin:keyWidth="fillBoth"
latin:keyEdgeFlags="right" />
diff --git a/java/res/xml-sw600dp/kbd_numkey_styles.xml b/java/res/xml-sw600dp/kbd_numkey_styles.xml
deleted file mode 100644
index b10dc9333..000000000
--- a/java/res/xml-sw600dp/kbd_numkey_styles.xml
+++ /dev/null
@@ -1,150 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2011, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<merge
- xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
->
- <switch>
- <case
- latin:colorScheme="white"
- >
- <key-style
- latin:styleName="num0KeyStyle"
- latin:code="48"
- latin:keyIcon="@drawable/sym_keyboard_num0_holo" />
- <key-style
- latin:styleName="num1KeyStyle"
- latin:code="49"
- latin:keyIcon="@drawable/sym_keyboard_num1_holo" />
- <key-style
- latin:styleName="num2KeyStyle"
- latin:code="50"
- latin:keyIcon="@drawable/sym_keyboard_num2_holo" />
- <key-style
- latin:styleName="num3KeyStyle"
- latin:code="51"
- latin:keyIcon="@drawable/sym_keyboard_num3_holo" />
- <key-style
- latin:styleName="num4KeyStyle"
- latin:code="52"
- latin:keyIcon="@drawable/sym_keyboard_num4_holo" />
- <key-style
- latin:styleName="num5KeyStyle"
- latin:code="53"
- latin:keyIcon="@drawable/sym_keyboard_num5_holo" />
- <key-style
- latin:styleName="num6KeyStyle"
- latin:code="54"
- latin:keyIcon="@drawable/sym_keyboard_num6_holo" />
- <key-style
- latin:styleName="num7KeyStyle"
- latin:code="55"
- latin:keyIcon="@drawable/sym_keyboard_num7_holo" />
- <key-style
- latin:styleName="num8KeyStyle"
- latin:code="56"
- latin:keyIcon="@drawable/sym_keyboard_num8_holo" />
- <key-style
- latin:styleName="num9KeyStyle"
- latin:code="57"
- latin:keyIcon="@drawable/sym_keyboard_num9_holo" />
- <key-style
- latin:styleName="numStarKeyStyle"
- latin:code="42"
- latin:keyIcon="@drawable/sym_keyboard_numbstar_holo" />
- <key-style
- latin:styleName="numPoundKeyStyle"
- latin:code="35"
- latin:keyIcon="@drawable/sym_keyboard_numbpound_holo" />
- <key-style
- latin:styleName="numAltKeyStyle"
- latin:code="@integer/key_switch_alpha_symbol"
- latin:keyIcon="@drawable/sym_keyboard_numalt"
- latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
- <key-style
- latin:styleName="numSpaceKeyStyle"
- latin:code="@integer/key_space"
- latin:keyIcon="@drawable/sym_keyboard_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- </case>
- <case
- latin:colorScheme="black"
- >
- <key-style
- latin:styleName="num0KeyStyle"
- latin:code="48"
- latin:keyIcon="@drawable/sym_bkeyboard_num0" />
- <key-style
- latin:styleName="num1KeyStyle"
- latin:code="49"
- latin:keyIcon="@drawable/sym_bkeyboard_num1" />
- <key-style
- latin:styleName="num2KeyStyle"
- latin:code="50"
- latin:keyIcon="@drawable/sym_bkeyboard_num2" />
- <key-style
- latin:styleName="num3KeyStyle"
- latin:code="51"
- latin:keyIcon="@drawable/sym_bkeyboard_num3" />
- <key-style
- latin:styleName="num4KeyStyle"
- latin:code="52"
- latin:keyIcon="@drawable/sym_bkeyboard_num4" />
- <key-style
- latin:styleName="num5KeyStyle"
- latin:code="53"
- latin:keyIcon="@drawable/sym_bkeyboard_num5" />
- <key-style
- latin:styleName="num6KeyStyle"
- latin:code="54"
- latin:keyIcon="@drawable/sym_bkeyboard_num6" />
- <key-style
- latin:styleName="num7KeyStyle"
- latin:code="55"
- latin:keyIcon="@drawable/sym_bkeyboard_num7" />
- <key-style
- latin:styleName="num8KeyStyle"
- latin:code="56"
- latin:keyIcon="@drawable/sym_bkeyboard_num8" />
- <key-style
- latin:styleName="num9KeyStyle"
- latin:code="57"
- latin:keyIcon="@drawable/sym_bkeyboard_num9" />
- <key-style
- latin:styleName="numStarKeyStyle"
- latin:code="42"
- latin:keyIcon="@drawable/sym_bkeyboard_numstar" />
- <key-style
- latin:styleName="numPoundKeyStyle"
- latin:code="35"
- latin:keyIcon="@drawable/sym_bkeyboard_numpound" />
- <key-style
- latin:styleName="numAltKeyStyle"
- latin:code="@integer/key_switch_alpha_symbol"
- latin:keyIcon="@drawable/sym_bkeyboard_numalt"
- latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
- <key-style
- latin:styleName="numSpaceKeyStyle"
- latin:code="@integer/key_space"
- latin:keyIcon="@drawable/sym_bkeyboard_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- </case>
- </switch>
-</merge>
diff --git a/java/res/xml-sw600dp/kbd_phone.xml b/java/res/xml-sw600dp/kbd_phone.xml
index 20b284923..133983d2a 100644
--- a/java/res/xml-sw600dp/kbd_phone.xml
+++ b/java/res/xml-sw600dp/kbd_phone.xml
@@ -109,7 +109,7 @@
<Key
latin:keyStyle="numPoundKeyStyle" />
<Key
- latin:keyStyle="micOrSettingsKeyStyle"
+ latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-11.00%p"
latin:keyWidth="fillBoth"
latin:keyEdgeFlags="right" />
diff --git a/java/res/xml-sw600dp/kbd_phone_symbols.xml b/java/res/xml-sw600dp/kbd_phone_symbols.xml
index a5ae9456c..73b7e4da6 100644
--- a/java/res/xml-sw600dp/kbd_phone_symbols.xml
+++ b/java/res/xml-sw600dp/kbd_phone_symbols.xml
@@ -118,7 +118,7 @@
<Key
latin:keyStyle="numPoundKeyStyle" />
<Key
- latin:keyStyle="micOrSettingsKeyStyle"
+ latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-11.00%p"
latin:keyWidth="fillBoth"
latin:keyEdgeFlags="right" />
diff --git a/java/res/xml-sw600dp/kbd_qwerty_row4.xml b/java/res/xml-sw600dp/kbd_qwerty_row4.xml
index 49e377fa7..958a7ed8f 100644
--- a/java/res/xml-sw600dp/kbd_qwerty_row4.xml
+++ b/java/res/xml-sw600dp/kbd_qwerty_row4.xml
@@ -155,7 +155,7 @@
</default>
</switch>
<Key
- latin:keyStyle="micOrSettingsKeyStyle"
+ latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-10.0%p"
latin:keyWidth="fillBoth"
latin:keyEdgeFlags="right" />
diff --git a/java/res/xml-sw600dp/kbd_symbols.xml b/java/res/xml-sw600dp/kbd_symbols.xml
index 4d3e7d3a2..fca97c737 100644
--- a/java/res/xml-sw600dp/kbd_symbols.xml
+++ b/java/res/xml-sw600dp/kbd_symbols.xml
@@ -210,7 +210,7 @@
</default>
</switch>
<Key
- latin:keyStyle="micOrSettingsKeyStyle"
+ latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-10.0%p"
latin:keyWidth="fillBoth"
latin:keyEdgeFlags="right" />
diff --git a/java/res/xml-sw600dp/kbd_symbols_shift.xml b/java/res/xml-sw600dp/kbd_symbols_shift.xml
index 1743c0ff2..c23681d4e 100644
--- a/java/res/xml-sw600dp/kbd_symbols_shift.xml
+++ b/java/res/xml-sw600dp/kbd_symbols_shift.xml
@@ -148,7 +148,7 @@
latin:keyXPos="30.750%p"
latin:keyWidth="39.750%p" />
<Key
- latin:keyStyle="micOrSettingsKeyStyle"
+ latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-10.0%p"
latin:keyWidth="fillRight"
latin:keyEdgeFlags="right" />
diff --git a/java/res/xml-sw768dp/kbd_key_styles.xml b/java/res/xml-sw768dp/kbd_key_styles.xml
index 4388e8959..ecfacc25b 100644
--- a/java/res/xml-sw768dp/kbd_key_styles.xml
+++ b/java/res/xml-sw768dp/kbd_key_styles.xml
@@ -29,111 +29,60 @@
<key-style
latin:styleName="functionalKeyStyle"
latin:isFunctional="true" />
- <key-style
- latin:styleName="shiftKeyStyle"
- latin:code="@integer/key_shift"
- latin:keyIcon="@drawable/sym_keyboard_shift_holo"
- latin:shiftedIcon="@drawable/sym_keyboard_shift_locked_holo"
- latin:iconPreview="@drawable/sym_keyboard_feedback_shift"
- latin:parentStyle="functionalKeyStyle"
- latin:isSticky="true" />
- <key-style
- latin:styleName="deleteKeyStyle"
- latin:code="@integer/key_delete"
- latin:keyIcon="@drawable/sym_keyboard_delete_holo"
- latin:iconPreview="@drawable/sym_keyboard_feedback_delete"
- latin:parentStyle="functionalKeyStyle"
- latin:isRepeatable="true" />
- <key-style
- latin:styleName="returnKeyStyle"
- latin:code="@integer/key_return"
- latin:keyIcon="@drawable/sym_keyboard_return_holo"
- latin:iconPreview="@drawable/sym_keyboard_feedback_return"
- latin:parentStyle="functionalKeyStyle" />
- <key-style
- latin:styleName="spaceKeyStyle"
- latin:code="@integer/key_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- <key-style
- latin:styleName="nonSpecialBackgroundSpaceKeyStyle"
- latin:code="@integer/key_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- <key-style
- latin:styleName="smileyKeyStyle"
- latin:keyLabel=":-)"
- latin:keyOutputText=":-) "
- latin:keyLabelOption="popupHint"
- latin:popupCharacters="@string/alternates_for_smiley"
- latin:maxPopupKeyboardColumn="5" />
- <key-style
- latin:styleName="settingsKeyStyle"
- latin:code="@integer/key_settings"
- latin:keyIcon="@drawable/sym_keyboard_settings_holo"
- latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
- latin:parentStyle="functionalKeyStyle" />
- <key-style
- latin:styleName="micKeyStyle"
- latin:code="@integer/key_shortcut"
- latin:keyIcon="@drawable/sym_keyboard_voice_holo"
- latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
- latin:parentStyle="functionalKeyStyle" />
</case>
<case
latin:colorScheme="black"
>
<key-style
latin:styleName="functionalKeyStyle" />
- <key-style
- latin:styleName="shiftKeyStyle"
- latin:code="@integer/key_shift"
- latin:keyIcon="@drawable/sym_bkeyboard_shift"
- latin:shiftedIcon="@drawable/sym_bkeyboard_shift_locked"
- latin:iconPreview="@drawable/sym_keyboard_feedback_shift"
- latin:parentStyle="functionalKeyStyle"
- latin:isSticky="true" />
- <key-style
- latin:styleName="deleteKeyStyle"
- latin:code="@integer/key_delete"
- latin:keyIcon="@drawable/sym_bkeyboard_delete"
- latin:iconPreview="@drawable/sym_keyboard_feedback_delete"
- latin:parentStyle="functionalKeyStyle"
- latin:isRepeatable="true" />
- <key-style
- latin:styleName="returnKeyStyle"
- latin:code="@integer/key_return"
- latin:keyIcon="@drawable/sym_bkeyboard_return"
- latin:iconPreview="@drawable/sym_keyboard_feedback_return"
- latin:parentStyle="functionalKeyStyle" />
- <key-style
- latin:styleName="spaceKeyStyle"
- latin:code="@integer/key_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- <key-style
- latin:styleName="nonSpecialBackgroundSpaceKeyStyle"
- latin:code="@integer/key_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- <key-style
- latin:styleName="smileyKeyStyle"
- latin:keyLabel=":-)"
- latin:keyOutputText=":-) "
- latin:keyLabelOption="popupHint"
- latin:popupCharacters="@string/alternates_for_smiley"
- latin:maxPopupKeyboardColumn="5" />
- <key-style
- latin:styleName="settingsKeyStyle"
- latin:code="@integer/key_settings"
- latin:keyIcon="@drawable/sym_bkeyboard_settings"
- latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
- latin:parentStyle="functionalKeyStyle" />
- <key-style
- latin:styleName="micKeyStyle"
- latin:code="@integer/key_shortcut"
- latin:keyIcon="@drawable/sym_bkeyboard_mic"
- latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
- latin:parentStyle="functionalKeyStyle" />
</case>
</switch>
<key-style
+ latin:styleName="shiftKeyStyle"
+ latin:code="@integer/key_shift"
+ latin:keyIcon="iconShiftKey"
+ latin:keyIconShifted="iconShiftedShiftKey"
+ latin:parentStyle="functionalKeyStyle"
+ latin:isSticky="true" />
+ <key-style
+ latin:styleName="deleteKeyStyle"
+ latin:code="@integer/key_delete"
+ latin:keyIcon="iconDeleteKey"
+ latin:parentStyle="functionalKeyStyle"
+ latin:isRepeatable="true" />
+ <key-style
+ latin:styleName="returnKeyStyle"
+ latin:code="@integer/key_return"
+ latin:keyIcon="iconReturnKey"
+ latin:parentStyle="functionalKeyStyle" />
+ <key-style
+ latin:styleName="spaceKeyStyle"
+ latin:code="@integer/key_space"
+ latin:keyIconPreview="iconPreviewSpaceKey" />
+ <key-style
+ latin:styleName="nonSpecialBackgroundSpaceKeyStyle"
+ latin:code="@integer/key_space"
+ latin:keyIconPreview="iconPreviewSpaceKey" />
+ <key-style
+ latin:styleName="smileyKeyStyle"
+ latin:keyLabel=":-)"
+ latin:keyOutputText=":-) "
+ latin:keyLabelOption="popupHint"
+ latin:popupCharacters="@string/alternates_for_smiley"
+ latin:maxPopupKeyboardColumn="5" />
+ <key-style
+ latin:styleName="settingsKeyStyle"
+ latin:code="@integer/key_settings"
+ latin:keyIcon="iconSettingsKey"
+ latin:keyIconPreview="iconPreviewSettingsKey"
+ latin:parentStyle="functionalKeyStyle" />
+ <key-style
+ latin:styleName="shortcutKeyStyle"
+ latin:code="@integer/key_shortcut"
+ latin:keyIcon="iconShortcutKey"
+ latin:keyIconPreview="iconPreviewShortcutKey"
+ latin:parentStyle="functionalKeyStyle" />
+ <key-style
latin:styleName="tabKeyStyle"
latin:code="@integer/key_tab"
latin:keyLabel="@string/label_tab_key"
diff --git a/java/res/xml-sw768dp/kbd_number.xml b/java/res/xml-sw768dp/kbd_number.xml
index 4f33e4154..1e478fd8d 100644
--- a/java/res/xml-sw768dp/kbd_number.xml
+++ b/java/res/xml-sw768dp/kbd_number.xml
@@ -193,7 +193,7 @@
latin:voiceKeyEnabled="true"
>
<Key
- latin:keyStyle="micKeyStyle"
+ latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" />
</case>
diff --git a/java/res/xml-sw768dp/kbd_numkey_styles.xml b/java/res/xml-sw768dp/kbd_numkey_styles.xml
deleted file mode 100644
index e27db94c7..000000000
--- a/java/res/xml-sw768dp/kbd_numkey_styles.xml
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, 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:colorScheme="white"
- >
- <key-style
- latin:styleName="num0KeyStyle"
- latin:code="48"
- latin:keyIcon="@drawable/sym_keyboard_num0_holo" />
- <key-style
- latin:styleName="num1KeyStyle"
- latin:code="49"
- latin:keyIcon="@drawable/sym_keyboard_num1_holo" />
- <key-style
- latin:styleName="num2KeyStyle"
- latin:code="50"
- latin:keyIcon="@drawable/sym_keyboard_num2_holo" />
- <key-style
- latin:styleName="num3KeyStyle"
- latin:code="51"
- latin:keyIcon="@drawable/sym_keyboard_num3_holo" />
- <key-style
- latin:styleName="num4KeyStyle"
- latin:code="52"
- latin:keyIcon="@drawable/sym_keyboard_num4_holo" />
- <key-style
- latin:styleName="num5KeyStyle"
- latin:code="53"
- latin:keyIcon="@drawable/sym_keyboard_num5_holo" />
- <key-style
- latin:styleName="num6KeyStyle"
- latin:code="54"
- latin:keyIcon="@drawable/sym_keyboard_num6_holo" />
- <key-style
- latin:styleName="num7KeyStyle"
- latin:code="55"
- latin:keyIcon="@drawable/sym_keyboard_num7_holo" />
- <key-style
- latin:styleName="num8KeyStyle"
- latin:code="56"
- latin:keyIcon="@drawable/sym_keyboard_num8_holo" />
- <key-style
- latin:styleName="num9KeyStyle"
- latin:code="57"
- latin:keyIcon="@drawable/sym_keyboard_num9_holo" />
- <key-style
- latin:styleName="numStarKeyStyle"
- latin:code="42"
- latin:keyIcon="@drawable/sym_keyboard_numbstar_holo" />
- <key-style
- latin:styleName="numPoundKeyStyle"
- latin:code="35"
- latin:keyIcon="@drawable/sym_keyboard_numbpound_holo" />
- <key-style
- latin:styleName="numAltKeyStyle"
- latin:code="@integer/key_switch_alpha_symbol"
- latin:keyIcon="@drawable/sym_keyboard_numalt"
- latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
- <key-style
- latin:styleName="numSpaceKeyStyle"
- latin:code="@integer/key_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- </case>
- <case
- latin:colorScheme="black"
- >
- <key-style
- latin:styleName="num0KeyStyle"
- latin:code="48"
- latin:keyIcon="@drawable/sym_bkeyboard_num0" />
- <key-style
- latin:styleName="num1KeyStyle"
- latin:code="49"
- latin:keyIcon="@drawable/sym_bkeyboard_num1" />
- <key-style
- latin:styleName="num2KeyStyle"
- latin:code="50"
- latin:keyIcon="@drawable/sym_bkeyboard_num2" />
- <key-style
- latin:styleName="num3KeyStyle"
- latin:code="51"
- latin:keyIcon="@drawable/sym_bkeyboard_num3" />
- <key-style
- latin:styleName="num4KeyStyle"
- latin:code="52"
- latin:keyIcon="@drawable/sym_bkeyboard_num4" />
- <key-style
- latin:styleName="num5KeyStyle"
- latin:code="53"
- latin:keyIcon="@drawable/sym_bkeyboard_num5" />
- <key-style
- latin:styleName="num6KeyStyle"
- latin:code="54"
- latin:keyIcon="@drawable/sym_bkeyboard_num6" />
- <key-style
- latin:styleName="num7KeyStyle"
- latin:code="55"
- latin:keyIcon="@drawable/sym_bkeyboard_num7" />
- <key-style
- latin:styleName="num8KeyStyle"
- latin:code="56"
- latin:keyIcon="@drawable/sym_bkeyboard_num8" />
- <key-style
- latin:styleName="num9KeyStyle"
- latin:code="57"
- latin:keyIcon="@drawable/sym_bkeyboard_num9" />
- <key-style
- latin:styleName="numStarKeyStyle"
- latin:code="42"
- latin:keyIcon="@drawable/sym_bkeyboard_numstar" />
- <key-style
- latin:styleName="numPoundKeyStyle"
- latin:code="35"
- latin:keyIcon="@drawable/sym_bkeyboard_numpound" />
- <key-style
- latin:styleName="numAltKeyStyle"
- latin:code="@integer/key_switch_alpha_symbol"
- latin:keyIcon="@drawable/sym_bkeyboard_numalt"
- latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
- <key-style
- latin:styleName="numSpaceKeyStyle"
- latin:code="@integer/key_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- </case>
- </switch>
-</merge>
diff --git a/java/res/xml-sw768dp/kbd_phone.xml b/java/res/xml-sw768dp/kbd_phone.xml
index 69169ffd1..b0d9337de 100644
--- a/java/res/xml-sw768dp/kbd_phone.xml
+++ b/java/res/xml-sw768dp/kbd_phone.xml
@@ -123,7 +123,7 @@
latin:voiceKeyEnabled="true"
>
<Key
- latin:keyStyle="micKeyStyle"
+ latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" />
</case>
diff --git a/java/res/xml-sw768dp/kbd_phone_symbols.xml b/java/res/xml-sw768dp/kbd_phone_symbols.xml
index e95579c0a..120a149d4 100644
--- a/java/res/xml-sw768dp/kbd_phone_symbols.xml
+++ b/java/res/xml-sw768dp/kbd_phone_symbols.xml
@@ -134,7 +134,7 @@
latin:voiceKeyEnabled="true"
>
<Key
- latin:keyStyle="micKeyStyle"
+ latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" />
</case>
diff --git a/java/res/xml-sw768dp/kbd_qwerty_row4.xml b/java/res/xml-sw768dp/kbd_qwerty_row4.xml
index fba2a65dd..00eabab9e 100644
--- a/java/res/xml-sw768dp/kbd_qwerty_row4.xml
+++ b/java/res/xml-sw768dp/kbd_qwerty_row4.xml
@@ -132,7 +132,7 @@
latin:voiceKeyEnabled="true"
>
<Key
- latin:keyStyle="micKeyStyle"
+ latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" />
</case>
diff --git a/java/res/xml-sw768dp/kbd_symbols.xml b/java/res/xml-sw768dp/kbd_symbols.xml
index d1a83c479..0e6103ab9 100644
--- a/java/res/xml-sw768dp/kbd_symbols.xml
+++ b/java/res/xml-sw768dp/kbd_symbols.xml
@@ -186,7 +186,7 @@
latin:voiceKeyEnabled="true"
>
<Key
- latin:keyStyle="micKeyStyle"
+ latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" />
</case>
diff --git a/java/res/xml-sw768dp/kbd_symbols_shift.xml b/java/res/xml-sw768dp/kbd_symbols_shift.xml
index dde144fdf..b36814104 100644
--- a/java/res/xml-sw768dp/kbd_symbols_shift.xml
+++ b/java/res/xml-sw768dp/kbd_symbols_shift.xml
@@ -166,7 +166,7 @@
latin:voiceKeyEnabled="true"
>
<Key
- latin:keyStyle="micKeyStyle"
+ latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" />
</case>
diff --git a/java/res/xml/kbd_key_styles.xml b/java/res/xml/kbd_key_styles.xml
index 201bff6e7..fbc4c920f 100644
--- a/java/res/xml/kbd_key_styles.xml
+++ b/java/res/xml/kbd_key_styles.xml
@@ -23,7 +23,7 @@
>
<!-- Base key style for the functional key -->
<switch>
- <case
+ <case
latin:colorScheme="white"
>
<key-style
@@ -51,159 +51,76 @@
<key-style
latin:styleName="settingsPopupStyle"
latin:keyLabelOption="popupHint"
- latin:popupCharacters="\@drawable/sym_keyboard_settings_holo|\@integer/key_settings"
+ latin:popupCharacters="\@icon/5|\@integer/key_settings"
latin:parentStyle="functionalKeyStyle" />
</default>
</switch>
<!-- Functional key styles -->
+ <key-style
+ latin:styleName="shiftKeyStyle"
+ latin:code="@integer/key_shift"
+ latin:keyIcon="iconShiftKey"
+ latin:keyIconShifted="iconShiftedShiftKey"
+ latin:parentStyle="functionalKeyStyle"
+ latin:isSticky="true" />
+ <key-style
+ latin:styleName="deleteKeyStyle"
+ latin:code="@integer/key_delete"
+ latin:keyIcon="iconDeleteKey"
+ latin:parentStyle="functionalKeyStyle"
+ latin:isRepeatable="true" />
<switch>
+ <!-- When this qwerty keyboard has no voice key but voice key is enabled, then symbol
+ keyboard will have mic key. That means we should use "?123mic" key here. -->
<case
- latin:colorScheme="white"
+ latin:voiceKeyEnabled="true"
+ latin:hasVoiceKey="false"
>
<key-style
- latin:styleName="shiftKeyStyle"
- latin:code="@integer/key_shift"
- latin:keyIcon="@drawable/sym_keyboard_shift"
- latin:shiftedIcon="@drawable/sym_keyboard_shift_locked"
- latin:iconPreview="@drawable/sym_keyboard_feedback_shift"
- latin:parentStyle="functionalKeyStyle"
- latin:isSticky="true" />
- <key-style
- latin:styleName="deleteKeyStyle"
- latin:code="@integer/key_delete"
- latin:keyIcon="@drawable/sym_keyboard_delete"
- latin:iconPreview="@drawable/sym_keyboard_feedback_delete"
- latin:parentStyle="functionalKeyStyle"
- latin:isRepeatable="true" />
- <switch>
- <!-- When this qwerty keyboard has no voice key but voice key is enabled, then
- symbol keyboard will have mic key. That means we should use "?123mic" key
- here. -->
- <case
- latin:voiceKeyEnabled="true"
- latin:hasVoiceKey="false"
- >
- <key-style
- latin:styleName="toSymbolKeyStyle"
- latin:code="@integer/key_switch_alpha_symbol"
- latin:keyIcon="@drawable/sym_keyboard_123_mic"
- latin:iconPreview="@drawable/sym_keyboard_feedback_123_mic"
- latin:parentStyle="functionalKeyStyle" />
- </case>
- <default>
- <key-style
- latin:styleName="toSymbolKeyStyle"
- latin:code="@integer/key_switch_alpha_symbol"
- latin:keyLabel="@string/label_to_symbol_key"
- latin:parentStyle="functionalKeyStyle" />
- </default>
- </switch>
- <key-style
- latin:styleName="settingsKeyStyle"
- latin:code="@integer/key_settings"
- latin:keyIcon="@drawable/sym_keyboard_settings"
- latin:iconPreview="@drawable/sym_keyboard_settings"
- latin:parentStyle="functionalKeyStyle" />
- <key-style
- latin:styleName="spaceKeyStyle"
- latin:code="@integer/key_space"
- latin:keyIcon="@drawable/sym_keyboard_space"
- latin:iconPreview="@drawable/sym_keyboard_space"
+ latin:styleName="toSymbolKeyStyle"
+ latin:code="@integer/key_switch_alpha_symbol"
+ latin:keyIcon="iconToSymbolKeyWithShortcut"
latin:parentStyle="functionalKeyStyle" />
- <key-style
- latin:styleName="tabKeyStyle"
- latin:code="@integer/key_tab"
- latin:keyIcon="@drawable/sym_keyboard_tab"
- latin:iconPreview="@drawable/sym_keyboard_tab"
- latin:parentStyle="functionalKeyStyle" />
- <key-style
- latin:styleName="micKeyStyle"
- latin:code="@integer/key_shortcut"
- latin:keyIcon="@drawable/sym_keyboard_mic"
- latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
- latin:parentStyle="settingsPopupStyle" />
- <!-- Note: This key style is not for functional tab key. This is used for the tab key
- which is laid out as normal letter key. -->
- <key-style
- latin:styleName="nonSpecialBackgroundTabKeyStyle"
- latin:code="@integer/key_tab"
- latin:keyIcon="@drawable/sym_keyboard_tab"
- latin:iconPreview="@drawable/sym_keyboard_tab" />
</case>
- <case
- latin:colorScheme="black"
- >
- <key-style
- latin:styleName="shiftKeyStyle"
- latin:code="@integer/key_shift"
- latin:keyIcon="@drawable/sym_bkeyboard_shift"
- latin:shiftedIcon="@drawable/sym_bkeyboard_shift_locked"
- latin:iconPreview="@drawable/sym_keyboard_feedback_shift"
- latin:parentStyle="functionalKeyStyle"
- latin:isSticky="true" />
- <key-style
- latin:styleName="deleteKeyStyle"
- latin:code="@integer/key_delete"
- latin:keyIcon="@drawable/sym_bkeyboard_delete"
- latin:iconPreview="@drawable/sym_keyboard_feedback_delete"
- latin:parentStyle="functionalKeyStyle"
- latin:isRepeatable="true" />
- <switch>
- <!-- When this qwerty keyboard has no voice key but voice key is enabled, then
- symbol keyboard will have mic key. That means we should use "?123mic" key
- here. -->
- <case
- latin:voiceKeyEnabled="true"
- latin:hasVoiceKey="false"
- >
- <key-style
- latin:styleName="toSymbolKeyStyle"
- latin:code="@integer/key_switch_alpha_symbol"
- latin:keyIcon="@drawable/sym_bkeyboard_123_mic"
- latin:iconPreview="@drawable/sym_keyboard_feedback_123_mic"
- latin:parentStyle="functionalKeyStyle" />
- </case>
- <default>
- <key-style
- latin:styleName="toSymbolKeyStyle"
- latin:code="@integer/key_switch_alpha_symbol"
- latin:keyLabel="@string/label_to_symbol_key"
- latin:parentStyle="functionalKeyStyle" />
- </default>
- </switch>
- <key-style
- latin:styleName="settingsKeyStyle"
- latin:code="@integer/key_settings"
- latin:keyIcon="@drawable/sym_bkeyboard_settings"
- latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
- latin:parentStyle="functionalKeyStyle" />
- <key-style
- latin:styleName="spaceKeyStyle"
- latin:code="@integer/key_space"
- latin:keyIcon="@drawable/sym_bkeyboard_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space"
- latin:parentStyle="functionalKeyStyle" />
+ <default>
<key-style
- latin:styleName="tabKeyStyle"
- latin:code="@integer/key_tab"
- latin:keyIcon="@drawable/sym_bkeyboard_tab"
- latin:iconPreview="@drawable/sym_keyboard_feedback_tab"
+ latin:styleName="toSymbolKeyStyle"
+ latin:code="@integer/key_switch_alpha_symbol"
+ latin:keyLabel="@string/label_to_symbol_key"
latin:parentStyle="functionalKeyStyle" />
- <key-style
- latin:styleName="micKeyStyle"
- latin:code="@integer/key_shortcut"
- latin:keyIcon="@drawable/sym_bkeyboard_mic"
- latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
- latin:parentStyle="settingsPopupStyle" />
- <!-- Note: This key style is not for functional tab key. This is used for the tab key
- which is laid out as normal letter key. -->
- <key-style
- latin:styleName="nonSpecialBackgroundTabKeyStyle"
- latin:code="@integer/key_tab"
- latin:keyIcon="@drawable/sym_bkeyboard_tab"
- latin:iconPreview="@drawable/sym_keyboard_feedback_tab" />
- </case>
+ </default>
</switch>
+ <key-style
+ latin:styleName="settingsKeyStyle"
+ latin:code="@integer/key_settings"
+ latin:keyIcon="iconSettingsKey"
+ latin:keyIconPreview="iconPreviewSettingsKey"
+ latin:parentStyle="functionalKeyStyle" />
+ <key-style
+ latin:styleName="spaceKeyStyle"
+ latin:code="@integer/key_space"
+ latin:keyIcon="iconSpaceKey"
+ latin:keyIconPreview="iconPreviewSpaceKey"
+ latin:parentStyle="functionalKeyStyle" />
+ <key-style
+ latin:styleName="tabKeyStyle"
+ latin:code="@integer/key_tab"
+ latin:keyIcon="iconTabKey"
+ latin:keyIconPreview="iconPreviewTabKey"
+ latin:parentStyle="functionalKeyStyle" />
+ <key-style
+ latin:styleName="shortcutKeyStyle"
+ latin:code="@integer/key_shortcut"
+ latin:keyIcon="iconShortcutKey"
+ latin:keyIconPreview="iconPreviewShortcutKey"
+ latin:parentStyle="settingsPopupStyle" />
+ <!-- Note: This key style is not for functional tab key. This is used for the tab key which is
+ laid out as normal letter key. -->
+ <key-style
+ latin:styleName="nonSpecialBackgroundTabKeyStyle"
+ latin:code="@integer/key_tab"
+ latin:keyIcon="iconTabKey"
+ latin:keyIconPreview="iconPreviewTabKey" />
<!-- Return key style -->
<switch>
<case
@@ -245,52 +162,18 @@
<case
latin:imeAction="actionSearch"
>
- <switch>
- <case
- latin:colorScheme="white"
- >
- <key-style
- latin:styleName="returnKeyStyle"
- latin:code="@integer/key_return"
- latin:keyIcon="@drawable/sym_keyboard_search"
- latin:iconPreview="@drawable/sym_keyboard_feedback_search"
- latin:parentStyle="functionalKeyStyle" />
- </case>
- <case
- latin:colorScheme="black"
- >
- <key-style
- latin:styleName="returnKeyStyle"
- latin:code="@integer/key_return"
- latin:keyIcon="@drawable/sym_bkeyboard_search"
- latin:iconPreview="@drawable/sym_keyboard_feedback_search"
- latin:parentStyle="functionalKeyStyle" />
- </case>
- </switch>
+ <key-style
+ latin:styleName="returnKeyStyle"
+ latin:code="@integer/key_return"
+ latin:keyIcon="iconSearchKey"
+ latin:parentStyle="functionalKeyStyle" />
</case>
<default>
- <switch>
- <case
- latin:colorScheme="white"
- >
- <key-style
- latin:styleName="returnKeyStyle"
- latin:code="@integer/key_return"
- latin:keyIcon="@drawable/sym_keyboard_return"
- latin:iconPreview="@drawable/sym_keyboard_return"
- latin:parentStyle="functionalKeyStyle" />
- </case>
- <case
- latin:colorScheme="black"
- >
- <key-style
- latin:styleName="returnKeyStyle"
- latin:code="@integer/key_return"
- latin:keyIcon="@drawable/sym_bkeyboard_return"
- latin:iconPreview="@drawable/sym_keyboard_feedback_return"
- latin:parentStyle="functionalKeyStyle" />
- </case>
- </switch>
+ <key-style
+ latin:styleName="returnKeyStyle"
+ latin:code="@integer/key_return"
+ latin:keyIcon="iconReturnKey"
+ latin:parentStyle="functionalKeyStyle" />
</default>
</switch>
<key-style
@@ -335,4 +218,4 @@
latin:parentStyle="functionalKeyStyle" />
</default>
</switch>
-</merge> \ No newline at end of file
+</merge>
diff --git a/java/res/xml/kbd_numkey_styles.xml b/java/res/xml/kbd_numkey_styles.xml
index 2f9ae325a..f53046aa2 100644
--- a/java/res/xml/kbd_numkey_styles.xml
+++ b/java/res/xml/kbd_numkey_styles.xml
@@ -21,130 +21,61 @@
<merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
>
- <switch>
- <case
- latin:colorScheme="white"
- >
- <key-style
- latin:styleName="num0KeyStyle"
- latin:code="48"
- latin:keyIcon="@drawable/sym_keyboard_num0" />
- <key-style
- latin:styleName="num1KeyStyle"
- latin:code="49"
- latin:keyIcon="@drawable/sym_keyboard_num1" />
- <key-style
- latin:styleName="num2KeyStyle"
- latin:code="50"
- latin:keyIcon="@drawable/sym_keyboard_num2" />
- <key-style
- latin:styleName="num3KeyStyle"
- latin:code="51"
- latin:keyIcon="@drawable/sym_keyboard_num3" />
- <key-style
- latin:styleName="num4KeyStyle"
- latin:code="52"
- latin:keyIcon="@drawable/sym_keyboard_num4" />
- <key-style
- latin:styleName="num5KeyStyle"
- latin:code="53"
- latin:keyIcon="@drawable/sym_keyboard_num5" />
- <key-style
- latin:styleName="num6KeyStyle"
- latin:code="54"
- latin:keyIcon="@drawable/sym_keyboard_num6" />
- <key-style
- latin:styleName="num7KeyStyle"
- latin:code="55"
- latin:keyIcon="@drawable/sym_keyboard_num7" />
- <key-style
- latin:styleName="num8KeyStyle"
- latin:code="56"
- latin:keyIcon="@drawable/sym_keyboard_num8" />
- <key-style
- latin:styleName="num9KeyStyle"
- latin:code="57"
- latin:keyIcon="@drawable/sym_keyboard_num9" />
- <key-style
- latin:styleName="numStarKeyStyle"
- latin:code="42"
- latin:keyIcon="@drawable/sym_keyboard_numstar" />
- <key-style
- latin:styleName="numPoundKeyStyle"
- latin:code="35"
- latin:keyIcon="@drawable/sym_keyboard_numpound" />
- <key-style
- latin:styleName="numAltKeyStyle"
- latin:code="@integer/key_switch_alpha_symbol"
- latin:keyIcon="@drawable/sym_keyboard_numalt"
- latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
- <key-style
- latin:styleName="numSpaceKeyStyle"
- latin:code="@integer/key_space"
- latin:keyIcon="@drawable/sym_keyboard_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- </case>
- <case
- latin:colorScheme="black"
- >
- <key-style
- latin:styleName="num0KeyStyle"
- latin:code="48"
- latin:keyIcon="@drawable/sym_bkeyboard_num0" />
- <key-style
- latin:styleName="num1KeyStyle"
- latin:code="49"
- latin:keyIcon="@drawable/sym_bkeyboard_num1" />
- <key-style
- latin:styleName="num2KeyStyle"
- latin:code="50"
- latin:keyIcon="@drawable/sym_bkeyboard_num2" />
- <key-style
- latin:styleName="num3KeyStyle"
- latin:code="51"
- latin:keyIcon="@drawable/sym_bkeyboard_num3" />
- <key-style
- latin:styleName="num4KeyStyle"
- latin:code="52"
- latin:keyIcon="@drawable/sym_bkeyboard_num4" />
- <key-style
- latin:styleName="num5KeyStyle"
- latin:code="53"
- latin:keyIcon="@drawable/sym_bkeyboard_num5" />
- <key-style
- latin:styleName="num6KeyStyle"
- latin:code="54"
- latin:keyIcon="@drawable/sym_bkeyboard_num6" />
- <key-style
- latin:styleName="num7KeyStyle"
- latin:code="55"
- latin:keyIcon="@drawable/sym_bkeyboard_num7" />
- <key-style
- latin:styleName="num8KeyStyle"
- latin:code="56"
- latin:keyIcon="@drawable/sym_bkeyboard_num8" />
- <key-style
- latin:styleName="num9KeyStyle"
- latin:code="57"
- latin:keyIcon="@drawable/sym_bkeyboard_num9" />
- <key-style
- latin:styleName="numStarKeyStyle"
- latin:code="42"
- latin:keyIcon="@drawable/sym_bkeyboard_numstar" />
- <key-style
- latin:styleName="numPoundKeyStyle"
- latin:code="35"
- latin:keyIcon="@drawable/sym_bkeyboard_numpound" />
- <key-style
- latin:styleName="numAltKeyStyle"
- latin:code="@integer/key_switch_alpha_symbol"
- latin:keyIcon="@drawable/sym_bkeyboard_numalt"
- latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
- <key-style
- latin:styleName="numSpaceKeyStyle"
- latin:code="@integer/key_space"
- latin:keyIcon="@drawable/sym_bkeyboard_space"
- latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
- </case>
- </switch>
+ <key-style
+ latin:styleName="num0KeyStyle"
+ latin:code="48"
+ latin:keyIcon="iconNum0Key" />
+ <key-style
+ latin:styleName="num1KeyStyle"
+ latin:code="49"
+ latin:keyIcon="iconNum1Key" />
+ <key-style
+ latin:styleName="num2KeyStyle"
+ latin:code="50"
+ latin:keyIcon="iconNum2Key" />
+ <key-style
+ latin:styleName="num3KeyStyle"
+ latin:code="51"
+ latin:keyIcon="iconNum3Key" />
+ <key-style
+ latin:styleName="num4KeyStyle"
+ latin:code="52"
+ latin:keyIcon="iconNum4Key" />
+ <key-style
+ latin:styleName="num5KeyStyle"
+ latin:code="53"
+ latin:keyIcon="iconNum5Key" />
+ <key-style
+ latin:styleName="num6KeyStyle"
+ latin:code="54"
+ latin:keyIcon="iconNum6Key" />
+ <key-style
+ latin:styleName="num7KeyStyle"
+ latin:code="55"
+ latin:keyIcon="iconNum7Key" />
+ <key-style
+ latin:styleName="num8KeyStyle"
+ latin:code="56"
+ latin:keyIcon="iconNum8Key" />
+ <key-style
+ latin:styleName="num9KeyStyle"
+ latin:code="57"
+ latin:keyIcon="iconNum9Key" />
+ <key-style
+ latin:styleName="numStarKeyStyle"
+ latin:code="42"
+ latin:keyIcon="iconNumStarKey" />
+ <key-style
+ latin:styleName="numPoundKeyStyle"
+ latin:code="35"
+ latin:keyIcon="iconNumPoundKey" />
+ <key-style
+ latin:styleName="numAltKeyStyle"
+ latin:code="@integer/key_switch_alpha_symbol"
+ latin:keyIcon="iconNumAltKey" />
+ <key-style
+ latin:styleName="numSpaceKeyStyle"
+ latin:code="@integer/key_space"
+ latin:keyIcon="iconSpaceKey"
+ latin:keyIconPreview="iconPreviewSpaceKey" />
</merge>
diff --git a/java/res/xml/kbd_qwerty_f1.xml b/java/res/xml/kbd_qwerty_f1.xml
index 45cc8f550..51b9800e0 100644
--- a/java/res/xml/kbd_qwerty_f1.xml
+++ b/java/res/xml/kbd_qwerty_f1.xml
@@ -48,7 +48,7 @@
latin:hasVoiceKey="true"
>
<Key
- latin:keyStyle="micKeyStyle"
+ latin:keyStyle="shortcutKeyStyle"
latin:keyWidth="9.2%p" />
</case>
<!-- latin:hasVoiceKey="false" -->
@@ -93,7 +93,7 @@
latin:hasVoiceKey="true"
>
<Key
- latin:keyStyle="micKeyStyle" />
+ latin:keyStyle="shortcutKeyStyle" />
</case>
<!-- latin:hasVoiceKey="false" -->
<case
diff --git a/java/res/xml/kbd_symbols_f1.xml b/java/res/xml/kbd_symbols_f1.xml
index bd1047766..da5b5fc8d 100644
--- a/java/res/xml/kbd_symbols_f1.xml
+++ b/java/res/xml/kbd_symbols_f1.xml
@@ -30,7 +30,7 @@
latin:hasVoiceKey="true"
>
<Key
- latin:keyStyle="micKeyStyle"
+ latin:keyStyle="shortcutKeyStyle"
latin:keyWidth="9.2%p" />
</case>
<!-- latin:hasVoiceKey="false" -->
@@ -49,7 +49,7 @@
latin:hasVoiceKey="true"
>
<Key
- latin:keyStyle="micKeyStyle" />
+ latin:keyStyle="shortcutKeyStyle" />
</case>
<!-- latin:hasVoiceKey="false" -->
<default>
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 36f36de2b..889d54bf3 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -22,6 +22,7 @@ import android.graphics.drawable.Drawable;
import android.util.Log;
import com.android.inputmethod.keyboard.internal.Key;
+import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.keyboard.internal.KeyboardParser;
import com.android.inputmethod.keyboard.internal.KeyboardShiftState;
import com.android.inputmethod.latin.R;
@@ -54,7 +55,7 @@ import java.util.Map;
* </pre>
*/
public class Keyboard {
- private static final String TAG = "Keyboard";
+ private static final String TAG = Keyboard.class.getSimpleName();
public static final int EDGE_LEFT = 0x01;
public static final int EDGE_RIGHT = 0x02;
@@ -133,6 +134,8 @@ public class Keyboard {
public final KeyboardId mId;
+ public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet();
+
// Variables for pre-computing nearest keys.
// TODO: Change GRID_WIDTH and GRID_HEIGHT to private.
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index d8d2bffbe..1d70481f4 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -16,6 +16,11 @@
package com.android.inputmethod.keyboard;
+import android.content.res.Resources;
+import android.os.SystemClock;
+import android.util.Log;
+import android.view.MotionEvent;
+
import com.android.inputmethod.keyboard.KeyboardView.UIHandler;
import com.android.inputmethod.keyboard.internal.Key;
import com.android.inputmethod.keyboard.internal.PointerTrackerKeyState;
@@ -24,11 +29,6 @@ import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SubtypeSwitcher;
-import android.content.res.Resources;
-import android.os.SystemClock;
-import android.util.Log;
-import android.view.MotionEvent;
-
import java.util.Arrays;
import java.util.List;
diff --git a/java/src/com/android/inputmethod/keyboard/internal/Key.java b/java/src/com/android/inputmethod/keyboard/internal/Key.java
index c5946ef00..5470067dc 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/Key.java
@@ -16,11 +16,6 @@
package com.android.inputmethod.keyboard.internal;
-import com.android.inputmethod.keyboard.Keyboard;
-import com.android.inputmethod.keyboard.internal.KeyStyles.KeyStyle;
-import com.android.inputmethod.keyboard.internal.KeyboardParser.ParseException;
-import com.android.inputmethod.latin.R;
-
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
@@ -28,6 +23,11 @@ import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.Xml;
+import com.android.inputmethod.keyboard.Keyboard;
+import com.android.inputmethod.keyboard.internal.KeyStyles.KeyStyle;
+import com.android.inputmethod.keyboard.internal.KeyboardParser.ParseException;
+import com.android.inputmethod.latin.R;
+
import java.util.ArrayList;
/**
@@ -165,7 +165,7 @@ public class Key {
mLabel = PopupCharactersParser.getLabel(popupSpecification);
mOutputText = PopupCharactersParser.getOutputText(popupSpecification);
mCode = PopupCharactersParser.getCode(res, popupSpecification);
- mIcon = PopupCharactersParser.getIcon(res, popupSpecification);
+ mIcon = keyboard.mIconsSet.getIcon(PopupCharactersParser.getIconId(popupSpecification));
// Horizontal gap is divided equally to both sides of the key.
mX = x + mGap / 2;
mY = y;
@@ -263,13 +263,18 @@ public class Key {
mEdgeFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyEdgeFlags, 0)
| row.mRowEdgeFlags;
+ final KeyboardIconsSet iconsSet = mKeyboard.mIconsSet;
mVisualInsetsLeft = KeyboardParser.getDimensionOrFraction(keyAttr,
R.styleable.Keyboard_Key_visualInsetsLeft, mKeyboard.getDisplayHeight(), 0);
mVisualInsetsRight = KeyboardParser.getDimensionOrFraction(keyAttr,
R.styleable.Keyboard_Key_visualInsetsRight, mKeyboard.getDisplayHeight(), 0);
- mPreviewIcon = style.getDrawable(keyAttr, R.styleable.Keyboard_Key_iconPreview);
+ mPreviewIcon = iconsSet.getIcon(style.getInt(
+ keyAttr, R.styleable.Keyboard_Key_keyIconPreview,
+ KeyboardIconsSet.ICON_UNDEFINED));
Keyboard.setDefaultBounds(mPreviewIcon);
- mIcon = style.getDrawable(keyAttr, R.styleable.Keyboard_Key_keyIcon);
+ mIcon = iconsSet.getIcon(style.getInt(
+ keyAttr, R.styleable.Keyboard_Key_keyIcon,
+ KeyboardIconsSet.ICON_UNDEFINED));
Keyboard.setDefaultBounds(mIcon);
mHintLetter = style.getText(keyAttr, R.styleable.Keyboard_Key_keyHintLetter);
@@ -288,8 +293,9 @@ public class Key {
mCode = Keyboard.CODE_DUMMY;
}
- final Drawable shiftedIcon = style.getDrawable(keyAttr,
- R.styleable.Keyboard_Key_shiftedIcon);
+ final Drawable shiftedIcon = iconsSet.getIcon(style.getInt(
+ keyAttr, R.styleable.Keyboard_Key_keyIconShifted,
+ KeyboardIconsSet.ICON_UNDEFINED));
if (shiftedIcon != null)
mKeyboard.getShiftedIcons().put(this, shiftedIcon);
} finally {
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java b/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
index dc2f4a15a..983f0649d 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyStyles.java
@@ -16,14 +16,13 @@
package com.android.inputmethod.keyboard.internal;
-import com.android.inputmethod.keyboard.internal.KeyboardParser.ParseException;
-import com.android.inputmethod.latin.R;
-
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
-import android.graphics.drawable.Drawable;
import android.util.Log;
+import com.android.inputmethod.keyboard.internal.KeyboardParser.ParseException;
+import com.android.inputmethod.latin.R;
+
import java.util.ArrayList;
import java.util.HashMap;
@@ -37,7 +36,6 @@ public class KeyStyles {
public interface KeyStyle {
public CharSequence[] getTextArray(TypedArray a, int index);
- public Drawable getDrawable(TypedArray a, int index);
public CharSequence getText(TypedArray a, int index);
public int getInt(TypedArray a, int index, int defaultValue);
public int getFlag(TypedArray a, int index, int defaultValue);
@@ -55,11 +53,6 @@ public class KeyStyles {
}
@Override
- public Drawable getDrawable(TypedArray a, int index) {
- return a.getDrawable(index);
- }
-
- @Override
public CharSequence getText(TypedArray a, int index) {
return a.getText(index);
}
@@ -140,12 +133,6 @@ public class KeyStyles {
}
@Override
- public Drawable getDrawable(TypedArray a, int index) {
- return a.hasValue(index)
- ? super.getDrawable(a, index) : (Drawable)mAttributes.get(index);
- }
-
- @Override
public CharSequence getText(TypedArray a, int index) {
return a.hasValue(index)
? super.getText(a, index) : (CharSequence)mAttributes.get(index);
@@ -177,25 +164,20 @@ public class KeyStyles {
// TODO: Currently not all Key attributes can be declared as style.
readInt(keyAttr, R.styleable.Keyboard_Key_code);
readText(keyAttr, R.styleable.Keyboard_Key_keyLabel);
- readFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelOption);
- readTextArray(keyAttr, R.styleable.Keyboard_Key_popupCharacters);
- readInt(keyAttr, R.styleable.Keyboard_Key_maxPopupKeyboardColumn);
readText(keyAttr, R.styleable.Keyboard_Key_keyOutputText);
- readDrawable(keyAttr, R.styleable.Keyboard_Key_keyIcon);
- readDrawable(keyAttr, R.styleable.Keyboard_Key_iconPreview);
readText(keyAttr, R.styleable.Keyboard_Key_keyHintLetter);
- readDrawable(keyAttr, R.styleable.Keyboard_Key_shiftedIcon);
+ readTextArray(keyAttr, R.styleable.Keyboard_Key_popupCharacters);
+ readFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelOption);
+ readInt(keyAttr, R.styleable.Keyboard_Key_keyIcon);
+ readInt(keyAttr, R.styleable.Keyboard_Key_keyIconPreview);
+ readInt(keyAttr, R.styleable.Keyboard_Key_keyIconShifted);
+ readInt(keyAttr, R.styleable.Keyboard_Key_maxPopupKeyboardColumn);
readBoolean(keyAttr, R.styleable.Keyboard_Key_isFunctional);
readBoolean(keyAttr, R.styleable.Keyboard_Key_isSticky);
readBoolean(keyAttr, R.styleable.Keyboard_Key_isRepeatable);
readBoolean(keyAttr, R.styleable.Keyboard_Key_enabled);
}
- private void readDrawable(TypedArray a, int index) {
- if (a.hasValue(index))
- mAttributes.put(index, a.getDrawable(index));
- }
-
private void readText(TypedArray a, int index) {
if (a.hasValue(index))
mAttributes.put(index, a.getText(index));
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java
new file mode 100644
index 000000000..7be738ceb
--- /dev/null
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.android.inputmethod.keyboard.internal;
+
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+
+import com.android.inputmethod.keyboard.Keyboard;
+import com.android.inputmethod.latin.R;
+
+public class KeyboardIconsSet {
+ public static final int ICON_UNDEFINED = 0;
+
+ // This should be aligned with Keyboard.keyIcon enum.
+ private static final int ICON_SHIFT_KEY = 1;
+ private static final int ICON_TO_SYMBOL_KEY = 2;
+ private static final int ICON_TO_SYMBOL_KEY_WITH_SHORTCUT = 3;
+ private static final int ICON_DELETE_KEY = 4;
+ private static final int ICON_SETTINGS_KEY = 5;
+ private static final int ICON_SHORTCUT_KEY = 6;
+ private static final int ICON_SPACE_KEY = 7;
+ private static final int ICON_RETURN_KEY = 8;
+ private static final int ICON_SEARCH_KEY = 9;
+ private static final int ICON_TAB_KEY = 10;
+ private static final int ICON_NUM1_KEY = 11;
+ private static final int ICON_NUM2_KEY = 12;
+ private static final int ICON_NUM3_KEY = 13;
+ private static final int ICON_NUM4_KEY = 14;
+ private static final int ICON_NUM5_KEY = 15;
+ private static final int ICON_NUM6_KEY = 16;
+ private static final int ICON_NUM7_KEY = 17;
+ private static final int ICON_NUM8_KEY = 18;
+ private static final int ICON_NUM9_KEY = 19;
+ private static final int ICON_NUM0_KEY = 20;
+ private static final int ICON_NUM_STAR_KEY = 21;
+ private static final int ICON_NUM_POUND_KEY = 22;
+ private static final int ICON_NUM_ALT_KEY = 23;
+ // This should be aligned with Keyboard.keyIconShifted enum.
+ private static final int ICON_SHIFTED_SHIFT_KEY = 24;
+ // This should be aligned with Keyboard.keyIconPreview enum.
+ private static final int ICON_PREVIEW_SPACE_KEY = 25;
+ private static final int ICON_PREVIEW_TAB_KEY = 26;
+ private static final int ICON_PREVIEW_SETTINGS_KEY = 27;
+ private static final int ICON_PREVIEW_SHORTCUT_KEY = 28;
+
+ private static final int ICON_LAST = 28;
+
+ private final Drawable mIcons[] = new Drawable[ICON_LAST + 1];
+
+ private static final int getIconId(int attrIndex) {
+ switch (attrIndex) {
+ case R.styleable.Keyboard_iconShiftKey:
+ return ICON_SHIFT_KEY;
+ case R.styleable.Keyboard_iconToSymbolKey:
+ return ICON_TO_SYMBOL_KEY;
+ case R.styleable.Keyboard_iconToSymbolKeyWithShortcut:
+ return ICON_TO_SYMBOL_KEY_WITH_SHORTCUT;
+ case R.styleable.Keyboard_iconDeleteKey:
+ return ICON_DELETE_KEY;
+ case R.styleable.Keyboard_iconSettingsKey:
+ return ICON_SETTINGS_KEY;
+ case R.styleable.Keyboard_iconShortcutKey:
+ return ICON_SHORTCUT_KEY;
+ case R.styleable.Keyboard_iconSpaceKey:
+ return ICON_SPACE_KEY;
+ case R.styleable.Keyboard_iconReturnKey:
+ return ICON_RETURN_KEY;
+ case R.styleable.Keyboard_iconSearchKey:
+ return ICON_SEARCH_KEY;
+ case R.styleable.Keyboard_iconTabKey:
+ return ICON_TAB_KEY;
+ case R.styleable.Keyboard_iconNum1Key:
+ return ICON_NUM1_KEY;
+ case R.styleable.Keyboard_iconNum2Key:
+ return ICON_NUM2_KEY;
+ case R.styleable.Keyboard_iconNum3Key:
+ return ICON_NUM3_KEY;
+ case R.styleable.Keyboard_iconNum4Key:
+ return ICON_NUM4_KEY;
+ case R.styleable.Keyboard_iconNum5Key:
+ return ICON_NUM5_KEY;
+ case R.styleable.Keyboard_iconNum6Key:
+ return ICON_NUM6_KEY;
+ case R.styleable.Keyboard_iconNum7Key:
+ return ICON_NUM7_KEY;
+ case R.styleable.Keyboard_iconNum8Key:
+ return ICON_NUM8_KEY;
+ case R.styleable.Keyboard_iconNum9Key:
+ return ICON_NUM9_KEY;
+ case R.styleable.Keyboard_iconNum0Key:
+ return ICON_NUM0_KEY;
+ case R.styleable.Keyboard_iconNumStarKey:
+ return ICON_NUM_STAR_KEY;
+ case R.styleable.Keyboard_iconNumPoundKey:
+ return ICON_NUM_POUND_KEY;
+ case R.styleable.Keyboard_iconNumAltKey:
+ return ICON_NUM_ALT_KEY;
+ case R.styleable.Keyboard_iconShiftedShiftKey:
+ return ICON_SHIFTED_SHIFT_KEY;
+ case R.styleable.Keyboard_iconPreviewSpaceKey:
+ return ICON_PREVIEW_SPACE_KEY;
+ case R.styleable.Keyboard_iconPreviewTabKey:
+ return ICON_PREVIEW_TAB_KEY;
+ case R.styleable.Keyboard_iconPreviewSettingsKey:
+ return ICON_PREVIEW_SETTINGS_KEY;
+ case R.styleable.Keyboard_iconPreviewShortcutKey:
+ return ICON_PREVIEW_SHORTCUT_KEY;
+ default:
+ return ICON_UNDEFINED;
+ }
+ }
+
+ public void loadIcons(TypedArray keyboardAttrs) {
+ final int count = keyboardAttrs.getIndexCount();
+ for (int i = 0; i < count; i++) {
+ final int attrIndex = keyboardAttrs.getIndex(i);
+ final int iconId = getIconId(attrIndex);
+ if (iconId != ICON_UNDEFINED) {
+ final Drawable icon = keyboardAttrs.getDrawable(attrIndex);
+ Keyboard.setDefaultBounds(icon);
+ mIcons[iconId] = icon;
+ }
+ }
+ }
+
+ public Drawable getIcon(int iconId) {
+ if (iconId == ICON_UNDEFINED)
+ return null;
+ if (iconId < 0 || iconId >= mIcons.length)
+ throw new IllegalArgumentException("icon id is out of range: " + iconId);
+ return mIcons[iconId];
+ }
+}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParser.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParser.java
index f54cf0bea..9525b0e00 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParser.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParser.java
@@ -232,6 +232,8 @@ public class KeyboardParser {
keyboard.setMaxPopupKeyboardColumn(keyAttr.getInt(
R.styleable.Keyboard_Key_maxPopupKeyboardColumn, 5));
+
+ mKeyboard.mIconsSet.loadIcons(keyboardAttr);
} finally {
keyAttr.recycle();
keyboardAttr.recycle();
diff --git a/java/src/com/android/inputmethod/keyboard/internal/MiniKeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/MiniKeyboardBuilder.java
index 7eb3e4623..01faae61d 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/MiniKeyboardBuilder.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/MiniKeyboardBuilder.java
@@ -16,16 +16,16 @@
package com.android.inputmethod.keyboard.internal;
-import com.android.inputmethod.keyboard.Keyboard;
-import com.android.inputmethod.keyboard.KeyboardView;
-import com.android.inputmethod.keyboard.MiniKeyboard;
-import com.android.inputmethod.latin.R;
-
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Paint;
import android.graphics.Rect;
+import com.android.inputmethod.keyboard.Keyboard;
+import com.android.inputmethod.keyboard.KeyboardView;
+import com.android.inputmethod.keyboard.MiniKeyboard;
+import com.android.inputmethod.latin.R;
+
import java.util.List;
public class MiniKeyboardBuilder {
diff --git a/java/src/com/android/inputmethod/keyboard/internal/PopupCharactersParser.java b/java/src/com/android/inputmethod/keyboard/internal/PopupCharactersParser.java
index 3b9a08322..8276f5d78 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/PopupCharactersParser.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/PopupCharactersParser.java
@@ -16,12 +16,12 @@
package com.android.inputmethod.keyboard.internal;
-import com.android.inputmethod.keyboard.Keyboard;
-import com.android.inputmethod.latin.R;
-
import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
import android.text.TextUtils;
+import android.util.Log;
+
+import com.android.inputmethod.keyboard.Keyboard;
+import com.android.inputmethod.latin.R;
/**
* String parser of popupCharacters attribute of Key.
@@ -29,16 +29,19 @@ import android.text.TextUtils;
* Each popup key text is one of the following:
* - A single letter (Letter)
* - Label optionally followed by keyOutputText or code (keyLabel|keyOutputText).
- * - Icon followed by keyOutputText or code (@drawable/icon|@integer/key_code)
+ * - Icon followed by keyOutputText or code (@icon/icon_number|@integer/key_code)
* Special character, comma ',' backslash '\', and bar '|' can be escaped by '\'
* character.
* Note that the character '@' and '\' are also parsed by XML parser and CSV parser as well.
+ * See {@link KeyboardIconsSet} about icon_number.
*/
public class PopupCharactersParser {
+ private static final String TAG = PopupCharactersParser.class.getSimpleName();
+
private static final char ESCAPE = '\\';
private static final String LABEL_END = "|";
private static final String PREFIX_AT = "@";
- private static final String PREFIX_ICON = PREFIX_AT + "drawable/";
+ private static final String PREFIX_ICON = PREFIX_AT + "icon/";
private static final String PREFIX_CODE = PREFIX_AT + "integer/";
private PopupCharactersParser() {
@@ -151,13 +154,18 @@ public class PopupCharactersParser {
return Keyboard.CODE_DUMMY;
}
- public static Drawable getIcon(Resources res, String popupSpec) {
+ public static int getIconId(String popupSpec) {
if (hasIcon(popupSpec)) {
int end = popupSpec.indexOf(LABEL_END, PREFIX_ICON.length() + 1);
- int resId = getResourceId(res, popupSpec.substring(PREFIX_AT.length(), end));
- return res.getDrawable(resId);
+ final String iconId = popupSpec.substring(PREFIX_ICON.length(), end);
+ try {
+ return Integer.valueOf(iconId);
+ } catch (NumberFormatException e) {
+ Log.w(TAG, "illegal icon id specified: " + iconId);
+ return KeyboardIconsSet.ICON_UNDEFINED;
+ }
}
- return null;
+ return KeyboardIconsSet.ICON_UNDEFINED;
}
private static int getResourceId(Resources res, String name) {
diff --git a/java/src/com/android/inputmethod/keyboard/internal/Row.java b/java/src/com/android/inputmethod/keyboard/internal/Row.java
index 99d69ea76..06aadcc05 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/Row.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/Row.java
@@ -16,14 +16,14 @@
package com.android.inputmethod.keyboard.internal;
-import com.android.inputmethod.keyboard.Keyboard;
-import com.android.inputmethod.latin.R;
-
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.util.Xml;
+import com.android.inputmethod.keyboard.Keyboard;
+import com.android.inputmethod.latin.R;
+
/**
* Container for keys in the keyboard. All keys in a row are at the same Y-coordinate.
* Some of the key size defaults can be overridden per row from what the {@link Keyboard}
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/PopupCharactersParserTests.java b/tests/src/com/android/inputmethod/keyboard/internal/PopupCharactersParserTests.java
index be64f89d2..e4a1c68d8 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/PopupCharactersParserTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/PopupCharactersParserTests.java
@@ -16,23 +16,24 @@
package com.android.inputmethod.keyboard.internal;
-import com.android.inputmethod.keyboard.Keyboard;
-import com.android.inputmethod.keyboard.internal.PopupCharactersParser.PopupCharactersParserError;
-import com.android.inputmethod.latin.R;
import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
import android.test.AndroidTestCase;
+import com.android.inputmethod.keyboard.Keyboard;
+import com.android.inputmethod.latin.R;
+
public class PopupCharactersParserTests extends AndroidTestCase {
private Resources mRes;
+ private static final int ICON_SETTINGS_KEY = 5;
+ private static final int ICON_UNDEFINED = KeyboardIconsSet.ICON_UNDEFINED;
+
private static final String CODE_SETTINGS = "@integer/key_settings";
- private static final String ICON_SETTINGS = "@drawable/sym_keyboard_settings";
+ private static final String ICON_SETTINGS = "@icon/" + ICON_SETTINGS_KEY;
private static final String CODE_NON_EXISTING = "@integer/non_existing";
- private static final String ICON_NON_EXISTING = "@drawable/non_existing";
+ private static final String ICON_NON_EXISTING = "@icon/non_existing";
private int mCodeSettings;
- private Drawable mIconSettings;
@Override
protected void setUp() {
@@ -41,33 +42,26 @@ public class PopupCharactersParserTests extends AndroidTestCase {
final String packageName = res.getResourcePackageName(R.string.english_ime_name);
final int codeId = res.getIdentifier(CODE_SETTINGS.substring(1), null, packageName);
- final int iconId = res.getIdentifier(ICON_SETTINGS.substring(1), null, packageName);
mCodeSettings = res.getInteger(codeId);
- mIconSettings = res.getDrawable(iconId);
}
private void assertParser(String message, String popupSpec, String expectedLabel,
- String expectedOutputText, Drawable expectedIcon, int expectedCode) {
+ String expectedOutputText, int expectedIcon, int expectedCode) {
String actualLabel = PopupCharactersParser.getLabel(popupSpec);
assertEquals(message + ": label:", expectedLabel, actualLabel);
String actualOutputText = PopupCharactersParser.getOutputText(popupSpec);
assertEquals(message + ": ouptputText:", expectedOutputText, actualOutputText);
- Drawable actualIcon = PopupCharactersParser.getIcon(mRes, popupSpec);
- // We can not compare drawables, checking null or non-null instead.
- if (expectedIcon == null) {
- assertNull(message + ": icon null:", actualIcon);
- } else {
- assertNotNull(message + ": icon non-null:", actualIcon);
- }
+ int actualIcon = PopupCharactersParser.getIconId(popupSpec);
+ assertEquals(message + ": icon:", expectedIcon, actualIcon);
int actualCode = PopupCharactersParser.getCode(mRes, popupSpec);
assertEquals(message + ": codes value:", expectedCode, actualCode);
}
private void assertParserError(String message, String popupSpec, String expectedLabel,
- String expectedOutputText, Drawable expectedIcon, int expectedCode) {
+ String expectedOutputText, int expectedIcon, int expectedCode) {
try {
assertParser(message, popupSpec, expectedLabel, expectedOutputText, expectedIcon,
expectedCode);
@@ -78,132 +72,149 @@ public class PopupCharactersParserTests extends AndroidTestCase {
}
public void testSingleLetter() {
- assertParser("Single letter", "a", "a", null, null, 'a');
- assertParser("Single escaped bar", "\\|", "|", null, null, '|');
- assertParser("Single escaped escape", "\\\\", "\\", null, null, '\\');
- assertParser("Single comma", ",", ",", null, null, ',');
- assertParser("Single escaped comma", "\\,", ",", null, null, ',');
- assertParser("Single escaped letter", "\\a", "a", null, null, 'a');
- assertParser("Single at", "@", "@", null, null, '@');
- assertParser("Single escaped at", "\\@", "@", null, null, '@');
- assertParser("Single letter with outputText", "a|abc", "a", "abc", null,
- Keyboard.CODE_DUMMY);
- assertParser("Single letter with escaped outputText", "a|a\\|c", "a", "a|c", null,
- Keyboard.CODE_DUMMY);
- assertParser("Single letter with comma outputText", "a|a,b", "a", "a,b", null,
- Keyboard.CODE_DUMMY);
- assertParser("Single letter with escaped comma outputText", "a|a\\,b", "a", "a,b", null,
- Keyboard.CODE_DUMMY);
- assertParser("Single letter with outputText starts with at", "a|@bc", "a", "@bc", null,
- Keyboard.CODE_DUMMY);
- assertParser("Single letter with outputText contains at", "a|a@c", "a", "a@c", null,
- Keyboard.CODE_DUMMY);
- assertParser("Single letter with escaped at outputText", "a|\\@bc", "a", "@bc", null,
- Keyboard.CODE_DUMMY);
- assertParser("Single escaped escape with outputText", "\\\\|\\\\", "\\", "\\", null,
- Keyboard.CODE_DUMMY);
- assertParser("Single escaped bar with outputText", "\\||\\|", "|", "|", null,
- Keyboard.CODE_DUMMY);
- assertParser("Single letter with code", "a|" + CODE_SETTINGS, "a", null, null,
- mCodeSettings);
+ assertParser("Single letter", "a",
+ "a", null, ICON_UNDEFINED, 'a');
+ assertParser("Single escaped bar", "\\|",
+ "|", null, ICON_UNDEFINED, '|');
+ assertParser("Single escaped escape", "\\\\",
+ "\\", null, ICON_UNDEFINED, '\\');
+ assertParser("Single comma", ",",
+ ",", null, ICON_UNDEFINED, ',');
+ assertParser("Single escaped comma", "\\,",
+ ",", null, ICON_UNDEFINED, ',');
+ assertParser("Single escaped letter", "\\a",
+ "a", null, ICON_UNDEFINED, 'a');
+ assertParser("Single at", "@",
+ "@", null, ICON_UNDEFINED, '@');
+ assertParser("Single escaped at", "\\@",
+ "@", null, ICON_UNDEFINED, '@');
+ assertParser("Single letter with outputText", "a|abc",
+ "a", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Single letter with escaped outputText", "a|a\\|c",
+ "a", "a|c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Single letter with comma outputText", "a|a,b",
+ "a", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Single letter with escaped comma outputText", "a|a\\,b",
+ "a", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Single letter with outputText starts with at", "a|@bc",
+ "a", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Single letter with outputText contains at", "a|a@c",
+ "a", "a@c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Single letter with escaped at outputText", "a|\\@bc",
+ "a", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Single escaped escape with outputText", "\\\\|\\\\",
+ "\\", "\\", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Single escaped bar with outputText", "\\||\\|",
+ "|", "|", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Single letter with code", "a|" + CODE_SETTINGS,
+ "a", null, ICON_UNDEFINED, mCodeSettings);
}
public void testLabel() {
- assertParser("Simple label", "abc", "abc", "abc", null, Keyboard.CODE_DUMMY);
- assertParser("Label with escaped bar", "a\\|c", "a|c", "a|c", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with escaped escape", "a\\\\c", "a\\c", "a\\c", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with comma", "a,c", "a,c", "a,c", null, Keyboard.CODE_DUMMY);
- assertParser("Label with escaped comma", "a\\,c", "a,c", "a,c", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label starts with at", "@bc", "@bc", "@bc", null, Keyboard.CODE_DUMMY);
- assertParser("Label contains at", "a@c", "a@c", "a@c", null, Keyboard.CODE_DUMMY);
- assertParser("Label with escaped at", "\\@bc", "@bc", "@bc", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with escaped letter", "\\abc", "abc", "abc", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with outputText", "abc|def", "abc", "def", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with comma and outputText", "a,c|def", "a,c", "def", null,
- Keyboard.CODE_DUMMY);
- assertParser("Escaped comma label with outputText", "a\\,c|def", "a,c", "def", null,
- Keyboard.CODE_DUMMY);
- assertParser("Escaped label with outputText", "a\\|c|def", "a|c", "def", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with escaped bar outputText", "abc|d\\|f", "abc", "d|f", null,
- Keyboard.CODE_DUMMY);
- assertParser("Escaped escape label with outputText", "a\\\\|def", "a\\", "def", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label starts with at and outputText", "@bc|def", "@bc", "def", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label contains at label and outputText", "a@c|def", "a@c", "def", null,
- Keyboard.CODE_DUMMY);
- assertParser("Escaped at label with outputText", "\\@bc|def", "@bc", "def", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with comma outputText", "abc|a,b", "abc", "a,b", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with escaped comma outputText", "abc|a\\,b", "abc", "a,b", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with outputText starts with at", "abc|@bc", "abc", "@bc", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with outputText contains at", "abc|a@c", "abc", "a@c", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with escaped at outputText", "abc|\\@bc", "abc", "@bc", null,
- Keyboard.CODE_DUMMY);
- assertParser("Label with escaped bar outputText", "abc|d\\|f", "abc", "d|f",
- null, Keyboard.CODE_DUMMY);
- assertParser("Escaped bar label with escaped bar outputText", "a\\|c|d\\|f", "a|c", "d|f",
- null, Keyboard.CODE_DUMMY);
- assertParser("Label with code", "abc|" + CODE_SETTINGS, "abc", null, null, mCodeSettings);
- assertParser("Escaped label with code", "a\\|c|" + CODE_SETTINGS, "a|c", null, null,
- mCodeSettings);
+ assertParser("Simple label", "abc",
+ "abc", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with escaped bar", "a\\|c",
+ "a|c", "a|c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with escaped escape", "a\\\\c",
+ "a\\c", "a\\c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with comma", "a,c",
+ "a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with escaped comma", "a\\,c",
+ "a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label starts with at", "@bc",
+ "@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label contains at", "a@c",
+ "a@c", "a@c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with escaped at", "\\@bc",
+ "@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with escaped letter", "\\abc",
+ "abc", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with outputText", "abc|def",
+ "abc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with comma and outputText", "a,c|def",
+ "a,c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Escaped comma label with outputText", "a\\,c|def",
+ "a,c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Escaped label with outputText", "a\\|c|def",
+ "a|c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with escaped bar outputText", "abc|d\\|f",
+ "abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Escaped escape label with outputText", "a\\\\|def",
+ "a\\", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label starts with at and outputText", "@bc|def",
+ "@bc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label contains at label and outputText", "a@c|def",
+ "a@c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Escaped at label with outputText", "\\@bc|def",
+ "@bc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with comma outputText", "abc|a,b",
+ "abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with escaped comma outputText", "abc|a\\,b",
+ "abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with outputText starts with at", "abc|@bc",
+ "abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with outputText contains at", "abc|a@c",
+ "abc", "a@c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with escaped at outputText", "abc|\\@bc",
+ "abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with escaped bar outputText", "abc|d\\|f",
+ "abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Escaped bar label with escaped bar outputText", "a\\|c|d\\|f",
+ "a|c", "d|f", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParser("Label with code", "abc|" + CODE_SETTINGS,
+ "abc", null, ICON_UNDEFINED, mCodeSettings);
+ assertParser("Escaped label with code", "a\\|c|" + CODE_SETTINGS,
+ "a|c", null, ICON_UNDEFINED, mCodeSettings);
}
public void testIconAndCode() {
- assertParser("Icon with outputText", ICON_SETTINGS + "|abc", null, "abc", mIconSettings,
- Keyboard.CODE_DUMMY);
- assertParser("Icon with outputText starts with at", ICON_SETTINGS + "|@bc", null, "@bc",
- mIconSettings, Keyboard.CODE_DUMMY);
- assertParser("Icon with outputText contains at", ICON_SETTINGS + "|a@c", null, "a@c",
- mIconSettings, Keyboard.CODE_DUMMY);
- assertParser("Icon with escaped at outputText", ICON_SETTINGS + "|\\@bc", null, "@bc",
- mIconSettings, Keyboard.CODE_DUMMY);
- assertParser("Label starts with at and code", "@bc|" + CODE_SETTINGS, "@bc", null, null,
- mCodeSettings);
- assertParser("Label contains at and code", "a@c|" + CODE_SETTINGS, "a@c", null, null,
- mCodeSettings);
- assertParser("Escaped at label with code", "\\@bc|" + CODE_SETTINGS, "@bc", null, null,
- mCodeSettings);
- assertParser("Icon with code", ICON_SETTINGS + "|" + CODE_SETTINGS, null, null,
- mIconSettings, mCodeSettings);
+ assertParser("Icon with outputText", ICON_SETTINGS + "|abc",
+ null, "abc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY);
+ assertParser("Icon with outputText starts with at", ICON_SETTINGS + "|@bc",
+ null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY);
+ assertParser("Icon with outputText contains at", ICON_SETTINGS + "|a@c",
+ null, "a@c", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY);
+ assertParser("Icon with escaped at outputText", ICON_SETTINGS + "|\\@bc",
+ null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY);
+ assertParser("Label starts with at and code", "@bc|" + CODE_SETTINGS,
+ "@bc", null, ICON_UNDEFINED, mCodeSettings);
+ assertParser("Label contains at and code", "a@c|" + CODE_SETTINGS,
+ "a@c", null, ICON_UNDEFINED, mCodeSettings);
+ assertParser("Escaped at label with code", "\\@bc|" + CODE_SETTINGS,
+ "@bc", null, ICON_UNDEFINED, mCodeSettings);
+ assertParser("Icon with code", ICON_SETTINGS + "|" + CODE_SETTINGS,
+ null, null, ICON_SETTINGS_KEY, mCodeSettings);
}
public void testFormatError() {
- assertParserError("Empty spec", "", null, null, null, Keyboard.CODE_UNSPECIFIED);
- assertParserError("Empty label with outputText", "|a", null, "a", null,
- Keyboard.CODE_DUMMY);
- assertParserError("Empty label with code", "|" + CODE_SETTINGS, null, null, null,
- mCodeSettings);
- assertParserError("Empty outputText with label", "a|", "a", null, null,
- Keyboard.CODE_UNSPECIFIED);
- assertParserError("Empty outputText with icon", ICON_SETTINGS + "|", null, null,
- mIconSettings, Keyboard.CODE_UNSPECIFIED);
- assertParserError("Empty icon and code", "|", null, null, null, Keyboard.CODE_UNSPECIFIED);
- assertParserError("Icon without code", ICON_SETTINGS, null, null, mIconSettings,
- Keyboard.CODE_DUMMY);
- assertParserError("Non existing icon", ICON_NON_EXISTING + "|abc", null, "abc", null,
- Keyboard.CODE_DUMMY);
- assertParserError("Non existing code", "abc|" + CODE_NON_EXISTING, "abc", null, null,
- Keyboard.CODE_UNSPECIFIED);
- assertParserError("Third bar at end", "a|b|", "a", null, null, Keyboard.CODE_UNSPECIFIED);
- assertParserError("Multiple bar", "a|b|c", "a", null, null, Keyboard.CODE_UNSPECIFIED);
- assertParserError("Multiple bar with label and code", "a|" + CODE_SETTINGS + "|c", "a",
- null, null, mCodeSettings);
- assertParserError("Multiple bar with icon and outputText", ICON_SETTINGS + "|b|c", null,
- null, mIconSettings, Keyboard.CODE_UNSPECIFIED);
+ assertParserError("Empty spec", "", null,
+ null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
+ assertParserError("Empty label with outputText", "|a",
+ null, "a", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParserError("Empty label with code", "|" + CODE_SETTINGS,
+ null, null, ICON_UNDEFINED, mCodeSettings);
+ assertParserError("Empty outputText with label", "a|",
+ "a", null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
+ assertParserError("Empty outputText with icon", ICON_SETTINGS + "|",
+ null, null, ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED);
+ assertParserError("Empty icon and code", "|",
+ null, null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
+ assertParserError("Icon without code", ICON_SETTINGS,
+ null, null, ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY);
+ assertParser("Non existing icon", ICON_NON_EXISTING + "|abc",
+ null, "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
+ assertParserError("Non existing code", "abc|" + CODE_NON_EXISTING,
+ "abc", null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
+ assertParserError("Third bar at end", "a|b|",
+ "a", null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
+ assertParserError("Multiple bar", "a|b|c",
+ "a", null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
+ assertParserError("Multiple bar with label and code", "a|" + CODE_SETTINGS + "|c",
+ "a", null, ICON_UNDEFINED, mCodeSettings);
+ assertParserError("Multiple bar with icon and outputText", ICON_SETTINGS + "|b|c",
+ null, null, ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED);
assertParserError("Multiple bar with icon and code",
- ICON_SETTINGS + "|" + CODE_SETTINGS + "|c", null, null, mIconSettings,
- mCodeSettings);
+ ICON_SETTINGS + "|" + CODE_SETTINGS + "|c",
+ null, null, ICON_SETTINGS_KEY, mCodeSettings);
}
}