diff options
Diffstat (limited to 'java')
54 files changed, 196 insertions, 104 deletions
diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png Binary files differindex 0c4820b34..01fc8ca78 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png Binary files differindex 5a20da1db..af4017e2c 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png Binary files differindex 4ec703d6c..4c35aca95 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png Binary files differindex 93322d2e2..174f3452c 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png Binary files differindex 5a9c722ce..1fcbd9a88 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png Binary files differindex 99b6cb170..072753f37 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png b/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png Binary files differindex 7dc59bf82..1ad746053 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png diff --git a/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png Binary files differindex c150341e3..ccd59d5fa 100644 --- a/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png +++ b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png Binary files differindex 53fe9c97d..4e337fa08 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png Binary files differindex 649ef9773..fe18497d8 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png Binary files differindex 93f7d87c2..00aab3d5a 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png Binary files differindex 8560b3ba7..ac0bfd3c1 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png Binary files differindex 778abaf24..ea2f35789 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png Binary files differindex 2a23945e5..6195ac0d4 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png b/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png Binary files differindex 6af2d8d0c..50cd06ae3 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png Binary files differindex fdaf69966..7ce52f0f5 100644 --- a/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png +++ b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png diff --git a/java/res/layout/input_gingerbread.xml b/java/res/layout/input_gingerbread.xml index 8f59cae21..73cf0a3fa 100644 --- a/java/res/layout/input_gingerbread.xml +++ b/java/res/layout/input_gingerbread.xml @@ -25,6 +25,7 @@ android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="wrap_content" + android:paddingBottom="@dimen/keyboard_bottom_padding" android:background="@drawable/keyboard_dark_background" android:textStyle="bold" diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml index 1396bff9b..043f4b363 100644 --- a/java/res/values-land/dimens.xml +++ b/java/res/values-land/dimens.xml @@ -19,13 +19,17 @@ --> <resources> - <dimen name="key_height">47dip</dimen> + <!-- key_height + key_bottom_gap = popup_key_height --> + <dimen name="key_height">0.250in</dimen> + <dimen name="key_bottom_gap">0.020in</dimen> + <dimen name="popup_key_height">0.270in</dimen> + <dimen name="keyboard_bottom_padding">0.0in</dimen> <dimen name="candidate_strip_height">38dip</dimen> <dimen name="candidate_strip_fading_edge_length">63dip</dimen> <dimen name="spacebar_vertical_correction">2dip</dimen> <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. --> - <!-- key_height x 1.7 --> - <dimen name="mini_keyboard_slide_allowance">79.9dip</dimen> - <!-- -key_height x 1.0 --> - <dimen name="mini_keyboard_vertical_correction">-47dip</dimen> + <!-- popup_key_height x 1.7 --> + <dimen name="mini_keyboard_slide_allowance">0.459in</dimen> + <!-- popup_key_height x 1.0 --> + <dimen name="mini_keyboard_vertical_correction">-0.270in</dimen> </resources> diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 1378be72c..c00c56a89 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -19,7 +19,11 @@ --> <resources> - <dimen name="key_height">54dip</dimen> + <!-- key_height + key_bottom_gap = popup_key_height --> + <dimen name="key_height">0.290in</dimen> + <dimen name="key_bottom_gap">0.035in</dimen> + <dimen name="popup_key_height">0.325in</dimen> + <dimen name="keyboard_bottom_padding">0.06in</dimen> <dimen name="bubble_pointer_offset">22dip</dimen> <dimen name="candidate_strip_height">42dip</dimen> <dimen name="candidate_strip_fading_edge_length">63dip</dimen> @@ -27,18 +31,20 @@ <!-- If the screen height in landscape is larger than the below value, then the keyboard will not go into extract (fullscreen) mode. --> <dimen name="max_height_for_fullscreen">2.5in</dimen> - <dimen name="key_text_size">22sp</dimen> - <dimen name="key_label_text_size">14sp</dimen> - <dimen name="key_preview_offset">0dip</dimen> - <dimen name="key_preview_height">80dip</dimen> + <dimen name="key_text_size">0.13in</dimen> + <dimen name="key_label_text_size">0.083in</dimen> + <dimen name="key_preview_text_size_large">0.236in</dimen> + <dimen name="key_preview_offset">0.000in</dimen> + <!-- key_height x 1.6 --> + <dimen name="key_preview_height">0.464in</dimen> <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. --> - <!-- key_height x 1.7 --> - <dimen name="mini_keyboard_slide_allowance">91.8dip</dimen> - <!-- -key_height x 1.0 --> - <dimen name="mini_keyboard_vertical_correction">-54dip</dimen> + <!-- popup_key_height x 1.7 --> + <dimen name="mini_keyboard_slide_allowance">0.553in</dimen> + <!-- popup_key_height x 1.0 --> + <dimen name="mini_keyboard_vertical_correction">-0.325in</dimen> <dimen name="key_hysteresis_distance">0.05in</dimen> <!-- We use "inch", not "dip" because this value tries dealing with physical distance related to user's finger. --> - <dimen name="keyboard_vertical_correction">-0.06in</dimen> + <dimen name="keyboard_vertical_correction">-0.05in</dimen> <dimen name="candidate_min_touchable_width">0.3in</dimen> </resources> diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml index 084795463..6e2e69208 100644 --- a/java/res/xml-da/kbd_qwerty.xml +++ b/java/res/xml-da/kbd_qwerty.xml @@ -28,10 +28,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="9.09%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="q" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-da/kbd_qwerty_black.xml b/java/res/xml-da/kbd_qwerty_black.xml index 9a64e869d..36656ed24 100644 --- a/java/res/xml-da/kbd_qwerty_black.xml +++ b/java/res/xml-da/kbd_qwerty_black.xml @@ -28,10 +28,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="9.09%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="q" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-de/kbd_qwerty.xml b/java/res/xml-de/kbd_qwerty.xml index b60c50dd6..e74f137e5 100644 --- a/java/res/xml-de/kbd_qwerty.xml +++ b/java/res/xml-de/kbd_qwerty.xml @@ -22,10 +22,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="q" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-de/kbd_qwerty_black.xml b/java/res/xml-de/kbd_qwerty_black.xml index 5cca5a622..2c0d6d59d 100644 --- a/java/res/xml-de/kbd_qwerty_black.xml +++ b/java/res/xml-de/kbd_qwerty_black.xml @@ -22,10 +22,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="q" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-fr/kbd_qwerty.xml b/java/res/xml-fr/kbd_qwerty.xml index ab78b37bb..bded3e3b3 100644 --- a/java/res/xml-fr/kbd_qwerty.xml +++ b/java/res/xml-fr/kbd_qwerty.xml @@ -22,10 +22,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="a" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-fr/kbd_qwerty_black.xml b/java/res/xml-fr/kbd_qwerty_black.xml index 97b55dccd..679d940f8 100644 --- a/java/res/xml-fr/kbd_qwerty_black.xml +++ b/java/res/xml-fr/kbd_qwerty_black.xml @@ -22,10 +22,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="a" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-iw/kbd_qwerty.xml b/java/res/xml-iw/kbd_qwerty.xml index a48c849d0..0ad2ca3c3 100644 --- a/java/res/xml-iw/kbd_qwerty.xml +++ b/java/res/xml-iw/kbd_qwerty.xml @@ -22,10 +22,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="ק" android:horizontalGap="5%p" diff --git a/java/res/xml-iw/kbd_qwerty_black.xml b/java/res/xml-iw/kbd_qwerty_black.xml index a72b036f4..10ca0fc12 100644 --- a/java/res/xml-iw/kbd_qwerty_black.xml +++ b/java/res/xml-iw/kbd_qwerty_black.xml @@ -22,10 +22,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="ק" android:horizontalGap="5%p" diff --git a/java/res/xml-nb/kbd_qwerty.xml b/java/res/xml-nb/kbd_qwerty.xml index 7e1610684..8377bbf3f 100644 --- a/java/res/xml-nb/kbd_qwerty.xml +++ b/java/res/xml-nb/kbd_qwerty.xml @@ -28,10 +28,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="9.09%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="q" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-nb/kbd_qwerty_black.xml b/java/res/xml-nb/kbd_qwerty_black.xml index f6a034ee9..ab1498488 100644 --- a/java/res/xml-nb/kbd_qwerty_black.xml +++ b/java/res/xml-nb/kbd_qwerty_black.xml @@ -28,10 +28,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="9.09%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="q" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-ru/kbd_qwerty.xml b/java/res/xml-ru/kbd_qwerty.xml index 9f16b9b7d..d40ccef10 100644 --- a/java/res/xml-ru/kbd_qwerty.xml +++ b/java/res/xml-ru/kbd_qwerty.xml @@ -22,10 +22,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="9.09%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="й" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-ru/kbd_qwerty_black.xml b/java/res/xml-ru/kbd_qwerty_black.xml index 73008befd..cc71b0812 100644 --- a/java/res/xml-ru/kbd_qwerty_black.xml +++ b/java/res/xml-ru/kbd_qwerty_black.xml @@ -22,10 +22,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="9.09%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="й" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-sr/kbd_qwerty.xml b/java/res/xml-sr/kbd_qwerty.xml index c671166d1..835f8c166 100644 --- a/java/res/xml-sr/kbd_qwerty.xml +++ b/java/res/xml-sr/kbd_qwerty.xml @@ -23,10 +23,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="9.09%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="љ" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-sr/kbd_qwerty_black.xml b/java/res/xml-sr/kbd_qwerty_black.xml index 5e5bceec0..76a9e55c1 100644 --- a/java/res/xml-sr/kbd_qwerty_black.xml +++ b/java/res/xml-sr/kbd_qwerty_black.xml @@ -23,10 +23,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="9.09%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="љ" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-sv/kbd_qwerty.xml b/java/res/xml-sv/kbd_qwerty.xml index 44117fc1f..f88bd3c39 100644 --- a/java/res/xml-sv/kbd_qwerty.xml +++ b/java/res/xml-sv/kbd_qwerty.xml @@ -30,10 +30,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="9.09%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="q" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml-sv/kbd_qwerty_black.xml b/java/res/xml-sv/kbd_qwerty_black.xml index 13ed3d1bf..8493237b2 100644 --- a/java/res/xml-sv/kbd_qwerty_black.xml +++ b/java/res/xml-sv/kbd_qwerty_black.xml @@ -30,10 +30,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="9.09%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="q" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml/kbd_phone.xml b/java/res/xml/kbd_phone.xml index 0a01fa00e..10774c666 100644 --- a/java/res/xml/kbd_phone.xml +++ b/java/res/xml/kbd_phone.xml @@ -22,7 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="26.67%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > <Row diff --git a/java/res/xml/kbd_phone_black.xml b/java/res/xml/kbd_phone_black.xml index 7a956b796..5afa9a194 100644 --- a/java/res/xml/kbd_phone_black.xml +++ b/java/res/xml/kbd_phone_black.xml @@ -22,7 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="26.67%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > <Row diff --git a/java/res/xml/kbd_phone_symbols.xml b/java/res/xml/kbd_phone_symbols.xml index 2dc93c15f..4c928a8d8 100644 --- a/java/res/xml/kbd_phone_symbols.xml +++ b/java/res/xml/kbd_phone_symbols.xml @@ -22,7 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="26.67%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > <Row diff --git a/java/res/xml/kbd_phone_symbols_black.xml b/java/res/xml/kbd_phone_symbols_black.xml index 5bc628965..4d686e145 100644 --- a/java/res/xml/kbd_phone_symbols_black.xml +++ b/java/res/xml/kbd_phone_symbols_black.xml @@ -22,7 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="26.67%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > <Row diff --git a/java/res/xml/kbd_popup_narrow_template.xml b/java/res/xml/kbd_popup_narrow_template.xml index ed3b13003..23c686e8b 100644 --- a/java/res/xml/kbd_popup_narrow_template.xml +++ b/java/res/xml/kbd_popup_narrow_template.xml @@ -22,6 +22,6 @@ android:keyWidth="9.45%p" android:horizontalGap="0px" android:verticalGap="0px" - android:keyHeight="@dimen/key_height" + android:keyHeight="@dimen/popup_key_height" > </Keyboard> diff --git a/java/res/xml/kbd_popup_template.xml b/java/res/xml/kbd_popup_template.xml index aca46930f..a287be1fd 100644 --- a/java/res/xml/kbd_popup_template.xml +++ b/java/res/xml/kbd_popup_template.xml @@ -22,6 +22,6 @@ android:keyWidth="10%p" android:horizontalGap="0px" android:verticalGap="0px" - android:keyHeight="@dimen/key_height" + android:keyHeight="@dimen/popup_key_height" > </Keyboard> diff --git a/java/res/xml/kbd_qwerty.xml b/java/res/xml/kbd_qwerty.xml index c6113abf7..a2c9b2b8e 100644 --- a/java/res/xml/kbd_qwerty.xml +++ b/java/res/xml/kbd_qwerty.xml @@ -22,10 +22,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="q" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml/kbd_qwerty_black.xml b/java/res/xml/kbd_qwerty_black.xml index 33cec9474..d9943a93f 100644 --- a/java/res/xml/kbd_qwerty_black.xml +++ b/java/res/xml/kbd_qwerty_black.xml @@ -22,10 +22,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - <Row> + <Row + android:rowEdgeFlags="top" + > <Key android:keyLabel="q" android:popupKeyboard="@xml/kbd_popup_template" diff --git a/java/res/xml/kbd_symbols.xml b/java/res/xml/kbd_symbols.xml index cb8b3b38f..dfc5bd0ec 100644 --- a/java/res/xml/kbd_symbols.xml +++ b/java/res/xml/kbd_symbols.xml @@ -22,7 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > <Row diff --git a/java/res/xml/kbd_symbols_black.xml b/java/res/xml/kbd_symbols_black.xml index bfb1646f4..add7f9fb2 100644 --- a/java/res/xml/kbd_symbols_black.xml +++ b/java/res/xml/kbd_symbols_black.xml @@ -22,7 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > <Row diff --git a/java/res/xml/kbd_symbols_shift.xml b/java/res/xml/kbd_symbols_shift.xml index 21cbb7132..9bee22069 100644 --- a/java/res/xml/kbd_symbols_shift.xml +++ b/java/res/xml/kbd_symbols_shift.xml @@ -22,7 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > <Row diff --git a/java/res/xml/kbd_symbols_shift_black.xml b/java/res/xml/kbd_symbols_shift_black.xml index d5d49ce0d..52b67c3de 100644 --- a/java/res/xml/kbd_symbols_shift_black.xml +++ b/java/res/xml/kbd_symbols_shift_black.xml @@ -22,7 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > <Row diff --git a/java/res/xml/popup_comma.xml b/java/res/xml/popup_comma.xml index 540dc9615..7666f4b62 100644 --- a/java/res/xml/popup_comma.xml +++ b/java/res/xml/popup_comma.xml @@ -23,7 +23,7 @@ android:keyWidth="10%p" android:horizontalGap="0px" android:verticalGap="0px" - android:keyHeight="@dimen/key_height" + android:keyHeight="@dimen/popup_key_height" > <Row android:rowEdgeFlags="top|bottom" diff --git a/java/res/xml/popup_domains.xml b/java/res/xml/popup_domains.xml index 0f7d97691..4e9789ff7 100644 --- a/java/res/xml/popup_domains.xml +++ b/java/res/xml/popup_domains.xml @@ -23,7 +23,7 @@ android:keyWidth="15%p" android:horizontalGap="0px" android:verticalGap="0px" - android:keyHeight="@dimen/key_height" + android:keyHeight="@dimen/popup_key_height" > <Row android:rowEdgeFlags="top|bottom" diff --git a/java/res/xml/popup_mic.xml b/java/res/xml/popup_mic.xml index f3cc63817..5bbd7dfa5 100644 --- a/java/res/xml/popup_mic.xml +++ b/java/res/xml/popup_mic.xml @@ -23,7 +23,7 @@ android:keyWidth="10%p" android:horizontalGap="0px" android:verticalGap="0px" - android:keyHeight="@dimen/key_height" + android:keyHeight="@dimen/popup_key_height" > <Row android:rowEdgeFlags="top|bottom" diff --git a/java/res/xml/popup_punctuation.xml b/java/res/xml/popup_punctuation.xml index ee1feabec..c429e38bc 100644 --- a/java/res/xml/popup_punctuation.xml +++ b/java/res/xml/popup_punctuation.xml @@ -23,7 +23,7 @@ android:keyWidth="10%p" android:horizontalGap="0px" android:verticalGap="0px" - android:keyHeight="@dimen/key_height" + android:keyHeight="@dimen/popup_key_height" > <Row android:rowEdgeFlags="top" diff --git a/java/res/xml/popup_smileys.xml b/java/res/xml/popup_smileys.xml index 3b556da77..1a14e1df1 100644 --- a/java/res/xml/popup_smileys.xml +++ b/java/res/xml/popup_smileys.xml @@ -23,7 +23,7 @@ android:keyWidth="15%p" android:horizontalGap="0px" android:verticalGap="0px" - android:keyHeight="@dimen/key_height" + android:keyHeight="@dimen/popup_key_height" > <Row android:rowEdgeFlags="top" diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 43d0a7beb..f0d5ef60a 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -90,6 +90,10 @@ public class LatinKeyboard extends Keyboard { // TODO: generalize for any keyboardId private boolean mIsBlackSym; + // TODO: remove this attribute when either Keyboard.mDefaultVerticalGap or Key.parent becomes + // non-private. + private final int mVerticalGap; + private static final int SHIFT_OFF = 0; private static final int SHIFT_ON = 1; private static final int SHIFT_LOCKED = 2; @@ -120,9 +124,7 @@ public class LatinKeyboard extends Keyboard { mRes = res; mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked); mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked); - mShiftLockPreviewIcon.setBounds(0, 0, - mShiftLockPreviewIcon.getIntrinsicWidth(), - mShiftLockPreviewIcon.getIntrinsicHeight()); + setDefaultBounds(mShiftLockPreviewIcon); mSpaceIcon = res.getDrawable(R.drawable.sym_keyboard_space); mSpaceAutoCompletionIndicator = res.getDrawable(R.drawable.sym_keyboard_space_led); mSpacePreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_space); @@ -140,6 +142,8 @@ public class LatinKeyboard extends Keyboard { || xmlLayoutResId == R.xml.kbd_qwerty_black; mSpaceKeyIndex = indexOf(LatinIME.KEYCODE_SPACE); initializeNumberHintResources(context); + // TODO remove this initialization after cleanup + mVerticalGap = super.getVerticalGap(); } private void initializeNumberHintResources(Context context) { @@ -196,6 +200,7 @@ public class LatinKeyboard extends Keyboard { } void setImeOptions(Resources res, int mode, int options) { + // TODO should clean up this method if (mEnterKey != null) { // Reset some of the rarely used attributes. mEnterKey.popupCharacters = null; @@ -247,9 +252,7 @@ public class LatinKeyboard extends Keyboard { } // Set the initial size of the preview icon if (mEnterKey.iconPreview != null) { - mEnterKey.iconPreview.setBounds(0, 0, - mEnterKey.iconPreview.getIntrinsicWidth(), - mEnterKey.iconPreview.getIntrinsicHeight()); + setDefaultBounds(mEnterKey.iconPreview); } } } @@ -736,6 +739,7 @@ public class LatinKeyboard extends Keyboard { return textSize; } + // TODO LatinKey could be static class class LatinKey extends Keyboard.Key { // functional normal state (with properties) @@ -784,6 +788,8 @@ public class LatinKeyboard extends Keyboard { */ @Override public boolean isInside(int x, int y) { + // TODO This should be done by parent.isInside(this, x, y) + // if Key.parent were protected. boolean result = LatinKeyboard.this.isInside(this, x, y); return result; } @@ -803,6 +809,15 @@ public class LatinKeyboard extends Keyboard { } return super.getCurrentDrawableState(); } + + @Override + public int squaredDistanceFrom(int x, int y) { + // We should count vertical gap between rows to calculate the center of this Key. + final int verticalGap = LatinKeyboard.this.mVerticalGap; + final int xDist = this.x + width / 2 - x; + final int yDist = this.y + (height + verticalGap) / 2 - y; + return xDist * xDist + yDist * yDist; + } } /** @@ -828,8 +843,7 @@ public class LatinKeyboard extends Keyboard { public SlidingLocaleDrawable(Drawable background, int width, int height) { mBackground = background; - mBackground.setBounds(0, 0, - mBackground.getIntrinsicWidth(), mBackground.getIntrinsicHeight()); + setDefaultBounds(mBackground); mWidth = width; mHeight = height; mTextPaint = new TextPaint(); @@ -887,7 +901,7 @@ public class LatinKeyboard extends Keyboard { canvas.drawText(mNextLanguage, diff - width / 2, baseline, paint); canvas.drawText(mPrevLanguage, diff + width + width / 2, baseline, paint); - lArrow.setBounds(0, 0, lArrow.getIntrinsicWidth(), lArrow.getIntrinsicHeight()); + setDefaultBounds(lArrow); rArrow.setBounds(width - rArrow.getIntrinsicWidth(), 0, width, rArrow.getIntrinsicHeight()); lArrow.draw(canvas); diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 0989dbdd3..9ff7b9aef 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -47,6 +47,7 @@ import android.widget.PopupWindow; import android.widget.TextView; import java.util.ArrayList; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.WeakHashMap; @@ -158,6 +159,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // Miscellaneous constants /* package */ static final int NOT_A_KEY = -1; private static final int[] LONG_PRESSABLE_STATE_SET = { android.R.attr.state_long_pressable }; + private static final int NUMBER_HINT_VERTICAL_ADJUSTMENT_PIXEL = -1; // XML attribute private int mKeyTextSize; @@ -178,6 +180,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // Main keyboard private Keyboard mKeyboard; private Key[] mKeys; + // TODO this attribute should be gotten from Keyboard. + private int mKeyboardVerticalGap; // Key preview popup private TextView mPreviewText; @@ -237,6 +241,11 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx private final Paint mPaint; private final Rect mPadding; private final Rect mClipRegion = new Rect(0, 0, 0, 0); + // This map caches key label text height in pixel as value and key label text size as map key. + private final HashMap<Integer, Integer> mTextHeightCache = new HashMap<Integer, Integer>(); + // Distance from horizontal center of the key, proportional to key label text height. + private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR = 0.55f; + private final String KEY_LABEL_HEIGHT_REFERENCE_CHAR = "H"; private final UIHandler mHandler = new UIHandler(); @@ -465,7 +474,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mPreviewPopup = new PopupWindow(context); if (previewLayout != 0) { mPreviewText = (TextView) inflate.inflate(previewLayout, null); - mPreviewTextSizeLarge = (int) mPreviewText.getTextSize(); + mPreviewTextSizeLarge = (int) res.getDimension(R.dimen.key_preview_text_size_large); mPreviewPopup.setContentView(mPreviewText); mPreviewPopup.setBackgroundDrawable(null); } else { @@ -576,6 +585,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx LatinImeLogger.onSetKeyboard(keyboard); mKeys = mKeyDetector.setKeyboard(keyboard, -getPaddingLeft(), -getPaddingTop() + mVerticalCorrection); + mKeyboardVerticalGap = (int)getResources().getDimension(R.dimen.key_bottom_gap); for (PointerTracker tracker : mPointerTrackers) { tracker.setKeyboard(mKeys, mKeyHysteresisDistance); } @@ -720,7 +730,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx int dimensionSum = 0; for (int i = 0; i < length; i++) { Key key = keys[i]; - dimensionSum += Math.min(key.width, key.height) + key.gap; + dimensionSum += Math.min(key.width, key.height + mKeyboardVerticalGap) + key.gap; } if (dimensionSum < 0 || length == 0) return; mKeyDetector.setProximityThreshold((int) (dimensionSum * 1.4f / length)); @@ -772,13 +782,14 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx paint.setColor(mKeyTextColor); boolean drawSingleKey = false; if (invalidKey != null && canvas.getClipBounds(clipRegion)) { - // Is clipRegion completely contained within the invalidated key? - if (invalidKey.x + kbdPaddingLeft - 1 <= clipRegion.left && - invalidKey.y + kbdPaddingTop - 1 <= clipRegion.top && - invalidKey.x + invalidKey.width + kbdPaddingLeft + 1 >= clipRegion.right && - invalidKey.y + invalidKey.height + kbdPaddingTop + 1 >= clipRegion.bottom) { - drawSingleKey = true; - } + // TODO we should use Rect.inset and Rect.contains here. + // Is clipRegion completely contained within the invalidated key? + if (invalidKey.x + kbdPaddingLeft - 1 <= clipRegion.left && + invalidKey.y + kbdPaddingTop - 1 <= clipRegion.top && + invalidKey.x + invalidKey.width + kbdPaddingLeft + 1 >= clipRegion.right && + invalidKey.y + invalidKey.height + kbdPaddingTop + 1 >= clipRegion.bottom) { + drawSingleKey = true; + } } canvas.drawColor(0x00000000, PorterDuff.Mode.CLEAR); final int keyCount = keys.length; @@ -794,8 +805,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx String label = key.label == null? null : adjustCase(key.label).toString(); final Rect bounds = keyBackground.getBounds(); - if (key.width != bounds.right || - key.height != bounds.bottom) { + if (key.width != bounds.right || key.height != bounds.bottom) { keyBackground.setBounds(0, 0, key.width, key.height); } canvas.translate(key.x + kbdPaddingLeft, key.y + kbdPaddingTop); @@ -804,22 +814,34 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx boolean shouldDrawIcon = true; if (label != null) { // For characters, use large font. For labels like "Done", use small font. + final int labelSize; if (label.length() > 1 && key.codes.length < 2) { - paint.setTextSize(mLabelTextSize); + labelSize = mLabelTextSize; paint.setTypeface(Typeface.DEFAULT_BOLD); } else { - paint.setTextSize(mKeyTextSize); + labelSize = mKeyTextSize; paint.setTypeface(mKeyTextStyle); } + paint.setTextSize(labelSize); + + Integer labelHeightValue = mTextHeightCache.get(labelSize); + final int labelHeight; + if (labelHeightValue != null) { + labelHeight = labelHeightValue; + } else { + Rect textBounds = new Rect(); + paint.getTextBounds(KEY_LABEL_HEIGHT_REFERENCE_CHAR, 0, 1, textBounds); + labelHeight = textBounds.height(); + mTextHeightCache.put(labelSize, labelHeight); + } + // Draw a drop shadow for the text paint.setShadowLayer(mShadowRadius, 0, 0, mShadowColor); - // Draw the text - canvas.drawText(label, - (key.width - padding.left - padding.right) / 2 - + padding.left, - (key.height - padding.top - padding.bottom) / 2 - + (paint.getTextSize() - paint.descent()) / 2 + padding.top, - paint); + final int centerX = (key.width + padding.left - padding.right) / 2; + final int centerY = (key.height + padding.top - padding.bottom) / 2; + final float baseline = centerY + + labelHeight * KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR; + canvas.drawText(label, centerX, baseline, paint); // Turn off drop shadow paint.setShadowLayer(0, 0, 0, 0); @@ -829,15 +851,23 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx } if (key.icon != null && shouldDrawIcon) { // Special handing for the upper-right number hint icons - final int drawableWidth = isNumberAtEdgeOfPopupChars(key) ? - key.width : key.icon.getIntrinsicWidth(); - final int drawableHeight = isNumberAtEdgeOfPopupChars(key) ? - key.height : key.icon.getIntrinsicHeight(); - - final int drawableX = (key.width - padding.left - padding.right - - drawableWidth) / 2 + padding.left; - final int drawableY = (key.height - padding.top - padding.bottom - - drawableHeight) / 2 + padding.top; + final int drawableWidth; + final int drawableHeight; + final int drawableX; + final int drawableY; + if (isNumberAtEdgeOfPopupChars(key)) { + drawableWidth = key.width; + drawableHeight = key.height; + drawableX = 0; + drawableY = NUMBER_HINT_VERTICAL_ADJUSTMENT_PIXEL; + } else { + drawableWidth = key.icon.getIntrinsicWidth(); + drawableHeight = key.icon.getIntrinsicHeight(); + drawableX = (key.width - padding.left - padding.right - drawableWidth) + / 2 + padding.left; + drawableY = (key.height - padding.top - padding.bottom - drawableHeight) + / 2 + padding.top; + } canvas.translate(drawableX, drawableY); key.icon.setBounds(0, 0, drawableWidth, drawableHeight); key.icon.draw(canvas); @@ -1003,6 +1033,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx if (key == null) return; mInvalidatedKey = key; + // TODO we should clean up this and record key's region to use in onBufferDraw. mDirtyRect.union(key.x + getPaddingLeft(), key.y + getPaddingTop(), key.x + key.width + getPaddingLeft(), key.y + key.height + getPaddingTop()); onBufferDraw(); |