diff options
Diffstat (limited to 'java')
44 files changed, 154 insertions, 111 deletions
diff --git a/java/res/drawable-hdpi/sym_keyboard_spacebar_lxx_dark.9.png b/java/res/drawable-hdpi/btn_keyboard_spacebar_normal_lxx_dark.9.png Binary files differindex 32311666f..32311666f 100644 --- a/java/res/drawable-hdpi/sym_keyboard_spacebar_lxx_dark.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_spacebar_normal_lxx_dark.9.png diff --git a/java/res/drawable-hdpi/sym_keyboard_spacebar_lxx_light.9.png b/java/res/drawable-hdpi/btn_keyboard_spacebar_normal_lxx_light.9.png Binary files differindex 1256b8b21..1256b8b21 100644 --- a/java/res/drawable-hdpi/sym_keyboard_spacebar_lxx_light.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_spacebar_normal_lxx_light.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png b/java/res/drawable-hdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png Binary files differnew file mode 100644 index 000000000..cd0d884c6 --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png b/java/res/drawable-hdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png Binary files differnew file mode 100644 index 000000000..c05605fbf --- /dev/null +++ b/java/res/drawable-hdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png diff --git a/java/res/drawable-mdpi/sym_keyboard_spacebar_lxx_dark.9.png b/java/res/drawable-mdpi/btn_keyboard_spacebar_normal_lxx_dark.9.png Binary files differindex b8e56dab4..b8e56dab4 100644 --- a/java/res/drawable-mdpi/sym_keyboard_spacebar_lxx_dark.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_spacebar_normal_lxx_dark.9.png diff --git a/java/res/drawable-mdpi/sym_keyboard_spacebar_lxx_light.9.png b/java/res/drawable-mdpi/btn_keyboard_spacebar_normal_lxx_light.9.png Binary files differindex 281f83062..281f83062 100644 --- a/java/res/drawable-mdpi/sym_keyboard_spacebar_lxx_light.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_spacebar_normal_lxx_light.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png b/java/res/drawable-mdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png Binary files differnew file mode 100644 index 000000000..cb2ca06d3 --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png b/java/res/drawable-mdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png Binary files differnew file mode 100644 index 000000000..653da974c --- /dev/null +++ b/java/res/drawable-mdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png diff --git a/java/res/drawable-xhdpi/sym_keyboard_spacebar_lxx_dark.9.png b/java/res/drawable-xhdpi/btn_keyboard_spacebar_normal_lxx_dark.9.png Binary files differindex ab032dc17..ab032dc17 100644 --- a/java/res/drawable-xhdpi/sym_keyboard_spacebar_lxx_dark.9.png +++ b/java/res/drawable-xhdpi/btn_keyboard_spacebar_normal_lxx_dark.9.png diff --git a/java/res/drawable-xhdpi/sym_keyboard_spacebar_lxx_light.9.png b/java/res/drawable-xhdpi/btn_keyboard_spacebar_normal_lxx_light.9.png Binary files differindex c1ed863f8..c1ed863f8 100644 --- a/java/res/drawable-xhdpi/sym_keyboard_spacebar_lxx_light.9.png +++ b/java/res/drawable-xhdpi/btn_keyboard_spacebar_normal_lxx_light.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png b/java/res/drawable-xhdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png Binary files differnew file mode 100644 index 000000000..c3428bede --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png b/java/res/drawable-xhdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png Binary files differnew file mode 100644 index 000000000..f795ee9af --- /dev/null +++ b/java/res/drawable-xhdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png diff --git a/java/res/drawable-xxhdpi/sym_keyboard_spacebar_lxx_dark.9.png b/java/res/drawable-xxhdpi/btn_keyboard_spacebar_normal_lxx_dark.9.png Binary files differindex 0339de37d..0339de37d 100644 --- a/java/res/drawable-xxhdpi/sym_keyboard_spacebar_lxx_dark.9.png +++ b/java/res/drawable-xxhdpi/btn_keyboard_spacebar_normal_lxx_dark.9.png diff --git a/java/res/drawable-xxhdpi/sym_keyboard_spacebar_lxx_light.9.png b/java/res/drawable-xxhdpi/btn_keyboard_spacebar_normal_lxx_light.9.png Binary files differindex b57cfb3d2..b57cfb3d2 100644 --- a/java/res/drawable-xxhdpi/sym_keyboard_spacebar_lxx_light.9.png +++ b/java/res/drawable-xxhdpi/btn_keyboard_spacebar_normal_lxx_light.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png b/java/res/drawable-xxhdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png Binary files differnew file mode 100644 index 000000000..8e74c6723 --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_spacebar_pressed_lxx_dark.9.png diff --git a/java/res/drawable-xxhdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png b/java/res/drawable-xxhdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png Binary files differnew file mode 100644 index 000000000..1ca1ae3e9 --- /dev/null +++ b/java/res/drawable-xxhdpi/btn_keyboard_spacebar_pressed_lxx_light.9.png diff --git a/java/res/drawable/btn_keyboard_key_lxx_dark.xml b/java/res/drawable/btn_keyboard_key_lxx_dark.xml index c82c13829..bb1789ae3 100644 --- a/java/res/drawable/btn_keyboard_key_lxx_dark.xml +++ b/java/res/drawable/btn_keyboard_key_lxx_dark.xml @@ -15,11 +15,6 @@ --> <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 f237fbea9..60fe02dd2 100644 --- a/java/res/drawable/btn_keyboard_key_lxx_light.xml +++ b/java/res/drawable/btn_keyboard_key_lxx_light.xml @@ -15,11 +15,6 @@ --> <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/drawable/btn_keyboard_spacebar_lxx_dark.xml b/java/res/drawable/btn_keyboard_spacebar_lxx_dark.xml index 5c595d9ed..e930e40e4 100644 --- a/java/res/drawable/btn_keyboard_spacebar_lxx_dark.xml +++ b/java/res/drawable/btn_keyboard_spacebar_lxx_dark.xml @@ -16,6 +16,6 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" - android:drawable="@color/key_background_pressed_lxx_dark" /> - <item android:drawable="@color/key_background_lxx_dark" /> + android:drawable="@drawable/btn_keyboard_spacebar_pressed_lxx_dark" /> + <item android:drawable="@drawable/btn_keyboard_spacebar_normal_lxx_dark" /> </selector> diff --git a/java/res/drawable/btn_keyboard_spacebar_lxx_light.xml b/java/res/drawable/btn_keyboard_spacebar_lxx_light.xml index acd19fda4..2b059938d 100644 --- a/java/res/drawable/btn_keyboard_spacebar_lxx_light.xml +++ b/java/res/drawable/btn_keyboard_spacebar_lxx_light.xml @@ -16,6 +16,6 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" - android:drawable="@color/key_background_pressed_lxx_light" /> - <item android:drawable="@color/key_background_lxx_light" /> + android:drawable="@drawable/btn_keyboard_spacebar_pressed_lxx_light" /> + <item android:drawable="@drawable/btn_keyboard_spacebar_normal_lxx_light" /> </selector> diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index c756f8c34..57e73767c 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -207,7 +207,13 @@ </declare-styleable> <declare-styleable name="Keyboard"> - <attr name="themeId" format="integer" /> + <attr name="themeId" format="enum"> + <!-- This should be aligned with KeyboardTheme.THEME_ID_*. --> + <enum name="ICS" value="0" /> + <enum name="KLP" value="2" /> + <enum name="LXXLight" value="3" /> + <enum name="LXXDark" value="4" /> + </attr> <!-- Touch position correction --> <attr name="touchPositionCorrectionData" format="reference" /> <!-- Keyboard top, bottom, left, right edges paddings, in propotion of keyboard height. --> @@ -278,7 +284,7 @@ <enum name="stickyOff" value="3" /> <enum name="stickyOn" value="4" /> <enum name="action" value="5" /> - <enum name="customAction" value="6" /> + <enum name="spacebar" value="6" /> </attr> <!-- The key action flags. --> <attr name="keyActionFlags" format="integer"> @@ -427,6 +433,13 @@ <enum name="emojiCategory5" value="15" /> <enum name="emojiCategory6" value="16" /> </attr> + <!-- This should be aligned with Keyboard.themeId and KeyboardTheme.THEME_ID_* --> + <attr name="keyboardTheme" format="enum|string"> + <enum name="ICS" value="0" /> + <enum name="KLP" value="2" /> + <enum name="LXXLight" value="3" /> + <enum name="LXXDark" value="4" /> + </attr> <!-- This should be aligned with KeyboardId.MODE_* --> <attr name="mode" format="enum|string"> <enum name="text" value="0" /> diff --git a/java/res/values/keyboard-icons-lxx-dark.xml b/java/res/values/keyboard-icons-lxx-dark.xml index 305df02cd..2e2fd0abb 100644 --- a/java/res/values/keyboard-icons-lxx-dark.xml +++ b/java/res/values/keyboard-icons-lxx-dark.xml @@ -24,7 +24,7 @@ <item name="iconShiftKey">@drawable/sym_keyboard_shift_lxx_dark</item> <item name="iconDeleteKey">@drawable/sym_keyboard_delete_lxx_dark</item> <item name="iconSettingsKey">@drawable/sym_keyboard_settings_lxx_dark</item> - <item name="iconSpaceKey">@drawable/sym_keyboard_spacebar_lxx_dark</item> + <item name="iconSpaceKey">@null</item> <item name="iconEnterKey">@drawable/sym_keyboard_return_lxx_dark</item> <item name="iconGoKey">@drawable/sym_keyboard_go_lxx_dark</item> <item name="iconSearchKey">@drawable/sym_keyboard_search_lxx_dark</item> diff --git a/java/res/values/keyboard-icons-lxx-light.xml b/java/res/values/keyboard-icons-lxx-light.xml index 866dc682f..099a706fe 100644 --- a/java/res/values/keyboard-icons-lxx-light.xml +++ b/java/res/values/keyboard-icons-lxx-light.xml @@ -24,7 +24,7 @@ <item name="iconShiftKey">@drawable/sym_keyboard_shift_lxx_light</item> <item name="iconDeleteKey">@drawable/sym_keyboard_delete_lxx_light</item> <item name="iconSettingsKey">@drawable/sym_keyboard_settings_lxx_light</item> - <item name="iconSpaceKey">@drawable/sym_keyboard_spacebar_lxx_light</item> + <item name="iconSpaceKey">@null</item> <item name="iconEnterKey">@drawable/sym_keyboard_return_lxx_light</item> <item name="iconGoKey">@drawable/sym_keyboard_go_lxx_light</item> <item name="iconSearchKey">@drawable/sym_keyboard_search_lxx_light</item> diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml index 051489e11..a9c7294a0 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -33,8 +33,8 @@ name="Keyboard.ICS" parent="Keyboard" > - <!-- This should be aligned with KeyboardSwitcher.KEYBOARD_THEMES[] --> - <item name="themeId">2</item> + <!-- This should be aligned with KeyboardTheme.THEME_ID_* --> + <item name="themeId">ICS</item> </style> <style name="KeyboardView.ICS" diff --git a/java/res/values/themes-klp.xml b/java/res/values/themes-klp.xml index a853ed9dd..da5e27fa1 100644 --- a/java/res/values/themes-klp.xml +++ b/java/res/values/themes-klp.xml @@ -33,8 +33,8 @@ name="Keyboard.KLP" parent="Keyboard" > - <!-- This should be aligned with KeyboardSwitcher.KEYBOARD_THEMES[] --> - <item name="themeId">0</item> + <!-- This should be aligned with KeyboardTheme.THEME_ID_* --> + <item name="themeId">KLP</item> </style> <style name="KeyboardView.KLP" diff --git a/java/res/values/themes-lxx-dark.xml b/java/res/values/themes-lxx-dark.xml index 2aaee1360..c49436c49 100644 --- a/java/res/values/themes-lxx-dark.xml +++ b/java/res/values/themes-lxx-dark.xml @@ -33,8 +33,8 @@ name="Keyboard.LXX_Dark" parent="Keyboard" > - <!-- This should be aligned with KeyboardSwitcher.KEYBOARD_THEMES[] --> - <item name="themeId">4</item> + <!-- This should be aligned with KeyboardTheme.THEME_ID_* --> + <item name="themeId">LXXDark</item> </style> <style name="KeyboardView.LXX_Dark" diff --git a/java/res/values/themes-lxx-light.xml b/java/res/values/themes-lxx-light.xml index e7a6f5894..6f0fb7131 100644 --- a/java/res/values/themes-lxx-light.xml +++ b/java/res/values/themes-lxx-light.xml @@ -33,8 +33,8 @@ name="Keyboard.LXX_Light" parent="Keyboard" > - <!-- This should be aligned with KeyboardSwitcher.KEYBOARD_THEMES[] --> - <item name="themeId">3</item> + <!-- This should be aligned with KeyboardTheme.THEME_ID_* --> + <item name="themeId">LXXLight</item> </style> <style name="KeyboardView.LXX_Light" diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml index c750a9319..006cda370 100644 --- a/java/res/xml-sw600dp/key_styles_common.xml +++ b/java/res/xml-sw600dp/key_styles_common.xml @@ -86,6 +86,7 @@ <key-style latin:styleName="spaceKeyStyle" latin:keySpec="!icon/space_key|!code/key_space" + latin:backgroundType="spacebar" latin:keyActionFlags="noKeyPreview|enableLongPress" /> <!-- U+200C: ZERO WIDTH NON-JOINER U+200D: ZERO WIDTH JOINER --> diff --git a/java/res/xml-sw600dp/key_styles_enter.xml b/java/res/xml-sw600dp/key_styles_enter.xml index c20523b2a..0227d811b 100644 --- a/java/res/xml-sw600dp/key_styles_enter.xml +++ b/java/res/xml-sw600dp/key_styles_enter.xml @@ -224,12 +224,24 @@ </case> <case latin:imeAction="actionCustomLabel" + latin:keyboardTheme="ICS|KLP" > <key-style latin:styleName="enterKeyStyle" latin:keySpec="dummy_label|!code/key_enter" latin:keyLabelFlags="fromCustomActionLabel" - latin:backgroundType="customAction" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionCustomLabel" + latin:keyboardTheme="LXXLight|LXXDark" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="dummy_label|!code/key_enter" + latin:keyLabelFlags="fromCustomActionLabel" + latin:backgroundType="functional" latin:parentStyle="defaultEnterKeyStyle" /> </case> <!-- imeAction is either actionNone or actionUnspecified. --> diff --git a/java/res/xml-sw600dp/rows_number_normal.xml b/java/res/xml-sw600dp/rows_number_normal.xml index 757e77933..7a4700d5a 100644 --- a/java/res/xml-sw600dp/rows_number_normal.xml +++ b/java/res/xml-sw600dp/rows_number_normal.xml @@ -141,9 +141,8 @@ </Row> <Row> <Key - latin:keyStyle="spaceKeyStyle" - latin:keyWidth="30%p" - latin:backgroundType="functional" /> + latin:keyStyle="tabletNumSpaceKeyStyle" + latin:keyWidth="30%p" /> <Key latin:keyStyle="numStarKeyStyle" latin:keyXPos="31%p" /> diff --git a/java/res/xml-sw600dp/rows_phone.xml b/java/res/xml-sw600dp/rows_phone.xml index 9022bc532..612397a90 100644 --- a/java/res/xml-sw600dp/rows_phone.xml +++ b/java/res/xml-sw600dp/rows_phone.xml @@ -107,9 +107,8 @@ </Row> <Row> <Key - latin:keyStyle="spaceKeyStyle" - latin:keyWidth="30%p" - latin:backgroundType="functional" /> + latin:keyStyle="tabletNumSpaceKeyStyle" + latin:keyWidth="30%p" /> <Key latin:keyStyle="numStarKeyStyle" latin:keyXPos="31%p" /> diff --git a/java/res/xml/key_space_symbols.xml b/java/res/xml/key_space_symbols.xml index 0ce522889..047de9f24 100644 --- a/java/res/xml/key_space_symbols.xml +++ b/java/res/xml/key_space_symbols.xml @@ -22,7 +22,6 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <Key - latin:backgroundType="normal" latin:keyStyle="spaceKeyStyle" latin:keyWidth="30%p" /> </merge> diff --git a/java/res/xml/key_styles_common.xml b/java/res/xml/key_styles_common.xml index 167e6f88d..43ee26b07 100644 --- a/java/res/xml/key_styles_common.xml +++ b/java/res/xml/key_styles_common.xml @@ -91,6 +91,7 @@ <key-style latin:styleName="spaceKeyStyle" latin:keySpec="!icon/space_key|!code/key_space" + latin:backgroundType="spacebar" latin:keyActionFlags="noKeyPreview|enableLongPress" /> <!-- U+200C: ZERO WIDTH NON-JOINER U+200D: ZERO WIDTH JOINER --> diff --git a/java/res/xml/key_styles_enter.xml b/java/res/xml/key_styles_enter.xml index 55dab78c3..7aea1ceff 100644 --- a/java/res/xml/key_styles_enter.xml +++ b/java/res/xml/key_styles_enter.xml @@ -393,12 +393,24 @@ </case> <case latin:imeAction="actionCustomLabel" + latin:keyboardTheme="ICS|KLP" > <key-style latin:styleName="enterKeyStyle" latin:keySpec="dummy_label|!code/key_enter" latin:keyLabelFlags="fromCustomActionLabel" - latin:backgroundType="customAction" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionCustomLabel" + latin:keyboardTheme="LXXLight|LXXDark" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="dummy_label|!code/key_enter" + latin:keyLabelFlags="fromCustomActionLabel" + latin:backgroundType="functional" latin:parentStyle="defaultEnterKeyStyle" /> </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 14b202874..97ae6c6c3 100644 --- a/java/res/xml/key_styles_number.xml +++ b/java/res/xml/key_styles_number.xml @@ -123,4 +123,24 @@ latin:keyLabelFlags="alignIconToBottom" latin:keyActionFlags="enableLongPress" latin:parentStyle="numKeyBaseStyle" /> + <!-- TODO: Consolidate these space key styles with numSpaceKeyStyle above by introducing <case> + predicator that checks device form-factor. --> + <switch> + <case latin:keyboardTheme="ICS|KLP"> + <key-style + latin:styleName="tabletNumSpaceKeyStyle" + latin:keySpec="!icon/space_key|!code/key_space" + latin:backgroundType="functional" + latin:keyActionFlags="enableLongPress" + latin:parentStyle="numKeyBaseStyle" /> + </case> + <case latin:keyboardTheme="LXXLight|LXXDark"> + <key-style + latin:styleName="tabletNumSpaceKeyStyle" + latin:keySpec="!icon/space_key|!code/key_space" + latin:backgroundType="spacebar" + latin:keyActionFlags="enableLongPress" + latin:parentStyle="numKeyBaseStyle" /> + </case> + </switch> </merge> diff --git a/java/res/xml/prefs_screen_debug.xml b/java/res/xml/prefs_screen_debug.xml index e0f3501fd..c47740268 100644 --- a/java/res/xml/prefs_screen_debug.xml +++ b/java/res/xml/prefs_screen_debug.xml @@ -58,32 +58,32 @@ android:defaultValue="false" android:persistent="true" /> <com.android.inputmethod.latin.settings.SeekBarDialogPreference - android:dependency="pref_customize_key_preview_animation" + android:dependency="pref_has_custom_key_preview_animation_params" android:key="pref_key_preview_show_up_start_x_scale" android:title="@string/prefs_key_popup_show_up_start_x_scale_settings" latin:maxValue="100" /> <!-- percent --> <com.android.inputmethod.latin.settings.SeekBarDialogPreference - android:dependency="pref_customize_key_preview_animation" + android:dependency="pref_has_custom_key_preview_animation_params" android:key="pref_key_preview_show_up_start_y_scale" android:title="@string/prefs_key_popup_show_up_start_y_scale_settings" latin:maxValue="100" /> <!-- percent --> <com.android.inputmethod.latin.settings.SeekBarDialogPreference - android:dependency="pref_customize_key_preview_animation" + android:dependency="pref_has_custom_key_preview_animation_params" android:key="pref_key_preview_dismiss_end_x_scale" android:title="@string/prefs_key_popup_dismiss_end_x_scale_settings" latin:maxValue="100" /> <!-- percent --> <com.android.inputmethod.latin.settings.SeekBarDialogPreference - android:dependency="pref_customize_key_preview_animation" + android:dependency="pref_has_custom_key_preview_animation_params" android:key="pref_key_preview_dismiss_end_y_scale" android:title="@string/prefs_key_popup_dismiss_end_y_scale_settings" latin:maxValue="100" /> <!-- percent --> <com.android.inputmethod.latin.settings.SeekBarDialogPreference - android:dependency="pref_customize_key_preview_animation" + android:dependency="pref_has_custom_key_preview_animation_params" android:key="pref_key_preview_show_up_duration" android:title="@string/prefs_key_popup_show_up_duration_settings" latin:maxValue="100" /> <!-- milliseconds --> <com.android.inputmethod.latin.settings.SeekBarDialogPreference - android:dependency="pref_customize_key_preview_animation" + android:dependency="pref_has_custom_key_preview_animation_params" android:key="pref_key_preview_dismiss_duration" android:title="@string/prefs_key_popup_dismiss_duration_settings" latin:maxValue="100" /> <!-- milliseconds --> diff --git a/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java b/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java index 24eaec85c..3a86ccbda 100644 --- a/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java +++ b/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java @@ -23,34 +23,16 @@ import com.android.inputmethod.annotations.UsedForTesting; @UsedForTesting public final class CursorAnchorInfoCompatWrapper { - public static final int CHARACTER_RECT_TYPE_MASK = 0x0f; /** - * Type for {@link #CHARACTER_RECT_TYPE_MASK}: the editor did not specify any type of this - * character. Editor authors should not use this flag. + * The insertion marker or character bounds have at least one visible region. */ - public static final int CHARACTER_RECT_TYPE_UNSPECIFIED = 0; + public static final int FLAG_HAS_VISIBLE_REGION = 0x01; /** - * Type for {@link #CHARACTER_RECT_TYPE_MASK}: the character is entirely visible. + * The insertion marker or character bounds have at least one invisible (clipped) region. */ - public static final int CHARACTER_RECT_TYPE_FULLY_VISIBLE = 1; - - /** - * Type for {@link #CHARACTER_RECT_TYPE_MASK}: some area of the character is invisible. - */ - public static final int CHARACTER_RECT_TYPE_PARTIALLY_VISIBLE = 2; - - /** - * Type for {@link #CHARACTER_RECT_TYPE_MASK}: the character is entirely invisible. - */ - public static final int CHARACTER_RECT_TYPE_INVISIBLE = 3; - - /** - * Type for {@link #CHARACTER_RECT_TYPE_MASK}: the editor gave up to calculate the rectangle - * for this character. Input method authors should ignore the returned rectangle. - */ - public static final int CHARACTER_RECT_TYPE_NOT_FEASIBLE = 4; + public static final int FLAG_HAS_INVISIBLE_REGION = 0x02; // Note that CursorAnchorInfo has been introduced in API level XX (Build.VERSION_CODE.LXX). private static final CompatUtils.ClassWrapper sCursorAnchorInfoClass; @@ -63,7 +45,7 @@ public final class CursorAnchorInfoCompatWrapper { private static final CompatUtils.ToFloatMethodWrapper sGetInsertionMarkerHorizontalMethod; private static final CompatUtils.ToFloatMethodWrapper sGetInsertionMarkerTopMethod; private static final CompatUtils.ToObjectMethodWrapper<Matrix> sGetMatrixMethod; - private static final CompatUtils.ToBooleanMethodWrapper sIsInsertionMarkerClippedMethod; + private static final CompatUtils.ToIntMethodWrapper sGetInsertionMarkerFlagsMethod; private static int COMPOSING_TEXT_START_DEFAULT = -1; static { @@ -72,7 +54,7 @@ public final class CursorAnchorInfoCompatWrapper { sGetCharacterRectMethod = sCursorAnchorInfoClass.getMethod( "getCharacterRect", (RectF)null, int.class); sGetCharacterRectFlagsMethod = sCursorAnchorInfoClass.getPrimitiveMethod( - "getCharacterRectFlags", CHARACTER_RECT_TYPE_UNSPECIFIED, int.class); + "getCharacterRectFlags", 0, int.class); sGetComposingTextMethod = sCursorAnchorInfoClass.getMethod( "getComposingText", (CharSequence)null); sGetComposingTextStartMethod = sCursorAnchorInfoClass.getPrimitiveMethod( @@ -86,8 +68,8 @@ public final class CursorAnchorInfoCompatWrapper { sGetInsertionMarkerTopMethod = sCursorAnchorInfoClass.getPrimitiveMethod( "getInsertionMarkerTop", 0.0f); sGetMatrixMethod = sCursorAnchorInfoClass.getMethod("getMatrix", (Matrix)null); - sIsInsertionMarkerClippedMethod = sCursorAnchorInfoClass.getPrimitiveMethod( - "isInsertionMarkerClipped", false); + sGetInsertionMarkerFlagsMethod = sCursorAnchorInfoClass.getPrimitiveMethod( + "getInsertionMarkerFlags", 0); } @UsedForTesting @@ -154,7 +136,7 @@ public final class CursorAnchorInfoCompatWrapper { return sGetInsertionMarkerTopMethod.invoke(mInstance); } - public boolean isInsertionMarkerClipped() { - return sIsInsertionMarkerClippedMethod.invoke(mInstance); + public int getInsertionMarkerFlags() { + return sGetInsertionMarkerFlagsMethod.invoke(mInstance); } } diff --git a/java/src/com/android/inputmethod/compat/InputConnectionCompatUtils.java b/java/src/com/android/inputmethod/compat/InputConnectionCompatUtils.java index 862ec8a58..a5c71b22f 100644 --- a/java/src/com/android/inputmethod/compat/InputConnectionCompatUtils.java +++ b/java/src/com/android/inputmethod/compat/InputConnectionCompatUtils.java @@ -21,30 +21,29 @@ import android.view.inputmethod.InputMethodManager; public final class InputConnectionCompatUtils { private static final CompatUtils.ClassWrapper sInputConnectionType; - private static final CompatUtils.ToBooleanMethodWrapper sRequestUpdateCursorAnchorInfoMethod; + private static final CompatUtils.ToBooleanMethodWrapper sRequestCursorUpdatesMethod; static { sInputConnectionType = new CompatUtils.ClassWrapper(InputConnection.class); - sRequestUpdateCursorAnchorInfoMethod = sInputConnectionType.getPrimitiveMethod( - "requestUpdateCursorAnchorInfo", false, int.class); + sRequestCursorUpdatesMethod = sInputConnectionType.getPrimitiveMethod( + "requestCursorUpdates", false, int.class); } - public static boolean isRequestUpdateCursorAnchorInfoAvailable() { - return sRequestUpdateCursorAnchorInfoMethod != null; + public static boolean isRequestCursorUpdatesAvailable() { + return sRequestCursorUpdatesMethod != null; } /** - * Local copies of some constants in CursorAnchorInfoRequest until the SDK becomes publicly - * available. + * Local copies of some constants in InputConnection until the SDK becomes publicly available. */ - private static int REQUEST_UPDATE_CURSOR_UPDATE_IMMEDIATE = 1 << 0; - private static int REQUEST_UPDATE_CURSOR_UPDATE_MONITOR = 1 << 1; + private static int CURSOR_UPDATE_IMMEDIATE = 1 << 0; + private static int CURSOR_UPDATE_MONITOR = 1 << 1; - private static boolean requestUpdateCursorAnchorInfoImpl(final InputConnection inputConnection, + private static boolean requestCursorUpdatesImpl(final InputConnection inputConnection, final int cursorUpdateMode) { - if (!isRequestUpdateCursorAnchorInfoAvailable()) { + if (!isRequestCursorUpdatesAvailable()) { return false; } - return sRequestUpdateCursorAnchorInfoMethod.invoke(inputConnection, cursorUpdateMode); + return sRequestCursorUpdatesMethod.invoke(inputConnection, cursorUpdateMode); } /** @@ -56,11 +55,10 @@ public final class InputConnectionCompatUtils { * as soon as possible to notify the current cursor/anchor position to the input method. * @return {@code false} if the request is not handled. Otherwise returns {@code true}. */ - public static boolean requestUpdateCursorAnchorInfo(final InputConnection inputConnection, + public static boolean requestCursorUpdates(final InputConnection inputConnection, final boolean enableMonitor, final boolean requestImmediateCallback) { - final int cursorUpdateMode = (enableMonitor ? REQUEST_UPDATE_CURSOR_UPDATE_MONITOR : 0) - | (requestImmediateCallback ? REQUEST_UPDATE_CURSOR_UPDATE_IMMEDIATE : 0); - return requestUpdateCursorAnchorInfoImpl(inputConnection, cursorUpdateMode); + final int cursorUpdateMode = (enableMonitor ? CURSOR_UPDATE_MONITOR : 0) + | (requestImmediateCallback ? CURSOR_UPDATE_IMMEDIATE : 0); + return requestCursorUpdatesImpl(inputConnection, cursorUpdateMode); } - } diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index 05334c7f4..efa527e15 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -139,7 +139,7 @@ public class Key implements Comparable<Key> { 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; + public static final int BACKGROUND_TYPE_SPACEBAR = 6; private final int mActionFlags; private static final int ACTION_FLAGS_IS_REPEATABLE = 0x01; @@ -506,7 +506,7 @@ public class Key implements Comparable<Key> { 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"; + case BACKGROUND_TYPE_SPACEBAR: return "spacebar"; default: return null; } } @@ -889,8 +889,8 @@ public class Key implements Comparable<Key> { 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) + // 6: BACKGROUND_TYPE_SPACEBAR + new KeyBackgroundState(), }; } @@ -904,7 +904,7 @@ public class Key implements Comparable<Key> { final Drawable background; if (mBackgroundType == BACKGROUND_TYPE_FUNCTIONAL) { background = functionalKeyBackground; - } else if (getCode() == Constants.CODE_SPACE) { + } else if (mBackgroundType == BACKGROUND_TYPE_SPACEBAR) { background = spacebarBackground; } else { background = keyBackground; diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java index 0cd606d19..7161d3f26 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java @@ -32,6 +32,8 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> { static final String KLP_KEYBOARD_THEME_KEY = "pref_keyboard_layout_20110916"; static final String LXX_KEYBOARD_THEME_KEY = "pref_keyboard_theme_20140509"; + // These should be aligned with Keyboard.themeId and Keyboard.Case.keyboardTheme + // attributes' values in attrs.xml. public static final int THEME_ID_ICS = 0; public static final int THEME_ID_KLP = 2; public static final int THEME_ID_LXX_LIGHT = 3; @@ -39,16 +41,16 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> { public 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_ICS, "ICS", R.style.KeyboardTheme_ICS, // This has never been selected because we support ICS or later. VERSION_CODES.BASE), - new KeyboardTheme(THEME_ID_KLP, R.style.KeyboardTheme_KLP, + new KeyboardTheme(THEME_ID_KLP, "KLP", R.style.KeyboardTheme_KLP, // Default theme for ICS, JB, and KLP. VERSION_CODES.ICE_CREAM_SANDWICH), - new KeyboardTheme(THEME_ID_LXX_LIGHT, R.style.KeyboardTheme_LXX_Light, + new KeyboardTheme(THEME_ID_LXX_LIGHT, "LXXLight", R.style.KeyboardTheme_LXX_Light, // Default theme for LXX. BuildCompatUtils.VERSION_CODES_LXX), - new KeyboardTheme(THEME_ID_LXX_DARK, R.style.KeyboardTheme_LXX_Dark, + new KeyboardTheme(THEME_ID_LXX_DARK, "LXXDark", R.style.KeyboardTheme_LXX_Dark, VERSION_CODES.BASE), }; @@ -59,12 +61,15 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> { public final int mThemeId; public final int mStyleId; + public final String mThemeName; private final int mMinApiVersion; // Note: The themeId should be aligned with "themeId" attribute of Keyboard style // in values/themes-<style>.xml. - private KeyboardTheme(final int themeId, final int styleId, final int minApiVersion) { + private KeyboardTheme(final int themeId, final String themeName, final int styleId, + final int minApiVersion) { mThemeId = themeId; + mThemeName = themeName; mStyleId = styleId; mMinApiVersion = minApiVersion; } @@ -128,6 +133,11 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> { return searchKeyboardThemeById(DEFAULT_THEME_ID); } + public static String getKeyboardThemeName(final int themeId) { + final KeyboardTheme theme = searchKeyboardThemeById(themeId); + return theme.mThemeName; + } + public static void saveKeyboardThemeId(final String themeIdString, final SharedPreferences prefs) { saveKeyboardThemeId(themeIdString, prefs, BuildCompatUtils.EFFECTIVE_SDK_INT); diff --git a/java/src/com/android/inputmethod/keyboard/TextDecorator.java b/java/src/com/android/inputmethod/keyboard/TextDecorator.java index 178516134..9192853ca 100644 --- a/java/src/com/android/inputmethod/keyboard/TextDecorator.java +++ b/java/src/com/android/inputmethod/keyboard/TextDecorator.java @@ -276,10 +276,10 @@ public class TextDecorator { final int lastCharRectIndex = composingTextStart + composingText.length() - 1; final RectF lastCharRect = info.getCharacterRect(lastCharRectIndex); final int lastCharRectFlag = info.getCharacterRectFlags(lastCharRectIndex); - final int lastCharRectType = - lastCharRectFlag & CursorAnchorInfoCompatWrapper.CHARACTER_RECT_TYPE_MASK; - if (lastCharRect == null || matrix == null || lastCharRectType != - CursorAnchorInfoCompatWrapper.CHARACTER_RECT_TYPE_FULLY_VISIBLE) { + final boolean hasInvisibleRegionInLastCharRect = + (lastCharRectFlag & CursorAnchorInfoCompatWrapper.FLAG_HAS_INVISIBLE_REGION) + != 0; + if (lastCharRect == null || matrix == null || hasInvisibleRegionInLastCharRect) { mUiOperator.hideUi(); return; } @@ -336,7 +336,8 @@ public class TextDecorator { } // In MODE_ADD_TO_DICTIONARY, we cannot retrieve the character position at all because // of the lack of composing text. We will use the insertion marker position instead. - if (info.isInsertionMarkerClipped()) { + if ((info.getInsertionMarkerFlags() & + CursorAnchorInfoCompatWrapper.FLAG_HAS_INVISIBLE_REGION) != 0) { mUiOperator.hideUi(); return; } diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java index 8bff27574..fa4192790 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java @@ -31,6 +31,7 @@ import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.KeyboardId; +import com.android.inputmethod.keyboard.KeyboardTheme; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.utils.ResourceUtils; @@ -643,6 +644,9 @@ public class KeyboardBuilder<KP extends KeyboardParams> { final boolean keyboardLayoutSetElementMatched = matchTypedValue(caseAttr, R.styleable.Keyboard_Case_keyboardLayoutSetElement, id.mElementId, KeyboardId.elementIdToName(id.mElementId)); + final boolean keyboardThemeMacthed = matchTypedValue(caseAttr, + R.styleable.Keyboard_Case_keyboardTheme, mParams.mThemeId, + KeyboardTheme.getKeyboardThemeName(mParams.mThemeId)); final boolean modeMatched = matchTypedValue(caseAttr, R.styleable.Keyboard_Case_mode, id.mMode, KeyboardId.modeName(id.mMode)); final boolean navigateNextMatched = matchBoolean(caseAttr, @@ -671,19 +675,21 @@ public class KeyboardBuilder<KP extends KeyboardParams> { final boolean countryCodeMatched = matchString(caseAttr, R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry()); final boolean selected = keyboardLayoutSetMatched && keyboardLayoutSetElementMatched - && modeMatched && navigateNextMatched && navigatePreviousMatched - && passwordInputMatched && clobberSettingsKeyMatched && hasShortcutKeyMatched - && languageSwitchKeyEnabledMatched && isMultiLineMatched && imeActionMatched - && isIconDefinedMatched && localeCodeMatched && languageCodeMatched - && countryCodeMatched; + && keyboardThemeMacthed && modeMatched && navigateNextMatched + && navigatePreviousMatched && passwordInputMatched && clobberSettingsKeyMatched + && hasShortcutKeyMatched && languageSwitchKeyEnabledMatched + && isMultiLineMatched && imeActionMatched && isIconDefinedMatched + && localeCodeMatched && languageCodeMatched && countryCodeMatched; if (DEBUG) { - startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE, + startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE, textAttr(caseAttr.getString( R.styleable.Keyboard_Case_keyboardLayoutSet), "keyboardLayoutSet"), textAttr(caseAttr.getString( R.styleable.Keyboard_Case_keyboardLayoutSetElement), "keyboardLayoutSetElement"), + textAttr(caseAttr.getString( + R.styleable.Keyboard_Case_keyboardTheme), "keyboardTheme"), textAttr(caseAttr.getString(R.styleable.Keyboard_Case_mode), "mode"), textAttr(caseAttr.getString(R.styleable.Keyboard_Case_imeAction), "imeAction"), diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index f1c7f4340..6b6384c48 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -922,13 +922,13 @@ public final class RichInputConnection { * prevents the application from fulfilling the request. (TODO: Improve the API when it turns * out that we actually need more detailed error codes) */ - public boolean requestUpdateCursorAnchorInfo(final boolean enableMonitor, + public boolean requestCursorUpdates(final boolean enableMonitor, final boolean requestImmediateCallback) { mIC = mParent.getCurrentInputConnection(); final boolean scheduled; if (null != mIC) { - scheduled = InputConnectionCompatUtils.requestUpdateCursorAnchorInfo(mIC, - enableMonitor, requestImmediateCallback); + scheduled = InputConnectionCompatUtils.requestCursorUpdates(mIC, enableMonitor, + requestImmediateCallback); } else { scheduled = false; } diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 4b5edb076..233a22512 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -167,7 +167,7 @@ public final class InputLogic { if (ProductionFlags.ENABLE_CURSOR_ANCHOR_INFO_CALLBACK) { // AcceptTypedWord feature relies on CursorAnchorInfo. if (settingsValues.mShouldShowUiToAcceptTypedWord) { - mConnection.requestUpdateCursorAnchorInfo(true /* enableMonitor */, + mConnection.requestCursorUpdates(true /* enableMonitor */, true /* requestImmediateCallback */); } } |