diff options
Diffstat (limited to 'java')
24 files changed, 501 insertions, 336 deletions
diff --git a/java/res/drawable/btn_keyboard_key_popup_action_lxx_dark.xml b/java/res/drawable/btn_keyboard_key_popup_action_lxx_dark.xml new file mode 100644 index 000000000..8b637f204 --- /dev/null +++ b/java/res/drawable/btn_keyboard_key_popup_action_lxx_dark.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2014 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_active_pressed_lxx_dark" /> + <item android:drawable="@drawable/btn_keyboard_key_active_lxx_dark" /> +</selector> diff --git a/java/res/drawable/btn_keyboard_key_popup_action_lxx_light.xml b/java/res/drawable/btn_keyboard_key_popup_action_lxx_light.xml new file mode 100644 index 000000000..67fc52144 --- /dev/null +++ b/java/res/drawable/btn_keyboard_key_popup_action_lxx_light.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2014 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_active_pressed_lxx_light" /> + <item android:drawable="@drawable/btn_keyboard_key_active_lxx_light" /> +</selector> diff --git a/java/res/layout/more_keys_keyboard.xml b/java/res/layout/more_keys_keyboard.xml index f3795afdc..449c00f92 100644 --- a/java/res/layout/more_keys_keyboard.xml +++ b/java/res/layout/more_keys_keyboard.xml @@ -27,5 +27,6 @@ <com.android.inputmethod.keyboard.MoreKeysKeyboardView android:id="@+id/more_keys_keyboard_view" android:layout_width="wrap_content" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + style="?attr/moreKeysKeyboardViewStyle" /> </LinearLayout> diff --git a/java/res/layout/more_keys_keyboard_for_action_lxx.xml b/java/res/layout/more_keys_keyboard_for_action_lxx.xml new file mode 100644 index 000000000..d23faa4f0 --- /dev/null +++ b/java/res/layout/more_keys_keyboard_for_action_lxx.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2014, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" +> + <com.android.inputmethod.keyboard.MoreKeysKeyboardView + android:id="@+id/more_keys_keyboard_view" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + style="?attr/moreKeysKeyboardViewForActionStyle" /> +</LinearLayout> diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 57e73767c..2e81bdf48 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -32,6 +32,8 @@ <attr name="moreKeysKeyboardStyle" format="reference" /> <!-- MoreKeysKeyboardView style --> <attr name="moreKeysKeyboardViewStyle" format="reference" /> + <!-- MoreKeysKeyboardView style for action key --> + <attr name="moreKeysKeyboardViewForActionStyle" format="reference" /> <!-- Suggestions strip style --> <attr name="suggestionStripViewStyle" format="reference" /> <!-- Suggestion word style --> @@ -119,6 +121,8 @@ <attr name="keyPreviewDismissAnimator" format="reference" /> <!-- Layout resource for more keys keyboard --> <attr name="moreKeysKeyboardLayout" format="reference" /> + <!-- Layout resource for more keys keyboard of action key --> + <attr name="moreKeysKeyboardForActionLayout" format="reference" /> <attr name="backgroundDimAlpha" format="integer" /> <!-- More keys keyboard will shown at touched point. --> <attr name="showMoreKeysKeyboardAtTouchedPoint" format="boolean" /> @@ -173,6 +177,10 @@ <attr name="suppressKeyPreviewAfterBatchInputDuration" format="integer" /> </declare-styleable> + <declare-styleable name="MoreKeysKeyboardView"> + <attr name="divider" format="reference" /> + </declare-styleable> + <declare-styleable name="EmojiPalettesView"> <attr name="categoryIndicatorEnabled" format="boolean" /> <attr name="categoryIndicatorDrawable" format="reference" /> diff --git a/java/res/values/donottranslate-debug-settings.xml b/java/res/values/donottranslate-debug-settings.xml new file mode 100644 index 000000000..35e6efa77 --- /dev/null +++ b/java/res/values/donottranslate-debug-settings.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2014, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Title for Android keyboard debug settings activity / dialog --> + <string name="english_ime_debug_settings">Android Keyboard Debug settings</string> + <string name="prefs_debug_mode">Debug Mode</string> + <string name="prefs_force_non_distinct_multitouch">Force non-distinct multitouch</string> + <string name="prefs_force_physical_keyboard_special_key">Force physical keyboard special key</string> + <string name="prefs_show_ui_to_accept_typed_word">Show UI to accept typed word</string> + <!-- Option to enable sliding key input indicator. The user can see a rubber band-like effect during sliding key input. [CHAR LIMIT=30]--> + <string name="sliding_key_input_preview">Show slide indicator</string> + <!-- Option summary to enable sliding key input indicator. The user can see a rubber band-like effect during sliding key input. [CHAR LIMIT=66]--> + <string name="sliding_key_input_preview_summary">Display visual cue while sliding from Shift or Symbol keys</string> + <!-- Title of the settings for key long press delay [CHAR LIMIT=35] --> + <string name="prefs_key_longpress_timeout_settings">Key long press delay</string> + <!-- Title of the settings for customize key popup animation parameters [CHAR LIMIT=35] --> + <string name="prefs_customize_key_preview_animation">Customize key preview animation</string> + <!-- Title of the settings for key popup show up animation duration (in milliseconds) [CHAR LIMIT=35] --> + <string name="prefs_key_popup_show_up_duration_settings">Key popup show up duration</string> + <!-- Title of the settings for key popup dismiss animation duration (in milliseconds) [CHAR LIMIT=35] --> + <string name="prefs_key_popup_dismiss_duration_settings">Key popup dismiss duration</string> + <!-- Title of the settings for key popup show up animation start X-scale (in percentile) [CHAR LIMIT=35] --> + <string name="prefs_key_popup_show_up_start_x_scale_settings">Key popup show up start X scale</string> + <!-- Title of the settings for key popup show up animation start Y-scale (in percentile) [CHAR LIMIT=35] --> + <string name="prefs_key_popup_show_up_start_y_scale_settings">Key popup show up start Y scale</string> + <!-- Title of the settings for key popup dismiss animation end X-scale (in percentile) [CHAR LIMIT=35] --> + <string name="prefs_key_popup_dismiss_end_x_scale_settings">Key popup dismiss end X scale</string> + <!-- Title of the settings for key popup dismiss animation end Y-scale (in percentile) [CHAR LIMIT=35] --> + <string name="prefs_key_popup_dismiss_end_y_scale_settings">Key popup dismiss end Y scale</string> + <!-- Title of the settings for reading an external dictionary file --> + <string name="prefs_read_external_dictionary">Read external dictionary file</string> + <!-- Message to show when there are no files to install as an external dictionary [CHAR LIMIT=100] --> + <string name="read_external_dictionary_no_files_message">No dictionary files in the Downloads folder</string> + <!-- Title of the dialog that selects a file to install as an external dictionary [CHAR LIMIT=50] --> + <string name="read_external_dictionary_multiple_files_title">Select a dictionary file to install</string> + <!-- Title of the confirmation dialog to install a file as an external dictionary [CHAR LIMIT=50] --> + <string name="read_external_dictionary_confirm_install_message">Really install this file for <xliff:g id="LANGUAGE_NAME" example="English">%s</xliff:g>?</string> + <!-- Title for an error dialog that contains the details of the error in the body [CHAR LIMIT=80] --> + <string name="read_external_dictionary_error">There was an error</string> + <!-- Title of the settings group for dumpping dictionary files that have been created on the device [CHAR LIMIT=35] --> + <string name="prefs_dump_dynamic_dicts">Dump dictionary</string> +</resources> diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index d4d638542..74988f90f 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -22,13 +22,6 @@ See {@link SettingsValues#needsToShowVoiceInputKey(SharedPreferences,Resources)} --> <string name="voice_mode_main">0</string> - <!-- Title for Android keyboard debug settings activity / dialog --> - <string name="english_ime_debug_settings">Android Keyboard Debug settings</string> - <string name="prefs_debug_mode">Debug Mode</string> - <string name="prefs_force_non_distinct_multitouch">Force non-distinct multitouch</string> - <string name="prefs_force_physical_keyboard_special_key">Force physical keyboard special key</string> - <string name="prefs_show_ui_to_accept_typed_word">Show UI to accept typed word</string> - <!-- Subtype locale display name exceptions. For each exception, there should be related string resources for display name that may have explicit keyboard layout. The string resource name must be "subtype_<locale>" or diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index 414820be9..8b8b28f02 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -58,11 +58,6 @@ <!-- Option summary for showing language switch key [CHAR LIMIT=65] --> <string name="show_language_switch_key_summary">Show when multiple input languages are enabled</string> - <!-- Option to enable sliding key input indicator. The user can see a rubber band-like effect during sliding key input. [CHAR LIMIT=30]--> - <string name="sliding_key_input_preview">Show slide indicator</string> - <!-- Option summary to enable sliding key input indicator. The user can see a rubber band-like effect during sliding key input. [CHAR LIMIT=66]--> - <string name="sliding_key_input_preview_summary">Display visual cue while sliding from Shift or Symbol keys</string> - <!-- Option for the dismiss delay of the key popup [CHAR LIMIT=25] --> <string name="key_preview_popup_dismiss_delay">Key popup dismiss delay</string> <!-- Description for delay for dismissing a popup on keypress: no delay [CHAR LIMIT=15] --> @@ -330,38 +325,10 @@ mobile devices. [CHAR LIMIT=25] --> <!-- Toast text to describe the same input style already exists [CHAR LIMIT=64]--> <string name="custom_input_style_already_exists">"The same input style already exists: <xliff:g id="INPUT_STYLE_NAME" example="English (Dvorak)">%s</xliff:g>"</string> - <!-- Title of the settings for key long press delay [CHAR LIMIT=35] --> - <string name="prefs_key_longpress_timeout_settings">Key long press delay</string> <!-- Title of the settings for keypress vibration duration [CHAR LIMIT=35] --> <string name="prefs_keypress_vibration_duration_settings">Keypress vibration duration</string> <!-- Title of the settings for keypress sound volume [CHAR LIMIT=35] --> <string name="prefs_keypress_sound_volume_settings">Keypress sound volume</string> - <!-- Title of the settings for customize key popup animation parameters [CHAR LIMIT=35] --> - <string name="prefs_customize_key_preview_animation">Customize key preview animation</string> - <!-- Title of the settings for key popup show up animation duration (in milliseconds) [CHAR LIMIT=35] --> - <string name="prefs_key_popup_show_up_duration_settings" translatable="false">Key popup show up duration</string> - <!-- Title of the settings for key popup dismiss animation duration (in milliseconds) [CHAR LIMIT=35] --> - <string name="prefs_key_popup_dismiss_duration_settings" translatable="false">Key popup dismiss duration</string> - <!-- Title of the settings for key popup show up animation start X-scale (in percentile) [CHAR LIMIT=35] --> - <string name="prefs_key_popup_show_up_start_x_scale_settings" translatable="false">Key popup show up start X scale</string> - <!-- Title of the settings for key popup show up animation start Y-scale (in percentile) [CHAR LIMIT=35] --> - <string name="prefs_key_popup_show_up_start_y_scale_settings" translatable="false">Key popup show up start Y scale</string> - <!-- Title of the settings for key popup dismiss animation end X-scale (in percentile) [CHAR LIMIT=35] --> - <string name="prefs_key_popup_dismiss_end_x_scale_settings" translatable="false">Key popup dismiss end X scale</string> - <!-- Title of the settings for key popup dismiss animation end Y-scale (in percentile) [CHAR LIMIT=35] --> - <string name="prefs_key_popup_dismiss_end_y_scale_settings" translatable="false">Key popup dismiss end Y scale</string> - <!-- Title of the settings for reading an external dictionary file --> - <string name="prefs_read_external_dictionary">Read external dictionary file</string> - <!-- Message to show when there are no files to install as an external dictionary [CHAR LIMIT=100] --> - <string name="read_external_dictionary_no_files_message">No dictionary files in the Downloads folder</string> - <!-- Title of the dialog that selects a file to install as an external dictionary [CHAR LIMIT=50] --> - <string name="read_external_dictionary_multiple_files_title">Select a dictionary file to install</string> - <!-- Title of the confirmation dialog to install a file as an external dictionary [CHAR LIMIT=50] --> - <string name="read_external_dictionary_confirm_install_message">Really install this file for <xliff:g id="LANGUAGE_NAME" example="English">%s</xliff:g>?</string> - <!-- Title for an error dialog that contains the details of the error in the body [CHAR LIMIT=80] --> - <string name="error">There was an error</string> - <!-- Title of the settings group for dumpping dictionary files that have been created on the device [CHAR LIMIT=35] --> - <string name="prefs_dump_dynamic_dicts" translatable="false">Dump dictionary</string> <!-- Title of the button to revert to the default value of the device in the settings dialog [CHAR LIMIT=15] --> <string name="button_default">Default</string> diff --git a/java/res/values/themes-common.xml b/java/res/values/themes-common.xml index 6805830cb..becaddd35 100644 --- a/java/res/values/themes-common.xml +++ b/java/res/values/themes-common.xml @@ -115,10 +115,7 @@ for instance delete button, need themed {@link KeyboardView} attributes. --> <style name="EmojiPalettesView" /> <style name="MoreKeysKeyboard" /> - <style - name="MoreKeysKeyboardView" - parent="KeyboardView" /> - <style name="MoreKeysKeyboardContainer" /> + <style name="MoreKeysKeyboardView" /> <style name="SuggestionStripView" /> <style name="SuggestionWord"> <item name="android:minWidth">@dimen/config_suggestion_min_width</item> diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml index a9c7294a0..9e656dd74 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -25,7 +25,9 @@ <item name="mainKeyboardViewStyle">@style/MainKeyboardView.ICS</item> <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.ICS</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.ICS</item> + <!-- Note: ICS theme uses the same style for both general more keys and action more keys. --> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.ICS</item> + <item name="moreKeysKeyboardViewForActionStyle">@style/MoreKeysKeyboardView.ICS</item> <item name="suggestionStripViewStyle">@style/SuggestionStripView.ICS</item> <item name="suggestionWordStyle">@style/SuggestionWord.ICS</item> </style> @@ -103,6 +105,7 @@ > <item name="android:background">@drawable/keyboard_popup_panel_background_ics</item> <item name="keyBackground">@drawable/btn_keyboard_key_popup_ics</item> + <item name="divider">@drawable/more_keys_divider</item> <item name="keyTypeface">normal</item> <item name="verticalCorrection">@dimen/config_more_keys_keyboard_vertical_correction_holo</item> </style> diff --git a/java/res/values/themes-klp.xml b/java/res/values/themes-klp.xml index da5e27fa1..c6319bc4e 100644 --- a/java/res/values/themes-klp.xml +++ b/java/res/values/themes-klp.xml @@ -25,7 +25,9 @@ <item name="mainKeyboardViewStyle">@style/MainKeyboardView.KLP</item> <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.KLP</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.KLP</item> + <!-- Note: KLP theme uses the same style for both general more keys and action more keys. --> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.KLP</item> + <item name="moreKeysKeyboardViewForActionStyle">@style/MoreKeysKeyboardView.KLP</item> <item name="suggestionStripViewStyle">@style/SuggestionStripView.KLP</item> <item name="suggestionWordStyle">@style/SuggestionWord.KLP</item> </style> @@ -103,6 +105,7 @@ > <item name="android:background">@drawable/keyboard_popup_panel_background_klp</item> <item name="keyBackground">@drawable/btn_keyboard_key_popup_klp</item> + <item name="divider">@drawable/more_keys_divider</item> <item name="keyTypeface">normal</item> <item name="verticalCorrection">@dimen/config_more_keys_keyboard_vertical_correction_holo</item> </style> diff --git a/java/res/values/themes-lxx-dark.xml b/java/res/values/themes-lxx-dark.xml index c49436c49..76e9d33bf 100644 --- a/java/res/values/themes-lxx-dark.xml +++ b/java/res/values/themes-lxx-dark.xml @@ -26,6 +26,7 @@ <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.LXX_Dark</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.LXX_Dark</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.LXX_Dark</item> + <item name="moreKeysKeyboardViewForActionStyle">@style/MoreKeysKeyboardView.LXX_Dark.Action</item> <item name="suggestionStripViewStyle">@style/SuggestionStripView.LXX_Dark</item> <item name="suggestionWordStyle">@style/SuggestionWord.LXX_Dark</item> </style> @@ -57,6 +58,7 @@ name="MainKeyboardView.LXX_Dark" parent="KeyboardView.LXX_Dark" > + <item name="moreKeysKeyboardForActionLayout">@layout/more_keys_keyboard_for_action_lxx</item> <item name="keyPreviewBackground">@drawable/keyboard_key_feedback_lxx_dark</item> <item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item> <item name="keyPreviewShowUpAnimator">@anim/key_preview_show_up_lxx</item> @@ -101,10 +103,19 @@ > <item name="android:background">@drawable/keyboard_popup_panel_background_lxx_dark</item> <item name="keyBackground">@drawable/btn_keyboard_key_popup_lxx_dark</item> + <item name="divider">@drawable/more_keys_divider</item> <item name="keyTypeface">normal</item> <item name="verticalCorrection">@dimen/config_more_keys_keyboard_vertical_correction_holo</item> </style> <style + name="MoreKeysKeyboardView.LXX_Dark.Action" + parent="MoreKeysKeyboardView.LXX_Dark" + > + <item name="android:background">@android:color/transparent</item> + <item name="keyBackground">@drawable/btn_keyboard_key_popup_action_lxx_dark</item> + <item name="divider">@null</item> + </style> + <style name="SuggestionStripView.LXX_Dark" parent="KeyboardView.LXX_Dark" > diff --git a/java/res/values/themes-lxx-light.xml b/java/res/values/themes-lxx-light.xml index 6f0fb7131..5cd84171d 100644 --- a/java/res/values/themes-lxx-light.xml +++ b/java/res/values/themes-lxx-light.xml @@ -26,6 +26,7 @@ <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.LXX_Light</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.LXX_Light</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.LXX_Light</item> + <item name="moreKeysKeyboardViewForActionStyle">@style/MoreKeysKeyboardView.LXX_Light.Action</item> <item name="suggestionStripViewStyle">@style/SuggestionStripView.LXX_Light</item> <item name="suggestionWordStyle">@style/SuggestionWord.LXX_Light</item> </style> @@ -57,6 +58,7 @@ name="MainKeyboardView.LXX_Light" parent="KeyboardView.LXX_Light" > + <item name="moreKeysKeyboardForActionLayout">@layout/more_keys_keyboard_for_action_lxx</item> <item name="keyPreviewBackground">@drawable/keyboard_key_feedback_lxx_light</item> <item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item> <item name="keyPreviewShowUpAnimator">@anim/key_preview_show_up_lxx</item> @@ -101,10 +103,19 @@ > <item name="android:background">@drawable/keyboard_popup_panel_background_lxx_light</item> <item name="keyBackground">@drawable/btn_keyboard_key_popup_lxx_light</item> + <item name="divider">@drawable/more_keys_divider</item> <item name="keyTypeface">normal</item> <item name="verticalCorrection">@dimen/config_more_keys_keyboard_vertical_correction_holo</item> </style> <style + name="MoreKeysKeyboardView.LXX_Light.Action" + parent="MoreKeysKeyboardView.LXX_Light" + > + <item name="android:background">@android:color/transparent</item> + <item name="keyBackground">@drawable/btn_keyboard_key_popup_action_lxx_light</item> + <item name="divider">@null</item> + </style> + <style name="SuggestionStripView.LXX_Light" parent="KeyboardView.LXX_Light" > diff --git a/java/res/xml-sw600dp/key_styles_enter.xml b/java/res/xml-sw600dp/key_styles_enter.xml index 0227d811b..d066d2d12 100644 --- a/java/res/xml-sw600dp/key_styles_enter.xml +++ b/java/res/xml-sw600dp/key_styles_enter.xml @@ -22,20 +22,18 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <!-- Navigate more keys style --> + <include latin:keyboardLayout="@xml/key_styles_navigate_more_keys" /> <switch> - <!-- latin:passwordInput="true" --> <case latin:imeAction="actionNext" latin:navigatePrevious="true" > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_previous" /> + latin:parentStyle="navigatePreviousMoreKeysStyle" /> </case> <case latin:imeAction="actionNext" - latin:navigatePrevious="false" > <key-style latin:styleName="navigateMoreKeysStyle" /> @@ -46,12 +44,10 @@ > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_next" /> + latin:parentStyle="navigateNextMoreKeysStyle" /> </case> <case latin:imeAction="actionPrevious" - latin:navigateNext="false" > <key-style latin:styleName="navigateMoreKeysStyle" /> @@ -62,33 +58,21 @@ > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_action_previous,!text/keyspec_action_next" /> + latin:parentStyle="navigatePreviousNextMoreKeysStyle" /> </case> <case latin:navigateNext="true" - latin:navigatePrevious="false" > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_next" /> + latin:parentStyle="navigateNextMoreKeysStyle" /> </case> <case - latin:navigateNext="false" latin:navigatePrevious="true" > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_previous" /> - </case> - <case - latin:navigateNext="false" - latin:navigatePrevious="false" - > - <key-style - latin:styleName="navigateMoreKeysStyle" /> + latin:parentStyle="navigatePreviousMoreKeysStyle" /> </case> <default> <key-style @@ -103,6 +87,7 @@ latin:keyActionFlags="noKeyPreview" latin:backgroundType="action" latin:parentStyle="navigateMoreKeysStyle" /> + <include latin:keyboardLayout="@xml/key_styles_actions" /> <switch> <!-- Shift + Enter in textMultiLine field. --> <case @@ -116,133 +101,52 @@ </case> <case latin:imeAction="actionGo" - latin:isIconDefined="go_key" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!icon/go_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionGo" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_go_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="goActionKeyStyle" /> </case> <case latin:imeAction="actionNext" - latin:isIconDefined="next_key" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!icon/next_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionNext" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_next_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="nextActionKeyStyle" /> </case> <case latin:imeAction="actionPrevious" - latin:isIconDefined="previous_key" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!icon/previous_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionPrevious" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_previous_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="previousActionKeyStyle" /> </case> <case latin:imeAction="actionDone" - latin:isIconDefined="done_key" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!icon/done_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionDone" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_done_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="doneActionKeyStyle" /> </case> <case latin:imeAction="actionSend" - latin:isIconDefined="send_key" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!icon/send_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionSend" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_send_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionSearch" - latin:isIconDefined="search_key" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!icon/search_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="sendActionKeyStyle" /> </case> <case latin:imeAction="actionSearch" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_search_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="searchActionKeyStyle" /> </case> <case latin:imeAction="actionCustomLabel" - latin:keyboardTheme="ICS|KLP" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="dummy_label|!code/key_enter" - latin:keyLabelFlags="fromCustomActionLabel" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionCustomLabel" - latin:keyboardTheme="LXXLight|LXXDark" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="dummy_label|!code/key_enter" - latin:keyLabelFlags="fromCustomActionLabel" - latin:backgroundType="functional" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="customLabelActionKeyStyle" /> </case> <!-- imeAction is either actionNone or actionUnspecified. --> <default> diff --git a/java/res/xml/key_styles_actions.xml b/java/res/xml/key_styles_actions.xml new file mode 100644 index 000000000..83901cad9 --- /dev/null +++ b/java/res/xml/key_styles_actions.xml @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2014, 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" +> + <!-- Go key --> + <switch> + <case latin:isIconDefined="go_key"> + <key-style + latin:styleName="goActionKeyStyle" + latin:keySpec="!icon/go_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <default> + <key-style + latin:styleName="goActionKeyStyle" + latin:keySpec="!text/label_go_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </default> + </switch> + <!-- Next key --> + <switch> + <case latin:isIconDefined="next_key"> + <key-style + latin:styleName="nextActionKeyStyle" + latin:keySpec="!icon/next_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <default> + <key-style + latin:styleName="nextActionKeyStyle" + latin:keySpec="!text/label_next_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </default> + </switch> + <!-- Previous key --> + <switch> + <case latin:isIconDefined="previous_key"> + <key-style + latin:styleName="previousActionKeyStyle" + latin:keySpec="!icon/previous_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <default> + <key-style + latin:styleName="previousActionKeyStyle" + latin:keySpec="!text/label_previous_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </default> + </switch> + <!-- Done key --> + <switch> + <case latin:isIconDefined="done_key"> + <key-style + latin:styleName="doneActionKeyStyle" + latin:keySpec="!icon/done_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <default> + <key-style + latin:styleName="doneActionKeyStyle" + latin:keySpec="!text/label_done_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </default> + </switch> + <!-- Send key --> + <switch> + <case latin:isIconDefined="send_key"> + <key-style + latin:styleName="sendActionKeyStyle" + latin:keySpec="!icon/send_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <default> + <key-style + latin:styleName="sendActionKeyStyle" + latin:keySpec="!text/label_send_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </default> + </switch> + <!-- Seartch key --> + <switch> + <case latin:isIconDefined="search_key"> + <key-style + latin:styleName="searchActionKeyStyle" + latin:keySpec="!icon/search_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <default> + <key-style + latin:styleName="searchActionKeyStyle" + latin:keySpec="!text/label_search_key|!code/key_enter" + latin:parentStyle="defaultEnterKeyStyle" /> + </default> + </switch> + <switch> + <case latin:keyboardTheme="ICS|KLP"> + <key-style + latin:styleName="customLabelActionKeyStyle" + latin:keySpec="dummy_label|!code/key_enter" + latin:keyLabelFlags="fromCustomActionLabel" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <!-- keyboardTheme="LXXLight|LXXDark" --> + <default> + <key-style + latin:styleName="customLabelActionKeyStyle" + latin:keySpec="dummy_label|!code/key_enter" + latin:keyLabelFlags="fromCustomActionLabel" + latin:backgroundType="functional" + latin:parentStyle="defaultEnterKeyStyle" /> + </default> + </switch> +</merge> diff --git a/java/res/xml/key_styles_enter.xml b/java/res/xml/key_styles_enter.xml index 7aea1ceff..d6d01b862 100644 --- a/java/res/xml/key_styles_enter.xml +++ b/java/res/xml/key_styles_enter.xml @@ -21,8 +21,8 @@ <merge xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > - <!-- TODO: Stop using many conditional cases for keyspec_emoji_action_key. There are way too many to maintain. --> <!-- Navigate more keys style --> + <include latin:keyboardLayout="@xml/key_styles_navigate_more_keys" /> <switch> <!-- latin:passwordInput="true" --> <case @@ -32,12 +32,10 @@ > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_previous" /> + latin:parentStyle="navigatePreviousMoreKeysStyle" /> </case> <case latin:imeAction="actionNext" - latin:navigatePrevious="false" latin:passwordInput="true" > <key-style @@ -50,12 +48,10 @@ > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_next" /> + latin:parentStyle="navigateNextMoreKeysStyle" /> </case> <case latin:imeAction="actionPrevious" - latin:navigateNext="false" latin:passwordInput="true" > <key-style @@ -68,32 +64,25 @@ > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_action_previous,!text/keyspec_action_next" /> + latin:parentStyle="navigatePreviousNextMoreKeysStyle" /> </case> <case latin:navigateNext="true" - latin:navigatePrevious="false" latin:passwordInput="true" > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_next" /> + latin:parentStyle="navigateNextMoreKeysStyle" /> </case> <case - latin:navigateNext="false" latin:navigatePrevious="true" latin:passwordInput="true" > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_previous" /> + latin:parentStyle="navigatePreviousMoreKeysStyle" /> </case> <case - latin:navigateNext="false" - latin:navigatePrevious="false" latin:passwordInput="true" > <key-style @@ -107,12 +96,10 @@ > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_previous" /> + latin:parentStyle="navigatePreviousMoreKeysStyle" /> </case> <case latin:imeAction="actionNext" - latin:navigatePrevious="false" latin:mode="email|url|phone|number|date|time|datetime" > <key-style @@ -125,12 +112,10 @@ > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_next" /> + latin:parentStyle="navigateNextMoreKeysStyle" /> </case> <case latin:imeAction="actionPrevious" - latin:navigateNext="false" latin:mode="email|url|phone|number|date|time|datetime" > <key-style @@ -143,32 +128,25 @@ > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_action_previous,!text/keyspec_action_next" /> + latin:parentStyle="navigatePreviousNextMoreKeysStyle" /> </case> <case latin:navigateNext="true" - latin:navigatePrevious="false" latin:mode="email|url|phone|number|date|time|datetime" > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_next" /> + latin:parentStyle="navigateNextMoreKeysStyle" /> </case> <case - latin:navigateNext="false" latin:navigatePrevious="true" latin:mode="email|url|phone|number|date|time|datetime" > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_action_previous" /> + latin:parentStyle="navigatePreviousMoreKeysStyle" /> </case> <case - latin:navigateNext="false" - latin:navigatePrevious="false" latin:mode="email|url|phone|number|date|time|datetime" > <key-style @@ -181,17 +159,14 @@ > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_emoji_action_key,!text/keyspec_action_previous" /> + latin:parentStyle="navigateEmojiPreviousMoreKeysStyle" /> </case> <case latin:imeAction="actionNext" - latin:navigatePrevious="false" > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_emoji_action_key" /> + latin:parentStyle="navigateEmojiMoreKeysStyle" /> </case> <case latin:imeAction="actionPrevious" @@ -199,17 +174,14 @@ > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_emoji_action_key,!text/keyspec_action_next" /> + latin:parentStyle="navigateEmojiNextMoreKeysStyle" /> </case> <case latin:imeAction="actionPrevious" - latin:navigateNext="false" > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_emoji_action_key" /> + latin:parentStyle="navigateEmojiMoreKeysStyle" /> </case> <case latin:navigateNext="true" @@ -217,39 +189,26 @@ > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!fixedColumnOrder!3,!needsDividers!,!text/keyspec_emoji_action_key,!text/keyspec_action_previous,!text/keyspec_action_next" /> + latin:parentStyle="navigateEmojiPreviousNextMoreKeysStyle" /> </case> <case latin:navigateNext="true" - latin:navigatePrevious="false" > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_emoji_action_key,!text/keyspec_action_next" /> + latin:parentStyle="navigateEmojiNextMoreKeysStyle" /> </case> <case - latin:navigateNext="false" latin:navigatePrevious="true" > <key-style latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_emoji_action_key,!text/keyspec_action_previous" /> - </case> - <case - latin:navigateNext="false" - latin:navigatePrevious="false" - > - <key-style - latin:styleName="navigateMoreKeysStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_emoji_action_key" /> + latin:parentStyle="navigateEmojiPreviousMoreKeysStyle" /> </case> <default> <key-style - latin:styleName="navigateMoreKeysStyle" /> + latin:styleName="navigateMoreKeysStyle" + latin:parentStyle="navigateEmojiMoreKeysStyle" /> </default> </switch> <!-- Enter key style --> @@ -260,10 +219,7 @@ latin:keyActionFlags="noKeyPreview" latin:backgroundType="action" latin:parentStyle="navigateMoreKeysStyle" /> - <key-style - latin:styleName="shiftEnterKeyStyle" - latin:keySpec="!icon/enter_key|!code/key_shift_enter" - latin:parentStyle="defaultEnterKeyStyle" /> + <include latin:keyboardLayout="@xml/key_styles_actions" /> <switch> <!-- Shift + Enter in textMultiLine field. --> <case @@ -272,7 +228,8 @@ > <key-style latin:styleName="enterKeyStyle" - latin:parentStyle="shiftEnterKeyStyle" /> + latin:keySpec="!icon/enter_key|!code/key_shift_enter" + latin:parentStyle="defaultEnterKeyStyle" /> </case> <!-- Smiley in textShortMessage field. This <case> should be after Shift + Enter <case> and before any of action <case>. --> @@ -285,139 +242,57 @@ </case> <case latin:imeAction="actionGo" - latin:isIconDefined="go_key" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!icon/go_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionGo" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_go_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="goActionKeyStyle" /> </case> <case latin:imeAction="actionNext" - latin:isIconDefined="next_key" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!icon/next_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionNext" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_next_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="nextActionKeyStyle" /> </case> <case latin:imeAction="actionPrevious" - latin:isIconDefined="previous_key" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!icon/previous_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionPrevious" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_previous_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="previousActionKeyStyle" /> </case> <case latin:imeAction="actionDone" - latin:isIconDefined="done_key" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!icon/done_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionDone" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_done_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="doneActionKeyStyle" /> </case> <case latin:imeAction="actionSend" - latin:isIconDefined="send_key" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!icon/send_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionSend" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_send_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionSearch" - latin:isIconDefined="search_key" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!icon/search_key|!code/key_enter" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="sendActionKeyStyle" /> </case> <case latin:imeAction="actionSearch" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!text/label_search_key|!code/key_enter" - latin:parentStyle="defaultEnterKeyStyle" /> - </case> - <case - latin:imeAction="actionCustomLabel" - latin:keyboardTheme="ICS|KLP" - > - <key-style - latin:styleName="enterKeyStyle" - latin:keySpec="dummy_label|!code/key_enter" - latin:keyLabelFlags="fromCustomActionLabel" - latin:backgroundType="action" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="searchActionKeyStyle" /> </case> <case latin:imeAction="actionCustomLabel" - latin:keyboardTheme="LXXLight|LXXDark" > <key-style latin:styleName="enterKeyStyle" - latin:keySpec="dummy_label|!code/key_enter" - latin:keyLabelFlags="fromCustomActionLabel" - latin:backgroundType="functional" - latin:parentStyle="defaultEnterKeyStyle" /> + latin:parentStyle="customLabelActionKeyStyle" /> </case> <!-- imeAction is either actionNone or actionUnspecified. --> <default> <key-style latin:styleName="enterKeyStyle" - latin:keySpec="!icon/enter_key|!code/key_enter" latin:parentStyle="defaultEnterKeyStyle" /> </default> </switch> diff --git a/java/res/xml/key_styles_navigate_more_keys.xml b/java/res/xml/key_styles_navigate_more_keys.xml new file mode 100644 index 000000000..f97114db9 --- /dev/null +++ b/java/res/xml/key_styles_navigate_more_keys.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2014, 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:keyboardTheme="ICS|KLP"> + <key-style + latin:styleName="navigateNextMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!text/keyspec_action_next" /> + <key-style + latin:styleName="navigatePreviousMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!text/keyspec_action_previous" /> + <key-style + latin:styleName="navigatePreviousNextMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_action_previous,!text/keyspec_action_next" /> + <key-style + latin:styleName="navigateEmojiMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!text/keyspec_emoji_action_key" /> + <key-style + latin:styleName="navigateEmojiNextMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_emoji_action_key,!text/keyspec_action_next" /> + <key-style + latin:styleName="navigateEmojiPreviousMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_emoji_action_key,!text/keyspec_action_previous" /> + <key-style + latin:styleName="navigateEmojiPreviousNextMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!fixedColumnOrder!3,!needsDividers!,!text/keyspec_emoji_action_key,!text/keyspec_action_previous,!text/keyspec_action_next" /> + </case> + <default> + <key-style + latin:styleName="navigateNextMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!icon/next_key|!code/key_action_next" /> + <key-style + latin:styleName="navigatePreviousMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!icon/previous_key|!code/key_action_previous" /> + <key-style + latin:styleName="navigatePreviousNextMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!icon/previous_key|!code/key_action_previous,!icon/next_key|!code/key_action_next" /> + <key-style + latin:styleName="navigateEmojiMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!text/keyspec_emoji_action_key" /> + <key-style + latin:styleName="navigateEmojiNextMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_emoji_action_key,!icon/next_key|!code/key_action_next" /> + <key-style + latin:styleName="navigateEmojiPreviousMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!fixedColumnOrder!2,!needsDividers!,!text/keyspec_emoji_action_key,!icon/previous_key|!code/key_action_previous" /> + <key-style + latin:styleName="navigateEmojiPreviousNextMoreKeysStyle" + latin:keyLabelFlags="hasPopupHint|preserveCase" + latin:moreKeys="!fixedColumnOrder!3,!needsDividers!,!text/keyspec_emoji_action_key,!icon/previous_key|!code/key_action_previous,!icon/next_key|!code/key_action_next" /> + </default> + </switch> +</merge> diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index efa527e15..a6f9f3c26 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -547,6 +547,10 @@ public class Key implements Comparable<Key> { return this instanceof Spacer; } + public final boolean isActionKey() { + return mBackgroundType == BACKGROUND_TYPE_ACTION; + } + public final boolean isShift() { return mCode == CODE_SHIFT; } diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index d2f3e9714..2ed4ea98e 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -88,6 +88,7 @@ import java.util.WeakHashMap; * @attr ref R.styleable#MainKeyboardView_keyPreviewShowUpAnimator * @attr ref R.styleable#MainKeyboardView_keyPreviewDismissAnimator * @attr ref R.styleable#MainKeyboardView_moreKeysKeyboardLayout + * @attr ref R.styleable#MainKeyboardView_moreKeysKeyboardForActionLayout * @attr ref R.styleable#MainKeyboardView_backgroundDimAlpha * @attr ref R.styleable#MainKeyboardView_showMoreKeysKeyboardAtTouchPoint * @attr ref R.styleable#MainKeyboardView_gestureFloatingPreviewTextLingerTimeout @@ -147,6 +148,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack private final Paint mBackgroundDimAlphaPaint = new Paint(); private boolean mNeedsToDimEntireKeyboard; private final View mMoreKeysKeyboardContainer; + private final View mMoreKeysKeyboardForActionContainer; private final WeakHashMap<Key, Keyboard> mMoreKeysKeyboardCache = new WeakHashMap<>(); private final boolean mConfigShowMoreKeysKeyboardAtTouchedPoint; // More keys panel (used by both more keys keyboard and more suggestions view) @@ -231,6 +233,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack final int moreKeysKeyboardLayoutId = mainKeyboardViewAttr.getResourceId( R.styleable.MainKeyboardView_moreKeysKeyboardLayout, 0); + final int moreKeysKeyboardForActionLayoutId = mainKeyboardViewAttr.getResourceId( + R.styleable.MainKeyboardView_moreKeysKeyboardForActionLayout, + moreKeysKeyboardLayoutId); mConfigShowMoreKeysKeyboardAtTouchedPoint = mainKeyboardViewAttr.getBoolean( R.styleable.MainKeyboardView_showMoreKeysKeyboardAtTouchedPoint, false); @@ -248,8 +253,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack mSlidingKeyInputDrawingPreview.setDrawingView(mDrawingPreviewPlacerView); mainKeyboardViewAttr.recycle(); - mMoreKeysKeyboardContainer = LayoutInflater.from(getContext()) - .inflate(moreKeysKeyboardLayoutId, null); + final LayoutInflater inflater = LayoutInflater.from(getContext()); + mMoreKeysKeyboardContainer = inflater.inflate(moreKeysKeyboardLayoutId, null); + mMoreKeysKeyboardForActionContainer = inflater.inflate( + moreKeysKeyboardForActionLayoutId, null); mLanguageOnSpacebarFadeoutAnimator = loadObjectAnimator( languageOnSpacebarFadeoutAnimatorResId, this); mAltCodeKeyWhileTypingFadeoutAnimator = loadObjectAnimator( @@ -581,7 +588,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack mMoreKeysKeyboardCache.put(key, moreKeysKeyboard); } - final View container = mMoreKeysKeyboardContainer; + final View container = key.isActionKey() ? mMoreKeysKeyboardForActionContainer + : mMoreKeysKeyboardContainer; final MoreKeysKeyboardView moreKeysKeyboardView = (MoreKeysKeyboardView)container.findViewById(R.id.more_keys_keyboard_view); moreKeysKeyboardView.setKeyboard(moreKeysKeyboard); diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java index 52e2e85ba..73c84cd92 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java @@ -18,11 +18,9 @@ package com.android.inputmethod.keyboard; import android.content.Context; import android.graphics.Paint; -import android.graphics.drawable.Drawable; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.keyboard.internal.KeyboardBuilder; -import com.android.inputmethod.keyboard.internal.KeyboardIconsSet; import com.android.inputmethod.keyboard.internal.KeyboardParams; import com.android.inputmethod.keyboard.internal.MoreKeySpec; import com.android.inputmethod.latin.R; @@ -257,7 +255,6 @@ public final class MoreKeysKeyboard extends Keyboard { public static class Builder extends KeyboardBuilder<MoreKeysKeyboardParams> { private final Key mParentKey; - private final Drawable mDivider; private static final float LABEL_PADDING_RATIO = 0.2f; private static final float DIVIDER_RATIO = 0.2f; @@ -306,10 +303,8 @@ public final class MoreKeysKeyboard extends Keyboard { } final int dividerWidth; if (key.needsDividersInMoreKeys()) { - mDivider = mResources.getDrawable(R.drawable.more_keys_divider); dividerWidth = (int)(keyWidth * DIVIDER_RATIO); } else { - mDivider = null; dividerWidth = 0; } final MoreKeySpec[] moreKeys = key.getMoreKeys(); @@ -352,7 +347,8 @@ public final class MoreKeysKeyboard extends Keyboard { if (params.mDividerWidth > 0 && pos != 0) { final int dividerX = (pos > 0) ? x - params.mDividerWidth : x + params.mDefaultKeyWidth; - final Key divider = new MoreKeyDivider(params, mDivider, dividerX, y); + final Key divider = new MoreKeyDivider( + params, dividerX, y, params.mDividerWidth, params.mDefaultRowHeight); params.onAddKey(divider); } } @@ -360,22 +356,11 @@ public final class MoreKeysKeyboard extends Keyboard { } } - private static class MoreKeyDivider extends Key.Spacer { - private final Drawable mIcon; - - public MoreKeyDivider(final MoreKeysKeyboardParams params, final Drawable icon, - final int x, final int y) { - super(params, x, y, params.mDividerWidth, params.mDefaultRowHeight); - mIcon = icon; - } - - @Override - public Drawable getIcon(final KeyboardIconsSet iconSet, final int alpha) { - // KeyboardIconsSet and alpha are unused. Use the icon that has been passed to the - // constructor. - // TODO: Drawable itself should have an alpha value. - mIcon.setAlpha(128); - return mIcon; + // Used as a divider maker. A divider is drawn by {@link MoreKeysKeyboardView}. + public static class MoreKeyDivider extends Key.Spacer { + public MoreKeyDivider(final KeyboardParams params, final int x, final int y, + final int width, final int height) { + super(params, x, y, width, height); } } } diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java index 5140c4ffc..a9d1239ed 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java @@ -17,6 +17,10 @@ package com.android.inputmethod.keyboard; import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; @@ -24,6 +28,7 @@ import android.view.ViewGroup; import com.android.inputmethod.accessibility.AccessibilityUtils; import com.android.inputmethod.accessibility.MoreKeysKeyboardAccessibilityDelegate; +import com.android.inputmethod.keyboard.internal.KeyDrawParams; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.utils.CoordinateUtils; @@ -35,6 +40,7 @@ import com.android.inputmethod.latin.utils.CoordinateUtils; public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel { private final int[] mCoordinates = CoordinateUtils.newInstance(); + private final Drawable mDivider; protected final KeyDetector mKeyDetector; private Controller mController = EMPTY_CONTROLLER; protected KeyboardActionListener mListener; @@ -53,6 +59,14 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel public MoreKeysKeyboardView(final Context context, final AttributeSet attrs, final int defStyle) { super(context, attrs, defStyle); + final TypedArray moreKeysKeyboardViewAttr = context.obtainStyledAttributes(attrs, + R.styleable.MoreKeysKeyboardView, defStyle, R.style.MoreKeysKeyboardView); + mDivider = moreKeysKeyboardViewAttr.getDrawable(R.styleable.MoreKeysKeyboardView_divider); + if (mDivider != null) { + // TODO: Drawable itself should have an alpha value. + mDivider.setAlpha(128); + } + moreKeysKeyboardViewAttr.recycle(); mKeyDetector = new MoreKeysDetector(getResources().getDimension( R.dimen.config_more_keys_keyboard_slide_allowance)); } @@ -70,6 +84,23 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel } @Override + protected void onDrawKeyTopVisuals(final Key key, final Canvas canvas, final Paint paint, + final KeyDrawParams params) { + if (!key.isSpacer() || !(key instanceof MoreKeysKeyboard.MoreKeyDivider) + || mDivider == null) { + super.onDrawKeyTopVisuals(key, canvas, paint, params); + return; + } + final int keyWidth = key.getDrawWidth(); + final int keyHeight = key.getHeight(); + final int iconWidth = Math.min(mDivider.getIntrinsicWidth(), keyWidth); + final int iconHeight = mDivider.getIntrinsicHeight(); + final int iconX = (keyWidth - iconWidth) / 2; // Align horizontally center + final int iconY = (keyHeight - iconHeight) / 2; // Align vertically center + drawIcon(canvas, mDivider, iconX, iconY, iconWidth, iconHeight); + } + + @Override public void setKeyboard(final Keyboard keyboard) { super.setKeyboard(keyboard); mKeyDetector.setKeyboard( diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index 6bc3da885..dcfaa3f6d 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -142,6 +142,15 @@ public class SuggestedWords { return mSuggestedWordInfoList.get(index); } + /** + * Gets the suggestion index from the suggestions list. + * @param suggestedWordInfo The {@link SuggestedWordInfo} to find the index. + * @return The position of the suggestion in the suggestion list. + */ + public int indexOf(SuggestedWordInfo suggestedWordInfo) { + return mSuggestedWordInfoList.indexOf(suggestedWordInfo); + } + public String getDebugString(final int pos) { if (!DebugFlags.DEBUG_ENABLED) { return null; diff --git a/java/src/com/android/inputmethod/latin/debug/ExternalDictionaryGetterForDebug.java b/java/src/com/android/inputmethod/latin/debug/ExternalDictionaryGetterForDebug.java index 7071d8689..a87785b1a 100644 --- a/java/src/com/android/inputmethod/latin/debug/ExternalDictionaryGetterForDebug.java +++ b/java/src/com/android/inputmethod/latin/debug/ExternalDictionaryGetterForDebug.java @@ -168,7 +168,7 @@ public class ExternalDictionaryGetterForDebug { } catch (IOException e) { // There was an error: show a dialog new AlertDialog.Builder(DialogUtils.getPlatformDialogThemeContext(context)) - .setTitle(R.string.error) + .setTitle(R.string.read_external_dictionary_error) .setMessage(e.toString()) .setPositiveButton(android.R.string.ok, new OnClickListener() { @Override diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 233a22512..2d5bd85dd 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -60,6 +60,7 @@ import com.android.inputmethod.latin.suggestions.SuggestionStripViewAccessor; import com.android.inputmethod.latin.utils.AsyncResultHolder; import com.android.inputmethod.latin.utils.InputTypeUtils; import com.android.inputmethod.latin.utils.RecapitalizeStatus; +import com.android.inputmethod.latin.utils.StatsUtils; import com.android.inputmethod.latin.utils.StringUtils; import com.android.inputmethod.latin.utils.TextRange; @@ -361,6 +362,8 @@ public final class InputLogic { if (shouldShowAddToDictionaryIndicator) { mTextDecorator.showAddToDictionaryIndicator(suggestionInfo); } + + StatsUtils.onPickSuggestionManually(mSuggestedWords, suggestionInfo); return inputTransaction; } |