diff options
Diffstat (limited to 'java')
103 files changed, 768 insertions, 127 deletions
diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on_lmp.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on_lmp.9.png Binary files differnew file mode 100644 index 000000000..814e40235 --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on_lmp.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_lmp.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_lmp.9.png Binary files differnew file mode 100644 index 000000000..90abe3940 --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_lmp.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png Binary files differnew file mode 100644 index 000000000..48eeb3f54 --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png Binary files differnew file mode 100644 index 000000000..71e0683cd --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_light_pressed_lmp.9.png b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed_lmp.9.png Binary files differnew file mode 100644 index 000000000..6768241a7 --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed_lmp.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_lmp.9.png b/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_lmp.9.png Binary files differnew file mode 100644 index 000000000..10f8e97e4 --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_key_popup_selected_lmp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_background_lmp.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..be394151a --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_background_lmp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_left_background_lmp.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_left_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..9fa6d0003 --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_left_background_lmp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_left_more_background_lmp.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_left_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..c73269b7e --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_left_more_background_lmp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_more_background_lmp.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..fffd4021e --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_more_background_lmp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_right_background_lmp.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_right_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..61c23c19b --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_right_background_lmp.9.png diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_right_more_background_lmp.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_right_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..827d74363 --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_key_feedback_right_more_background_lmp.9.png diff --git a/java/res/drawable-hdpi/keyboard_popup_panel_background_lmp.9.png b/java/res/drawable-hdpi/keyboard_popup_panel_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..f9dd3b8b1 --- /dev/null +++ b/java/res/drawable-hdpi/keyboard_popup_panel_background_lmp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on_lmp.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on_lmp.9.png Binary files differnew file mode 100644 index 000000000..b7b2dca43 --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on_lmp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_lmp.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_lmp.9.png Binary files differnew file mode 100644 index 000000000..4a92b80dd --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_lmp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png Binary files differnew file mode 100644 index 000000000..72125a065 --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png Binary files differnew file mode 100644 index 000000000..82413d4cc --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_light_pressed_lmp.9.png b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed_lmp.9.png Binary files differnew file mode 100644 index 000000000..049385984 --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed_lmp.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_lmp.9.png b/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_lmp.9.png Binary files differnew file mode 100644 index 000000000..ee0aae28b --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_key_popup_selected_lmp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_background_lmp.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..625490b1f --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_background_lmp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_left_background_lmp.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_left_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..427c87061 --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_left_background_lmp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_left_more_background_lmp.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_left_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..ea757296d --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_left_more_background_lmp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_more_background_lmp.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..1911c429f --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_more_background_lmp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_right_background_lmp.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_right_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..cdef116d2 --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_right_background_lmp.9.png diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_right_more_background_lmp.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_right_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..dea5d076c --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_key_feedback_right_more_background_lmp.9.png diff --git a/java/res/drawable-mdpi/keyboard_popup_panel_background_lmp.9.png b/java/res/drawable-mdpi/keyboard_popup_panel_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..896505518 --- /dev/null +++ b/java/res/drawable-mdpi/keyboard_popup_panel_background_lmp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_normal_on_lmp.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_normal_on_lmp.9.png Binary files differnew file mode 100644 index 000000000..20251a000 --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_normal_on_lmp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_lmp.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_lmp.9.png Binary files differnew file mode 100644 index 000000000..84d173967 --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_lmp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png Binary files differnew file mode 100644 index 000000000..ee4490eac --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png Binary files differnew file mode 100644 index 000000000..e8124776c --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_light_pressed_lmp.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_light_pressed_lmp.9.png Binary files differnew file mode 100644 index 000000000..f770962c3 --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_light_pressed_lmp.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_lmp.9.png b/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_lmp.9.png Binary files differnew file mode 100644 index 000000000..891d00024 --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_key_popup_selected_lmp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_background_lmp.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..c211d89c8 --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_background_lmp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_left_background_lmp.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_left_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..543bc763e --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_left_background_lmp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_left_more_background_lmp.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_left_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..ec42aadb6 --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_left_more_background_lmp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_more_background_lmp.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..319e9d7cf --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_more_background_lmp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_right_background_lmp.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_right_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..052032be7 --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_right_background_lmp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_key_feedback_right_more_background_lmp.9.png b/java/res/drawable-xhdpi/keyboard_key_feedback_right_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..c7e9d1c9e --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_key_feedback_right_more_background_lmp.9.png diff --git a/java/res/drawable-xhdpi/keyboard_popup_panel_background_lmp.9.png b/java/res/drawable-xhdpi/keyboard_popup_panel_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..36df715b6 --- /dev/null +++ b/java/res/drawable-xhdpi/keyboard_popup_panel_background_lmp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_normal_on_lmp.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_normal_on_lmp.9.png Binary files differnew file mode 100644 index 000000000..97f96258e --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_normal_on_lmp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_lmp.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_lmp.9.png Binary files differnew file mode 100644 index 000000000..dfb16a76b --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_lmp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png Binary files differnew file mode 100644 index 000000000..bf1d34686 --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_off_lmp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png Binary files differnew file mode 100644 index 000000000..962277165 --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_dark_pressed_on_lmp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_light_pressed_lmp.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_light_pressed_lmp.9.png Binary files differnew file mode 100644 index 000000000..17144b673 --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_light_pressed_lmp.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_key_popup_selected_lmp.9.png b/java/res/drawable-xxhdpi/btn_keyboard_key_popup_selected_lmp.9.png Binary files differnew file mode 100644 index 000000000..0cbb2ec84 --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_key_popup_selected_lmp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_background_lmp.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..fd2f9e514 --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_background_lmp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_left_background_lmp.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..3ab79007e --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_background_lmp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_left_more_background_lmp.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..99543a1e0 --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_left_more_background_lmp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_more_background_lmp.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..121411a06 --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_more_background_lmp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_right_background_lmp.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..e9e379287 --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_background_lmp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_key_feedback_right_more_background_lmp.9.png b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_more_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..6c1143aeb --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_key_feedback_right_more_background_lmp.9.png diff --git a/java/res/drawable-xxhdpi/keyboard_popup_panel_background_lmp.9.png b/java/res/drawable-xxhdpi/keyboard_popup_panel_background_lmp.9.png Binary files differnew file mode 100644 index 000000000..91d5d7f90 --- /dev/null +++ b/java/res/drawable-xxhdpi/keyboard_popup_panel_background_lmp.9.png diff --git a/java/res/drawable/btn_keyboard_key_functional_lmp.xml b/java/res/drawable/btn_keyboard_key_functional_lmp.xml new file mode 100644 index 000000000..427b8d568 --- /dev/null +++ b/java/res/drawable/btn_keyboard_key_functional_lmp.xml @@ -0,0 +1,22 @@ +<?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"> + <!-- Functional keys. --> + <item android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_dark_pressed_lmp" /> + <item android:drawable="@android:color/transparent" /> +</selector> diff --git a/java/res/drawable/btn_keyboard_key_ics.xml b/java/res/drawable/btn_keyboard_key_ics.xml index 259bb9ba5..9db0eeef4 100644 --- a/java/res/drawable/btn_keyboard_key_ics.xml +++ b/java/res/drawable/btn_keyboard_key_ics.xml @@ -39,7 +39,7 @@ <!-- Empty background keys. --> <item android:state_empty="true" - android:drawable="@drawable/transparent" /> + android:drawable="@android:color/transparent" /> <!-- Normal keys. --> <item android:state_pressed="true" diff --git a/java/res/drawable/btn_keyboard_key_klp.xml b/java/res/drawable/btn_keyboard_key_klp.xml index 16b5fa00b..500e3ea75 100644 --- a/java/res/drawable/btn_keyboard_key_klp.xml +++ b/java/res/drawable/btn_keyboard_key_klp.xml @@ -39,7 +39,7 @@ <!-- Empty background keys. --> <item android:state_empty="true" - android:drawable="@drawable/transparent" /> + android:drawable="@android:color/transparent" /> <!-- Normal keys. --> <item android:state_pressed="true" diff --git a/java/res/drawable/btn_keyboard_key_lmp.xml b/java/res/drawable/btn_keyboard_key_lmp.xml new file mode 100644 index 000000000..fdd19df68 --- /dev/null +++ b/java/res/drawable/btn_keyboard_key_lmp.xml @@ -0,0 +1,48 @@ +<?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"> + <!-- Functional keys. --> + <item android:state_single="true" android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_dark_pressed_lmp" /> + <item android:state_single="true" + android:drawable="@android:color/transparent" /> + + <!-- Action keys. --> + <item android:state_active="true" android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_dark_pressed_lmp" /> + <item android:state_active="true" + android:drawable="@android:color/transparent" /> + + <!-- Toggle keys. Use checkable/checked state. --> + <item android:state_checkable="true" android:state_checked="true" android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_dark_pressed_on_lmp" /> + <item android:state_checkable="true" android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_dark_pressed_lmp" /> + <item android:state_checkable="true" android:state_checked="true" + android:drawable="@drawable/btn_keyboard_key_dark_normal_on_lmp" /> + <item android:state_checkable="true" + android:drawable="@android:color/transparent" /> + + <!-- Empty background keys. --> + <item android:state_empty="true" + android:drawable="@android:color/transparent" /> + + <!-- Normal keys. --> + <item android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_light_pressed_lmp" /> + <item android:drawable="@android:color/transparent" /> +</selector> diff --git a/java/res/drawable/btn_keyboard_key_popup_ics.xml b/java/res/drawable/btn_keyboard_key_popup_ics.xml index 31b613176..17d646b8f 100644 --- a/java/res/drawable/btn_keyboard_key_popup_ics.xml +++ b/java/res/drawable/btn_keyboard_key_popup_ics.xml @@ -17,5 +17,5 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/btn_keyboard_key_popup_selected_ics" /> - <item android:drawable="@drawable/transparent" /> + <item android:drawable="@android:color/transparent" /> </selector> diff --git a/java/res/drawable/btn_keyboard_key_popup_klp.xml b/java/res/drawable/btn_keyboard_key_popup_klp.xml index 62cbca8ae..9dfc93ae8 100644 --- a/java/res/drawable/btn_keyboard_key_popup_klp.xml +++ b/java/res/drawable/btn_keyboard_key_popup_klp.xml @@ -17,5 +17,5 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/btn_keyboard_key_popup_selected_klp" /> - <item android:drawable="@drawable/transparent" /> + <item android:drawable="@android:color/transparent" /> </selector> diff --git a/java/res/drawable/btn_keyboard_key_popup_lmp.xml b/java/res/drawable/btn_keyboard_key_popup_lmp.xml new file mode 100644 index 000000000..ebedaea3a --- /dev/null +++ b/java/res/drawable/btn_keyboard_key_popup_lmp.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_popup_selected_lmp" /> + <item android:drawable="@android:color/transparent" /> +</selector> diff --git a/java/res/drawable/btn_keyboard_spacebar_lmp.xml b/java/res/drawable/btn_keyboard_spacebar_lmp.xml new file mode 100644 index 000000000..516cb0731 --- /dev/null +++ b/java/res/drawable/btn_keyboard_spacebar_lmp.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_light_pressed_lmp" /> + <item android:drawable="@android:color/transparent" /> +</selector> diff --git a/java/res/drawable/transparent.xml b/java/res/drawable/btn_suggestion_lmp.xml index 855cf2ad5..c778e236f 100644 --- a/java/res/drawable/transparent.xml +++ b/java/res/drawable/btn_suggestion_lmp.xml @@ -2,7 +2,7 @@ <!-- /* ** -** Copyright 2011, The Android Open Source Project +** 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. @@ -18,13 +18,10 @@ */ --> -<shape +<selector xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle" > - <solid - android:color="@android:color/transparent" /> - <size - android:width="50dp" - android:height="40dp" /> -</shape> + <item + android:state_pressed="true" + android:drawable="@drawable/btn_keyboard_key_popup_selected_lmp" /> +</selector> diff --git a/java/res/drawable/keyboard_key_feedback_lmp.xml b/java/res/drawable/keyboard_key_feedback_lmp.xml new file mode 100644 index 000000000..cdbe64c38 --- /dev/null +++ b/java/res/drawable/keyboard_key_feedback_lmp.xml @@ -0,0 +1,36 @@ +<?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" + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" +> + <!-- Left edge --> + <item latin:state_left_edge="true" latin:state_has_morekeys="true" + android:drawable="@drawable/keyboard_key_feedback_left_more_background_lmp" /> + <item latin:state_left_edge="true" + android:drawable="@drawable/keyboard_key_feedback_left_background_lmp" /> + + <!-- Right edge --> + <item latin:state_right_edge="true" latin:state_has_morekeys="true" + android:drawable="@drawable/keyboard_key_feedback_right_more_background_lmp" /> + <item latin:state_right_edge="true" + android:drawable="@drawable/keyboard_key_feedback_right_background_lmp" /> + + <item latin:state_has_morekeys="true" + android:drawable="@drawable/keyboard_key_feedback_more_background_lmp" /> + <item android:drawable="@drawable/keyboard_key_feedback_background_lmp" /> +</selector> diff --git a/java/res/layout/suggestions_strip.xml b/java/res/layout/suggestions_strip.xml index bff9a1ef9..36898c890 100644 --- a/java/res/layout/suggestions_strip.xml +++ b/java/res/layout/suggestions_strip.xml @@ -64,4 +64,12 @@ android:textSize="16sp" style="?attr/suggestionWordStyle" /> </LinearLayout> + <ImageButton + android:id="@+id/suggestions_strip_voice_key" + android:layout_width="@dimen/config_suggestions_strip_edge_key_width" + android:layout_height="fill_parent" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + style="?attr/suggestionWordStyle" /> </merge> diff --git a/java/res/values-land/config.xml b/java/res/values-land/config.xml index f72d64ff7..37bf22fb0 100644 --- a/java/res/values-land/config.xml +++ b/java/res/values-land/config.xml @@ -59,6 +59,7 @@ <dimen name="config_suggestions_strip_height">36dp</dimen> <dimen name="config_suggestions_strip_horizontal_margin">54dp</dimen> + <dimen name="config_suggestions_strip_edge_key_width">54dp</dimen> <dimen name="config_more_suggestions_row_height">36dp</dimen> <integer name="config_max_more_suggestions_row">2</integer> <fraction name="config_min_more_suggestions_width">60%</fraction> diff --git a/java/res/values-sw600dp-land/config.xml b/java/res/values-sw600dp-land/config.xml index 8789e729f..ba8b52f0b 100644 --- a/java/res/values-sw600dp-land/config.xml +++ b/java/res/values-sw600dp-land/config.xml @@ -50,6 +50,7 @@ <dimen name="config_suggestions_strip_height">44dp</dimen> <dimen name="config_suggestions_strip_horizontal_margin">180.0dp</dimen> + <dimen name="config_suggestions_strip_edge_key_width">54dp</dimen> <integer name="config_max_more_suggestions_row">5</integer> <fraction name="config_min_more_suggestions_width">50%</fraction> diff --git a/java/res/values-sw600dp/config.xml b/java/res/values-sw600dp/config.xml index 12e9832f9..d97538de0 100644 --- a/java/res/values-sw600dp/config.xml +++ b/java/res/values-sw600dp/config.xml @@ -63,7 +63,8 @@ <fraction name="config_key_shifted_letter_hint_ratio_5row">27%</fraction> <dimen name="config_suggestions_strip_height">44dp</dimen> - <dimen name="config_suggestions_strip_horizontal_margin">0dp</dimen> + <dimen name="config_suggestions_strip_horizontal_margin">54dp</dimen> + <dimen name="config_suggestions_strip_edge_key_width">54dp</dimen> <dimen name="config_more_suggestions_row_height">44dp</dimen> <integer name="config_max_more_suggestions_row">6</integer> <fraction name="config_min_more_suggestions_width">90%</fraction> diff --git a/java/res/values-sw768dp-land/config.xml b/java/res/values-sw768dp-land/config.xml index 17733f099..63f86ba81 100644 --- a/java/res/values-sw768dp-land/config.xml +++ b/java/res/values-sw768dp-land/config.xml @@ -51,6 +51,7 @@ <dimen name="config_suggestions_strip_height">44dp</dimen> <dimen name="config_suggestions_strip_horizontal_margin">340dp</dimen> + <dimen name="config_suggestions_strip_edge_key_width">54dp</dimen> <fraction name="config_min_more_suggestions_width">50%</fraction> <!-- Gesture floating preview text parameters --> diff --git a/java/res/values-sw768dp/config.xml b/java/res/values-sw768dp/config.xml index 647cca94b..94b38d850 100644 --- a/java/res/values-sw768dp/config.xml +++ b/java/res/values-sw768dp/config.xml @@ -62,6 +62,7 @@ <dimen name="config_suggestions_strip_height">44dp</dimen> <dimen name="config_suggestions_strip_horizontal_margin">100dp</dimen> + <dimen name="config_suggestions_strip_edge_key_width">54dp</dimen> <dimen name="config_more_suggestions_row_height">44dp</dimen> <integer name="config_max_more_suggestions_row">6</integer> <fraction name="config_min_more_suggestions_width">90%</fraction> diff --git a/java/res/values/colors.xml b/java/res/values/colors.xml index 824928c6b..dabb4d65e 100644 --- a/java/res/values/colors.xml +++ b/java/res/values/colors.xml @@ -40,6 +40,12 @@ <color name="typed_word_color_klp">#D8F0F0F0</color> <color name="suggested_word_color_klp">#B2F0F0F0</color> <color name="highlight_translucent_color_klp">#99E0E0E0</color> + <!-- Color resources for LMP theme. Base color = F0F0F0 --> + <color name="key_hint_letter_color_lmp">@android:color/white</color> + <color name="highlight_color_lmp">#FFF0F0F0</color> + <color name="typed_word_color_lmp">#D8F0F0F0</color> + <color name="suggested_word_color_lmp">#B2F0F0F0</color> + <color name="highlight_translucent_color_lmp">#99E0E0E0</color> <!-- Color resources for setup wizard and tutorial --> <color name="setup_background">#FFEBEBEB</color> <color name="setup_text_dark">#FF707070</color> diff --git a/java/res/values/config-common.xml b/java/res/values/config-common.xml index 3fe4b947c..1962c0d45 100644 --- a/java/res/values/config-common.xml +++ b/java/res/values/config-common.xml @@ -24,9 +24,6 @@ at input history to suggest a hopefully helpful suggestions for the next word? --> <bool name="config_default_next_word_prediction">true</bool> - <!-- This configuration must be aligned with {@link KeyboardTheme#DEFAULT_THEME_ID}. --> - <string name="config_default_keyboard_theme_id" translatable="false">2</string> - <integer name="config_delay_update_shift_state">100</integer> <integer name="config_double_space_period_timeout">1100</integer> diff --git a/java/res/values/config.xml b/java/res/values/config.xml index 1ab49279c..9f556a6e4 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -64,7 +64,8 @@ <fraction name="config_key_shifted_letter_hint_ratio_5row">41%</fraction> <dimen name="config_suggestions_strip_height">40dp</dimen> - <dimen name="config_suggestions_strip_horizontal_margin">0dp</dimen> + <dimen name="config_suggestions_strip_horizontal_margin">36dp</dimen> + <dimen name="config_suggestions_strip_edge_key_width">36dp</dimen> <dimen name="config_more_suggestions_row_height">40dp</dimen> <integer name="config_max_more_suggestions_row">6</integer> <fraction name="config_min_more_suggestions_width">90%</fraction> diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index 9a610a0d0..415dd0b65 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -47,17 +47,6 @@ <string name="prefs_debug_mode">Debug Mode</string> <string name="prefs_force_non_distinct_multitouch">Force non-distinct multitouch</string> - <!-- For keyboard color scheme option dialog. --> - <string-array name="keyboard_theme_names"> - <item>@string/keyboard_color_scheme_white</item> - <item>@string/keyboard_color_scheme_blue</item> - </string-array> - <!-- An element must be a keyboard theme id of {@link KeyboardTheme#THEME_ID_*}. --> - <string-array name="keyboard_theme_ids"> - <item>2</item> - <item>0</item> - </string-array> - <!-- 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/keyboard-icons-holo.xml b/java/res/values/keyboard-icons-holo.xml index 4c888d570..669d2c07d 100644 --- a/java/res/values/keyboard-icons-holo.xml +++ b/java/res/values/keyboard-icons-holo.xml @@ -21,9 +21,6 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="KeyboardIcons.Holo"> <!-- Keyboard icons --> - <!-- TODO: The following holo icon for phone (drawable-hdpi and drawable-xhdpi) are missing. - sym_keyboard_123_mic_holo - --> <item name="iconShiftKey">@drawable/sym_keyboard_shift_holo_dark</item> <item name="iconDeleteKey">@drawable/sym_keyboard_delete_holo_dark</item> <item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo_dark</item> diff --git a/java/res/values/keyboard-icons-lmp.xml b/java/res/values/keyboard-icons-lmp.xml new file mode 100644 index 000000000..a9cbabca6 --- /dev/null +++ b/java/res/values/keyboard-icons-lmp.xml @@ -0,0 +1,41 @@ +<?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:android="http://schemas.android.com/apk/res/android"> + <style name="KeyboardIcons.LMP"> + <!-- Keyboard icons --> + <item name="iconShiftKey">@drawable/sym_keyboard_shift_holo_dark</item> + <item name="iconDeleteKey">@drawable/sym_keyboard_delete_holo_dark</item> + <item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo_dark</item> + <item name="iconSpaceKey">@drawable/sym_keyboard_space_holo_dark</item> + <item name="iconEnterKey">@drawable/sym_keyboard_return_holo_dark</item> + <item name="iconSearchKey">@drawable/sym_keyboard_search_holo_dark</item> + <item name="iconTabKey">@drawable/sym_keyboard_tab_holo_dark</item> + <item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo_dark</item> + <item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space_holo_dark</item> + <item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_locked_holo_dark</item> + <item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_holo_dark</item> + <item name="iconTabKeyPreview">@drawable/sym_keyboard_feedback_tab</item> + <item name="iconLanguageSwitchKey">@drawable/sym_keyboard_language_switch_dark</item> + <item name="iconZwnjKey">@drawable/sym_keyboard_zwnj_holo_dark</item> + <item name="iconZwjKey">@drawable/sym_keyboard_zwj_holo_dark</item> + <item name="iconEmojiKey">@drawable/sym_keyboard_smiley_holo_dark</item> + </style> +</resources> diff --git a/java/res/values/keyboard-themes.xml b/java/res/values/keyboard-themes.xml new file mode 100644 index 000000000..0325f5be0 --- /dev/null +++ b/java/res/values/keyboard-themes.xml @@ -0,0 +1,34 @@ +<?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"> + <!-- For keyboard color scheme option dialog. --> + <string-array name="keyboard_theme_names" translatable="false"> + <item>@string/keyboard_color_scheme_white</item> + <item>@string/keyboard_color_scheme_blue</item> + <!-- TODO: Make this item as translatable string resource. --> + <item>Quantum</item> + </string-array> + <!-- An element must be a keyboard theme id of {@link KeyboardTheme#THEME_ID_*}. --> + <string-array name="keyboard_theme_ids" translatable="false"> + <item>2</item> + <item>0</item> + <item>3</item> + </string-array> +</resources> diff --git a/java/res/values/themes-lmp.xml b/java/res/values/themes-lmp.xml new file mode 100644 index 000000000..773da196d --- /dev/null +++ b/java/res/values/themes-lmp.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. +*/ +--> + +<resources xmlns:android="http://schemas.android.com/apk/res/android"> + <style name="KeyboardTheme.LMP" parent="KeyboardIcons.LMP"> + <item name="keyboardStyle">@style/Keyboard.LMP</item> + <item name="keyboardViewStyle">@style/KeyboardView.LMP</item> + <item name="mainKeyboardViewStyle">@style/MainKeyboardView.LMP</item> + <item name="keyPreviewTextViewStyle">@style/KeyPreviewTextView.LMP</item> + <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.LMP</item> + <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.LMP</item> + <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.LMP</item> + <item name="suggestionStripViewStyle">@style/SuggestionStripView.LMP</item> + <item name="suggestionWordStyle">@style/SuggestionWord.LMP</item> + </style> + <style + name="Keyboard.LMP" + parent="Keyboard" + > + <!-- This should be aligned with KeyboardSwitcher.KEYBOARD_THEMES[] --> + <item name="themeId">0</item> + <item name="keyboardTopPadding">@fraction/config_keyboard_top_padding_holo</item> + <item name="keyboardBottomPadding">@fraction/config_keyboard_bottom_padding_holo</item> + <item name="horizontalGap">@fraction/config_key_horizontal_gap_holo</item> + <item name="verticalGap">@fraction/config_key_vertical_gap_holo</item> + <item name="touchPositionCorrectionData">@array/touch_position_correction_data_holo</item> + </style> + <style + name="KeyboardView.LMP" + parent="KeyboardView" + > + <item name="android:background">@drawable/keyboard_background_holo</item> + <item name="keyBackground">@drawable/btn_keyboard_key_lmp</item> + <item name="keyTypeface">bold</item> + <item name="keyTextColor">@color/key_text_color_holo</item> + <item name="keyTextInactivatedColor">@color/key_text_inactivated_color_holo</item> + <item name="keyHintLetterColor">@color/key_hint_letter_color_lmp</item> + <item name="keyHintLabelColor">@color/key_hint_label_color_holo</item> + <item name="keyShiftedLetterHintInactivatedColor">@color/key_shifted_letter_hint_inactivated_color_holo</item> + <item name="keyShiftedLetterHintActivatedColor">@color/key_shifted_letter_hint_activated_color_holo</item> + <item name="keyPreviewTextColor">@color/key_text_color_holo</item> + <item name="keyTextShadowColor">@color/key_text_shadow_color_holo</item> + <item name="keyTextShadowRadius">0.0</item> + </style> + <style + name="MainKeyboardView.LMP" + parent="KeyboardView.LMP" + > + <item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item> + <item name="gestureFloatingPreviewTextColor">@color/highlight_color_lmp</item> + <item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_holo</item> + <item name="gestureTrailColor">@color/highlight_color_lmp</item> + <item name="slidingKeyInputPreviewColor">@color/highlight_translucent_color_lmp</item> + <item name="autoCorrectionSpacebarLedEnabled">false</item> + <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item> + <item name="languageOnSpacebarTextColor">@color/spacebar_text_color_holo</item> + <item name="languageOnSpacebarTextShadowColor">@color/spacebar_text_shadow_color_holo</item> + <item name="spacebarBackground">@drawable/btn_keyboard_spacebar_lmp</item> + </style> + <style + name="KeyPreviewTextView.LMP" + parent="KeyPreviewTextView" + > + <item name="android:background">@drawable/keyboard_key_feedback_lmp</item> + </style> + <!-- Though {@link EmojiPalettesView} doesn't extend {@link KeyboardView}, some views inside it, + for instance delete button, need themed {@link KeyboardView} attributes. --> + <style + name="EmojiPalettesView.LMP" + parent="KeyboardView.LMP" + > + <item name="keyBackgroundEmojiFunctional">@drawable/btn_keyboard_key_functional_lmp</item> + <item name="emojiTabLabelColor">@color/emoji_tab_label_color_holo</item> + </style> + <style + name="MoreKeysKeyboard.LMP" + parent="Keyboard.LMP" + > + <item name="keyboardTopPadding">0%p</item> + <item name="keyboardBottomPadding">0%p</item> + <item name="horizontalGap">0%p</item> + <item name="touchPositionCorrectionData">@null</item> + </style> + <style + name="MoreKeysKeyboardView.LMP" + parent="KeyboardView.LMP" + > + <item name="android:background">@drawable/keyboard_popup_panel_background_lmp</item> + <item name="keyBackground">@drawable/btn_keyboard_key_popup_lmp</item> + <item name="keyTypeface">normal</item> + <item name="verticalCorrection">@dimen/config_more_keys_keyboard_vertical_correction_holo</item> + </style> + <style + name="SuggestionStripView.LMP" + parent="KeyboardView.LMP" + > + <item name="suggestionsCountInStrip">@integer/config_suggestions_count_in_strip</item> + <item name="centerSuggestionPercentile">@fraction/config_center_suggestion_percentile</item> + <item name="maxMoreSuggestionsRow">@integer/config_max_more_suggestions_row</item> + <item name="minMoreSuggestionsWidth">@fraction/config_min_more_suggestions_width</item> + <item name="android:background">@drawable/keyboard_suggest_strip_holo</item> + <item name="suggestionStripOptions">autoCorrectBold|validTypedWordBold</item> + <item name="colorValidTypedWord">@color/typed_word_color_lmp</item> + <item name="colorTypedWord">@color/typed_word_color_lmp</item> + <item name="colorAutoCorrect">@color/highlight_color_lmp</item> + <item name="colorSuggested">@color/suggested_word_color_lmp</item> + <item name="alphaObsoleted">70%</item> + </style> + <style + name="SuggestionWord.LMP" + parent="SuggestionWord" + > + <item name="android:background">@drawable/btn_suggestion_lmp</item> + <item name="android:textColor">@color/highlight_color_lmp</item> + </style> +</resources> diff --git a/java/res/xml-sw600dp/key_shortcut.xml b/java/res/xml-sw600dp/key_settings.xml index d24e81f73..45915e948 100644 --- a/java/res/xml-sw600dp/key_shortcut.xml +++ b/java/res/xml-sw600dp/key_settings.xml @@ -2,7 +2,7 @@ <!-- /* ** -** Copyright 2012, The Android Open Source Project +** 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. @@ -23,29 +23,12 @@ > <switch> <case - latin:supportsSwitchingToShortcutIme="true" - latin:clobberSettingsKey="false" - > - <Key - latin:keyStyle="shortcutKeyStyle" - latin:keyLabelFlags="hasPopupHint|preserveCase" - latin:moreKeys="!text/keyspec_settings" /> - </case> - <case - latin:supportsSwitchingToShortcutIme="true" - latin:clobberSettingsKey="true" - > - <Key - latin:keyStyle="shortcutKeyStyle" /> - </case> - <case - latin:supportsSwitchingToShortcutIme="false" latin:clobberSettingsKey="false" > <Key latin:keyStyle="settingsKeyStyle" /> </case> - <!-- supportsSwitchingToShortcutIme="false" clobberSettingsKey="true" --> + <!-- clobberSettingsKey="true" --> <default> <Spacer /> </default> diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml index 3d5556fe5..f9b959b76 100644 --- a/java/res/xml-sw600dp/key_styles_common.xml +++ b/java/res/xml-sw600dp/key_styles_common.xml @@ -78,7 +78,7 @@ latin:keyboardLayout="@xml/key_styles_enter" /> <key-style latin:styleName="spaceKeyStyle" - latin:keySpec=" |!code/key_space" + latin:keySpec="!icon/space_key|!code/key_space" latin:keyActionFlags="noKeyPreview|enableLongPress" /> <!-- U+200C: ZERO WIDTH NON-JOINER U+200D: ZERO WIDTH JOINER --> diff --git a/java/res/xml-sw600dp/row_dvorak4.xml b/java/res/xml-sw600dp/row_dvorak4.xml index 2ba6a491b..d3709ef6d 100644 --- a/java/res/xml-sw600dp/row_dvorak4.xml +++ b/java/res/xml-sw600dp/row_dvorak4.xml @@ -29,7 +29,7 @@ latin:keyStyle="toSymbolKeyStyle" latin:keyWidth="10.0%p" /> <include - latin:keyboardLayout="@xml/key_shortcut" /> + latin:keyboardLayout="@xml/key_settings" /> <include latin:keyboardLayout="@xml/key_f1" /> <include diff --git a/java/res/xml-sw600dp/row_pcqwerty5.xml b/java/res/xml-sw600dp/row_pcqwerty5.xml index 52b581ae6..ac07f11c2 100644 --- a/java/res/xml-sw600dp/row_pcqwerty5.xml +++ b/java/res/xml-sw600dp/row_pcqwerty5.xml @@ -26,7 +26,7 @@ > <include latin:keyWidth="9.0%p" - latin:keyboardLayout="@xml/key_shortcut" /> + latin:keyboardLayout="@xml/key_settings" /> <switch> <case latin:languageSwitchKeyEnabled="true" diff --git a/java/res/xml-sw600dp/row_qwerty4.xml b/java/res/xml-sw600dp/row_qwerty4.xml index 7969dd8a5..d93143761 100644 --- a/java/res/xml-sw600dp/row_qwerty4.xml +++ b/java/res/xml-sw600dp/row_qwerty4.xml @@ -29,7 +29,7 @@ latin:keyStyle="toSymbolKeyStyle" latin:keyWidth="10.0%p" /> <include - latin:keyboardLayout="@xml/key_shortcut" /> + latin:keyboardLayout="@xml/key_settings" /> <include latin:keyboardLayout="@xml/key_f1" /> <include diff --git a/java/res/xml/key_f1.xml b/java/res/xml/key_f1.xml index c96ddcac1..3471c85f5 100644 --- a/java/res/xml/key_f1.xml +++ b/java/res/xml/key_f1.xml @@ -36,27 +36,10 @@ latin:keySpec="\@" latin:keyStyle="f1MoreKeysStyle" /> </case> - <case - latin:supportsSwitchingToShortcutIme="false" - > - <Key - latin:keySpec="!text/keyspec_comma" - latin:keyLabelFlags="hasPopupHint" - latin:keyStyle="f1MoreKeysStyle" /> - </case> - <!-- latin:supportsSwitchingToShortcutIme="true" --> - <case - latin:hasShortcutKey="true" - > - <Key - latin:keyStyle="shortcutKeyStyle" /> - </case> - <!-- latin:hasShortcutKey="false" --> <default> <Key latin:keySpec="!text/keyspec_comma" latin:keyLabelFlags="hasPopupHint" - latin:additionalMoreKeys="!text/keyspec_shortcut" latin:keyStyle="f1MoreKeysStyle" /> </default> </switch> diff --git a/java/res/xml/key_styles_common.xml b/java/res/xml/key_styles_common.xml index 78e030132..773995fa8 100644 --- a/java/res/xml/key_styles_common.xml +++ b/java/res/xml/key_styles_common.xml @@ -87,7 +87,7 @@ latin:keyboardLayout="@xml/key_styles_enter" /> <key-style latin:styleName="spaceKeyStyle" - latin:keySpec=" |!code/key_space" + latin:keySpec="!icon/space_key|!code/key_space" latin:keyActionFlags="noKeyPreview|enableLongPress" /> <!-- U+200C: ZERO WIDTH NON-JOINER U+200D: ZERO WIDTH JOINER --> diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 015699681..2adc957b1 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -503,7 +503,7 @@ android:subtypeId="0xea266ea4" android:imeSubtypeLocale="my_MM" android:imeSubtypeMode="keyboard" - android:imeSubtypeExtraValue="KeyboardLayoutSet=myanmar,EmojiCapable" + android:imeSubtypeExtraValue="KeyboardLayoutSet=myanmar,EmojiCapable,CombiningRules=MyanmarReordering" android:isAsciiCapable="false" /> <subtype android:icon="@drawable/ic_ime_switcher_dark" diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 7d86dbd5d..61ebb6992 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -158,12 +158,11 @@ android:persistent="true" android:defaultValue="false" /> <ListPreference - android:key="pref_keyboard_layout_20110916" + android:key="pref_keyboard_theme" android:title="@string/keyboard_color_scheme" android:persistent="true" android:entryValues="@array/keyboard_theme_ids" - android:entries="@array/keyboard_theme_names" - android:defaultValue="@string/config_default_keyboard_theme_id" /> + android:entries="@array/keyboard_theme_names" /> <PreferenceScreen android:fragment="com.android.inputmethod.latin.settings.AdditionalSubtypeSettings" android:key="custom_input_styles" diff --git a/java/res/xml/row_dvorak4.xml b/java/res/xml/row_dvorak4.xml index 91462cb9c..279f64627 100644 --- a/java/res/xml/row_dvorak4.xml +++ b/java/res/xml/row_dvorak4.xml @@ -30,7 +30,6 @@ <Key latin:keySpec="q" latin:backgroundType="normal" - latin:additionalMoreKeys="!text/keyspec_shortcut" latin:keyStyle="f1MoreKeysStyle" /> <include latin:keyXPos="25%p" diff --git a/java/res/xml/row_pcqwerty5.xml b/java/res/xml/row_pcqwerty5.xml index 3782763a8..32c5389cc 100644 --- a/java/res/xml/row_pcqwerty5.xml +++ b/java/res/xml/row_pcqwerty5.xml @@ -26,13 +26,6 @@ > <switch> <case - latin:hasShortcutKey="true" - > - <Key - latin:keyStyle="shortcutKeyStyle" - latin:keyWidth="11.538%p" /> - </case> - <case latin:clobberSettingsKey="false" > <Key diff --git a/java/src/com/android/inputmethod/event/CombinerChain.java b/java/src/com/android/inputmethod/event/CombinerChain.java index 8b59dc52a..990f7deea 100644 --- a/java/src/com/android/inputmethod/event/CombinerChain.java +++ b/java/src/com/android/inputmethod/event/CombinerChain.java @@ -23,6 +23,7 @@ import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.utils.CollectionUtils; import java.util.ArrayList; +import java.util.HashMap; /** * This class implements the logic chain between receiving events and generating code points. @@ -43,6 +44,13 @@ public class CombinerChain { private SpannableStringBuilder mStateFeedback; private final ArrayList<Combiner> mCombiners; + private static final HashMap<String, Class> IMPLEMENTED_COMBINERS + = new HashMap<String, Class>(); + static { + IMPLEMENTED_COMBINERS.put("MyanmarReordering", MyanmarReordering.class); + } + private static final String COMBINER_SPEC_SEPARATOR = ";"; + /** * Create an combiner chain. * @@ -56,6 +64,9 @@ public class CombinerChain { mCombiners = CollectionUtils.newArrayList(); // The dead key combiner is always active, and always first mCombiners.add(new DeadKeyCombiner()); + for (final Combiner combiner : combinerList) { + mCombiners.add(combiner); + } mCombinedText = new StringBuilder(); mStateFeedback = new SpannableStringBuilder(); } @@ -114,4 +125,29 @@ public class CombinerChain { final SpannableStringBuilder s = new SpannableStringBuilder(mCombinedText); return s.append(mStateFeedback); } + + public static Combiner[] createCombiners(final String spec) { + if (TextUtils.isEmpty(spec)) { + return new Combiner[0]; + } + final String[] combinerDescriptors = spec.split(COMBINER_SPEC_SEPARATOR); + final Combiner[] combiners = new Combiner[combinerDescriptors.length]; + int i = 0; + for (final String combinerDescriptor : combinerDescriptors) { + final Class combinerClass = IMPLEMENTED_COMBINERS.get(combinerDescriptor); + if (null == combinerClass) { + throw new RuntimeException("Unknown combiner descriptor: " + combinerDescriptor); + } + try { + combiners[i++] = (Combiner)combinerClass.newInstance(); + } catch (InstantiationException e) { + throw new RuntimeException("Unable to instantiate combiner: " + combinerDescriptor, + e); + } catch (IllegalAccessException e) { + throw new RuntimeException("Unable to instantiate combiner: " + combinerDescriptor, + e); + } + } + return combiners; + } } diff --git a/java/src/com/android/inputmethod/event/MyanmarReordering.java b/java/src/com/android/inputmethod/event/MyanmarReordering.java new file mode 100644 index 000000000..0831b63ec --- /dev/null +++ b/java/src/com/android/inputmethod/event/MyanmarReordering.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +package com.android.inputmethod.event; + +import java.util.ArrayList; + +/** + * A combiner that reorders input for Myanmar. + */ +public class MyanmarReordering implements Combiner { + @Override + public Event processEvent(ArrayList<Event> previousEvents, Event event) { + return event; + } + + @Override + public CharSequence getCombiningStateFeedback() { + return ""; + } + + @Override + public void reset() { + } +} diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index 1cd6ef249..4a46a4a46 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -64,7 +64,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { * what user actually typed. */ private boolean mIsAutoCorrectionActive; - private KeyboardTheme mKeyboardTheme = KeyboardTheme.getDefaultKeyboardTheme(); + private KeyboardTheme mKeyboardTheme; private Context mThemeContext; private static final KeyboardSwitcher sInstance = new KeyboardSwitcher(); @@ -101,7 +101,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { private boolean updateKeyboardThemeAndContextThemeWrapper(final Context context, final KeyboardTheme keyboardTheme) { - if (mThemeContext == null || mKeyboardTheme.mThemeId != keyboardTheme.mThemeId) { + if (mThemeContext == null || !keyboardTheme.equals(mKeyboardTheme)) { mKeyboardTheme = keyboardTheme; mThemeContext = new ContextThemeWrapper(context, keyboardTheme.mStyleId); KeyboardLayoutSet.clearKeyboardCache(); @@ -342,7 +342,8 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mKeyboardView.closing(); } - updateKeyboardThemeAndContextThemeWrapper(mLatinIME, mKeyboardTheme); + updateKeyboardThemeAndContextThemeWrapper( + mLatinIME, KeyboardTheme.getKeyboardTheme(mPrefs)); mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate( R.layout.input_view, null); mMainKeyboardFrame = mCurrentInputView.findViewById(R.id.main_keyboard_frame); diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java index 4db72ad4d..429c7ddd7 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java @@ -17,34 +17,85 @@ package com.android.inputmethod.keyboard; import android.content.SharedPreferences; +import android.os.Build; +import android.os.Build.VERSION_CODES; import android.util.Log; import com.android.inputmethod.latin.R; -import com.android.inputmethod.latin.settings.Settings; + +import java.util.Arrays; +import java.util.Comparator; public final class KeyboardTheme { private static final String TAG = KeyboardTheme.class.getSimpleName(); - public static final int THEME_ID_ICS = 0; - public static final int THEME_ID_KLP = 2; - private static final int DEFAULT_THEME_ID = THEME_ID_KLP; + static final String KITKAT_KEYBOARD_THEME_KEY = "pref_keyboard_layout_20110916"; + static final String KEYBOARD_THEME_KEY = "pref_keyboard_theme_20140509"; + + static final int THEME_ID_ICS = 0; + static final int THEME_ID_KLP = 2; + static final int THEME_ID_LMP = 3; + static final int DEFAULT_THEME_ID = THEME_ID_KLP; private static final KeyboardTheme[] KEYBOARD_THEMES = { - new KeyboardTheme(THEME_ID_ICS, R.style.KeyboardTheme_ICS), - new KeyboardTheme(THEME_ID_KLP, R.style.KeyboardTheme_KLP), + new KeyboardTheme(THEME_ID_ICS, R.style.KeyboardTheme_ICS, + VERSION_CODES.ICE_CREAM_SANDWICH), + new KeyboardTheme(THEME_ID_KLP, R.style.KeyboardTheme_KLP, + VERSION_CODES.KITKAT), + new KeyboardTheme(THEME_ID_LMP, R.style.KeyboardTheme_LMP, + // TODO: Update this constant once the *next* version becomes available. + VERSION_CODES.CUR_DEVELOPMENT), }; + static { + // Sort {@link #KEYBOARD_THEME} by descending order of {@link #mMinApiVersion}. + Arrays.sort(KEYBOARD_THEMES, new Comparator<KeyboardTheme>() { + @Override + public int compare(final KeyboardTheme lhs, final KeyboardTheme rhs) { + if (lhs.mMinApiVersion > rhs.mMinApiVersion) return -1; + if (lhs.mMinApiVersion < rhs.mMinApiVersion) return 1; + return 0; + } + }); + } public final int mThemeId; public final int mStyleId; + final int mMinApiVersion; // Note: The themeId should be aligned with "themeId" attribute of Keyboard style - // in values/style.xml. - public KeyboardTheme(final int themeId, final int styleId) { + // in values/themes-<style>.xml. + private KeyboardTheme(final int themeId, final int styleId, final int minApiVersion) { mThemeId = themeId; mStyleId = styleId; + mMinApiVersion = minApiVersion; + } + + @Override + public boolean equals(final Object o) { + if (o == this) return true; + return (o instanceof KeyboardTheme) && ((KeyboardTheme)o).mThemeId == mThemeId; } - private static KeyboardTheme searchKeyboardTheme(final int themeId) { + @Override + public int hashCode() { + return mThemeId; + } + + // TODO: This method should be removed when {@link LatinImeLogger} is removed. + public int getCompatibleThemeIdForLogging() { + switch (mThemeId) { + case THEME_ID_ICS: + return 5; + case THEME_ID_KLP: + return 9; + case THEME_ID_LMP: + return 10; + default: // Invalid theme + return -1; + } + } + + private static KeyboardTheme searchKeyboardThemeById(final int themeId) { // TODO: This search algorithm isn't optimal if there are many themes. for (final KeyboardTheme theme : KEYBOARD_THEMES) { if (theme.mThemeId == themeId) { @@ -54,18 +105,57 @@ public final class KeyboardTheme { return null; } - public static KeyboardTheme getDefaultKeyboardTheme() { - return searchKeyboardTheme(DEFAULT_THEME_ID); + private static int getSdkVersion() { + final int sdkVersion = Build.VERSION.SDK_INT; + // TODO: Consider to remove this check once the *next* version becomes available. + if (sdkVersion == VERSION_CODES.KITKAT && Build.VERSION.CODENAME.startsWith("L")) { + return VERSION_CODES.CUR_DEVELOPMENT; + } + return sdkVersion; + } + + static KeyboardTheme getDefaultKeyboardTheme(final SharedPreferences prefs, + final int sdkVersion) { + final String obsoleteIdString = prefs.getString(KITKAT_KEYBOARD_THEME_KEY, null); + if (obsoleteIdString != null) { + // Remove old preference. + prefs.edit().remove(KITKAT_KEYBOARD_THEME_KEY).apply(); + if (sdkVersion <= VERSION_CODES.KITKAT) { + try { + final int themeId = Integer.parseInt(obsoleteIdString); + final KeyboardTheme theme = searchKeyboardThemeById(themeId); + if (theme != null) { + return theme; + } + Log.w(TAG, "Unknown keyboard theme in preference: " + obsoleteIdString); + } catch (final NumberFormatException e) { + Log.w(TAG, "Illegal keyboard theme in preference: " + obsoleteIdString); + } + } + } + // TODO: This search algorithm isn't optimal if there are many themes. + for (final KeyboardTheme theme : KEYBOARD_THEMES) { + if (sdkVersion >= theme.mMinApiVersion) { + return theme; + } + } + return searchKeyboardThemeById(DEFAULT_THEME_ID); + } + + public static void saveKeyboardThemeId(final String themeIdString, + final SharedPreferences prefs) { + prefs.edit().putString(KEYBOARD_THEME_KEY, themeIdString).apply(); } public static KeyboardTheme getKeyboardTheme(final SharedPreferences prefs) { - final String themeIdString = prefs.getString(Settings.PREF_KEYBOARD_LAYOUT, null); + final int sdkVersion = getSdkVersion(); + final String themeIdString = prefs.getString(KEYBOARD_THEME_KEY, null); if (themeIdString == null) { - return getDefaultKeyboardTheme(); + return getDefaultKeyboardTheme(prefs, sdkVersion); } try { final int themeId = Integer.parseInt(themeIdString); - final KeyboardTheme theme = searchKeyboardTheme(themeId); + final KeyboardTheme theme = searchKeyboardThemeById(themeId); if (theme != null) { return theme; } @@ -73,9 +163,8 @@ public final class KeyboardTheme { } catch (final NumberFormatException e) { Log.w(TAG, "Illegal keyboard theme in preference: " + themeIdString); } - // Reset preference to default value. - final String defaultThemeIdString = Integer.toString(DEFAULT_THEME_ID); - prefs.edit().putString(Settings.PREF_KEYBOARD_LAYOUT, defaultThemeIdString).apply(); - return getDefaultKeyboardTheme(); + // Remove preference. + prefs.edit().remove(KEYBOARD_THEME_KEY).apply(); + return getDefaultKeyboardTheme(prefs, sdkVersion); } } diff --git a/java/src/com/android/inputmethod/latin/Constants.java b/java/src/com/android/inputmethod/latin/Constants.java index e71723a15..5bc9b6281 100644 --- a/java/src/com/android/inputmethod/latin/Constants.java +++ b/java/src/com/android/inputmethod/latin/Constants.java @@ -115,6 +115,11 @@ public final class Constants { */ public static final String IS_ADDITIONAL_SUBTYPE = "isAdditionalSubtype"; + /** + * The subtype extra value used to specify the combining rules. + */ + public static final String COMBINING_RULES = "CombiningRules"; + private ExtraValue() { // This utility class is not publicly instantiable. } diff --git a/java/src/com/android/inputmethod/latin/Dictionary.java b/java/src/com/android/inputmethod/latin/Dictionary.java index 0742fbde9..cd380db6b 100644 --- a/java/src/com/android/inputmethod/latin/Dictionary.java +++ b/java/src/com/android/inputmethod/latin/Dictionary.java @@ -57,6 +57,8 @@ public abstract class Dictionary { public static final String TYPE_USER_HISTORY = "history"; // Personalization dictionary. public static final String TYPE_PERSONALIZATION = "personalization"; + // Contextual dictionary. + public static final String TYPE_CONTEXTUAL = "contextual"; public final String mDictType; public Dictionary(final String dictType) { diff --git a/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java b/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java index 9735645cb..ea9691a5a 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java +++ b/java/src/com/android/inputmethod/latin/DictionaryFacilitatorForSuggest.java @@ -23,6 +23,7 @@ import android.util.Log; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; +import com.android.inputmethod.latin.personalization.ContextualDictionary; import com.android.inputmethod.latin.personalization.PersonalizationDictionary; import com.android.inputmethod.latin.personalization.UserHistoryDictionary; import com.android.inputmethod.latin.utils.CollectionUtils; @@ -63,7 +64,8 @@ public class DictionaryFacilitatorForSuggest { Dictionary.TYPE_USER_HISTORY, Dictionary.TYPE_PERSONALIZATION, Dictionary.TYPE_USER, - Dictionary.TYPE_CONTACTS + Dictionary.TYPE_CONTACTS, + Dictionary.TYPE_CONTEXTUAL }; private static final Map<String, Class<? extends ExpandableBinaryDictionary>> @@ -74,6 +76,7 @@ public class DictionaryFacilitatorForSuggest { DICT_TYPE_TO_CLASS.put(Dictionary.TYPE_PERSONALIZATION, PersonalizationDictionary.class); DICT_TYPE_TO_CLASS.put(Dictionary.TYPE_USER, UserBinaryDictionary.class); DICT_TYPE_TO_CLASS.put(Dictionary.TYPE_CONTACTS, ContactsBinaryDictionary.class); + DICT_TYPE_TO_CLASS.put(Dictionary.TYPE_CONTEXTUAL, ContextualDictionary.class); } private static final String DICT_FACTORY_METHOD_NAME = "getDictionary"; @@ -201,6 +204,7 @@ public class DictionaryFacilitatorForSuggest { if (usePersonalizedDicts) { subDictTypesToUse.add(Dictionary.TYPE_USER_HISTORY); subDictTypesToUse.add(Dictionary.TYPE_PERSONALIZATION); + subDictTypesToUse.add(Dictionary.TYPE_CONTEXTUAL); } final Dictionary newMainDict; diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d64a1a6f7..7dc566a14 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -733,6 +733,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // Note that the calling sequence of onCreate() and onCurrentInputMethodSubtypeChanged() // is not guaranteed. It may even be called at the same time on a different thread. mSubtypeSwitcher.onSubtypeChanged(subtype); + mInputLogic.onSubtypeChanged(SubtypeLocaleUtils.getCombiningRulesExtraValue(subtype)); loadKeyboard(); } @@ -808,7 +809,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // The app calling setText() has the effect of clearing the composing // span, so we should reset our state unconditionally, even if restarting is true. - mInputLogic.startInput(restarting, editorInfo); + // We also tell the input logic about the combining rules for the current subtype, so + // it can adjust its combiners if needed. + mInputLogic.startInput(restarting, editorInfo, + mSubtypeSwitcher.getCombiningRulesExtraValueOfCurrentSubtype()); // Note: the following does a round-trip IPC on the main thread: be careful final Locale currentLocale = mSubtypeSwitcher.getCurrentSubtypeLocale(); diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java index 021133945..c8a2fb2f9 100644 --- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java +++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java @@ -52,7 +52,6 @@ public final class SubtypeSwitcher { private /* final */ RichInputMethodManager mRichImm; private /* final */ Resources mResources; - private /* final */ ConnectivityManager mConnectivityManager; private final LanguageOnSpacebarHelper mLanguageOnSpacebarHelper = new LanguageOnSpacebarHelper(); @@ -111,10 +110,10 @@ public final class SubtypeSwitcher { } mResources = context.getResources(); mRichImm = RichInputMethodManager.getInstance(); - mConnectivityManager = (ConnectivityManager) context.getSystemService( + ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService( Context.CONNECTIVITY_SERVICE); - final NetworkInfo info = mConnectivityManager.getActiveNetworkInfo(); + final NetworkInfo info = connectivityManager.getActiveNetworkInfo(); mIsNetworkConnected = (info != null && info.isConnected()); onSubtypeChanged(getCurrentSubtype()); @@ -327,4 +326,8 @@ public final class SubtypeSwitcher { + DUMMY_EMOJI_SUBTYPE); return DUMMY_EMOJI_SUBTYPE; } + + public String getCombiningRulesExtraValueOfCurrentSubtype() { + return SubtypeLocaleUtils.getCombiningRulesExtraValue(getCurrentSubtype()); + } } diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index d755195f2..cdee496a8 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -41,6 +41,7 @@ public final class WordComposer { public static final int CAPS_MODE_AUTO_SHIFT_LOCKED = 0x7; private CombinerChain mCombinerChain; + private String mCombiningSpec; // Memory so that we don't uselessly recreate the combiner chain // The list of events that served to compose this string. private final ArrayList<Event> mEvents; @@ -91,6 +92,21 @@ public final class WordComposer { } /** + * Restart input with a new combining spec. + * @param combiningSpec The spec string for combining. This is found in the extra value. + */ + public void restart(final String combiningSpec) { + final String nonNullCombiningSpec = null == combiningSpec ? "" : combiningSpec; + if (nonNullCombiningSpec.equals(mCombiningSpec)) { + mCombinerChain.reset(); + } else { + mCombinerChain = new CombinerChain(CombinerChain.createCombiners(nonNullCombiningSpec)); + mCombiningSpec = nonNullCombiningSpec; + } + reset(); + } + + /** * Clear out the keys registered so far. */ public void reset() { diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 75432fbac..e80ee35bd 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -97,6 +97,11 @@ public final class InputLogic { private boolean mIsAutoCorrectionIndicatorOn; private long mDoubleSpacePeriodCountdownStart; + /** + * Create a new instance of the input logic. + * @param latinIME the instance of the parent LatinIME. We should remove this when we can. + * @param suggestionStripViewAccessor an object to access the suggestion strip view. + */ public InputLogic(final LatinIME latinIME, final SuggestionStripViewAccessor suggestionStripViewAccessor) { mLatinIME = latinIME; @@ -117,9 +122,12 @@ public final class InputLogic { * * @param restarting whether input is starting in the same field as before. Unused for now. * @param editorInfo the editorInfo associated with the editor. + * @param combiningSpec the combining spec string for this subtype */ - public void startInput(final boolean restarting, final EditorInfo editorInfo) { + public void startInput(final boolean restarting, final EditorInfo editorInfo, + final String combiningSpec) { mEnteredText = null; + mWordComposer.restart(combiningSpec); resetComposingState(true /* alsoResetLastComposedWord */); mDeleteCount = 0; mSpaceState = SpaceState.NONE; @@ -138,6 +146,14 @@ public final class InputLogic { } /** + * Call this when the subtype changes. + * @param combiningSpec the spec string for the combining rules + */ + public void onSubtypeChanged(final String combiningSpec) { + mWordComposer.restart(combiningSpec); + } + + /** * Clean up the input logic after input is finished. */ public void finishInput() { diff --git a/java/src/com/android/inputmethod/latin/personalization/ContextualDictionary.java b/java/src/com/android/inputmethod/latin/personalization/ContextualDictionary.java new file mode 100644 index 000000000..96f03f9ff --- /dev/null +++ b/java/src/com/android/inputmethod/latin/personalization/ContextualDictionary.java @@ -0,0 +1,53 @@ +/* + * 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. + */ + +package com.android.inputmethod.latin.personalization; + +import android.content.Context; + +import com.android.inputmethod.annotations.UsedForTesting; +import com.android.inputmethod.latin.Dictionary; +import com.android.inputmethod.latin.ExpandableBinaryDictionary; + +import java.io.File; +import java.util.Locale; + +public class ContextualDictionary extends ExpandableBinaryDictionary { + /* package */ static final String NAME = PersonalizationDictionary.class.getSimpleName(); + + private ContextualDictionary(final Context context, final Locale locale, + final File dictFile) { + super(context, getDictName(NAME, locale, dictFile), locale, Dictionary.TYPE_CONTEXTUAL, + dictFile); + // Always reset the contents. + clear(); + } + @UsedForTesting + public static ContextualDictionary getDictionary(final Context context, final Locale locale, + final File dictFile) { + return new ContextualDictionary(context, locale, dictFile); + } + + @Override + public boolean isValidWord(final String word) { + // Strings out of this dictionary should not be considered existing words. + return false; + } + + @Override + protected void loadInitialContentsLocked() { + } +} diff --git a/java/src/com/android/inputmethod/latin/settings/Settings.java b/java/src/com/android/inputmethod/latin/settings/Settings.java index a3aae8cb3..4e4c8885c 100644 --- a/java/src/com/android/inputmethod/latin/settings/Settings.java +++ b/java/src/com/android/inputmethod/latin/settings/Settings.java @@ -64,7 +64,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang "pref_show_language_switch_key"; public static final String PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST = "pref_include_other_imes_in_language_switch_list"; - public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20110916"; + public static final String PREF_KEYBOARD_THEME = "pref_keyboard_theme"; public static final String PREF_CUSTOM_INPUT_STYLES = "custom_input_styles"; // TODO: consolidate key preview dismiss delay with the key preview animation parameters. public static final String PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY = diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java index 22cbd204c..e1d38e7c4 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java @@ -37,6 +37,7 @@ import android.util.Log; import android.view.inputmethod.InputMethodSubtype; import com.android.inputmethod.dictionarypack.DictionarySettingsActivity; +import com.android.inputmethod.keyboard.KeyboardTheme; import com.android.inputmethod.latin.AudioAndHapticFeedbackManager; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.SubtypeSwitcher; @@ -253,11 +254,31 @@ public final class SettingsFragment extends InputMethodSettingsFragment } updateListPreferenceSummaryToCurrentValue(Settings.PREF_SHOW_SUGGESTIONS_SETTING); updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY); - updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEYBOARD_LAYOUT); + final ListPreference keyboardThemePref = (ListPreference)findPreference( + Settings.PREF_KEYBOARD_THEME); + if (keyboardThemePref != null) { + final KeyboardTheme keyboardTheme = KeyboardTheme.getKeyboardTheme(prefs); + final String value = Integer.toString(keyboardTheme.mThemeId); + final CharSequence entries[] = keyboardThemePref.getEntries(); + final int entryIndex = keyboardThemePref.findIndexOfValue(value); + keyboardThemePref.setSummary(entryIndex < 0 ? null : entries[entryIndex]); + keyboardThemePref.setValue(value); + } updateCustomInputStylesSummary(prefs, res); } @Override + public void onPause() { + super.onPause(); + final SharedPreferences prefs = getPreferenceManager().getSharedPreferences(); + final ListPreference keyboardThemePref = (ListPreference)findPreference( + Settings.PREF_KEYBOARD_THEME); + if (keyboardThemePref != null) { + KeyboardTheme.saveKeyboardThemeId(keyboardThemePref.getValue(), prefs); + } + } + + @Override public void onDestroy() { getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener( this); @@ -287,7 +308,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment ensureConsistencyOfAutoCorrectionSettings(); updateListPreferenceSummaryToCurrentValue(Settings.PREF_SHOW_SUGGESTIONS_SETTING); updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY); - updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEYBOARD_LAYOUT); + updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEYBOARD_THEME); refreshEnablingsOfKeypressSoundAndVibrationSettings(prefs, getResources()); } diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java index a578fa4a4..d4f7f36da 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java @@ -18,7 +18,9 @@ package com.android.inputmethod.latin.suggestions; import android.content.Context; import android.content.res.Resources; +import android.content.res.TypedArray; import android.graphics.Color; +import android.graphics.drawable.Drawable; import android.support.v4.view.ViewCompat; import android.text.TextUtils; import android.util.AttributeSet; @@ -31,6 +33,7 @@ import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; import android.view.ViewGroup; import android.view.ViewParent; +import android.widget.ImageButton; import android.widget.RelativeLayout; import android.widget.TextView; @@ -59,12 +62,14 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick public void addWordToUserDictionary(String word); public void showImportantNoticeContents(); public void pickSuggestionManually(int index, SuggestedWordInfo word); + public void onCodeInput(int primaryCode, int x, int y, boolean isKeyRepeat); } static final boolean DBG = LatinImeLogger.sDBG; private static final float DEBUG_INFO_TEXT_SIZE_IN_DIP = 6.0f; private final ViewGroup mSuggestionsStrip; + private final ImageButton mVoiceKey; private final ViewGroup mAddToDictionaryStrip; private final View mImportantNoticeStrip; MainKeyboardView mMainKeyboardView; @@ -86,39 +91,42 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick private static class StripVisibilityGroup { private final View mSuggestionsStrip; + private final View mVoiceKey; private final View mAddToDictionaryStrip; private final View mImportantNoticeStrip; - public StripVisibilityGroup(final View suggestionsStrip, final View addToDictionaryStrip, - final View importantNoticeStrip) { + public StripVisibilityGroup(final View suggestionsStrip, final View voiceKey, + final View addToDictionaryStrip, final View importantNoticeStrip) { mSuggestionsStrip = suggestionsStrip; + mVoiceKey = voiceKey; mAddToDictionaryStrip = addToDictionaryStrip; mImportantNoticeStrip = importantNoticeStrip; - showSuggestionsStrip(); + showSuggestionsStrip(false /* voiceKeyEnabled */); } - public void setLayoutDirection(final boolean isRtlLanguage) { - final int layoutDirection = isRtlLanguage ? ViewCompat.LAYOUT_DIRECTION_RTL - : ViewCompat.LAYOUT_DIRECTION_LTR; + public void setLayoutDirection(final int layoutDirection) { ViewCompat.setLayoutDirection(mSuggestionsStrip, layoutDirection); ViewCompat.setLayoutDirection(mAddToDictionaryStrip, layoutDirection); ViewCompat.setLayoutDirection(mImportantNoticeStrip, layoutDirection); } - public void showSuggestionsStrip() { + public void showSuggestionsStrip(final boolean enableVoiceKey) { mSuggestionsStrip.setVisibility(VISIBLE); + mVoiceKey.setVisibility(enableVoiceKey ? VISIBLE : INVISIBLE); mAddToDictionaryStrip.setVisibility(INVISIBLE); mImportantNoticeStrip.setVisibility(INVISIBLE); } public void showAddToDictionaryStrip() { mSuggestionsStrip.setVisibility(INVISIBLE); + mVoiceKey.setVisibility(INVISIBLE); mAddToDictionaryStrip.setVisibility(VISIBLE); mImportantNoticeStrip.setVisibility(INVISIBLE); } public void showImportantNoticeStrip() { mSuggestionsStrip.setVisibility(INVISIBLE); + mVoiceKey.setVisibility(INVISIBLE); mAddToDictionaryStrip.setVisibility(INVISIBLE); mImportantNoticeStrip.setVisibility(VISIBLE); } @@ -145,10 +153,11 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick inflater.inflate(R.layout.suggestions_strip, this); mSuggestionsStrip = (ViewGroup)findViewById(R.id.suggestions_strip); + mVoiceKey = (ImageButton)findViewById(R.id.suggestions_strip_voice_key); mAddToDictionaryStrip = (ViewGroup)findViewById(R.id.add_to_dictionary_strip); mImportantNoticeStrip = findViewById(R.id.important_notice_strip); - mStripVisibilityGroup = new StripVisibilityGroup(mSuggestionsStrip, mAddToDictionaryStrip, - mImportantNoticeStrip); + mStripVisibilityGroup = new StripVisibilityGroup(mSuggestionsStrip, mVoiceKey, + mAddToDictionaryStrip, mImportantNoticeStrip); for (int pos = 0; pos < SuggestedWords.MAX_SUGGESTIONS; pos++) { final TextView word = new TextView(context, null, R.attr.suggestionWordStyle); @@ -177,6 +186,13 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick R.dimen.config_more_suggestions_modal_tolerance); mMoreSuggestionsSlidingDetector = new GestureDetector( context, mMoreSuggestionsSlidingListener); + + final TypedArray keyboardAttr = context.obtainStyledAttributes(attrs, + R.styleable.Keyboard, defStyle, R.style.SuggestionStripView); + final Drawable iconVoice = keyboardAttr.getDrawable(R.styleable.Keyboard_iconShortcutKey); + keyboardAttr.recycle(); + mVoiceKey.setImageDrawable(iconVoice); + mVoiceKey.setOnClickListener(this); } /** @@ -188,16 +204,30 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick mMainKeyboardView = (MainKeyboardView)inputView.findViewById(R.id.keyboard_view); } + private boolean isVoiceKeyEnabled() { + if (mMainKeyboardView == null) { + return false; + } + final Keyboard keyboard = mMainKeyboardView.getKeyboard(); + if (keyboard == null) { + return false; + } + return keyboard.mId.mHasShortcutKey; + } + public void setSuggestions(final SuggestedWords suggestedWords, final boolean isRtlLanguage) { clear(); - mStripVisibilityGroup.setLayoutDirection(isRtlLanguage); + final int layoutDirection = isRtlLanguage ? ViewCompat.LAYOUT_DIRECTION_RTL + : ViewCompat.LAYOUT_DIRECTION_LTR; + setLayoutDirection(layoutDirection); + mStripVisibilityGroup.setLayoutDirection(layoutDirection); mSuggestedWords = suggestedWords; mSuggestionsCountInStrip = mLayoutHelper.layoutAndReturnSuggestionCountInStrip( mSuggestedWords, mSuggestionsStrip, this); if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.suggestionStripView_setSuggestions(mSuggestedWords); } - mStripVisibilityGroup.showSuggestionsStrip(); + mStripVisibilityGroup.showSuggestionsStrip(isVoiceKeyEnabled()); } public int setMoreSuggestionsHeight(final int remainingHeight) { @@ -252,7 +282,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick public void clear() { mSuggestionsStrip.removeAllViews(); removeAllDebugInfoViews(); - mStripVisibilityGroup.showSuggestionsStrip(); + mStripVisibilityGroup.showSuggestionsStrip(false /* enableVoiceKey */); dismissMoreSuggestionsPanel(); } @@ -415,6 +445,12 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick mListener.showImportantNoticeContents(); return; } + if (view == mVoiceKey) { + mListener.onCodeInput(Constants.CODE_SHORTCUT, + Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE, + false /* isKeyRepeat */); + return; + } final Object tag = view.getTag(); // {@link String} tag is set at {@link #showAddToDictionaryHint(String,CharSequence)}. if (tag instanceof String) { diff --git a/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java b/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java index b37779bdc..938d27122 100644 --- a/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java @@ -324,4 +324,8 @@ public final class SubtypeLocaleUtils { public static boolean isRtlLanguage(final InputMethodSubtype subtype) { return isRtlLanguage(getSubtypeLocale(subtype)); } + + public static String getCombiningRulesExtraValue(final InputMethodSubtype subtype) { + return subtype.getExtraValueOf(Constants.Subtype.ExtraValue.COMBINING_RULES); + } } |