Move icon declaration to Keyboard theme

Bug: 4436327
Change-Id: I074014d28dcb323b60dbc8fd9e169c75c393e0b3
main
Tadashi G. Takaoka 2011-06-21 23:38:42 +09:00
parent 72934bd596
commit c2a21786e5
41 changed files with 981 additions and 1129 deletions

View File

@ -141,6 +141,35 @@
<attr name="popupKeyboardTemplate" format="reference" /> <attr name="popupKeyboardTemplate" format="reference" />
<!-- Locale of the keyboard layout --> <!-- Locale of the keyboard layout -->
<attr name="keyboardLocale" format="string" /> <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>
<declare-styleable name="Keyboard_Key"> <declare-styleable name="Keyboard_Key">
@ -163,8 +192,6 @@
<attr name="isSticky" format="boolean" /> <attr name="isSticky" format="boolean" />
<!-- Whether long-pressing on this key will make it repeat. --> <!-- Whether long-pressing on this key will make it repeat. -->
<attr name="isRepeatable" format="boolean" /> <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. --> <!-- The string of characters to output when this key is pressed. -->
<attr name="keyOutputText" format="string" /> <attr name="keyOutputText" format="string" />
<!-- The label to display on the key. --> <!-- The label to display on the key. -->
@ -182,11 +209,47 @@
<flag name="hasUppercaseLetter" value="0x40" /> <flag name="hasUppercaseLetter" value="0x40" />
</attr> </attr>
<!-- The icon to display on the key instead of the label. --> <!-- 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/> --> <!-- The key style to specify a set of key attributes defined by <key_style/> -->
<attr name="keyStyle" format="string" /> <attr name="keyStyle" format="string" />
<!-- Shift key icon for shifted state -->
<attr name="shiftedIcon" format="reference" />
<!-- The key is enabled and responds on press. --> <!-- The key is enabled and responds on press. -->
<attr name="enabled" format="boolean" /> <attr name="enabled" format="boolean" />
<!-- Visual insets --> <!-- Visual insets -->

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -38,137 +38,66 @@
</case> </case>
</switch> </switch>
<!-- Functional key styles --> <!-- 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> <switch>
<case <case
latin:colorScheme="white" latin:voiceKeyEnabled="true"
> >
<key-style <key-style
latin:styleName="shiftKeyStyle" latin:styleName="shortcutOrSettingsKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_shortcut"
latin:keyIcon="@drawable/sym_keyboard_shift_holo" latin:keyIcon="iconShortcutKey"
latin:shiftedIcon="@drawable/sym_keyboard_shift_locked_holo" latin:keyIconPreview="iconPreviewShortcutKey"
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:keyLabelOption="popupHint"
latin:popupCharacters="@string/alternates_for_smiley" latin:popupCharacters="\@icon/5|\@integer/key_settings"
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>
</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" />
<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" /> 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> </case>
<default>
<key-style
latin:styleName="shortcutOrSettingsKeyStyle"
latin:code="@integer/key_settings"
latin:keyIcon="iconSettingsKey"
latin:keyIconPreview="iconPreviewSettingsKey"
latin:parentStyle="functionalKeyStyle" />
</default>
</switch> </switch>
<key-style <key-style
latin:styleName="tabKeyStyle" latin:styleName="tabKeyStyle"
latin:code="@integer/key_tab" latin:code="@integer/key_tab"
latin:keyIcon="@drawable/sym_keyboard_tab_holo" latin:keyIcon="iconTabKey"
latin:iconPreview="@drawable/sym_keyboard_tab_holo" latin:keyIconPreview="iconPreviewTabKey"
latin:parentStyle="functionalKeyStyle" /> latin:parentStyle="functionalKeyStyle" />
<key-style <key-style
latin:styleName="toSymbolKeyStyle" latin:styleName="toSymbolKeyStyle"

View File

@ -80,7 +80,7 @@
latin:keyStyle="num0KeyStyle" /> latin:keyStyle="num0KeyStyle" />
<Spacer /> <Spacer />
<Key <Key
latin:keyStyle="micOrSettingsKeyStyle" latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-11.00%p" latin:keyXPos="-11.00%p"
latin:keyWidth="fillRight" latin:keyWidth="fillRight"
latin:keyEdgeFlags="right" /> latin:keyEdgeFlags="right" />
@ -176,7 +176,7 @@
<Key <Key
latin:keyLabel="#" /> latin:keyLabel="#" />
<Key <Key
latin:keyStyle="micOrSettingsKeyStyle" latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-11.00%p" latin:keyXPos="-11.00%p"
latin:keyWidth="fillBoth" latin:keyWidth="fillBoth"
latin:keyEdgeFlags="right" /> latin:keyEdgeFlags="right" />

View File

@ -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>

View File

@ -109,7 +109,7 @@
<Key <Key
latin:keyStyle="numPoundKeyStyle" /> latin:keyStyle="numPoundKeyStyle" />
<Key <Key
latin:keyStyle="micOrSettingsKeyStyle" latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-11.00%p" latin:keyXPos="-11.00%p"
latin:keyWidth="fillBoth" latin:keyWidth="fillBoth"
latin:keyEdgeFlags="right" /> latin:keyEdgeFlags="right" />

View File

@ -118,7 +118,7 @@
<Key <Key
latin:keyStyle="numPoundKeyStyle" /> latin:keyStyle="numPoundKeyStyle" />
<Key <Key
latin:keyStyle="micOrSettingsKeyStyle" latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-11.00%p" latin:keyXPos="-11.00%p"
latin:keyWidth="fillBoth" latin:keyWidth="fillBoth"
latin:keyEdgeFlags="right" /> latin:keyEdgeFlags="right" />

View File

@ -155,7 +155,7 @@
</default> </default>
</switch> </switch>
<Key <Key
latin:keyStyle="micOrSettingsKeyStyle" latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-10.0%p" latin:keyXPos="-10.0%p"
latin:keyWidth="fillBoth" latin:keyWidth="fillBoth"
latin:keyEdgeFlags="right" /> latin:keyEdgeFlags="right" />

View File

@ -210,7 +210,7 @@
</default> </default>
</switch> </switch>
<Key <Key
latin:keyStyle="micOrSettingsKeyStyle" latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-10.0%p" latin:keyXPos="-10.0%p"
latin:keyWidth="fillBoth" latin:keyWidth="fillBoth"
latin:keyEdgeFlags="right" /> latin:keyEdgeFlags="right" />

View File

@ -148,7 +148,7 @@
latin:keyXPos="30.750%p" latin:keyXPos="30.750%p"
latin:keyWidth="39.750%p" /> latin:keyWidth="39.750%p" />
<Key <Key
latin:keyStyle="micOrSettingsKeyStyle" latin:keyStyle="shortcutOrSettingsKeyStyle"
latin:keyXPos="-10.0%p" latin:keyXPos="-10.0%p"
latin:keyWidth="fillRight" latin:keyWidth="fillRight"
latin:keyEdgeFlags="right" /> latin:keyEdgeFlags="right" />

View File

@ -29,110 +29,59 @@
<key-style <key-style
latin:styleName="functionalKeyStyle" latin:styleName="functionalKeyStyle"
latin:isFunctional="true" /> 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>
<case <case
latin:colorScheme="black" latin:colorScheme="black"
> >
<key-style <key-style
latin:styleName="functionalKeyStyle" /> 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> </case>
</switch> </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 <key-style
latin:styleName="tabKeyStyle" latin:styleName="tabKeyStyle"
latin:code="@integer/key_tab" latin:code="@integer/key_tab"

View File

@ -193,7 +193,7 @@
latin:voiceKeyEnabled="true" latin:voiceKeyEnabled="true"
> >
<Key <Key
latin:keyStyle="micKeyStyle" latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p" latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" /> latin:keyWidth="fillRight" />
</case> </case>

View File

@ -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>

View File

@ -123,7 +123,7 @@
latin:voiceKeyEnabled="true" latin:voiceKeyEnabled="true"
> >
<Key <Key
latin:keyStyle="micKeyStyle" latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p" latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" /> latin:keyWidth="fillRight" />
</case> </case>

View File

@ -134,7 +134,7 @@
latin:voiceKeyEnabled="true" latin:voiceKeyEnabled="true"
> >
<Key <Key
latin:keyStyle="micKeyStyle" latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p" latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" /> latin:keyWidth="fillRight" />
</case> </case>

View File

@ -132,7 +132,7 @@
latin:voiceKeyEnabled="true" latin:voiceKeyEnabled="true"
> >
<Key <Key
latin:keyStyle="micKeyStyle" latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p" latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" /> latin:keyWidth="fillRight" />
</case> </case>

View File

@ -186,7 +186,7 @@
latin:voiceKeyEnabled="true" latin:voiceKeyEnabled="true"
> >
<Key <Key
latin:keyStyle="micKeyStyle" latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p" latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" /> latin:keyWidth="fillRight" />
</case> </case>

View File

@ -166,7 +166,7 @@
latin:voiceKeyEnabled="true" latin:voiceKeyEnabled="true"
> >
<Key <Key
latin:keyStyle="micKeyStyle" latin:keyStyle="shortcutKeyStyle"
latin:keyXPos="-8.047%p" latin:keyXPos="-8.047%p"
latin:keyWidth="fillRight" /> latin:keyWidth="fillRight" />
</case> </case>

View File

@ -23,7 +23,7 @@
> >
<!-- Base key style for the functional key --> <!-- Base key style for the functional key -->
<switch> <switch>
<case <case
latin:colorScheme="white" latin:colorScheme="white"
> >
<key-style <key-style
@ -51,159 +51,76 @@
<key-style <key-style
latin:styleName="settingsPopupStyle" latin:styleName="settingsPopupStyle"
latin:keyLabelOption="popupHint" latin:keyLabelOption="popupHint"
latin:popupCharacters="\@drawable/sym_keyboard_settings_holo|\@integer/key_settings" latin:popupCharacters="\@icon/5|\@integer/key_settings"
latin:parentStyle="functionalKeyStyle" /> latin:parentStyle="functionalKeyStyle" />
</default> </default>
</switch> </switch>
<!-- Functional key styles --> <!-- 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> <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 <case
latin:colorScheme="white" latin:voiceKeyEnabled="true"
latin:hasVoiceKey="false"
> >
<key-style <key-style
latin:styleName="shiftKeyStyle" latin:styleName="toSymbolKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_switch_alpha_symbol"
latin:keyIcon="@drawable/sym_keyboard_shift" latin:keyIcon="iconToSymbolKeyWithShortcut"
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" /> 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: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>
<case <default>
latin:colorScheme="black"
>
<key-style <key-style
latin:styleName="shiftKeyStyle" latin:styleName="toSymbolKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_switch_alpha_symbol"
latin:keyIcon="@drawable/sym_bkeyboard_shift" latin:keyLabel="@string/label_to_symbol_key"
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" /> latin:parentStyle="functionalKeyStyle" />
<key-style </default>
latin:styleName="spaceKeyStyle"
latin:code="@integer/key_space"
latin:keyIcon="@drawable/sym_bkeyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space"
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="tabKeyStyle"
latin:code="@integer/key_tab"
latin:keyIcon="@drawable/sym_bkeyboard_tab"
latin:iconPreview="@drawable/sym_keyboard_feedback_tab"
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>
</switch> </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 --> <!-- Return key style -->
<switch> <switch>
<case <case
@ -245,52 +162,18 @@
<case <case
latin:imeAction="actionSearch" latin:imeAction="actionSearch"
> >
<switch> <key-style
<case latin:styleName="returnKeyStyle"
latin:colorScheme="white" latin:code="@integer/key_return"
> latin:keyIcon="iconSearchKey"
<key-style latin:parentStyle="functionalKeyStyle" />
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>
</case> </case>
<default> <default>
<switch> <key-style
<case latin:styleName="returnKeyStyle"
latin:colorScheme="white" latin:code="@integer/key_return"
> latin:keyIcon="iconReturnKey"
<key-style latin:parentStyle="functionalKeyStyle" />
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>
</default> </default>
</switch> </switch>
<key-style <key-style
@ -335,4 +218,4 @@
latin:parentStyle="functionalKeyStyle" /> latin:parentStyle="functionalKeyStyle" />
</default> </default>
</switch> </switch>
</merge> </merge>

View File

@ -21,130 +21,61 @@
<merge <merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
> >
<switch> <key-style
<case latin:styleName="num0KeyStyle"
latin:colorScheme="white" latin:code="48"
> latin:keyIcon="iconNum0Key" />
<key-style <key-style
latin:styleName="num0KeyStyle" latin:styleName="num1KeyStyle"
latin:code="48" latin:code="49"
latin:keyIcon="@drawable/sym_keyboard_num0" /> latin:keyIcon="iconNum1Key" />
<key-style <key-style
latin:styleName="num1KeyStyle" latin:styleName="num2KeyStyle"
latin:code="49" latin:code="50"
latin:keyIcon="@drawable/sym_keyboard_num1" /> latin:keyIcon="iconNum2Key" />
<key-style <key-style
latin:styleName="num2KeyStyle" latin:styleName="num3KeyStyle"
latin:code="50" latin:code="51"
latin:keyIcon="@drawable/sym_keyboard_num2" /> latin:keyIcon="iconNum3Key" />
<key-style <key-style
latin:styleName="num3KeyStyle" latin:styleName="num4KeyStyle"
latin:code="51" latin:code="52"
latin:keyIcon="@drawable/sym_keyboard_num3" /> latin:keyIcon="iconNum4Key" />
<key-style <key-style
latin:styleName="num4KeyStyle" latin:styleName="num5KeyStyle"
latin:code="52" latin:code="53"
latin:keyIcon="@drawable/sym_keyboard_num4" /> latin:keyIcon="iconNum5Key" />
<key-style <key-style
latin:styleName="num5KeyStyle" latin:styleName="num6KeyStyle"
latin:code="53" latin:code="54"
latin:keyIcon="@drawable/sym_keyboard_num5" /> latin:keyIcon="iconNum6Key" />
<key-style <key-style
latin:styleName="num6KeyStyle" latin:styleName="num7KeyStyle"
latin:code="54" latin:code="55"
latin:keyIcon="@drawable/sym_keyboard_num6" /> latin:keyIcon="iconNum7Key" />
<key-style <key-style
latin:styleName="num7KeyStyle" latin:styleName="num8KeyStyle"
latin:code="55" latin:code="56"
latin:keyIcon="@drawable/sym_keyboard_num7" /> latin:keyIcon="iconNum8Key" />
<key-style <key-style
latin:styleName="num8KeyStyle" latin:styleName="num9KeyStyle"
latin:code="56" latin:code="57"
latin:keyIcon="@drawable/sym_keyboard_num8" /> latin:keyIcon="iconNum9Key" />
<key-style <key-style
latin:styleName="num9KeyStyle" latin:styleName="numStarKeyStyle"
latin:code="57" latin:code="42"
latin:keyIcon="@drawable/sym_keyboard_num9" /> latin:keyIcon="iconNumStarKey" />
<key-style <key-style
latin:styleName="numStarKeyStyle" latin:styleName="numPoundKeyStyle"
latin:code="42" latin:code="35"
latin:keyIcon="@drawable/sym_keyboard_numstar" /> latin:keyIcon="iconNumPoundKey" />
<key-style <key-style
latin:styleName="numPoundKeyStyle" latin:styleName="numAltKeyStyle"
latin:code="35" latin:code="@integer/key_switch_alpha_symbol"
latin:keyIcon="@drawable/sym_keyboard_numpound" /> latin:keyIcon="iconNumAltKey" />
<key-style <key-style
latin:styleName="numAltKeyStyle" latin:styleName="numSpaceKeyStyle"
latin:code="@integer/key_switch_alpha_symbol" latin:code="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_numalt" latin:keyIcon="iconSpaceKey"
latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" /> latin:keyIconPreview="iconPreviewSpaceKey" />
<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> </merge>

View File

@ -48,7 +48,7 @@
latin:hasVoiceKey="true" latin:hasVoiceKey="true"
> >
<Key <Key
latin:keyStyle="micKeyStyle" latin:keyStyle="shortcutKeyStyle"
latin:keyWidth="9.2%p" /> latin:keyWidth="9.2%p" />
</case> </case>
<!-- latin:hasVoiceKey="false" --> <!-- latin:hasVoiceKey="false" -->
@ -93,7 +93,7 @@
latin:hasVoiceKey="true" latin:hasVoiceKey="true"
> >
<Key <Key
latin:keyStyle="micKeyStyle" /> latin:keyStyle="shortcutKeyStyle" />
</case> </case>
<!-- latin:hasVoiceKey="false" --> <!-- latin:hasVoiceKey="false" -->
<case <case

View File

@ -30,7 +30,7 @@
latin:hasVoiceKey="true" latin:hasVoiceKey="true"
> >
<Key <Key
latin:keyStyle="micKeyStyle" latin:keyStyle="shortcutKeyStyle"
latin:keyWidth="9.2%p" /> latin:keyWidth="9.2%p" />
</case> </case>
<!-- latin:hasVoiceKey="false" --> <!-- latin:hasVoiceKey="false" -->
@ -49,7 +49,7 @@
latin:hasVoiceKey="true" latin:hasVoiceKey="true"
> >
<Key <Key
latin:keyStyle="micKeyStyle" /> latin:keyStyle="shortcutKeyStyle" />
</case> </case>
<!-- latin:hasVoiceKey="false" --> <!-- latin:hasVoiceKey="false" -->
<default> <default>

View File

@ -22,6 +22,7 @@ import android.graphics.drawable.Drawable;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.keyboard.internal.Key; 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.KeyboardParser;
import com.android.inputmethod.keyboard.internal.KeyboardShiftState; import com.android.inputmethod.keyboard.internal.KeyboardShiftState;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
@ -54,7 +55,7 @@ import java.util.Map;
* </pre> * </pre>
*/ */
public class Keyboard { 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_LEFT = 0x01;
public static final int EDGE_RIGHT = 0x02; public static final int EDGE_RIGHT = 0x02;
@ -133,6 +134,8 @@ public class Keyboard {
public final KeyboardId mId; public final KeyboardId mId;
public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet();
// Variables for pre-computing nearest keys. // Variables for pre-computing nearest keys.
// TODO: Change GRID_WIDTH and GRID_HEIGHT to private. // TODO: Change GRID_WIDTH and GRID_HEIGHT to private.

View File

@ -16,6 +16,11 @@
package com.android.inputmethod.keyboard; 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.KeyboardView.UIHandler;
import com.android.inputmethod.keyboard.internal.Key; import com.android.inputmethod.keyboard.internal.Key;
import com.android.inputmethod.keyboard.internal.PointerTrackerKeyState; 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.R;
import com.android.inputmethod.latin.SubtypeSwitcher; 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.Arrays;
import java.util.List; import java.util.List;

View File

@ -16,11 +16,6 @@
package com.android.inputmethod.keyboard.internal; 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.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.content.res.XmlResourceParser; import android.content.res.XmlResourceParser;
@ -28,6 +23,11 @@ import android.graphics.drawable.Drawable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Xml; 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; import java.util.ArrayList;
/** /**
@ -165,7 +165,7 @@ public class Key {
mLabel = PopupCharactersParser.getLabel(popupSpecification); mLabel = PopupCharactersParser.getLabel(popupSpecification);
mOutputText = PopupCharactersParser.getOutputText(popupSpecification); mOutputText = PopupCharactersParser.getOutputText(popupSpecification);
mCode = PopupCharactersParser.getCode(res, 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. // Horizontal gap is divided equally to both sides of the key.
mX = x + mGap / 2; mX = x + mGap / 2;
mY = y; mY = y;
@ -263,13 +263,18 @@ public class Key {
mEdgeFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyEdgeFlags, 0) mEdgeFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyEdgeFlags, 0)
| row.mRowEdgeFlags; | row.mRowEdgeFlags;
final KeyboardIconsSet iconsSet = mKeyboard.mIconsSet;
mVisualInsetsLeft = KeyboardParser.getDimensionOrFraction(keyAttr, mVisualInsetsLeft = KeyboardParser.getDimensionOrFraction(keyAttr,
R.styleable.Keyboard_Key_visualInsetsLeft, mKeyboard.getDisplayHeight(), 0); R.styleable.Keyboard_Key_visualInsetsLeft, mKeyboard.getDisplayHeight(), 0);
mVisualInsetsRight = KeyboardParser.getDimensionOrFraction(keyAttr, mVisualInsetsRight = KeyboardParser.getDimensionOrFraction(keyAttr,
R.styleable.Keyboard_Key_visualInsetsRight, mKeyboard.getDisplayHeight(), 0); 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); 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); Keyboard.setDefaultBounds(mIcon);
mHintLetter = style.getText(keyAttr, R.styleable.Keyboard_Key_keyHintLetter); mHintLetter = style.getText(keyAttr, R.styleable.Keyboard_Key_keyHintLetter);
@ -288,8 +293,9 @@ public class Key {
mCode = Keyboard.CODE_DUMMY; mCode = Keyboard.CODE_DUMMY;
} }
final Drawable shiftedIcon = style.getDrawable(keyAttr, final Drawable shiftedIcon = iconsSet.getIcon(style.getInt(
R.styleable.Keyboard_Key_shiftedIcon); keyAttr, R.styleable.Keyboard_Key_keyIconShifted,
KeyboardIconsSet.ICON_UNDEFINED));
if (shiftedIcon != null) if (shiftedIcon != null)
mKeyboard.getShiftedIcons().put(this, shiftedIcon); mKeyboard.getShiftedIcons().put(this, shiftedIcon);
} finally { } finally {

View File

@ -16,14 +16,13 @@
package com.android.inputmethod.keyboard.internal; 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.TypedArray;
import android.content.res.XmlResourceParser; import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.util.Log; 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.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -37,7 +36,6 @@ public class KeyStyles {
public interface KeyStyle { public interface KeyStyle {
public CharSequence[] getTextArray(TypedArray a, int index); public CharSequence[] getTextArray(TypedArray a, int index);
public Drawable getDrawable(TypedArray a, int index);
public CharSequence getText(TypedArray a, int index); public CharSequence getText(TypedArray a, int index);
public int getInt(TypedArray a, int index, int defaultValue); public int getInt(TypedArray a, int index, int defaultValue);
public int getFlag(TypedArray a, int index, int defaultValue); public int getFlag(TypedArray a, int index, int defaultValue);
@ -54,11 +52,6 @@ public class KeyStyles {
return parseTextArray(a, index); return parseTextArray(a, index);
} }
@Override
public Drawable getDrawable(TypedArray a, int index) {
return a.getDrawable(index);
}
@Override @Override
public CharSequence getText(TypedArray a, int index) { public CharSequence getText(TypedArray a, int index) {
return a.getText(index); return a.getText(index);
@ -139,12 +132,6 @@ public class KeyStyles {
? super.getTextArray(a, index) : (CharSequence[])mAttributes.get(index); ? super.getTextArray(a, index) : (CharSequence[])mAttributes.get(index);
} }
@Override
public Drawable getDrawable(TypedArray a, int index) {
return a.hasValue(index)
? super.getDrawable(a, index) : (Drawable)mAttributes.get(index);
}
@Override @Override
public CharSequence getText(TypedArray a, int index) { public CharSequence getText(TypedArray a, int index) {
return a.hasValue(index) return a.hasValue(index)
@ -177,25 +164,20 @@ public class KeyStyles {
// TODO: Currently not all Key attributes can be declared as style. // TODO: Currently not all Key attributes can be declared as style.
readInt(keyAttr, R.styleable.Keyboard_Key_code); readInt(keyAttr, R.styleable.Keyboard_Key_code);
readText(keyAttr, R.styleable.Keyboard_Key_keyLabel); 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); 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); 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_isFunctional);
readBoolean(keyAttr, R.styleable.Keyboard_Key_isSticky); readBoolean(keyAttr, R.styleable.Keyboard_Key_isSticky);
readBoolean(keyAttr, R.styleable.Keyboard_Key_isRepeatable); readBoolean(keyAttr, R.styleable.Keyboard_Key_isRepeatable);
readBoolean(keyAttr, R.styleable.Keyboard_Key_enabled); 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) { private void readText(TypedArray a, int index) {
if (a.hasValue(index)) if (a.hasValue(index))
mAttributes.put(index, a.getText(index)); mAttributes.put(index, a.getText(index));

View File

@ -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];
}
}

View File

@ -232,6 +232,8 @@ public class KeyboardParser {
keyboard.setMaxPopupKeyboardColumn(keyAttr.getInt( keyboard.setMaxPopupKeyboardColumn(keyAttr.getInt(
R.styleable.Keyboard_Key_maxPopupKeyboardColumn, 5)); R.styleable.Keyboard_Key_maxPopupKeyboardColumn, 5));
mKeyboard.mIconsSet.loadIcons(keyboardAttr);
} finally { } finally {
keyAttr.recycle(); keyAttr.recycle();
keyboardAttr.recycle(); keyboardAttr.recycle();

View File

@ -16,16 +16,16 @@
package com.android.inputmethod.keyboard.internal; 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.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Rect; 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; import java.util.List;
public class MiniKeyboardBuilder { public class MiniKeyboardBuilder {

View File

@ -16,29 +16,32 @@
package com.android.inputmethod.keyboard.internal; package com.android.inputmethod.keyboard.internal;
import android.content.res.Resources;
import android.text.TextUtils;
import android.util.Log;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
/** /**
* String parser of popupCharacters attribute of Key. * String parser of popupCharacters attribute of Key.
* The string is comma separated texts each of which represents one popup key. * The string is comma separated texts each of which represents one popup key.
* Each popup key text is one of the following: * Each popup key text is one of the following:
* - A single letter (Letter) * - A single letter (Letter)
* - Label optionally followed by keyOutputText or code (keyLabel|keyOutputText). * - 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 '\' * Special character, comma ',' backslash '\', and bar '|' can be escaped by '\'
* character. * character.
* Note that the character '@' and '\' are also parsed by XML parser and CSV parser as well. * 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 { public class PopupCharactersParser {
private static final String TAG = PopupCharactersParser.class.getSimpleName();
private static final char ESCAPE = '\\'; private static final char ESCAPE = '\\';
private static final String LABEL_END = "|"; private static final String LABEL_END = "|";
private static final String PREFIX_AT = "@"; 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 static final String PREFIX_CODE = PREFIX_AT + "integer/";
private PopupCharactersParser() { private PopupCharactersParser() {
@ -151,13 +154,18 @@ public class PopupCharactersParser {
return Keyboard.CODE_DUMMY; return Keyboard.CODE_DUMMY;
} }
public static Drawable getIcon(Resources res, String popupSpec) { public static int getIconId(String popupSpec) {
if (hasIcon(popupSpec)) { if (hasIcon(popupSpec)) {
int end = popupSpec.indexOf(LABEL_END, PREFIX_ICON.length() + 1); int end = popupSpec.indexOf(LABEL_END, PREFIX_ICON.length() + 1);
int resId = getResourceId(res, popupSpec.substring(PREFIX_AT.length(), end)); final String iconId = popupSpec.substring(PREFIX_ICON.length(), end);
return res.getDrawable(resId); 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) { private static int getResourceId(Resources res, String name) {

View File

@ -16,14 +16,14 @@
package com.android.inputmethod.keyboard.internal; 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.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.content.res.XmlResourceParser; import android.content.res.XmlResourceParser;
import android.util.Xml; 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. * 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} * Some of the key size defaults can be overridden per row from what the {@link Keyboard}

View File

@ -16,23 +16,24 @@
package com.android.inputmethod.keyboard.internal; 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.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.latin.R;
public class PopupCharactersParserTests extends AndroidTestCase { public class PopupCharactersParserTests extends AndroidTestCase {
private Resources mRes; 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 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 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 int mCodeSettings;
private Drawable mIconSettings;
@Override @Override
protected void setUp() { protected void setUp() {
@ -41,33 +42,26 @@ public class PopupCharactersParserTests extends AndroidTestCase {
final String packageName = res.getResourcePackageName(R.string.english_ime_name); final String packageName = res.getResourcePackageName(R.string.english_ime_name);
final int codeId = res.getIdentifier(CODE_SETTINGS.substring(1), null, packageName); 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); mCodeSettings = res.getInteger(codeId);
mIconSettings = res.getDrawable(iconId);
} }
private void assertParser(String message, String popupSpec, String expectedLabel, 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); String actualLabel = PopupCharactersParser.getLabel(popupSpec);
assertEquals(message + ": label:", expectedLabel, actualLabel); assertEquals(message + ": label:", expectedLabel, actualLabel);
String actualOutputText = PopupCharactersParser.getOutputText(popupSpec); String actualOutputText = PopupCharactersParser.getOutputText(popupSpec);
assertEquals(message + ": ouptputText:", expectedOutputText, actualOutputText); assertEquals(message + ": ouptputText:", expectedOutputText, actualOutputText);
Drawable actualIcon = PopupCharactersParser.getIcon(mRes, popupSpec); int actualIcon = PopupCharactersParser.getIconId(popupSpec);
// We can not compare drawables, checking null or non-null instead. assertEquals(message + ": icon:", expectedIcon, actualIcon);
if (expectedIcon == null) {
assertNull(message + ": icon null:", actualIcon);
} else {
assertNotNull(message + ": icon non-null:", actualIcon);
}
int actualCode = PopupCharactersParser.getCode(mRes, popupSpec); int actualCode = PopupCharactersParser.getCode(mRes, popupSpec);
assertEquals(message + ": codes value:", expectedCode, actualCode); assertEquals(message + ": codes value:", expectedCode, actualCode);
} }
private void assertParserError(String message, String popupSpec, String expectedLabel, private void assertParserError(String message, String popupSpec, String expectedLabel,
String expectedOutputText, Drawable expectedIcon, int expectedCode) { String expectedOutputText, int expectedIcon, int expectedCode) {
try { try {
assertParser(message, popupSpec, expectedLabel, expectedOutputText, expectedIcon, assertParser(message, popupSpec, expectedLabel, expectedOutputText, expectedIcon,
expectedCode); expectedCode);
@ -78,132 +72,149 @@ public class PopupCharactersParserTests extends AndroidTestCase {
} }
public void testSingleLetter() { public void testSingleLetter() {
assertParser("Single letter", "a", "a", null, null, 'a'); assertParser("Single letter", "a",
assertParser("Single escaped bar", "\\|", "|", null, null, '|'); "a", null, ICON_UNDEFINED, 'a');
assertParser("Single escaped escape", "\\\\", "\\", null, null, '\\'); assertParser("Single escaped bar", "\\|",
assertParser("Single comma", ",", ",", null, null, ','); "|", null, ICON_UNDEFINED, '|');
assertParser("Single escaped comma", "\\,", ",", null, null, ','); assertParser("Single escaped escape", "\\\\",
assertParser("Single escaped letter", "\\a", "a", null, null, 'a'); "\\", null, ICON_UNDEFINED, '\\');
assertParser("Single at", "@", "@", null, null, '@'); assertParser("Single comma", ",",
assertParser("Single escaped at", "\\@", "@", null, null, '@'); ",", null, ICON_UNDEFINED, ',');
assertParser("Single letter with outputText", "a|abc", "a", "abc", null, assertParser("Single escaped comma", "\\,",
Keyboard.CODE_DUMMY); ",", null, ICON_UNDEFINED, ',');
assertParser("Single letter with escaped outputText", "a|a\\|c", "a", "a|c", null, assertParser("Single escaped letter", "\\a",
Keyboard.CODE_DUMMY); "a", null, ICON_UNDEFINED, 'a');
assertParser("Single letter with comma outputText", "a|a,b", "a", "a,b", null, assertParser("Single at", "@",
Keyboard.CODE_DUMMY); "@", null, ICON_UNDEFINED, '@');
assertParser("Single letter with escaped comma outputText", "a|a\\,b", "a", "a,b", null, assertParser("Single escaped at", "\\@",
Keyboard.CODE_DUMMY); "@", null, ICON_UNDEFINED, '@');
assertParser("Single letter with outputText starts with at", "a|@bc", "a", "@bc", null, assertParser("Single letter with outputText", "a|abc",
Keyboard.CODE_DUMMY); "a", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Single letter with outputText contains at", "a|a@c", "a", "a@c", null, assertParser("Single letter with escaped outputText", "a|a\\|c",
Keyboard.CODE_DUMMY); "a", "a|c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Single letter with escaped at outputText", "a|\\@bc", "a", "@bc", null, assertParser("Single letter with comma outputText", "a|a,b",
Keyboard.CODE_DUMMY); "a", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Single escaped escape with outputText", "\\\\|\\\\", "\\", "\\", null, assertParser("Single letter with escaped comma outputText", "a|a\\,b",
Keyboard.CODE_DUMMY); "a", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Single escaped bar with outputText", "\\||\\|", "|", "|", null, assertParser("Single letter with outputText starts with at", "a|@bc",
Keyboard.CODE_DUMMY); "a", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Single letter with code", "a|" + CODE_SETTINGS, "a", null, null, assertParser("Single letter with outputText contains at", "a|a@c",
mCodeSettings); "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() { public void testLabel() {
assertParser("Simple label", "abc", "abc", "abc", null, Keyboard.CODE_DUMMY); assertParser("Simple label", "abc",
assertParser("Label with escaped bar", "a\\|c", "a|c", "a|c", null, "abc", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
Keyboard.CODE_DUMMY); assertParser("Label with escaped bar", "a\\|c",
assertParser("Label with escaped escape", "a\\\\c", "a\\c", "a\\c", null, "a|c", "a|c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
Keyboard.CODE_DUMMY); assertParser("Label with escaped escape", "a\\\\c",
assertParser("Label with comma", "a,c", "a,c", "a,c", null, Keyboard.CODE_DUMMY); "a\\c", "a\\c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with escaped comma", "a\\,c", "a,c", "a,c", null, assertParser("Label with comma", "a,c",
Keyboard.CODE_DUMMY); "a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label starts with at", "@bc", "@bc", "@bc", null, Keyboard.CODE_DUMMY); assertParser("Label with escaped comma", "a\\,c",
assertParser("Label contains at", "a@c", "a@c", "a@c", null, Keyboard.CODE_DUMMY); "a,c", "a,c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with escaped at", "\\@bc", "@bc", "@bc", null, assertParser("Label starts with at", "@bc",
Keyboard.CODE_DUMMY); "@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with escaped letter", "\\abc", "abc", "abc", null, assertParser("Label contains at", "a@c",
Keyboard.CODE_DUMMY); "a@c", "a@c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with outputText", "abc|def", "abc", "def", null, assertParser("Label with escaped at", "\\@bc",
Keyboard.CODE_DUMMY); "@bc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with comma and outputText", "a,c|def", "a,c", "def", null, assertParser("Label with escaped letter", "\\abc",
Keyboard.CODE_DUMMY); "abc", "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Escaped comma label with outputText", "a\\,c|def", "a,c", "def", null, assertParser("Label with outputText", "abc|def",
Keyboard.CODE_DUMMY); "abc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Escaped label with outputText", "a\\|c|def", "a|c", "def", null, assertParser("Label with comma and outputText", "a,c|def",
Keyboard.CODE_DUMMY); "a,c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with escaped bar outputText", "abc|d\\|f", "abc", "d|f", null, assertParser("Escaped comma label with outputText", "a\\,c|def",
Keyboard.CODE_DUMMY); "a,c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Escaped escape label with outputText", "a\\\\|def", "a\\", "def", null, assertParser("Escaped label with outputText", "a\\|c|def",
Keyboard.CODE_DUMMY); "a|c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label starts with at and outputText", "@bc|def", "@bc", "def", null, assertParser("Label with escaped bar outputText", "abc|d\\|f",
Keyboard.CODE_DUMMY); "abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label contains at label and outputText", "a@c|def", "a@c", "def", null, assertParser("Escaped escape label with outputText", "a\\\\|def",
Keyboard.CODE_DUMMY); "a\\", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Escaped at label with outputText", "\\@bc|def", "@bc", "def", null, assertParser("Label starts with at and outputText", "@bc|def",
Keyboard.CODE_DUMMY); "@bc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with comma outputText", "abc|a,b", "abc", "a,b", null, assertParser("Label contains at label and outputText", "a@c|def",
Keyboard.CODE_DUMMY); "a@c", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with escaped comma outputText", "abc|a\\,b", "abc", "a,b", null, assertParser("Escaped at label with outputText", "\\@bc|def",
Keyboard.CODE_DUMMY); "@bc", "def", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with outputText starts with at", "abc|@bc", "abc", "@bc", null, assertParser("Label with comma outputText", "abc|a,b",
Keyboard.CODE_DUMMY); "abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with outputText contains at", "abc|a@c", "abc", "a@c", null, assertParser("Label with escaped comma outputText", "abc|a\\,b",
Keyboard.CODE_DUMMY); "abc", "a,b", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with escaped at outputText", "abc|\\@bc", "abc", "@bc", null, assertParser("Label with outputText starts with at", "abc|@bc",
Keyboard.CODE_DUMMY); "abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with escaped bar outputText", "abc|d\\|f", "abc", "d|f", assertParser("Label with outputText contains at", "abc|a@c",
null, Keyboard.CODE_DUMMY); "abc", "a@c", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Escaped bar label with escaped bar outputText", "a\\|c|d\\|f", "a|c", "d|f", assertParser("Label with escaped at outputText", "abc|\\@bc",
null, Keyboard.CODE_DUMMY); "abc", "@bc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParser("Label with code", "abc|" + CODE_SETTINGS, "abc", null, null, mCodeSettings); assertParser("Label with escaped bar outputText", "abc|d\\|f",
assertParser("Escaped label with code", "a\\|c|" + CODE_SETTINGS, "a|c", null, null, "abc", "d|f", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
mCodeSettings); 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() { public void testIconAndCode() {
assertParser("Icon with outputText", ICON_SETTINGS + "|abc", null, "abc", mIconSettings, assertParser("Icon with outputText", ICON_SETTINGS + "|abc",
Keyboard.CODE_DUMMY); null, "abc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY);
assertParser("Icon with outputText starts with at", ICON_SETTINGS + "|@bc", null, "@bc", assertParser("Icon with outputText starts with at", ICON_SETTINGS + "|@bc",
mIconSettings, Keyboard.CODE_DUMMY); null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY);
assertParser("Icon with outputText contains at", ICON_SETTINGS + "|a@c", null, "a@c", assertParser("Icon with outputText contains at", ICON_SETTINGS + "|a@c",
mIconSettings, Keyboard.CODE_DUMMY); null, "a@c", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY);
assertParser("Icon with escaped at outputText", ICON_SETTINGS + "|\\@bc", null, "@bc", assertParser("Icon with escaped at outputText", ICON_SETTINGS + "|\\@bc",
mIconSettings, Keyboard.CODE_DUMMY); null, "@bc", ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY);
assertParser("Label starts with at and code", "@bc|" + CODE_SETTINGS, "@bc", null, null, assertParser("Label starts with at and code", "@bc|" + CODE_SETTINGS,
mCodeSettings); "@bc", null, ICON_UNDEFINED, mCodeSettings);
assertParser("Label contains at and code", "a@c|" + CODE_SETTINGS, "a@c", null, null, assertParser("Label contains at and code", "a@c|" + CODE_SETTINGS,
mCodeSettings); "a@c", null, ICON_UNDEFINED, mCodeSettings);
assertParser("Escaped at label with code", "\\@bc|" + CODE_SETTINGS, "@bc", null, null, assertParser("Escaped at label with code", "\\@bc|" + CODE_SETTINGS,
mCodeSettings); "@bc", null, ICON_UNDEFINED, mCodeSettings);
assertParser("Icon with code", ICON_SETTINGS + "|" + CODE_SETTINGS, null, null, assertParser("Icon with code", ICON_SETTINGS + "|" + CODE_SETTINGS,
mIconSettings, mCodeSettings); null, null, ICON_SETTINGS_KEY, mCodeSettings);
} }
public void testFormatError() { public void testFormatError() {
assertParserError("Empty spec", "", null, null, null, Keyboard.CODE_UNSPECIFIED); assertParserError("Empty spec", "", null,
assertParserError("Empty label with outputText", "|a", null, "a", null, null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
Keyboard.CODE_DUMMY); assertParserError("Empty label with outputText", "|a",
assertParserError("Empty label with code", "|" + CODE_SETTINGS, null, null, null, null, "a", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
mCodeSettings); assertParserError("Empty label with code", "|" + CODE_SETTINGS,
assertParserError("Empty outputText with label", "a|", "a", null, null, null, null, ICON_UNDEFINED, mCodeSettings);
Keyboard.CODE_UNSPECIFIED); assertParserError("Empty outputText with label", "a|",
assertParserError("Empty outputText with icon", ICON_SETTINGS + "|", null, null, "a", null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
mIconSettings, Keyboard.CODE_UNSPECIFIED); assertParserError("Empty outputText with icon", ICON_SETTINGS + "|",
assertParserError("Empty icon and code", "|", null, null, null, Keyboard.CODE_UNSPECIFIED); null, null, ICON_SETTINGS_KEY, Keyboard.CODE_UNSPECIFIED);
assertParserError("Icon without code", ICON_SETTINGS, null, null, mIconSettings, assertParserError("Empty icon and code", "|",
Keyboard.CODE_DUMMY); null, null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParserError("Non existing icon", ICON_NON_EXISTING + "|abc", null, "abc", null, assertParserError("Icon without code", ICON_SETTINGS,
Keyboard.CODE_DUMMY); null, null, ICON_SETTINGS_KEY, Keyboard.CODE_DUMMY);
assertParserError("Non existing code", "abc|" + CODE_NON_EXISTING, "abc", null, null, assertParser("Non existing icon", ICON_NON_EXISTING + "|abc",
Keyboard.CODE_UNSPECIFIED); null, "abc", ICON_UNDEFINED, Keyboard.CODE_DUMMY);
assertParserError("Third bar at end", "a|b|", "a", null, null, Keyboard.CODE_UNSPECIFIED); assertParserError("Non existing code", "abc|" + CODE_NON_EXISTING,
assertParserError("Multiple bar", "a|b|c", "a", null, null, Keyboard.CODE_UNSPECIFIED); "abc", null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParserError("Multiple bar with label and code", "a|" + CODE_SETTINGS + "|c", "a", assertParserError("Third bar at end", "a|b|",
null, null, mCodeSettings); "a", null, ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED);
assertParserError("Multiple bar with icon and outputText", ICON_SETTINGS + "|b|c", null, assertParserError("Multiple bar", "a|b|c",
null, mIconSettings, Keyboard.CODE_UNSPECIFIED); "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", assertParserError("Multiple bar with icon and code",
ICON_SETTINGS + "|" + CODE_SETTINGS + "|c", null, null, mIconSettings, ICON_SETTINGS + "|" + CODE_SETTINGS + "|c",
mCodeSettings); null, null, ICON_SETTINGS_KEY, mCodeSettings);
} }
} }