aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/anim/more_keys_keyboard_fadein.xml29
-rw-r--r--java/res/anim/more_keys_keyboard_fadeout.xml29
-rw-r--r--java/res/drawable/btn_keyboard_key_lxx_dark.xml5
-rw-r--r--java/res/drawable/btn_keyboard_key_lxx_light.xml5
-rw-r--r--java/res/values-land/config.xml6
-rw-r--r--java/res/values-sw600dp-land/config.xml6
-rw-r--r--java/res/values-sw600dp/config.xml7
-rw-r--r--java/res/values-sw768dp-land/config.xml6
-rw-r--r--java/res/values-sw768dp/config.xml7
-rw-r--r--java/res/values/attrs.xml22
-rw-r--r--java/res/values/config.xml7
-rw-r--r--java/res/values/themes-common.xml20
-rw-r--r--java/res/values/themes-holo.xml35
-rw-r--r--java/res/values/themes-ics.xml12
-rw-r--r--java/res/values/themes-klp.xml12
-rw-r--r--java/res/values/themes-lxx-dark.xml12
-rw-r--r--java/res/values/themes-lxx-light.xml12
-rw-r--r--java/res/values/themes-lxx.xml37
-rw-r--r--java/res/xml-sw600dp/key_styles_enter.xml1
-rw-r--r--java/res/xml/key_styles_enter.xml1
-rw-r--r--java/res/xml/key_styles_number.xml3
-rw-r--r--java/res/xml/method.xml20
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java119
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java54
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java31
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java12
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java133
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java2
28 files changed, 325 insertions, 320 deletions
diff --git a/java/res/anim/more_keys_keyboard_fadein.xml b/java/res/anim/more_keys_keyboard_fadein.xml
deleted file mode 100644
index c781f36ad..000000000
--- a/java/res/anim/more_keys_keyboard_fadein.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/decelerate_interpolator"
->
- <alpha
- android:fromAlpha="0.5"
- android:toAlpha="1.0"
- android:duration="@integer/config_more_keys_keyboard_fadein_anim_time" />
-</set>
diff --git a/java/res/anim/more_keys_keyboard_fadeout.xml b/java/res/anim/more_keys_keyboard_fadeout.xml
deleted file mode 100644
index 32fae6bd8..000000000
--- a/java/res/anim/more_keys_keyboard_fadeout.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2010, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<set
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/accelerate_interpolator"
->
- <alpha
- android:fromAlpha="1.0"
- android:toAlpha="0.0"
- android:duration="@integer/config_more_keys_keyboard_fadeout_anim_time" />
-</set>
diff --git a/java/res/drawable/btn_keyboard_key_lxx_dark.xml b/java/res/drawable/btn_keyboard_key_lxx_dark.xml
index bb1789ae3..c82c13829 100644
--- a/java/res/drawable/btn_keyboard_key_lxx_dark.xml
+++ b/java/res/drawable/btn_keyboard_key_lxx_dark.xml
@@ -15,6 +15,11 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Custom label action keys. -->
+ <item android:state_active="true" android:state_checked="true" android:state_pressed="true"
+ android:drawable="@color/key_background_pressed_lxx_dark" />
+ <item android:state_active="true" android:state_checked="true"
+ android:drawable="@color/key_background_lxx_dark" />
<!-- Action keys. -->
<item android:state_active="true" android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_key_active_pressed_lxx_dark" />
diff --git a/java/res/drawable/btn_keyboard_key_lxx_light.xml b/java/res/drawable/btn_keyboard_key_lxx_light.xml
index 60fe02dd2..f237fbea9 100644
--- a/java/res/drawable/btn_keyboard_key_lxx_light.xml
+++ b/java/res/drawable/btn_keyboard_key_lxx_light.xml
@@ -15,6 +15,11 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Custom label action keys. -->
+ <item android:state_active="true" android:state_checked="true" android:state_pressed="true"
+ android:drawable="@color/key_background_pressed_lxx_light" />
+ <item android:state_active="true" android:state_checked="true"
+ android:drawable="@color/key_background_lxx_light" />
<!-- Action keys. -->
<item android:state_active="true" android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_key_active_pressed_lxx_light" />
diff --git a/java/res/values-land/config.xml b/java/res/values-land/config.xml
index 5eea4c1c6..34d6d4e19 100644
--- a/java/res/values-land/config.xml
+++ b/java/res/values-land/config.xml
@@ -43,10 +43,12 @@
<fraction name="config_key_preview_text_ratio">90%</fraction>
<fraction name="config_key_letter_ratio">65%</fraction>
- <fraction name="config_key_large_letter_ratio">74%</fraction>
+ <fraction name="config_key_large_letter_ratio_holo">74%</fraction>
+ <fraction name="config_key_large_letter_ratio_lxx">90%</fraction>
<fraction name="config_key_label_ratio">40%</fraction>
<fraction name="config_key_hint_letter_ratio">30%</fraction>
- <fraction name="config_key_hint_label_ratio">52%</fraction>
+ <fraction name="config_key_hint_label_ratio_holo">52%</fraction>
+ <fraction name="config_key_hint_label_ratio_lxx">30%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio">40%</fraction>
<fraction name="config_language_on_spacebar_text_ratio">40.000%</fraction>
diff --git a/java/res/values-sw600dp-land/config.xml b/java/res/values-sw600dp-land/config.xml
index 6368eef41..c238b2c42 100644
--- a/java/res/values-sw600dp-land/config.xml
+++ b/java/res/values-sw600dp-land/config.xml
@@ -33,10 +33,12 @@
<fraction name="config_key_horizontal_gap_holo">0.9%p</fraction>
<fraction name="config_key_letter_ratio">50%</fraction>
- <fraction name="config_key_large_letter_ratio">48%</fraction>
+ <fraction name="config_key_large_letter_ratio_holo">48%</fraction>
+ <fraction name="config_key_large_letter_ratio_lxx">60%</fraction>
<fraction name="config_key_label_ratio">32%</fraction>
<fraction name="config_key_hint_letter_ratio">23%</fraction>
- <fraction name="config_key_hint_label_ratio">34%</fraction>
+ <fraction name="config_key_hint_label_ratio_holo">34%</fraction>
+ <fraction name="config_key_hint_label_ratio_lxx">20%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio">29%</fraction>
<fraction name="config_language_on_spacebar_text_ratio">30.0%</fraction>
<dimen name="config_key_shifted_letter_hint_padding">4dp</dimen>
diff --git a/java/res/values-sw600dp/config.xml b/java/res/values-sw600dp/config.xml
index 9d16e2cb9..3c489bbe8 100644
--- a/java/res/values-sw600dp/config.xml
+++ b/java/res/values-sw600dp/config.xml
@@ -45,11 +45,12 @@
<dimen name="config_key_preview_height">94.5dp</dimen>
<fraction name="config_key_preview_text_ratio">50%</fraction>
<fraction name="config_key_letter_ratio">42%</fraction>
- <fraction name="config_key_large_letter_ratio">45%</fraction>
+ <fraction name="config_key_large_letter_ratio_holo">45%</fraction>
+ <fraction name="config_key_large_letter_ratio_lxx">60%</fraction>
<fraction name="config_key_label_ratio">25%</fraction>
- <fraction name="config_key_large_label_ratio">32%</fraction>
<fraction name="config_key_hint_letter_ratio">23%</fraction>
- <fraction name="config_key_hint_label_ratio">28%</fraction>
+ <fraction name="config_key_hint_label_ratio_holo">28%</fraction>
+ <fraction name="config_key_hint_label_ratio_lxx">20%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio">22%</fraction>
<fraction name="config_language_on_spacebar_text_ratio">28.0%</fraction>
<dimen name="config_key_hint_letter_padding">3dp</dimen>
diff --git a/java/res/values-sw768dp-land/config.xml b/java/res/values-sw768dp-land/config.xml
index a1659b45a..587a3c1a4 100644
--- a/java/res/values-sw768dp-land/config.xml
+++ b/java/res/values-sw768dp-land/config.xml
@@ -35,10 +35,12 @@
<dimen name="config_key_preview_height">107.1dp</dimen>
<fraction name="config_key_letter_ratio">43%</fraction>
- <fraction name="config_key_large_letter_ratio">42%</fraction>
+ <fraction name="config_key_large_letter_ratio_holo">42%</fraction>
+ <fraction name="config_key_large_letter_ratio_lxx">60%</fraction>
<fraction name="config_key_label_ratio">28%</fraction>
<fraction name="config_key_hint_letter_ratio">23%</fraction>
- <fraction name="config_key_hint_label_ratio">28%</fraction>
+ <fraction name="config_key_hint_label_ratio_holo">28%</fraction>
+ <fraction name="config_key_hint_label_ratio_lxx">20%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio">24%</fraction>
<fraction name="config_language_on_spacebar_text_ratio">24.00%</fraction>
diff --git a/java/res/values-sw768dp/config.xml b/java/res/values-sw768dp/config.xml
index 635061d24..f573c40df 100644
--- a/java/res/values-sw768dp/config.xml
+++ b/java/res/values-sw768dp/config.xml
@@ -43,11 +43,12 @@
<dimen name="config_key_preview_height">94.5dp</dimen>
<fraction name="config_key_preview_text_ratio">50%</fraction>
<fraction name="config_key_letter_ratio">40%</fraction>
- <fraction name="config_key_large_letter_ratio">42%</fraction>
+ <fraction name="config_key_large_letter_ratio_holo">42%</fraction>
+ <fraction name="config_key_large_letter_ratio_lxx">60%</fraction>
<fraction name="config_key_label_ratio">28%</fraction>
- <fraction name="config_key_large_label_ratio">28%</fraction>
<fraction name="config_key_hint_letter_ratio">23%</fraction>
- <fraction name="config_key_hint_label_ratio">28%</fraction>
+ <fraction name="config_key_hint_label_ratio_holo">28%</fraction>
+ <fraction name="config_key_hint_label_ratio_lxx">20%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio">26%</fraction>
<fraction name="config_language_on_spacebar_text_ratio">29.03%</fraction>
<dimen name="config_key_hint_letter_padding">3dp</dimen>
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index 9a2227321..bfe385698 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -270,9 +270,10 @@
<enum name="empty" value="0" />
<enum name="normal" value="1" />
<enum name="functional" value="2" />
- <enum name="action" value="3" />
- <enum name="stickyOff" value="4" />
- <enum name="stickyOn" value="5" />
+ <enum name="stickyOff" value="3" />
+ <enum name="stickyOn" value="4" />
+ <enum name="action" value="5" />
+ <enum name="customAction" value="6" />
</attr>
<!-- The key action flags. -->
<attr name="keyActionFlags" format="integer">
@@ -291,14 +292,15 @@
<!-- The key label flags. -->
<attr name="keyLabelFlags" format="integer">
<!-- This should be aligned with Key.LABEL_FLAGS__* -->
- <flag name="alignLeftOfCenter" value="0x08" />
+ <flag name="alignHintLabelToBottom" value="0x02" />
+ <flag name="alignIconToBottom" value="0x04" />
+ <flag name="alignLabelOffCenter" value="0x08" />
<flag name="fontNormal" value="0x10" />
<flag name="fontMonoSpace" value="0x20" />
<flag name="fontDefault" value="0x30" />
<flag name="followKeyLargeLetterRatio" value="0x40" />
<flag name="followKeyLetterRatio" value="0x80" />
<flag name="followKeyLabelRatio" value="0xC0" />
- <flag name="followKeyLargeLabelRatio" value="0x100" />
<flag name="followKeyHintLabelRatio" value="0x140" />
<flag name="hasPopupHint" value="0x200" />
<flag name="hasShiftedLetterHint" value="0x400" />
@@ -357,8 +359,6 @@
<attr name="keyLabelSize" format="dimension|fraction" />
<!-- Large size of the text for one letter keys, in the proportion of key height. -->
<attr name="keyLargeLetterRatio" format="fraction" />
- <!-- Large size of the text for keys with multiple letters, in the proportion of key height. -->
- <attr name="keyLargeLabelRatio" format="fraction" />
<!-- Size of the text for hint letter (= one character hint label), in the proportion of
key height. -->
<attr name="keyHintLetterRatio" format="fraction" />
@@ -366,6 +366,14 @@
<attr name="keyHintLabelRatio" format="fraction" />
<!-- Size of the text for shifted letter hint, in the proportion of key height. -->
<attr name="keyShiftedLetterHintRatio" format="fraction" />
+ <!-- The label's horizontal offset to the center of the key. Negative is to left and
+ positive is to right. The value is in proportion of the width of
+ TypefaceUtils.KEY_LABEL_REFERENCE_CHAR. -->
+ <attr name="keyLabelOffCenterRatio" format="fraction" />
+ <!-- The hint label's horizontal offset to the center of the key. Negative is to left and
+ positive is to right. The value is in proportion of the width of
+ TypefaceUtils.KEY_LABEL_REFERENCE_CHAR. -->
+ <attr name="keyHintLabelOffCenterRatio" format="fraction" />
<!-- Color to use for the label in a key. -->
<attr name="keyTextColor" format="color" />
<attr name="keyTextShadowColor" format="color" />
diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index d748c9179..af3b5890b 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -47,11 +47,12 @@
<dimen name="config_key_preview_height">80dp</dimen>
<fraction name="config_key_preview_text_ratio">82%</fraction>
<fraction name="config_key_letter_ratio">55%</fraction>
- <fraction name="config_key_large_letter_ratio">65%</fraction>
+ <fraction name="config_key_large_letter_ratio_holo">65%</fraction>
+ <fraction name="config_key_large_letter_ratio_lxx">90%</fraction>
<fraction name="config_key_label_ratio">34%</fraction>
- <fraction name="config_key_large_label_ratio">40%</fraction>
<fraction name="config_key_hint_letter_ratio">25%</fraction>
- <fraction name="config_key_hint_label_ratio">44%</fraction>
+ <fraction name="config_key_hint_label_ratio_holo">44%</fraction>
+ <fraction name="config_key_hint_label_ratio_lxx">30%</fraction>
<fraction name="config_key_shifted_letter_hint_ratio">35%</fraction>
<fraction name="config_language_on_spacebar_text_ratio">33.735%</fraction>
<dimen name="config_key_hint_letter_padding">1dp</dimen>
diff --git a/java/res/values/themes-common.xml b/java/res/values/themes-common.xml
index b139110ca..46f255399 100644
--- a/java/res/values/themes-common.xml
+++ b/java/res/values/themes-common.xml
@@ -22,23 +22,27 @@
<style name="KeyboardIcons" />
<!-- Default theme values -->
<style name="Keyboard">
- <item name="touchPositionCorrectionData">@array/touch_position_correction_data_default</item>
<item name="rowHeight">25%p</item>
- <item name="moreKeysTemplate">@xml/kbd_more_keys_keyboard_template</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>
+ <item name="keyboardTopPadding">@fraction/config_keyboard_top_padding_holo</item>
+ <item name="keyboardBottomPadding">@fraction/config_keyboard_bottom_padding_holo</item>
<item name="keyboardLeftPadding">@fraction/config_keyboard_left_padding</item>
<item name="keyboardRightPadding">@fraction/config_keyboard_right_padding</item>
+ <item name="moreKeysTemplate">@xml/kbd_more_keys_keyboard_template</item>
<item name="maxMoreKeysColumn">@integer/config_max_more_keys_column</item>
</style>
<style name="KeyboardView">
- <item name="keyBackground">@drawable/btn_keyboard_key_klp</item>
<item name="keyLetterSize">@fraction/config_key_letter_ratio</item>
- <item name="keyLargeLetterRatio">@fraction/config_key_large_letter_ratio</item>
+ <item name="keyLargeLetterRatio">@fraction/config_key_large_letter_ratio_holo</item>
<item name="keyLabelSize">@fraction/config_key_label_ratio</item>
- <item name="keyLargeLabelRatio">@fraction/config_key_large_label_ratio</item>
<item name="keyHintLetterRatio">@fraction/config_key_hint_letter_ratio</item>
- <item name="keyHintLabelRatio">@fraction/config_key_hint_label_ratio</item>
+ <item name="keyHintLabelRatio">@fraction/config_key_hint_label_ratio_holo</item>
<item name="keyShiftedLetterHintRatio">@fraction/config_key_shifted_letter_hint_ratio</item>
<item name="keyTypeface">normal</item>
+ <!-- A negative value to disable key text shadow layer. -->
+ <item name="keyTextShadowRadius">-1.0</item>
<item name="keyHintLetterPadding">@dimen/config_key_hint_letter_padding</item>
<item name="keyPopupHintLetterPadding">@dimen/config_key_popup_hint_letter_padding</item>
<item name="keyShiftedLetterHintPadding">@dimen/config_key_shifted_letter_hint_padding</item>
@@ -130,8 +134,4 @@
<item name="android:singleLine">true</item>
<item name="android:ellipsize">none</item>
</style>
- <style name="MoreKeysKeyboardAnimation">
- <item name="android:windowEnterAnimation">@anim/more_keys_keyboard_fadein</item>
- <item name="android:windowExitAnimation">@anim/more_keys_keyboard_fadeout</item>
- </style>
</resources>
diff --git a/java/res/values/themes-holo.xml b/java/res/values/themes-holo.xml
new file mode 100644
index 000000000..cb3ad7a3a
--- /dev/null
+++ b/java/res/values/themes-holo.xml
@@ -0,0 +1,35 @@
+<?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">
+ <!-- Holo KeyboardView theme (ICS and KLP) -->
+ <style
+ name="KeyboardView.Holo"
+ parent="KeyboardView"
+ >
+ <item name="keyTypeface">bold</item>
+ <item name="keyLargeLetterRatio">@fraction/config_key_large_letter_ratio_holo</item>
+ <item name="keyLabelOffCenterRatio">-175%</item>
+ <item name="keyHintLabelRatio">@fraction/config_key_hint_label_ratio_holo</item>
+ <item name="keyHintLabelOffCenterRatio">200%</item>
+ <!-- U+2026: "…" HORIZONTAL ELLIPSIS -->
+ <item name="keyPopupHintLetter">&#x2026;</item>
+ </style>
+</resources>
diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml
index a6f390cbb..6fddcb905 100644
--- a/java/res/values/themes-ics.xml
+++ b/java/res/values/themes-ics.xml
@@ -35,21 +35,15 @@
>
<!-- This should be aligned with KeyboardSwitcher.KEYBOARD_THEMES[] -->
<item name="themeId">2</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.ICS"
- parent="KeyboardView"
+ parent="KeyboardView.Holo"
>
<item name="android:background">@drawable/keyboard_background_holo</item>
<item name="keyBackground">@drawable/btn_keyboard_key_ics</item>
<item name="functionalKeyBackground">@drawable/btn_keyboard_key_functional_ics</item>
<item name="spacebarBackground">@drawable/btn_keyboard_spacebar_ics</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="functionalTextColor">@color/key_text_color_holo</item>
@@ -58,10 +52,6 @@
<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>
- <!-- A negative value to disable key text shadow layer. -->
- <item name="keyTextShadowRadius">-1.0</item>
- <!-- U+2026: "…" HORIZONTAL ELLIPSIS -->
- <item name="keyPopupHintLetter">&#x2026;</item>
</style>
<style
name="MainKeyboardView.ICS"
diff --git a/java/res/values/themes-klp.xml b/java/res/values/themes-klp.xml
index 8782a76aa..c9b83316c 100644
--- a/java/res/values/themes-klp.xml
+++ b/java/res/values/themes-klp.xml
@@ -35,21 +35,15 @@
>
<!-- 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.KLP"
- parent="KeyboardView"
+ parent="KeyboardView.Holo"
>
<item name="android:background">@drawable/keyboard_background_holo</item>
<item name="keyBackground">@drawable/btn_keyboard_key_klp</item>
<item name="functionalKeyBackground">@drawable/btn_keyboard_key_functional_klp</item>
<item name="spacebarBackground">@drawable/btn_keyboard_spacebar_klp</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="functionalTextColor">@color/key_text_color_holo</item>
@@ -58,10 +52,6 @@
<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>
- <!-- A negative value to disable key text shadow layer. -->
- <item name="keyTextShadowRadius">-1.0</item>
- <!-- U+2026: "…" HORIZONTAL ELLIPSIS -->
- <item name="keyPopupHintLetter">&#x2026;</item>
</style>
<style
name="MainKeyboardView.KLP"
diff --git a/java/res/values/themes-lxx-dark.xml b/java/res/values/themes-lxx-dark.xml
index fa6aa62e5..6afbd9b15 100644
--- a/java/res/values/themes-lxx-dark.xml
+++ b/java/res/values/themes-lxx-dark.xml
@@ -35,22 +35,15 @@
>
<!-- This should be aligned with KeyboardSwitcher.KEYBOARD_THEMES[] -->
<item name="themeId">4</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.LXX_Dark"
- parent="KeyboardView"
+ parent="KeyboardView.LXX"
>
<item name="android:background">@drawable/keyboard_background_lxx_dark</item>
<item name="keyBackground">@drawable/btn_keyboard_key_lxx_dark</item>
<item name="functionalKeyBackground">@drawable/btn_keyboard_key_functional_lxx_dark</item>
<item name="spacebarBackground">@drawable/btn_keyboard_spacebar_lxx_dark</item>
- <item name="spacebarIconWidthRatio">0.9</item>
- <item name="keyTypeface">normal</item>
<item name="keyTextColor">@color/key_text_color_lxx_dark</item>
<item name="keyTextInactivatedColor">@color/key_functional_text_color_lxx_dark</item>
<item name="functionalTextColor">@color/key_text_color_lxx_dark</item>
@@ -59,9 +52,6 @@
<item name="keyShiftedLetterHintInactivatedColor">@color/key_text_inactive_color_lxx_dark</item>
<item name="keyShiftedLetterHintActivatedColor">@color/key_text_color_lxx_dark</item>
<item name="keyPreviewTextColor">@color/key_text_color_lxx_dark</item>
- <!-- A negative value to disable key text shadow layer. -->
- <item name="keyTextShadowRadius">-1.0</item>
- <item name="keyPopupHintLetter"></item> <!-- No popup hint letter -->
</style>
<style
name="MainKeyboardView.LXX_Dark"
diff --git a/java/res/values/themes-lxx-light.xml b/java/res/values/themes-lxx-light.xml
index e7350f924..b3ced80a1 100644
--- a/java/res/values/themes-lxx-light.xml
+++ b/java/res/values/themes-lxx-light.xml
@@ -35,22 +35,15 @@
>
<!-- This should be aligned with KeyboardSwitcher.KEYBOARD_THEMES[] -->
<item name="themeId">3</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.LXX_Light"
- parent="KeyboardView"
+ parent="KeyboardView.LXX"
>
<item name="android:background">@drawable/keyboard_background_lxx_light</item>
<item name="keyBackground">@drawable/btn_keyboard_key_lxx_light</item>
<item name="functionalKeyBackground">@drawable/btn_keyboard_key_functional_lxx_light</item>
<item name="spacebarBackground">@drawable/btn_keyboard_spacebar_lxx_light</item>
- <item name="spacebarIconWidthRatio">0.9</item>
- <item name="keyTypeface">normal</item>
<item name="keyTextColor">@color/key_text_color_lxx_light</item>
<item name="keyTextInactivatedColor">@color/key_text_inactive_color_lxx_light</item>
<item name="functionalTextColor">@color/key_functional_text_color_lxx_light</item>
@@ -59,9 +52,6 @@
<item name="keyShiftedLetterHintInactivatedColor">@color/key_text_inactive_color_lxx_light</item>
<item name="keyShiftedLetterHintActivatedColor">@color/key_text_color_lxx_light</item>
<item name="keyPreviewTextColor">@color/key_text_color_lxx_light</item>
- <!-- A negative value to disable key text shadow layer. -->
- <item name="keyTextShadowRadius">-1.0</item>
- <item name="keyPopupHintLetter"></item> <!-- No popup hint letter -->
</style>
<style
name="MainKeyboardView.LXX_Light"
diff --git a/java/res/values/themes-lxx.xml b/java/res/values/themes-lxx.xml
new file mode 100644
index 000000000..1c33cd60b
--- /dev/null
+++ b/java/res/values/themes-lxx.xml
@@ -0,0 +1,37 @@
+<?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">
+ <!-- LXX KeyboardView theme (LXX_Light and LXX_Dark) -->
+ <style
+ name="KeyboardView.LXX"
+ parent="KeyboardView"
+ >
+ <item name="keyTypeface">normal</item>
+ <item name="keyLargeLetterRatio">@fraction/config_key_large_letter_ratio_lxx</item>
+ <item name="keyLabelOffCenterRatio">-80%</item>
+ <item name="keyHintLabelRatio">@fraction/config_key_hint_label_ratio_lxx</item>
+ <item name="keyHintLabelOffCenterRatio">300%</item>
+ <item name="keyLabelFlags">alignHintLabelToBottom</item>
+ <item name="spacebarIconWidthRatio">0.9</item>
+ <!-- No popup hint letter -->
+ <item name="keyPopupHintLetter"></item>
+ </style>
+</resources>
diff --git a/java/res/xml-sw600dp/key_styles_enter.xml b/java/res/xml-sw600dp/key_styles_enter.xml
index 740bf3543..d0167d336 100644
--- a/java/res/xml-sw600dp/key_styles_enter.xml
+++ b/java/res/xml-sw600dp/key_styles_enter.xml
@@ -230,6 +230,7 @@
latin:styleName="enterKeyStyle"
latin:keySpec="dummy_label|!code/key_enter"
latin:keyLabelFlags="fromCustomActionLabel"
+ latin:backgroundType="customAction"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<!-- imeAction is either actionNone or actionUnspecified. -->
diff --git a/java/res/xml/key_styles_enter.xml b/java/res/xml/key_styles_enter.xml
index 770bf3876..960c79c18 100644
--- a/java/res/xml/key_styles_enter.xml
+++ b/java/res/xml/key_styles_enter.xml
@@ -398,6 +398,7 @@
latin:styleName="enterKeyStyle"
latin:keySpec="dummy_label|!code/key_enter"
latin:keyLabelFlags="fromCustomActionLabel"
+ latin:backgroundType="customAction"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<!-- imeAction is either actionNone or actionUnspecified. -->
diff --git a/java/res/xml/key_styles_number.xml b/java/res/xml/key_styles_number.xml
index f754b99b3..14b202874 100644
--- a/java/res/xml/key_styles_number.xml
+++ b/java/res/xml/key_styles_number.xml
@@ -39,7 +39,7 @@
latin:parentStyle="numKeyBaseStyle" />
<key-style
latin:styleName="numberKeyStyle"
- latin:keyLabelFlags="alignLeftOfCenter|hasHintLabel"
+ latin:keyLabelFlags="alignLabelOffCenter|hasHintLabel"
latin:parentStyle="numKeyStyle" />
<key-style
latin:styleName="num0KeyStyle"
@@ -120,6 +120,7 @@
<key-style
latin:styleName="numSpaceKeyStyle"
latin:keySpec="!icon/space_key_for_number_layout|!code/key_space"
+ latin:keyLabelFlags="alignIconToBottom"
latin:keyActionFlags="enableLongPress"
latin:parentStyle="numKeyBaseStyle" />
</merge>
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index 5021f33ee..7013c6b86 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -51,7 +51,7 @@
fr_CH: French (Switzerland)/swiss
gl_ES: Galician (Spain)/spanish
hi: Hindi/hindi
- (hi: Hindi/hindi_compact) # This is a preliminary keyboard layout.
+ hi: Hindi/hindi_compact
hr: Croatian/qwertz
hu: Hungarian/qwertz
hy_AM: Armenian (Armenia) Phonetic/armenian_phonetic
@@ -178,6 +178,7 @@
/>
<!-- TODO: This bengali keyboard is a preliminary layout.
This isn't based on the final specification. -->
+ <!--
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0xbff5986c"
@@ -186,6 +187,7 @@
android:imeSubtypeExtraValue="KeyboardLayoutSet=bengali,EmojiCapable"
android:isAsciiCapable="false"
/>
+ -->
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0xd2e520d5"
@@ -346,8 +348,6 @@
android:imeSubtypeExtraValue="KeyboardLayoutSet=hindi,EmojiCapable"
android:isAsciiCapable="false"
/>
- <!-- TODO: This hindi_compact keyboard is a preliminary layout.
- This isn't based on the final specification. -->
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic_compact"
android:subtypeId="0xe49c89a1"
@@ -448,6 +448,7 @@
/>
<!-- TODO: This kannada keyboard is a preliminary layout.
This isn't based on the final specification. -->
+ <!--
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0x8c78064f"
@@ -456,6 +457,7 @@
android:imeSubtypeExtraValue="KeyboardLayoutSet=kannada,EmojiCapable"
android:isAsciiCapable="false"
/>
+ -->
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0x2e391c04"
@@ -498,6 +500,7 @@
/>
<!-- TODO: This malayalam keyboard is a preliminary layout.
This isn't based on the final specification. -->
+ <!--
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0xc182ebd4"
@@ -506,6 +509,7 @@
android:imeSubtypeExtraValue="KeyboardLayoutSet=malayalam,EmojiCapable"
android:isAsciiCapable="false"
/>
+ -->
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0xcdcfc3ab"
@@ -516,6 +520,7 @@
/>
<!-- TODO: This marathi keyboard is a preliminary layout.
This isn't based on the final specification. -->
+ <!--
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0x747b9f03"
@@ -524,6 +529,7 @@
android:imeSubtypeExtraValue="KeyboardLayoutSet=marathi,EmojiCapable"
android:isAsciiCapable="false"
/>
+ -->
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0x84c87c61"
@@ -534,6 +540,7 @@
/>
<!-- TODO: This Myanmar keyboard is a preliminary layout.
This isn't based on the final specification. -->
+ <!--
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0xea266ea4"
@@ -542,6 +549,7 @@
android:imeSubtypeExtraValue="KeyboardLayoutSet=myanmar,EmojiCapable,CombiningRules=MyanmarReordering"
android:isAsciiCapable="false"
/>
+ -->
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0x3f12ee14"
@@ -624,6 +632,7 @@
/>
<!-- TODO: This sinhala keyboard is a preliminary layout.
This isn't based on the final specification. -->
+ <!--
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0x5c6b3bde"
@@ -632,6 +641,7 @@
android:imeSubtypeExtraValue="KeyboardLayoutSet=sinhala,EmojiCapable"
android:isAsciiCapable="false"
/>
+ -->
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0x8e94d413"
@@ -692,6 +702,7 @@
/>
<!-- TODO: This tamil keyboard is a preliminary layout.
This isn't based on the final specification. -->
+ <!--
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0x67acea2a"
@@ -700,8 +711,10 @@
android:imeSubtypeExtraValue="KeyboardLayoutSet=tamil,EmojiCapable"
android:isAsciiCapable="false"
/>
+ -->
<!-- TODO: This telugu keyboard is a preliminary layout.
This isn't based on the final specification. -->
+ <!--
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0x1e177389"
@@ -710,6 +723,7 @@
android:imeSubtypeExtraValue="KeyboardLayoutSet=telugu,EmojiCapable"
android:isAsciiCapable="false"
/>
+ -->
<subtype android:icon="@drawable/ic_ime_switcher_dark"
android:label="@string/subtype_generic"
android:subtypeId="0x1f94d5d4"
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index af54fb674..618d38962 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -58,7 +58,9 @@ public class Key implements Comparable<Key> {
private final String mHintLabel;
/** Flags of the label */
private final int mLabelFlags;
- private static final int LABEL_FLAGS_ALIGN_LEFT_OF_CENTER = 0x08;
+ private static final int LABEL_FLAGS_ALIGN_HINT_LABEL_TO_BOTTOM = 0x02;
+ private static final int LABEL_FLAGS_ALIGN_ICON_TO_BOTTOM = 0x04;
+ private static final int LABEL_FLAGS_ALIGN_LABEL_OFF_CENTER = 0x08;
// Font typeface specification.
private static final int LABEL_FLAGS_FONT_MASK = 0x30;
private static final int LABEL_FLAGS_FONT_NORMAL = 0x10;
@@ -69,7 +71,6 @@ public class Key implements Comparable<Key> {
private static final int LABEL_FLAGS_FOLLOW_KEY_LARGE_LETTER_RATIO = 0x40;
private static final int LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO = 0x80;
private static final int LABEL_FLAGS_FOLLOW_KEY_LABEL_RATIO = 0xC0;
- private static final int LABEL_FLAGS_FOLLOW_KEY_LARGE_LABEL_RATIO = 0x100;
private static final int LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO = 0x140;
// End of key text ratio mask enum values
private static final int LABEL_FLAGS_HAS_POPUP_HINT = 0x200;
@@ -123,9 +124,10 @@ public class Key implements Comparable<Key> {
public static final int BACKGROUND_TYPE_EMPTY = 0;
public static final int BACKGROUND_TYPE_NORMAL = 1;
public static final int BACKGROUND_TYPE_FUNCTIONAL = 2;
- public static final int BACKGROUND_TYPE_ACTION = 3;
- public static final int BACKGROUND_TYPE_STICKY_OFF = 4;
- public static final int BACKGROUND_TYPE_STICKY_ON = 5;
+ public static final int BACKGROUND_TYPE_STICKY_OFF = 3;
+ public static final int BACKGROUND_TYPE_STICKY_ON = 4;
+ public static final int BACKGROUND_TYPE_ACTION = 5;
+ public static final int BACKGROUND_TYPE_CUSTOM_ACTION = 6;
private final int mActionFlags;
private static final int ACTION_FLAGS_IS_REPEATABLE = 0x01;
@@ -483,9 +485,10 @@ public class Key implements Comparable<Key> {
case BACKGROUND_TYPE_EMPTY: return "empty";
case BACKGROUND_TYPE_NORMAL: return "normal";
case BACKGROUND_TYPE_FUNCTIONAL: return "functional";
- case BACKGROUND_TYPE_ACTION: return "action";
case BACKGROUND_TYPE_STICKY_OFF: return "stickyOff";
case BACKGROUND_TYPE_STICKY_ON: return "stickyOn";
+ case BACKGROUND_TYPE_ACTION: return "action";
+ case BACKGROUND_TYPE_CUSTOM_ACTION: return "customAction";
default: return null;
}
}
@@ -577,8 +580,6 @@ public class Key implements Comparable<Key> {
return params.mLargeLetterSize;
case LABEL_FLAGS_FOLLOW_KEY_LABEL_RATIO:
return params.mLabelSize;
- case LABEL_FLAGS_FOLLOW_KEY_LARGE_LABEL_RATIO:
- return params.mLargeLabelSize;
case LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO:
return params.mHintLabelSize;
default: // No follow key ratio flag specified.
@@ -641,8 +642,16 @@ public class Key implements Comparable<Key> {
return Typeface.DEFAULT_BOLD;
}
- public final boolean isAlignLeftOfCenter() {
- return (mLabelFlags & LABEL_FLAGS_ALIGN_LEFT_OF_CENTER) != 0;
+ public final boolean isAlignHintLabelToBottom(final int defaultFlags) {
+ return ((mLabelFlags | defaultFlags) & LABEL_FLAGS_ALIGN_HINT_LABEL_TO_BOTTOM) != 0;
+ }
+
+ public final boolean isAlignIconToBottom() {
+ return (mLabelFlags & LABEL_FLAGS_ALIGN_ICON_TO_BOTTOM) != 0;
+ }
+
+ public final boolean isAlignLabelOffCenter() {
+ return (mLabelFlags & LABEL_FLAGS_ALIGN_LABEL_OFF_CENTER) != 0;
}
public final boolean hasPopupHint() {
@@ -814,47 +823,37 @@ public class Key implements Comparable<Key> {
return dx * dx + dy * dy;
}
- private final static int[] KEY_STATE_NORMAL_HIGHLIGHT_ON = {
- android.R.attr.state_checkable,
- android.R.attr.state_checked
- };
-
- private final static int[] KEY_STATE_PRESSED_HIGHLIGHT_ON = {
- android.R.attr.state_pressed,
- android.R.attr.state_checkable,
- android.R.attr.state_checked
- };
-
- private final static int[] KEY_STATE_NORMAL_HIGHLIGHT_OFF = {
- android.R.attr.state_checkable
- };
+ static class KeyBackgroundState {
+ private final int[] mReleasedState;
+ private final int[] mPressedState;
- private final static int[] KEY_STATE_PRESSED_HIGHLIGHT_OFF = {
- android.R.attr.state_pressed,
- android.R.attr.state_checkable
- };
-
- private final static int[] KEY_STATE_NORMAL = {
- };
-
- private final static int[] KEY_STATE_PRESSED = {
- android.R.attr.state_pressed
- };
-
- private final static int[] KEY_STATE_EMPTY = {
- android.R.attr.state_empty
- };
+ private KeyBackgroundState(final int ... attrs) {
+ mReleasedState = attrs;
+ mPressedState = Arrays.copyOf(attrs, attrs.length + 1);
+ mPressedState[attrs.length] = android.R.attr.state_pressed;
+ }
- // action normal state (with properties)
- private static final int[] KEY_STATE_ACTIVE_NORMAL = {
- android.R.attr.state_active
- };
+ public int[] getState(final boolean pressed) {
+ return pressed ? mPressedState : mReleasedState;
+ }
- // action pressed state (with properties)
- private static final int[] KEY_STATE_ACTIVE_PRESSED = {
- android.R.attr.state_active,
- android.R.attr.state_pressed
- };
+ public static final KeyBackgroundState[] STATES = {
+ // 0: BACKGROUND_TYPE_EMPTY
+ new KeyBackgroundState(android.R.attr.state_empty),
+ // 1: BACKGROUND_TYPE_NORMAL
+ new KeyBackgroundState(),
+ // 2: BACKGROUND_TYPE_FUNCTIONAL
+ new KeyBackgroundState(),
+ // 3: BACKGROUND_TYPE_STICKY_OFF
+ new KeyBackgroundState(android.R.attr.state_checkable),
+ // 4: BACKGROUND_TYPE_STICKY_ON
+ new KeyBackgroundState(android.R.attr.state_checkable, android.R.attr.state_checked),
+ // 5: BACKGROUND_TYPE_ACTION
+ new KeyBackgroundState(android.R.attr.state_active),
+ // 6: BACKGROUND_TYPE_CUSTOM_ACTION
+ new KeyBackgroundState(android.R.attr.state_active, android.R.attr.state_checked)
+ };
+ }
/**
* Returns the background drawable for the key, based on the current state and type of the key.
@@ -871,28 +870,8 @@ public class Key implements Comparable<Key> {
} else {
background = keyBackground;
}
- final int[] stateSet;
- switch (mBackgroundType) {
- case BACKGROUND_TYPE_ACTION:
- stateSet = mPressed ? KEY_STATE_ACTIVE_PRESSED : KEY_STATE_ACTIVE_NORMAL;
- break;
- case BACKGROUND_TYPE_STICKY_OFF:
- stateSet = mPressed ? KEY_STATE_PRESSED_HIGHLIGHT_OFF : KEY_STATE_NORMAL_HIGHLIGHT_OFF;
- break;
- case BACKGROUND_TYPE_STICKY_ON:
- stateSet = mPressed ? KEY_STATE_PRESSED_HIGHLIGHT_ON : KEY_STATE_NORMAL_HIGHLIGHT_ON;
- break;
- case BACKGROUND_TYPE_EMPTY:
- stateSet = mPressed ? KEY_STATE_PRESSED : KEY_STATE_EMPTY;
- break;
- case BACKGROUND_TYPE_FUNCTIONAL:
- stateSet = mPressed ? KEY_STATE_PRESSED : KEY_STATE_NORMAL;
- break;
- default: /* BACKGROUND_TYPE_NORMAL */
- stateSet = mPressed ? KEY_STATE_PRESSED : KEY_STATE_NORMAL;
- break;
- }
- background.setState(stateSet);
+ final int[] state = KeyBackgroundState.STATES[mBackgroundType].getState(mPressed);
+ background.setState(state);
return background;
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 5af0be649..075cd901d 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -48,6 +48,7 @@ import java.util.HashSet;
* @attr ref R.styleable#KeyboardView_functionalKeyBackground
* @attr ref R.styleable#KeyboardView_spacebarBackground
* @attr ref R.styleable#KeyboardView_spacebarIconWidthRatio
+ * @attr ref R.styleable#Keyboard_Key_keyLabelFlags
* @attr ref R.styleable#KeyboardView_keyHintLetterPadding
* @attr ref R.styleable#KeyboardView_keyPopupHintLetter
* @attr ref R.styleable#KeyboardView_keyPopupHintLetterPadding
@@ -62,6 +63,8 @@ import java.util.HashSet;
* @attr ref R.styleable#Keyboard_Key_keyHintLetterRatio
* @attr ref R.styleable#Keyboard_Key_keyShiftedLetterHintRatio
* @attr ref R.styleable#Keyboard_Key_keyHintLabelRatio
+ * @attr ref R.styleable#Keyboard_Key_keyLabelOffCenterRatio
+ * @attr ref R.styleable#Keyboard_Key_keyHintLabelOffCenterRatio
* @attr ref R.styleable#Keyboard_Key_keyPreviewTextRatio
* @attr ref R.styleable#Keyboard_Key_keyTextColor
* @attr ref R.styleable#Keyboard_Key_keyTextColorDisabled
@@ -75,6 +78,9 @@ import java.util.HashSet;
public class KeyboardView extends View {
// XML attributes
private final KeyVisualAttributes mKeyVisualAttributes;
+ // Default keyLabelFlags from {@link KeyboardTheme}.
+ // Currently only "alignHintLabelToBottom" is supported.
+ private final int mDefaultKeyLabelFlags;
private final float mKeyHintLetterPadding;
private final String mKeyPopupHintLetter;
private final float mKeyPopupHintLetterPadding;
@@ -146,6 +152,7 @@ public class KeyboardView extends View {
final TypedArray keyAttr = context.obtainStyledAttributes(attrs,
R.styleable.Keyboard_Key, defStyle, R.style.KeyboardView);
+ mDefaultKeyLabelFlags = keyAttr.getInt(R.styleable.Keyboard_Key_keyLabelFlags, 0);
mKeyVisualAttributes = KeyVisualAttributes.newInstance(keyAttr);
keyAttr.recycle();
@@ -357,7 +364,8 @@ public class KeyboardView extends View {
// Draw key label.
final Drawable icon = key.getIcon(mKeyboard.mIconsSet, params.mAnimAlpha);
- float positionX = centerX;
+ float labelX = centerX;
+ float labelBaseline = centerY;
final String label = key.getLabel();
if (label != null) {
paint.setTypeface(key.selectTypeface(params));
@@ -366,15 +374,15 @@ public class KeyboardView extends View {
final float labelCharWidth = TypefaceUtils.getReferenceCharWidth(paint);
// Vertical label text alignment.
- final float baseline = centerY + labelCharHeight / 2.0f;
+ labelBaseline = centerY + labelCharHeight / 2.0f;
// Horizontal label text alignment
- if (key.isAlignLeftOfCenter()) {
- // TODO: Parameterise this?
- positionX = centerX - labelCharWidth * 7.0f / 4.0f;
+ if (key.isAlignLabelOffCenter()) {
+ // The label is placed off center of the key. Used mainly on "phone number" layout.
+ labelX = centerX + params.mLabelOffCenterRatio * labelCharWidth;
paint.setTextAlign(Align.LEFT);
} else {
- positionX = centerX;
+ labelX = centerX;
paint.setTextAlign(Align.CENTER);
}
if (key.needsAutoXScale()) {
@@ -402,7 +410,7 @@ public class KeyboardView extends View {
paint.clearShadowLayer();
}
blendAlpha(paint, params.mAnimAlpha);
- canvas.drawText(label, 0, label.length(), positionX, baseline, paint);
+ canvas.drawText(label, 0, label.length(), labelX, labelBaseline, paint);
// Turn off drop shadow and reset x-scale.
paint.clearShadowLayer();
paint.setTextScaleX(1.0f);
@@ -418,22 +426,22 @@ public class KeyboardView extends View {
blendAlpha(paint, params.mAnimAlpha);
final float labelCharHeight = TypefaceUtils.getReferenceCharHeight(paint);
final float labelCharWidth = TypefaceUtils.getReferenceCharWidth(paint);
- final KeyVisualAttributes visualAttr = key.getVisualAttributes();
- final float adjustmentY = (visualAttr == null) ? 0.0f
- : visualAttr.mHintLabelVerticalAdjustment * labelCharHeight;
- final float hintX, hintY;
+ final float hintX, hintBaseline;
if (key.hasHintLabel()) {
// The hint label is placed just right of the key label. Used mainly on
// "phone number" layout.
- // TODO: Generalize the following calculations.
- hintX = positionX + labelCharWidth * 2.0f;
- hintY = centerY + labelCharHeight / 2.0f;
+ hintX = labelX + params.mHintLabelOffCenterRatio * labelCharWidth;
+ if (key.isAlignHintLabelToBottom(mDefaultKeyLabelFlags)) {
+ hintBaseline = labelBaseline;
+ } else {
+ hintBaseline = centerY + labelCharHeight / 2.0f;
+ }
paint.setTextAlign(Align.LEFT);
} else if (key.hasShiftedLetterHint()) {
// The hint label is placed at top-right corner of the key. Used mainly on tablet.
hintX = keyWidth - mKeyShiftedLetterHintPadding - labelCharWidth / 2.0f;
paint.getFontMetrics(mFontMetrics);
- hintY = -mFontMetrics.top;
+ hintBaseline = -mFontMetrics.top;
paint.setTextAlign(Align.CENTER);
} else { // key.hasHintLetter()
// The hint letter is placed at top-right corner of the key. Used mainly on phone.
@@ -441,10 +449,12 @@ public class KeyboardView extends View {
final float hintLabelWidth = TypefaceUtils.getStringWidth(hintLabel, paint);
hintX = keyWidth - mKeyHintLetterPadding
- Math.max(hintDigitWidth, hintLabelWidth) / 2.0f;
- hintY = -paint.ascent();
+ hintBaseline = -paint.ascent();
paint.setTextAlign(Align.CENTER);
}
- canvas.drawText(hintLabel, 0, hintLabel.length(), hintX, hintY + adjustmentY, paint);
+ final float adjustmentY = params.mHintLabelVerticalAdjustment * labelCharHeight;
+ canvas.drawText(
+ hintLabel, 0, hintLabel.length(), hintX, hintBaseline + adjustmentY, paint);
}
// Draw key icon.
@@ -456,9 +466,13 @@ public class KeyboardView extends View {
iconWidth = Math.min(icon.getIntrinsicWidth(), keyWidth);
}
final int iconHeight = icon.getIntrinsicHeight();
- // Align center.
- final int iconY = (keyHeight - iconHeight) / 2;
- final int iconX = (keyWidth - iconWidth) / 2;
+ final int iconY;
+ if (key.isAlignIconToBottom()) {
+ iconY = keyHeight - iconHeight;
+ } else {
+ iconY = (keyHeight - iconHeight) / 2; // Align vertically center.
+ }
+ final int iconX = (keyWidth - iconWidth) / 2; // Align horizontally center.
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java
index 07ac06bab..df50efdc1 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyDrawParams.java
@@ -26,7 +26,6 @@ public final class KeyDrawParams {
public int mLetterSize;
public int mLabelSize;
public int mLargeLetterSize;
- public int mLargeLabelSize;
public int mHintLetterSize;
public int mShiftedLetterHintSize;
public int mHintLabelSize;
@@ -42,6 +41,10 @@ public final class KeyDrawParams {
public int mShiftedLetterHintActivatedColor;
public int mPreviewTextColor;
+ public float mHintLabelVerticalAdjustment;
+ public float mLabelOffCenterRatio;
+ public float mHintLabelOffCenterRatio;
+
public int mAnimAlpha;
public KeyDrawParams() {}
@@ -52,7 +55,6 @@ public final class KeyDrawParams {
mLetterSize = copyFrom.mLetterSize;
mLabelSize = copyFrom.mLabelSize;
mLargeLetterSize = copyFrom.mLargeLetterSize;
- mLargeLabelSize = copyFrom.mLargeLabelSize;
mHintLetterSize = copyFrom.mHintLetterSize;
mShiftedLetterHintSize = copyFrom.mShiftedLetterHintSize;
mHintLabelSize = copyFrom.mHintLabelSize;
@@ -68,6 +70,10 @@ public final class KeyDrawParams {
mShiftedLetterHintActivatedColor = copyFrom.mShiftedLetterHintActivatedColor;
mPreviewTextColor = copyFrom.mPreviewTextColor;
+ mHintLabelVerticalAdjustment = copyFrom.mHintLabelVerticalAdjustment;
+ mLabelOffCenterRatio = copyFrom.mLabelOffCenterRatio;
+ mHintLabelOffCenterRatio = copyFrom.mHintLabelOffCenterRatio;
+
mAnimAlpha = copyFrom.mAnimAlpha;
}
@@ -84,7 +90,6 @@ public final class KeyDrawParams {
attr.mLetterSize, attr.mLetterRatio, mLetterSize);
mLabelSize = selectTextSizeFromDimensionOrRatio(keyHeight,
attr.mLabelSize, attr.mLabelRatio, mLabelSize);
- mLargeLabelSize = selectTextSize(keyHeight, attr.mLargeLabelRatio, mLargeLabelSize);
mLargeLetterSize = selectTextSize(keyHeight, attr.mLargeLetterRatio, mLargeLetterSize);
mHintLetterSize = selectTextSize(keyHeight, attr.mHintLetterRatio, mHintLetterSize);
mShiftedLetterHintSize = selectTextSize(keyHeight,
@@ -103,6 +108,13 @@ public final class KeyDrawParams {
mShiftedLetterHintActivatedColor = selectColor(
attr.mShiftedLetterHintActivatedColor, mShiftedLetterHintActivatedColor);
mPreviewTextColor = selectColor(attr.mPreviewTextColor, mPreviewTextColor);
+
+ mHintLabelVerticalAdjustment = selectFloatIfNonZero(
+ attr.mHintLabelVerticalAdjustment, mHintLabelVerticalAdjustment);
+ mLabelOffCenterRatio = selectFloatIfNonZero(
+ attr.mLabelOffCenterRatio, mLabelOffCenterRatio);
+ mHintLabelOffCenterRatio = selectFloatIfNonZero(
+ attr.mHintLabelOffCenterRatio, mHintLabelOffCenterRatio);
}
public KeyDrawParams mayCloneAndUpdateParams(final int keyHeight,
@@ -115,7 +127,7 @@ public final class KeyDrawParams {
return newParams;
}
- private static final int selectTextSizeFromDimensionOrRatio(final int keyHeight,
+ private static int selectTextSizeFromDimensionOrRatio(final int keyHeight,
final int dimens, final float ratio, final int defaultDimens) {
if (ResourceUtils.isValidDimensionPixelSize(dimens)) {
return dimens;
@@ -126,7 +138,7 @@ public final class KeyDrawParams {
return defaultDimens;
}
- private static final int selectTextSize(final int keyHeight, final float ratio,
+ private static int selectTextSize(final int keyHeight, final float ratio,
final int defaultSize) {
if (ResourceUtils.isValidFraction(ratio)) {
return (int)(keyHeight * ratio);
@@ -134,10 +146,17 @@ public final class KeyDrawParams {
return defaultSize;
}
- private static final int selectColor(final int attrColor, final int defaultColor) {
+ private static int selectColor(final int attrColor, final int defaultColor) {
if (attrColor != 0) {
return attrColor;
}
return defaultColor;
}
+
+ private static float selectFloatIfNonZero(final float attrFloat, final float defaultFloat) {
+ if (attrFloat != 0) {
+ return attrFloat;
+ }
+ return defaultFloat;
+ }
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java b/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java
index 133462ac7..c60d587db 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyVisualAttributes.java
@@ -31,7 +31,6 @@ public final class KeyVisualAttributes {
public final float mLabelRatio;
public final int mLabelSize;
public final float mLargeLetterRatio;
- public final float mLargeLabelRatio;
public final float mHintLetterRatio;
public final float mShiftedLetterHintRatio;
public final float mHintLabelRatio;
@@ -48,13 +47,14 @@ public final class KeyVisualAttributes {
public final int mPreviewTextColor;
public final float mHintLabelVerticalAdjustment;
+ public final float mLabelOffCenterRatio;
+ public final float mHintLabelOffCenterRatio;
private static final int[] VISUAL_ATTRIBUTE_IDS = {
R.styleable.Keyboard_Key_keyTypeface,
R.styleable.Keyboard_Key_keyLetterSize,
R.styleable.Keyboard_Key_keyLabelSize,
R.styleable.Keyboard_Key_keyLargeLetterRatio,
- R.styleable.Keyboard_Key_keyLargeLabelRatio,
R.styleable.Keyboard_Key_keyHintLetterRatio,
R.styleable.Keyboard_Key_keyShiftedLetterHintRatio,
R.styleable.Keyboard_Key_keyHintLabelRatio,
@@ -69,6 +69,8 @@ public final class KeyVisualAttributes {
R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor,
R.styleable.Keyboard_Key_keyPreviewTextColor,
R.styleable.Keyboard_Key_keyHintLabelVerticalAdjustment,
+ R.styleable.Keyboard_Key_keyLabelOffCenterRatio,
+ R.styleable.Keyboard_Key_keyHintLabelOffCenterRatio
};
private static final SparseIntArray sVisualAttributeIds = new SparseIntArray();
private static final int ATTR_DEFINED = 1;
@@ -109,8 +111,6 @@ public final class KeyVisualAttributes {
R.styleable.Keyboard_Key_keyLabelSize);
mLargeLetterRatio = ResourceUtils.getFraction(keyAttr,
R.styleable.Keyboard_Key_keyLargeLetterRatio);
- mLargeLabelRatio = ResourceUtils.getFraction(keyAttr,
- R.styleable.Keyboard_Key_keyLargeLabelRatio);
mHintLetterRatio = ResourceUtils.getFraction(keyAttr,
R.styleable.Keyboard_Key_keyHintLetterRatio);
mShiftedLetterHintRatio = ResourceUtils.getFraction(keyAttr,
@@ -135,5 +135,9 @@ public final class KeyVisualAttributes {
mHintLabelVerticalAdjustment = ResourceUtils.getFraction(keyAttr,
R.styleable.Keyboard_Key_keyHintLabelVerticalAdjustment, 0.0f);
+ mLabelOffCenterRatio = ResourceUtils.getFraction(keyAttr,
+ R.styleable.Keyboard_Key_keyLabelOffCenterRatio, 0.0f);
+ mHintLabelOffCenterRatio = ResourceUtils.getFraction(keyAttr,
+ R.styleable.Keyboard_Key_keyHintLabelOffCenterRatio, 0.0f);
}
}
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index c7c3aaa18..3a5f85d63 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -295,8 +295,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
- public void postResetInputConnectionCaches(final boolean tryResumeSuggestions,
- final int remainingTries) {
+ public void postResetCaches(final boolean tryResumeSuggestions, final int remainingTries) {
removeMessages(MSG_RESET_CACHES);
sendMessage(obtainMessage(MSG_RESET_CACHES, tryResumeSuggestions ? 1 : 0,
remainingTries, null));
@@ -753,92 +752,20 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
loadKeyboard();
}
- /**
- * A class that holds information to pass from onStartInputInternal to onStartInputViewInternal
- *
- * OnStartInput needs to reload the settings and that will prevent onStartInputViewInternal
- * from comparing the old settings with the new ones, so we use this memory to pass the
- * necessary information along.
- */
- private static class EditorChangeInfo {
- public final boolean mIsSameInputType;
- public final boolean mHasSameOrientation;
- public final boolean mCanReachInputConnection;
- public EditorChangeInfo(final boolean isSameInputType, final boolean hasSameOrientation,
- final boolean canReachInputConnection) {
- mIsSameInputType = isSameInputType;
- mHasSameOrientation = hasSameOrientation;
- mCanReachInputConnection = canReachInputConnection;
- }
- }
-
- private EditorChangeInfo mLastEditorChangeInfo;
-
private void onStartInputInternal(final EditorInfo editorInfo, final boolean restarting) {
super.onStartInput(editorInfo, restarting);
- if (editorInfo == null) {
- Log.e(TAG, "Null EditorInfo in onStartInput()");
- return;
- }
- SettingsValues currentSettingsValues = mSettings.getCurrent();
- final boolean isSameInputType = currentSettingsValues.isSameInputType(editorInfo);
- final boolean hasSameOrientation =
- currentSettingsValues.hasSameOrientation(getResources().getConfiguration());
- mRichImm.clearSubtypeCaches();
- final boolean inputTypeChanged = !isSameInputType;
- final boolean isDifferentTextField = !restarting || inputTypeChanged;
- if (isDifferentTextField || !hasSameOrientation) {
- loadSettings();
- currentSettingsValues = mSettings.getCurrent();
- }
-
- // Note: the following does a round-trip IPC on the main thread: be careful
- final Locale currentLocale = mSubtypeSwitcher.getCurrentSubtypeLocale();
- final Suggest suggest = mInputLogic.mSuggest;
- if (null != currentLocale && !currentLocale.equals(suggest.getLocale())) {
- // TODO: Do this automatically.
- resetSuggest();
- }
- if (isDifferentTextField && currentSettingsValues.mAutoCorrectionEnabledPerUserSettings) {
- suggest.setAutoCorrectionThreshold(currentSettingsValues.mAutoCorrectionThreshold);
- }
-
- // The app calling setText() has the effect of clearing the composing
- // span, so we should reset our state unconditionally, even if restarting is true.
- // We also tell the input logic about the combining rules for the current subtype, so
- // it can adjust its combiners if needed.
- mInputLogic.startInput(mSubtypeSwitcher.getCombiningRulesExtraValueOfCurrentSubtype());
- // TODO[IL]: Can the following be moved to InputLogic#startInput?
- final boolean canReachInputConnection;
- if (!mInputLogic.mConnection.resetCachesUponCursorMoveAndReturnSuccess(
- editorInfo.initialSelStart, editorInfo.initialSelEnd,
- false /* shouldFinishComposition */)) {
- // Sometimes, while rotating, for some reason the framework tells the app we are not
- // connected to it and that means we can't refresh the cache. In this case, schedule a
- // refresh later.
- // We try resetting the caches up to 5 times before giving up.
- mHandler.postResetInputConnectionCaches(isDifferentTextField || !hasSameOrientation,
- 5 /* remainingTries */);
- canReachInputConnection = false;
- } else {
- // When rotating, initialSelStart and initialSelEnd sometimes are lying. Make a best
- // effort to work around this bug.
- mInputLogic.mConnection.tryFixLyingCursorPosition();
- mHandler.postResumeSuggestions(true /* shouldIncludeResumedWordInSuggestions */,
- true /* shouldDelay */);
- canReachInputConnection = true;
- }
-
- mLastEditorChangeInfo = new EditorChangeInfo(isSameInputType, hasSameOrientation,
- canReachInputConnection);
}
@SuppressWarnings("deprecation")
private void onStartInputViewInternal(final EditorInfo editorInfo, final boolean restarting) {
super.onStartInputView(editorInfo, restarting);
+ mRichImm.clearSubtypeCaches();
final KeyboardSwitcher switcher = mKeyboardSwitcher;
switcher.updateKeyboardTheme();
final MainKeyboardView mainKeyboardView = switcher.getMainKeyboardView();
+ // If we are starting input in a different text field from before, we'll have to reload
+ // settings, so currentSettingsValues can't be final.
+ SettingsValues currentSettingsValues = mSettings.getCurrent();
if (editorInfo == null) {
Log.e(TAG, "Null EditorInfo in onStartInputView()");
@@ -881,7 +808,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
accessUtils.onStartInputViewInternal(mainKeyboardView, editorInfo, restarting);
}
- final boolean inputTypeChanged = !mLastEditorChangeInfo.mIsSameInputType;
+ final boolean inputTypeChanged = !currentSettingsValues.isSameInputType(editorInfo);
final boolean isDifferentTextField = !restarting || inputTypeChanged;
if (isDifferentTextField) {
mSubtypeSwitcher.updateParametersOnStartInputView();
@@ -891,13 +818,57 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Note: This call should be done by InputMethodService?
updateFullscreenMode();
- final SettingsValues currentSettingsValues = mSettings.getCurrent();
+ // The app calling setText() has the effect of clearing the composing
+ // span, so we should reset our state unconditionally, even if restarting is true.
+ // We also tell the input logic about the combining rules for the current subtype, so
+ // it can adjust its combiners if needed.
+ mInputLogic.startInput(mSubtypeSwitcher.getCombiningRulesExtraValueOfCurrentSubtype());
+
+ // Note: the following does a round-trip IPC on the main thread: be careful
+ final Locale currentLocale = mSubtypeSwitcher.getCurrentSubtypeLocale();
+ final Suggest suggest = mInputLogic.mSuggest;
+ if (null != currentLocale && !currentLocale.equals(suggest.getLocale())) {
+ // TODO: Do this automatically.
+ resetSuggest();
+ }
+
+ // TODO[IL]: Can the following be moved to InputLogic#startInput?
+ final boolean canReachInputConnection;
+ if (!mInputLogic.mConnection.resetCachesUponCursorMoveAndReturnSuccess(
+ editorInfo.initialSelStart, editorInfo.initialSelEnd,
+ false /* shouldFinishComposition */)) {
+ // Sometimes, while rotating, for some reason the framework tells the app we are not
+ // connected to it and that means we can't refresh the cache. In this case, schedule a
+ // refresh later.
+ // We try resetting the caches up to 5 times before giving up.
+ mHandler.postResetCaches(isDifferentTextField, 5 /* remainingTries */);
+ // mLastSelection{Start,End} are reset later in this method, don't need to do it here
+ canReachInputConnection = false;
+ } else {
+ // When rotating, initialSelStart and initialSelEnd sometimes are lying. Make a best
+ // effort to work around this bug.
+ mInputLogic.mConnection.tryFixLyingCursorPosition();
+ mHandler.postResumeSuggestions(true /* shouldIncludeResumedWordInSuggestions */,
+ true /* shouldDelay */);
+ canReachInputConnection = true;
+ }
+
+ if (isDifferentTextField ||
+ !currentSettingsValues.hasSameOrientation(getResources().getConfiguration())) {
+ loadSettings();
+ }
if (isDifferentTextField) {
mainKeyboardView.closing();
+ currentSettingsValues = mSettings.getCurrent();
+
+ if (currentSettingsValues.mAutoCorrectionEnabledPerUserSettings) {
+ suggest.setAutoCorrectionThreshold(
+ currentSettingsValues.mAutoCorrectionThreshold);
+ }
switcher.loadKeyboard(editorInfo, currentSettingsValues, getCurrentAutoCapsState(),
getCurrentRecapitalizeState());
- if (!mLastEditorChangeInfo.mCanReachInputConnection) {
+ if (!canReachInputConnection) {
// If we can't reach the input connection, we will call loadKeyboard again later,
// so we need to save its state now. The call will be done in #retryResetCaches.
switcher.saveKeyboardState();
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 2be792040..418866ae1 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -2035,7 +2035,7 @@ public final class InputLogic {
mConnection.getExpectedSelectionStart(), mConnection.getExpectedSelectionEnd(),
shouldFinishComposition)) {
if (0 < remainingTries) {
- handler.postResetInputConnectionCaches(tryResumeSuggestions, remainingTries - 1);
+ handler.postResetCaches(tryResumeSuggestions, remainingTries - 1);
return false;
}
// If remainingTries is 0, we should stop waiting for new tries, however we'll still