Update tablet keyboard layout to the latest design

This change introduces shiftedIcon attribute for Key which specifies
icon to draw the shift key while the key is in shifted state.

This change also intriduces new configurable dimension value
key_label_horizontal_alignment_padding which represents horizontal
padding for left or right alignment of key label.

Bug: 3216592
Bug: 3201839
Change-Id: I3aa7392227ce573c404517678e6340a8d1fcb328
main
Tadashi G. Takaoka 2010-11-23 23:59:56 -08:00
parent 79efbed76f
commit 7f0befe1f0
96 changed files with 870 additions and 433 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/btn_keyboard_key_popup_selected_holo" />
<item android:drawable="@drawable/btn_keyboard_key_light_popup_normal" />
</selector>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_long_pressable="true"
android:drawable="@drawable/keyboard_key_feedback_more_background" />
<item android:drawable="@drawable/keyboard_key_feedback_background_holo" />
</selector>

View File

@ -0,0 +1,41 @@
<?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.
*/
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/keyboard_popup_panel_background_holo"
android:paddingLeft="44dip"
android:paddingRight="32dip"
>
<com.android.inputmethod.latin.BaseKeyboardView
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
android:id="@+id/BaseKeyboardView"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/latinkeyboard_transparent"
latin:keyBackground="@drawable/btn_keyboard_key_honeycomb_popup"
latin:keyHysteresisDistance="0dip"
latin:verticalCorrection="@dimen/mini_keyboard_vertical_correction"
/>
</LinearLayout>

View File

@ -27,9 +27,11 @@
android:layout_height="wrap_content"
android:paddingTop="@dimen/keyboard_top_padding"
android:paddingBottom="@dimen/keyboard_bottom_padding"
android:background="@drawable/keyboard_dark_background"
android:background="@drawable/keyboard_background_holo"
android:textStyle="bold"
latin:keyBackground="@drawable/btn_keyboard_key_honeycomb"
latin:keyPreviewLayout="@layout/key_preview_honeycomb"
latin:popupLayout="@layout/keyboard_popup_honeycomb"
latin:keyTextStyle="bold"
/>

View File

@ -0,0 +1,29 @@
<?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.
*/
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="80sp"
android:textSize="40sp"
android:textColor="@color/latinkeyboard_key_color_white"
android:minWidth="24dip"
android:gravity="center"
android:background="@drawable/keyboard_key_feedback_honeycomb"
/>

View File

@ -0,0 +1,41 @@
<?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.
*/
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/keyboard_popup_panel_background_holo"
android:paddingLeft="24dip"
android:paddingRight="24dip"
>
<com.android.inputmethod.latin.BaseKeyboardView
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
android:id="@+id/BaseKeyboardView"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/latinkeyboard_transparent"
latin:keyBackground="@drawable/btn_keyboard_key_honeycomb_popup"
latin:keyHysteresisDistance="0dip"
latin:verticalCorrection="@dimen/mini_keyboard_vertical_correction"
/>
</LinearLayout>

View File

@ -21,22 +21,24 @@
<resources>
<!-- key_height + key_bottom_gap = popup_key_height -->
<dimen name="key_height">13.0mm</dimen>
<dimen name="key_bottom_gap">2.0mm</dimen>
<dimen name="key_bottom_gap">1.5mm</dimen>
<dimen name="key_horizontal_gap">2.0mm</dimen>
<dimen name="popup_key_height">15.0mm</dimen>
<dimen name="keyboard_top_padding">1.0mm</dimen>
<dimen name="keyboard_bottom_padding">1.0mm</dimen>
<!-- key_height x 1.6 -->
<dimen name="key_preview_height">20.8mm</dimen>
<!-- key_height x 1.0 -->
<dimen name="key_preview_height">13.0mm</dimen>
<!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
<!-- popup_key_height x 1.2 -->
<dimen name="mini_keyboard_slide_allowance">15.6mm</dimen>
<!-- popup_key_height x -1.0 -->
<dimen name="mini_keyboard_vertical_correction">-13.0mm</dimen>
<dimen name="key_text_size">0.175in</dimen>
<dimen name="key_label_text_size">0.110in</dimen>
<dimen name="key_preview_text_size_large">0.245in</dimen>
<dimen name="key_text_size">24dip</dimen>
<dimen name="key_label_text_size">18dip</dimen>
<dimen name="key_preview_text_size_large">24dip</dimen>
<!-- left or right padding for of label alignment -->
<dimen name="key_label_horizontal_alignment_padding">18dip</dimen>
<dimen name="candidate_strip_height">46dip</dimen>
</resources>

View File

@ -126,6 +126,8 @@
<attr name="manualTemporaryUpperCaseHintIcon" format="reference" />
<!-- The key style to specify a set of key attributes defined by <key_style/> -->
<attr name="keyStyle" format="string" />
<!-- Shift key icon for shifted state -->
<attr name="shiftedIcon" format="reference" />
</declare-styleable>
<declare-styleable name="BaseKeyboard_Row">

View File

@ -37,6 +37,8 @@
<dimen name="key_text_size">0.13in</dimen>
<dimen name="key_label_text_size">0.083in</dimen>
<dimen name="key_preview_text_size_large">40sp</dimen>
<!-- left or right padding for of label alignment -->
<dimen name="key_label_horizontal_alignment_padding">0.13in</dimen>
<dimen name="key_preview_offset">0.000in</dimen>
<!-- We use "inch", not "dip" because this value tries dealing with physical distance related
to user's finger. -->

View File

@ -0,0 +1,149 @@
<?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.
*/
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
>
<!-- Functional key styles -->
<switch>
<case
latin:colorScheme="white"
>
<key-style
latin:styleName="functionalKeyStyle"
latin:isModifier="true" />
<key-style
latin:styleName="shiftKeyStyle"
latin:codes="@integer/key_shift"
latin:keyIcon="@drawable/sym_keyboard_shift_holo"
latin:shiftedIcon="@drawable/sym_keyboard_shift_locked_holo"
latin:iconPreview="@drawable/sym_keyboard_feedback_shift"
latin:parentStyle="functionalKeyStyle"
latin:isSticky="true" />
<key-style
latin:styleName="deleteKeyStyle"
latin:codes="@integer/key_delete"
latin:keyIcon="@drawable/sym_keyboard_delete_holo"
latin:iconPreview="@drawable/sym_keyboard_feedback_delete"
latin:parentStyle="functionalKeyStyle"
latin:isRepeatable="true" />
<key-style
latin:styleName="returnKeyStyle"
latin:codes="@integer/key_return"
latin:keyIcon="@drawable/sym_keyboard_return_holo"
latin:iconPreview="@drawable/sym_keyboard_feedback_return"
latin:parentStyle="functionalKeyStyle" />
1
<key-style
latin:styleName="spaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space_holo"
latin:iconPreview="@drawable/sym_keyboard_feedback_space"
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="nonSpecialBackgroundSpaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space_holo"
latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
<key-style
latin:styleName="smileyKeyStyle"
latin:codes="0"
latin:keyIcon="@drawable/sym_keyboard_smiley_holo"
latin:keyOutputText=";-) "
latin:keyHintIcon="@drawable/hint_popup_holo"
latin:popupKeyboard="@xml/popup_smileys" />
</case>
<case
latin:colorScheme="black"
>
<key-style
latin:styleName="functionalKeyStyle" />
<key-style
latin:styleName="shiftKeyStyle"
latin:codes="@integer/key_shift"
latin:keyIcon="@drawable/sym_bkeyboard_shift"
latin:shiftedIcon="@drawable/sym_bkeyboard_shift_locked"
latin:iconPreview="@drawable/sym_keyboard_feedback_shift"
latin:parentStyle="functionalKeyStyle"
latin:isSticky="true" />
<key-style
latin:styleName="deleteKeyStyle"
latin:codes="@integer/key_delete"
latin:keyIcon="@drawable/sym_bkeyboard_delete"
latin:iconPreview="@drawable/sym_keyboard_feedback_delete"
latin:parentStyle="functionalKeyStyle"
latin:isRepeatable="true" />
<key-style
latin:styleName="returnKeyStyle"
latin:codes="@integer/key_return"
latin:keyIcon="@drawable/sym_bkeyboard_return"
latin:iconPreview="@drawable/sym_keyboard_feedback_return"
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="spaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_bkeyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space"
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="nonSpecialBackgroundSpaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_bkeyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
<key-style
latin:styleName="smileyKeyStyle"
latin:keyLabel=";-)"
latin:keyOutputText=";-) "
latin:keyHintIcon="@drawable/hint_popup_holo"
latin:popupKeyboard="@xml/popup_smileys" />
</case>
</switch>
<key-style
latin:styleName="tabKeyStyle"
latin:codes="@integer/key_tab"
latin:keyLabel="@string/label_tab_key"
latin:keyLabelOption="fontNormal"
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="toSymbolKeyStyle"
latin:codes="@integer/key_switch_alpha_symbol"
latin:keyLabel="@string/label_to_symbol_key"
latin:keyLabelOption="fontNormal"
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="toAlphaKeyStyle"
latin:codes="@integer/key_switch_alpha_symbol"
latin:keyLabel="@string/label_to_alpha_key"
latin:keyLabelOption="fontNormal"
latin:parentStyle="functionalKeyStyle" />
<key-style
latin:styleName="moreKeyStyle"
latin:codes="@integer/key_shift"
latin:keyLabel="@string/label_more_key"
latin:keyLabelOption="fontNormal"
latin:parentStyle="functionalKeyStyle"
latin:isSticky="true" />
<key-style
latin:styleName="comKeyStyle"
latin:keyLabel=".com"
latin:keyLabelOption="fontNormal"
latin:keyHintIcon="@drawable/hint_popup_holo"
latin:popupKeyboard="@xml/popup_domains" />
</merge>

View File

@ -25,13 +25,13 @@
latin:verticalGap="@dimen/key_bottom_gap"
latin:keyHeight="@dimen/key_height"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
<!-- This row is intentionally not marked as a top row -->
<Row>
<Key
latin:codes="@integer/key_tab"
latin:keyLabel="@string/label_tab_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:isModifier="true"
latin:keyStyle="tabKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyEdgeFlags="left" />
<Spacer
latin:horizontalGap="4.458%p" />
@ -55,12 +55,8 @@
<Spacer
latin:horizontalGap="9.360%p" />
<Key
latin:codes="@integer/key_delete"
latin:keyLabel="@string/label_backspace_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="9.804%p"
latin:isModifier="true"
latin:isRepeatable="true"
latin:keyEdgeFlags="right" />
</Row>
<Row>
@ -86,11 +82,8 @@
<Spacer
latin:horizontalGap="4.458%p" />
<Key
latin:codes="@integer/key_return"
latin:keyLabel="@string/label_return_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:keyStyle="returnKeyStyle"
latin:keyWidth="14.706%p"
latin:isModifier="true"
latin:keyEdgeFlags="right" />
</Row>
<Row>
@ -125,9 +118,7 @@
<Spacer
latin:horizontalGap="16.406%p" />
<Key
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space"
latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle"
latin:keyWidth="24.127%p" />
<Spacer
latin:horizontalGap="4.458%p" />

View File

@ -0,0 +1,150 @@
<?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.
*/
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
>
<switch>
<case
latin:colorScheme="white"
>
<key-style
latin:styleName="num0KeyStyle"
latin:codes="48"
latin:keyIcon="@drawable/sym_keyboard_num0_holo" />
<key-style
latin:styleName="num1KeyStyle"
latin:codes="49"
latin:keyIcon="@drawable/sym_keyboard_num1_holo" />
<key-style
latin:styleName="num2KeyStyle"
latin:codes="50"
latin:keyIcon="@drawable/sym_keyboard_num2_holo" />
<key-style
latin:styleName="num3KeyStyle"
latin:codes="51"
latin:keyIcon="@drawable/sym_keyboard_num3_holo" />
<key-style
latin:styleName="num4KeyStyle"
latin:codes="52"
latin:keyIcon="@drawable/sym_keyboard_num4_holo" />
<key-style
latin:styleName="num5KeyStyle"
latin:codes="53"
latin:keyIcon="@drawable/sym_keyboard_num5_holo" />
<key-style
latin:styleName="num6KeyStyle"
latin:codes="54"
latin:keyIcon="@drawable/sym_keyboard_num6_holo" />
<key-style
latin:styleName="num7KeyStyle"
latin:codes="55"
latin:keyIcon="@drawable/sym_keyboard_num7_holo" />
<key-style
latin:styleName="num8KeyStyle"
latin:codes="56"
latin:keyIcon="@drawable/sym_keyboard_num8_holo" />
<key-style
latin:styleName="num9KeyStyle"
latin:codes="57"
latin:keyIcon="@drawable/sym_keyboard_num9_holo" />
<key-style
latin:styleName="numStarKeyStyle"
latin:codes="42"
latin:keyIcon="@drawable/sym_keyboard_numbstar_holo" />
<key-style
latin:styleName="numPoundKeyStyle"
latin:codes="35"
latin:keyIcon="@drawable/sym_keyboard_numbpound_holo" />
<key-style
latin:styleName="numAltKeyStyle"
latin:codes="@integer/key_switch_alpha_symbol"
latin:keyIcon="@drawable/sym_keyboard_numalt"
latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
<key-style
latin:styleName="numSpaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space_holo"
latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
</case>
<case
latin:colorScheme="black"
>
<key-style
latin:styleName="num0KeyStyle"
latin:codes="48"
latin:keyIcon="@drawable/sym_bkeyboard_num0" />
<key-style
latin:styleName="num1KeyStyle"
latin:codes="49"
latin:keyIcon="@drawable/sym_bkeyboard_num1" />
<key-style
latin:styleName="num2KeyStyle"
latin:codes="50"
latin:keyIcon="@drawable/sym_bkeyboard_num2" />
<key-style
latin:styleName="num3KeyStyle"
latin:codes="51"
latin:keyIcon="@drawable/sym_bkeyboard_num3" />
<key-style
latin:styleName="num4KeyStyle"
latin:codes="52"
latin:keyIcon="@drawable/sym_bkeyboard_num4" />
<key-style
latin:styleName="num5KeyStyle"
latin:codes="53"
latin:keyIcon="@drawable/sym_bkeyboard_num5" />
<key-style
latin:styleName="num6KeyStyle"
latin:codes="54"
latin:keyIcon="@drawable/sym_bkeyboard_num6" />
<key-style
latin:styleName="num7KeyStyle"
latin:codes="55"
latin:keyIcon="@drawable/sym_bkeyboard_num7" />
<key-style
latin:styleName="num8KeyStyle"
latin:codes="56"
latin:keyIcon="@drawable/sym_bkeyboard_num8" />
<key-style
latin:styleName="num9KeyStyle"
latin:codes="57"
latin:keyIcon="@drawable/sym_bkeyboard_num9" />
<key-style
latin:styleName="numStarKeyStyle"
latin:codes="42"
latin:keyIcon="@drawable/sym_bkeyboard_numstar" />
<key-style
latin:styleName="numPoundKeyStyle"
latin:codes="35"
latin:keyIcon="@drawable/sym_bkeyboard_numpound" />
<key-style
latin:styleName="numAltKeyStyle"
latin:codes="@integer/key_switch_alpha_symbol"
latin:keyIcon="@drawable/sym_bkeyboard_numalt"
latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
<key-style
latin:styleName="numSpaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_bkeyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
</case>
</switch>
</merge>

View File

@ -25,13 +25,15 @@
latin:verticalGap="@dimen/key_bottom_gap"
latin:keyHeight="@dimen/key_height"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
<include
latin:keyboardLayout="@xml/kbd_numkey_styles" />
<!-- This row is intentionally not marked as a top row -->
<Row>
<Key
latin:codes="@integer/key_tab"
latin:keyLabel="@string/label_tab_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:isModifier="true"
latin:keyStyle="tabKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyEdgeFlags="left" />
<!-- To match one character label size with "Tab", I placed spaces around the char '-'
and '+'. -->
@ -48,32 +50,22 @@
<Spacer
latin:horizontalGap="8.479%p" />
<Key
latin:codes="49"
latin:keyIcon="@drawable/sym_keyboard_num1" />
latin:keyStyle="num1KeyStyle" />
<Key
latin:codes="50"
latin:keyIcon="@drawable/sym_keyboard_num2" />
latin:keyStyle="num2KeyStyle" />
<Key
latin:codes="51"
latin:keyIcon="@drawable/sym_keyboard_num3" />
latin:keyStyle="num3KeyStyle" />
<Spacer
latin:horizontalGap="4.458%p" />
latin:horizontalGap="9.360%p" />
<Key
latin:codes="@integer/key_delete"
latin:keyLabel="@string/label_backspace_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:keyWidth="14.706%p"
latin:isModifier="true"
latin:isRepeatable="true"
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="9.804%p"
latin:keyEdgeFlags="right" />
</Row>
<Row>
<Key
latin:codes="@integer/key_shift"
latin:keyLabel="@string/label_more_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:isModifier="true"
latin:isSticky="true"
latin:keyStyle="moreKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyEdgeFlags="left" />
<!-- To match one character label size with "More", I placed spaces around the char ','
and '.'. -->
@ -90,22 +82,16 @@
<Spacer
latin:horizontalGap="8.479%p" />
<Key
latin:codes="52"
latin:keyIcon="@drawable/sym_keyboard_num4" />
latin:keyStyle="num4KeyStyle" />
<Key
latin:codes="53"
latin:keyIcon="@drawable/sym_keyboard_num5" />
latin:keyStyle="num5KeyStyle" />
<Key
latin:codes="54"
latin:keyIcon="@drawable/sym_keyboard_num6" />
latin:keyStyle="num6KeyStyle" />
<Spacer
latin:horizontalGap="4.458%p" />
<Key
latin:codes="@integer/key_return"
latin:keyLabel="@string/label_return_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:keyStyle="returnKeyStyle"
latin:keyWidth="14.706%p"
latin:isModifier="true"
latin:keyEdgeFlags="right" />
</Row>
<Row>
@ -126,14 +112,11 @@
<Spacer
latin:horizontalGap="8.479%p" />
<Key
latin:codes="55"
latin:keyIcon="@drawable/sym_keyboard_num7" />
latin:keyStyle="num7KeyStyle" />
<Key
latin:codes="56"
latin:keyIcon="@drawable/sym_keyboard_num8" />
latin:keyStyle="num8KeyStyle" />
<Key
latin:codes="57"
latin:keyIcon="@drawable/sym_keyboard_num9" />
latin:keyStyle="num9KeyStyle" />
<!-- There is an empty area bellow the "Enter" key and right of the "9" key. To ignore
the touch event on the area, "9" is intentionally not marked as a right edge key. -->
</Row>
@ -144,21 +127,16 @@
<Spacer
latin:horizontalGap="20.427%p" />
<Key
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space"
latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle"
latin:keyWidth="16.085%p" />
<Spacer
latin:horizontalGap="8.479%p" />
<Key
latin:codes="42"
latin:keyIcon="@drawable/sym_keyboard_numstar" />
latin:keyStyle="numStarKeyStyle" />
<Key
latin:codes="48"
latin:keyIcon="@drawable/sym_keyboard_num0" />
latin:keyStyle="num0KeyStyle" />
<Key
latin:codes="35"
latin:keyIcon="@drawable/sym_keyboard_numpound" />
latin:keyStyle="numPoundKeyStyle" />
<!-- There is an empty area bellow the "Enter" key and right of the "#" key. To ignore
the touch event on the area, "#" is intentionally not marked as a right edge key. -->
</Row>

View File

@ -25,13 +25,15 @@
latin:verticalGap="@dimen/key_bottom_gap"
latin:keyHeight="@dimen/key_height"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
<include
latin:keyboardLayout="@xml/kbd_numkey_styles" />
<!-- This row is intentionally not marked as a top row -->
<Row>
<Key
latin:codes="@integer/key_tab"
latin:keyLabel="@string/label_tab_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:isModifier="true"
latin:keyStyle="tabKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyEdgeFlags="left" />
<Spacer
latin:horizontalGap="4.458%p" />
@ -52,32 +54,22 @@
<Spacer
latin:horizontalGap="4.458%p" />
<Key
latin:codes="49"
latin:keyIcon="@drawable/sym_keyboard_num1" />
latin:keyStyle="num1KeyStyle" />
<Key
latin:codes="50"
latin:keyIcon="@drawable/sym_keyboard_num2" />
latin:keyStyle="num2KeyStyle" />
<Key
latin:codes="51"
latin:keyIcon="@drawable/sym_keyboard_num3" />
latin:keyStyle="num3KeyStyle" />
<Spacer
latin:horizontalGap="4.458%p" />
latin:horizontalGap="9.360%p" />
<Key
latin:codes="@integer/key_delete"
latin:keyLabel="@string/label_backspace_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:keyWidth="14.706%p"
latin:isModifier="true"
latin:isRepeatable="true"
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="9.804%p"
latin:keyEdgeFlags="right" />
</Row>
<Row>
<Key
latin:codes="@integer/key_shift"
latin:keyLabel="@string/label_more_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:isModifier="true"
latin:isSticky="true"
latin:keyStyle="moreKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyEdgeFlags="left" />
<Spacer
latin:horizontalGap="4.458%p" />
@ -98,22 +90,16 @@
<Spacer
latin:horizontalGap="4.458%p" />
<Key
latin:codes="52"
latin:keyIcon="@drawable/sym_keyboard_num4" />
latin:keyStyle="num4KeyStyle" />
<Key
latin:codes="53"
latin:keyIcon="@drawable/sym_keyboard_num5" />
latin:keyStyle="num5KeyStyle" />
<Key
latin:codes="54"
latin:keyIcon="@drawable/sym_keyboard_num6" />
latin:keyStyle="num6KeyStyle" />
<Spacer
latin:horizontalGap="4.458%p" />
<Key
latin:codes="@integer/key_return"
latin:keyLabel="@string/label_return_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:keyStyle="returnKeyStyle"
latin:keyWidth="14.706%p"
latin:isModifier="true"
latin:keyEdgeFlags="right" />
</Row>
<Row>
@ -138,14 +124,11 @@
<Spacer
latin:horizontalGap="4.458%p" />
<Key
latin:codes="55"
latin:keyIcon="@drawable/sym_keyboard_num7" />
latin:keyStyle="num7KeyStyle" />
<Key
latin:codes="56"
latin:keyIcon="@drawable/sym_keyboard_num8" />
latin:keyStyle="num8KeyStyle" />
<Key
latin:codes="57"
latin:keyIcon="@drawable/sym_keyboard_num9" />
latin:keyStyle="num9KeyStyle" />
<!-- There is an empty area bellow the "Enter" key and right of the "9" key. To ignore
the touch event on the area, "9" is intentionally not marked as a right edge key. -->
</Row>
@ -156,21 +139,16 @@
<Spacer
latin:horizontalGap="16.406%p" />
<Key
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space"
latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle"
latin:keyWidth="24.127%p" />
<Spacer
latin:horizontalGap="4.458%p" />
<Key
latin:codes="42"
latin:keyIcon="@drawable/sym_keyboard_numstar" />
latin:keyStyle="numStarKeyStyle" />
<Key
latin:codes="48"
latin:keyIcon="@drawable/sym_keyboard_num0" />
latin:keyStyle="num0KeyStyle" />
<Key
latin:codes="35"
latin:keyIcon="@drawable/sym_keyboard_numpound" />
latin:keyStyle="numPoundKeyStyle" />
<!-- There is an empty area bellow the "Enter" key and right of the "#" key. To ignore
the touch event on the area, "#" is intentionally not marked as a right edge key. -->
</Row>

View File

@ -24,8 +24,14 @@
latin:verticalGap="@dimen/key_bottom_gap"
latin:keyHeight="@dimen/key_height"
>
<include latin:keyboardLayout="@xml/kbd_qwerty_row1" />
<include latin:keyboardLayout="@xml/kbd_qwerty_row2" />
<include latin:keyboardLayout="@xml/kbd_qwerty_row3" />
<include latin:keyboardLayout="@xml/kbd_qwerty_row4" />
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
<include
latin:keyboardLayout="@xml/kbd_qwerty_row1" />
<include
latin:keyboardLayout="@xml/kbd_qwerty_row2" />
<include
latin:keyboardLayout="@xml/kbd_qwerty_row3" />
<include
latin:keyboardLayout="@xml/kbd_qwerty_row4" />
</Keyboard>

View File

@ -26,11 +26,9 @@
latin:keyWidth="8.272%p"
>
<Key
latin:codes="@integer/key_tab"
latin:keyLabel="@string/label_tab_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:keyStyle="tabKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyWidth="7.949%p"
latin:isModifier="true"
latin:keyEdgeFlags="left" />
<Key
latin:keyLabel="q"
@ -73,12 +71,8 @@
latin:popupKeyboard="@xml/kbd_popup_template"
latin:popupCharacters="@string/alternates_for_p" />
<Key
latin:codes="@integer/key_delete"
latin:keyIcon="@drawable/sym_keyboard_delete"
latin:iconPreview="@drawable/sym_keyboard_feedback_delete"
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="9.331%p"
latin:isModifier="true"
latin:isRepeatable="true"
latin:keyEdgeFlags="right" />
</Row>
</merge>

View File

@ -25,11 +25,9 @@
latin:keyWidth="8.157%p"
>
<Key
latin:codes="@integer/key_switch_alpha_symbol"
latin:keyLabel="@string/label_to_symbol_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:keyStyle="toSymbolKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyWidth="11.167%p"
latin:isModifier="true"
latin:keyEdgeFlags="left" />
<Key
latin:keyLabel="a"
@ -60,11 +58,8 @@
latin:popupKeyboard="@xml/kbd_popup_template"
latin:popupCharacters="@string/alternates_for_l" />
<Key
latin:codes="@integer/key_return"
latin:keyLabel="@string/label_return_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:keyStyle="returnKeyStyle"
latin:keyWidth="15.750%p"
latin:isModifier="true"
latin:keyEdgeFlags="right" />
</Row>
</merge>

View File

@ -25,12 +25,8 @@
latin:keyWidth="8.042%p"
>
<Key
latin:codes="@integer/key_shift"
latin:keyLabel="@string/label_shift_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="15.192%p"
latin:isModifier="true"
latin:isSticky="true"
latin:keyEdgeFlags="left" />
<Key
latin:keyLabel="z"
@ -81,12 +77,8 @@
</default>
</switch>
<Key
latin:codes="@integer/key_shift"
latin:keyLabel="@string/label_shift_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:keyWidth="12.430%p"
latin:isModifier="true"
latin:isSticky="true"
latin:keyStyle="shiftKeyStyle"
latin:keyWidth="12.530%p"
latin:keyEdgeFlags="right" />
</Row>
</merge>

View File

@ -32,10 +32,7 @@
latin:mode="email"
>
<Key
latin:keyLabel=".com"
latin:keyOutputText=".com"
latin:keyHintIcon="@drawable/hint_popup"
latin:popupKeyboard="@xml/popup_domains" />
latin:keyStyle="comKeyStyle" />
<Key
latin:keyLabel="\@" />
</case>
@ -44,18 +41,12 @@
latin:mode="url"
>
<Key
latin:keyLabel=".com"
latin:keyOutputText=".com"
latin:keyHintIcon="@drawable/hint_popup"
latin:popupKeyboard="@xml/popup_domains"
latin:keyStyle="comKeyStyle"
latin:keyWidth="16.084%p" />
</case>
<default>
<Key
latin:keyLabel=":-)"
latin:keyOutputText=":-)"
latin:keyHintIcon="@drawable/hint_popup"
latin:popupKeyboard="@xml/popup_smileys" />
latin:keyStyle="smileyKeyStyle" />
<Key
latin:keyLabel="/"
latin:manualTemporaryUpperCaseCode="64"
@ -66,11 +57,8 @@
</default>
</switch>
<Key
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space"
latin:keyWidth="37.454%p"
latin:isModifier="true" />
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="37.454%p" />
<switch>
<case
latin:mode="email"

View File

@ -24,16 +24,16 @@
latin:verticalGap="@dimen/key_bottom_gap"
latin:keyHeight="@dimen/key_height"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
<!-- This row is intentionally not marked as a top row -->
<Row
latin:keyWidth="8.272%p"
>
<Key
latin:codes="@integer/key_tab"
latin:keyLabel="@string/label_tab_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:keyStyle="tabKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyWidth="7.949%p"
latin:isModifier="true"
latin:keyEdgeFlags="left" />
<Key
latin:keyLabel="1"
@ -70,23 +70,17 @@
latin:popupKeyboard="@xml/kbd_popup_template"
latin:popupCharacters="ⁿ∅" />
<Key
latin:codes="@integer/key_delete"
latin:keyIcon="@drawable/sym_keyboard_delete"
latin:iconPreview="@drawable/sym_keyboard_feedback_delete"
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="9.331%p"
latin:isModifier="true"
latin:isRepeatable="true"
latin:keyEdgeFlags="right" />
</Row>
<Row
latin:keyWidth="8.157%p"
>
<Key
latin:codes="@integer/key_switch_alpha_symbol"
latin:keyLabel="@string/label_to_alpha_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:keyStyle="toAlphaKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyWidth="11.167%p"
latin:isModifier="true"
latin:keyEdgeFlags="left" />
<Key
latin:keyLabel="#" />
@ -121,23 +115,17 @@
latin:popupKeyboard="@xml/kbd_popup_template"
latin:popupCharacters="]}&gt;" />
<Key
latin:codes="@integer/key_return"
latin:keyLabel="@string/label_return_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:keyStyle="returnKeyStyle"
latin:keyWidth="15.750%p"
latin:isModifier="true"
latin:keyEdgeFlags="right" />
</Row>
<Row
latin:keyWidth="8.042%p"
>
<Key
latin:codes="@integer/key_shift"
latin:keyLabel="@string/label_more_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:keyStyle="moreKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyWidth="15.192%p"
latin:isModifier="true"
latin:isSticky="true"
latin:keyEdgeFlags="left" />
<Key
latin:keyLabel="&lt;"
@ -166,13 +154,9 @@
latin:popupKeyboard="@xml/kbd_popup_template"
latin:popupCharacters="¿" />
<Key
latin:codes="@integer/key_shift"
latin:keyLabel="@string/label_more_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:iconPreview="@drawable/sym_keyboard_feedback_shift"
latin:keyWidth="12.430%p"
latin:isModifier="true"
latin:isSticky="true"
latin:keyStyle="moreKeyStyle"
latin:keyLabelOption="alignRight"
latin:keyWidth="12.530%p"
latin:keyEdgeFlags="right" />
</Row>
<!-- This row is intentionally not marked as a bottom row -->
@ -186,11 +170,8 @@
<Key
latin:keyLabel="\@" />
<Key
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space"
latin:keyWidth="37.454%p"
latin:isModifier="true" />
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="37.454%p" />
<Key
latin:keyLabel="&quot;"
latin:popupKeyboard="@xml/kbd_popup_template"

View File

@ -24,16 +24,16 @@
latin:verticalGap="@dimen/key_bottom_gap"
latin:keyHeight="@dimen/key_height"
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
<!-- This row is intentionally not marked as a top row -->
<Row
latin:keyWidth="8.272%p"
>
<Key
latin:codes="@integer/key_tab"
latin:keyLabel="@string/label_tab_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:keyStyle="tabKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyWidth="7.949%p"
latin:isModifier="true"
latin:keyEdgeFlags="left" />
<Key
latin:keyLabel="~" />
@ -60,23 +60,17 @@
<Key
latin:keyLabel="}" />
<Key
latin:codes="@integer/key_delete"
latin:keyIcon="@drawable/sym_keyboard_delete"
latin:iconPreview="@drawable/sym_keyboard_feedback_delete"
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="9.331%p"
latin:isModifier="true"
latin:isRepeatable="true"
latin:keyEdgeFlags="right" />
</Row>
<Row
latin:keyWidth="8.157%p"
>
<Key
latin:codes="@integer/key_switch_alpha_symbol"
latin:keyLabel="@string/label_to_alpha_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:keyStyle="toAlphaKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyWidth="11.167%p"
latin:isModifier="true"
latin:keyEdgeFlags="left" />
<Key
latin:keyLabel="£" />
@ -101,23 +95,17 @@
<Key
latin:keyLabel="]" />
<Key
latin:codes="@integer/key_return"
latin:keyLabel="@string/label_return_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:keyStyle="returnKeyStyle"
latin:keyWidth="15.750%p"
latin:isModifier="true"
latin:keyEdgeFlags="right" />
</Row>
<Row
latin:keyWidth="8.042%p"
>
<Key
latin:codes="@integer/key_shift"
latin:keyLabel="@string/label_more_key"
latin:keyLabelOption="fontNormal|alignLeft|alignBottom"
latin:keyStyle="moreKeyStyle"
latin:keyLabelOption="alignLeft"
latin:keyWidth="15.192%p"
latin:isModifier="true"
latin:isSticky="true"
latin:keyEdgeFlags="left" />
<Key
latin:keyLabel="©" />
@ -142,12 +130,9 @@
<Key
latin:keyLabel="¿" />
<Key
latin:codes="@integer/key_shift"
latin:keyLabel="@string/label_more_key"
latin:keyLabelOption="fontNormal|alignRight|alignBottom"
latin:keyWidth="12.430%p"
latin:isModifier="true"
latin:isSticky="true"
latin:keyStyle="moreKeyStyle"
latin:keyLabelOption="alignRight"
latin:keyWidth="12.530%p"
latin:keyEdgeFlags="right" />
</Row>
<!-- This row is intentionally not marked as a bottom row -->
@ -157,10 +142,7 @@
<Spacer
latin:horizontalGap="32.488%p" />
<Key
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space"
latin:keyWidth="37.454%p"
latin:isModifier="true" />
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="37.454%p" />
</Row>
</Keyboard>

View File

@ -33,6 +33,7 @@
latin:styleName="shiftKeyStyle"
latin:codes="@integer/key_shift"
latin:keyIcon="@drawable/sym_keyboard_shift"
latin:shiftedIcon="@drawable/sym_keyboard_shift_locked"
latin:iconPreview="@drawable/sym_keyboard_feedback_shift"
latin:parentStyle="functionalKeyStyle"
latin:isSticky="true" />
@ -109,6 +110,7 @@
latin:styleName="shiftKeyStyle"
latin:codes="@integer/key_shift"
latin:keyIcon="@drawable/sym_bkeyboard_shift"
latin:shiftedIcon="@drawable/sym_bkeyboard_shift_locked"
latin:iconPreview="@drawable/sym_keyboard_feedback_shift"
latin:parentStyle="functionalKeyStyle"
latin:isSticky="true" />

View File

@ -0,0 +1,150 @@
<?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.
*/
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
>
<switch>
<case
latin:colorScheme="white"
>
<key-style
latin:styleName="num0KeyStyle"
latin:codes="48"
latin:keyIcon="@drawable/sym_keyboard_num0" />
<key-style
latin:styleName="num1KeyStyle"
latin:codes="49"
latin:keyIcon="@drawable/sym_keyboard_num1" />
<key-style
latin:styleName="num2KeyStyle"
latin:codes="50"
latin:keyIcon="@drawable/sym_keyboard_num2" />
<key-style
latin:styleName="num3KeyStyle"
latin:codes="51"
latin:keyIcon="@drawable/sym_keyboard_num3" />
<key-style
latin:styleName="num4KeyStyle"
latin:codes="52"
latin:keyIcon="@drawable/sym_keyboard_num4" />
<key-style
latin:styleName="num5KeyStyle"
latin:codes="53"
latin:keyIcon="@drawable/sym_keyboard_num5" />
<key-style
latin:styleName="num6KeyStyle"
latin:codes="54"
latin:keyIcon="@drawable/sym_keyboard_num6" />
<key-style
latin:styleName="num7KeyStyle"
latin:codes="55"
latin:keyIcon="@drawable/sym_keyboard_num7" />
<key-style
latin:styleName="num8KeyStyle"
latin:codes="56"
latin:keyIcon="@drawable/sym_keyboard_num8" />
<key-style
latin:styleName="num9KeyStyle"
latin:codes="57"
latin:keyIcon="@drawable/sym_keyboard_num9" />
<key-style
latin:styleName="numStarKeyStyle"
latin:codes="42"
latin:keyIcon="@drawable/sym_keyboard_numstar" />
<key-style
latin:styleName="numPoundKeyStyle"
latin:codes="35"
latin:keyIcon="@drawable/sym_keyboard_numpound" />
<key-style
latin:styleName="numAltKeyStyle"
latin:codes="@integer/key_switch_alpha_symbol"
latin:keyIcon="@drawable/sym_keyboard_numalt"
latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
<key-style
latin:styleName="numSpaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
</case>
<case
latin:colorScheme="black"
>
<key-style
latin:styleName="num0KeyStyle"
latin:codes="48"
latin:keyIcon="@drawable/sym_bkeyboard_num0" />
<key-style
latin:styleName="num1KeyStyle"
latin:codes="49"
latin:keyIcon="@drawable/sym_bkeyboard_num1" />
<key-style
latin:styleName="num2KeyStyle"
latin:codes="50"
latin:keyIcon="@drawable/sym_bkeyboard_num2" />
<key-style
latin:styleName="num3KeyStyle"
latin:codes="51"
latin:keyIcon="@drawable/sym_bkeyboard_num3" />
<key-style
latin:styleName="num4KeyStyle"
latin:codes="52"
latin:keyIcon="@drawable/sym_bkeyboard_num4" />
<key-style
latin:styleName="num5KeyStyle"
latin:codes="53"
latin:keyIcon="@drawable/sym_bkeyboard_num5" />
<key-style
latin:styleName="num6KeyStyle"
latin:codes="54"
latin:keyIcon="@drawable/sym_bkeyboard_num6" />
<key-style
latin:styleName="num7KeyStyle"
latin:codes="55"
latin:keyIcon="@drawable/sym_bkeyboard_num7" />
<key-style
latin:styleName="num8KeyStyle"
latin:codes="56"
latin:keyIcon="@drawable/sym_bkeyboard_num8" />
<key-style
latin:styleName="num9KeyStyle"
latin:codes="57"
latin:keyIcon="@drawable/sym_bkeyboard_num9" />
<key-style
latin:styleName="numStarKeyStyle"
latin:codes="42"
latin:keyIcon="@drawable/sym_bkeyboard_numstar" />
<key-style
latin:styleName="numPoundKeyStyle"
latin:codes="35"
latin:keyIcon="@drawable/sym_bkeyboard_numpound" />
<key-style
latin:styleName="numAltKeyStyle"
latin:codes="@integer/key_switch_alpha_symbol"
latin:keyIcon="@drawable/sym_bkeyboard_numalt"
latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
<key-style
latin:styleName="numSpaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_bkeyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
</case>
</switch>
</merge>

View File

@ -27,116 +27,8 @@
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
<switch>
<case
latin:colorScheme="white"
>
<key-style
latin:styleName="num0KeyStyle"
latin:codes="48"
latin:keyIcon="@drawable/sym_keyboard_num0" />
<key-style
latin:styleName="num1KeyStyle"
latin:codes="49"
latin:keyIcon="@drawable/sym_keyboard_num1" />
<key-style
latin:styleName="num2KeyStyle"
latin:codes="50"
latin:keyIcon="@drawable/sym_keyboard_num2" />
<key-style
latin:styleName="num3KeyStyle"
latin:codes="51"
latin:keyIcon="@drawable/sym_keyboard_num3" />
<key-style
latin:styleName="num4KeyStyle"
latin:codes="52"
latin:keyIcon="@drawable/sym_keyboard_num4" />
<key-style
latin:styleName="num5KeyStyle"
latin:codes="53"
latin:keyIcon="@drawable/sym_keyboard_num5" />
<key-style
latin:styleName="num6KeyStyle"
latin:codes="54"
latin:keyIcon="@drawable/sym_keyboard_num6" />
<key-style
latin:styleName="num7KeyStyle"
latin:codes="55"
latin:keyIcon="@drawable/sym_keyboard_num7" />
<key-style
latin:styleName="num8KeyStyle"
latin:codes="56"
latin:keyIcon="@drawable/sym_keyboard_num8" />
<key-style
latin:styleName="num9KeyStyle"
latin:codes="57"
latin:keyIcon="@drawable/sym_keyboard_num9" />
<key-style
latin:styleName="numAltKeyStyle"
latin:codes="@integer/key_switch_alpha_symbol"
latin:keyIcon="@drawable/sym_keyboard_numalt"
latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
<key-style
latin:styleName="numSpaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
</case>
<case
latin:colorScheme="black"
>
<key-style
latin:styleName="num0KeyStyle"
latin:codes="48"
latin:keyIcon="@drawable/sym_bkeyboard_num0" />
<key-style
latin:styleName="num1KeyStyle"
latin:codes="49"
latin:keyIcon="@drawable/sym_bkeyboard_num1" />
<key-style
latin:styleName="num2KeyStyle"
latin:codes="50"
latin:keyIcon="@drawable/sym_bkeyboard_num2" />
<key-style
latin:styleName="num3KeyStyle"
latin:codes="51"
latin:keyIcon="@drawable/sym_bkeyboard_num3" />
<key-style
latin:styleName="num4KeyStyle"
latin:codes="52"
latin:keyIcon="@drawable/sym_bkeyboard_num4" />
<key-style
latin:styleName="num5KeyStyle"
latin:codes="53"
latin:keyIcon="@drawable/sym_bkeyboard_num5" />
<key-style
latin:styleName="num6KeyStyle"
latin:codes="54"
latin:keyIcon="@drawable/sym_bkeyboard_num6" />
<key-style
latin:styleName="num7KeyStyle"
latin:codes="55"
latin:keyIcon="@drawable/sym_bkeyboard_num7" />
<key-style
latin:styleName="num8KeyStyle"
latin:codes="56"
latin:keyIcon="@drawable/sym_bkeyboard_num8" />
<key-style
latin:styleName="num9KeyStyle"
latin:codes="57"
latin:keyIcon="@drawable/sym_bkeyboard_num9" />
<key-style
latin:styleName="numAltKeyStyle"
latin:codes="@integer/key_switch_alpha_symbol"
latin:keyIcon="@drawable/sym_bkeyboard_numalt"
latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" />
<key-style
latin:styleName="numSpaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_bkeyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
</case>
</switch>
<include
latin:keyboardLayout="@xml/kbd_numkey_styles" />
<Row
latin:rowEdgeFlags="top"
>

View File

@ -27,44 +27,8 @@
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
<switch>
<case
latin:colorScheme="white"
>
<key-style
latin:styleName="numStarKeyStyle"
latin:codes="42"
latin:keyIcon="@drawable/sym_keyboard_numstar"
latin:keyEdgeFlags="left" />
<key-style
latin:styleName="numPoundKeyStyle"
latin:codes="35"
latin:keyIcon="@drawable/sym_keyboard_numpound" />
<key-style
latin:styleName="numSpaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_keyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
</case>
<case
latin:colorScheme="black"
>
<key-style
latin:styleName="numStarKeyStyle"
latin:codes="42"
latin:keyIcon="@drawable/sym_bkeyboard_numstar"
latin:keyEdgeFlags="left" />
<key-style
latin:styleName="numPoundKeyStyle"
latin:codes="35"
latin:keyIcon="@drawable/sym_bkeyboard_numpound" />
<key-style
latin:styleName="numSpaceKeyStyle"
latin:codes="@integer/key_space"
latin:keyIcon="@drawable/sym_bkeyboard_space"
latin:iconPreview="@drawable/sym_keyboard_feedback_space" />
</case>
</switch>
<include
latin:keyboardLayout="@xml/kbd_numkey_styles" />
<Row
latin:rowEdgeFlags="top"
>

View File

@ -28,11 +28,14 @@ import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.Log;
import android.util.Xml;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard
@ -86,6 +89,9 @@ public class BaseKeyboard {
/** List of shift keys in this keyboard */
private final List<Key> mShiftKeys = new ArrayList<Key>();
/** List of shift keys and its shifted state icon */
private final HashMap<Key, Drawable> mShiftedIcons = new HashMap<Key, Drawable>();
/** Total height of the keyboard, including the padding and keys */
private int mTotalHeight;
@ -340,6 +346,10 @@ public class BaseKeyboard {
manualTemporaryUpperCaseCode = style.getInt(a,
R.styleable.BaseKeyboard_Key_manualTemporaryUpperCaseCode, 0);
text = style.getText(a, R.styleable.BaseKeyboard_Key_keyOutputText);
final Drawable shiftedIcon = style.getDrawable(a,
R.styleable.BaseKeyboard_Key_shiftedIcon);
if (shiftedIcon != null)
keyboard.getShiftedIcons().put(this, shiftedIcon);
if (codes == null && !TextUtils.isEmpty(label)) {
codes = new int[] { label.charAt(0) };
@ -622,6 +632,10 @@ public class BaseKeyboard {
return mShiftKeys;
}
public Map<Key, Drawable> getShiftedIcons() {
return mShiftedIcons;
}
private void computeNearestNeighbors() {
// Round-up so we don't have any pixels outside the grid
mCellWidth = (getMinWidth() + GRID_WIDTH - 1) / GRID_WIDTH;
@ -686,8 +700,10 @@ public class BaseKeyboard {
mTotalWidth = parser.getMaxRowWidth();
mTotalHeight = parser.getTotalHeight();
} catch (XmlPullParserException e) {
Log.w(TAG, "keyboard XML parse error: " + e);
throw new IllegalArgumentException(e);
} catch (IOException e) {
Log.w(TAG, "keyboard XML parse error: " + e);
throw new RuntimeException(e);
}
}

View File

@ -174,6 +174,7 @@ public class BaseKeyboardParser {
keyboard.setVerticalGap(getDimensionOrFraction(a,
R.styleable.BaseKeyboard_verticalGap, height, 0));
a.recycle();
if (DEBUG_TAG) Log.d(TAG, "id=" + keyboard.mId);
}
private void parseKeyboardContent(XmlResourceParser parser, List<Key> keys)
@ -310,6 +311,7 @@ public class BaseKeyboardParser {
checkEndTag(TAG_INCLUDE, parser);
if (keyboardLayout == 0)
throw new ParseException("No keyboardLayout attribute in <include/>", parser);
if (DEBUG_TAG) Log.d(TAG, String.format(" keyboardLayout=0x%08x", keyboardLayout));
parseMerge(mResources.getLayout(keyboardLayout), row, keys);
}
}
@ -560,10 +562,10 @@ public class BaseKeyboardParser {
}
private static String debugInteger(TypedArray a, int index, String name) {
return a.hasValue(index) ? name + "=" + a.getInt(index, 0) : "";
return a.hasValue(index) ? " " + name + "=" + a.getInt(index, 0) : "";
}
private static String debugBoolean(TypedArray a, int index, String name) {
return a.hasValue(index) ? name + "=" + a.getBoolean(index, false) : "";
return a.hasValue(index) ? " " + name + "=" + a.getBoolean(index, false) : "";
}
}

View File

@ -71,6 +71,7 @@ import java.util.WeakHashMap;
public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
private static final String TAG = "BaseKeyboardView";
private static final boolean DEBUG = false;
private static final boolean DEBUG_SHOW_ALIGN = false;
private static final boolean DEBUG_KEYBOARD_GRID = false;
public static final int COLOR_SCHEME_WHITE = 0;
@ -252,17 +253,15 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
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>();
// This map caches key label text width in pixel as value and key label text size as map key.
private final HashMap<Integer, Integer> mTextWidthCache = new HashMap<Integer, Integer>();
// Distance from horizontal center of the key, proportional to key label text height and width.
private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER = 0.55f;
private final float KEY_LABEL_VERTICAL_PADDING_FACTOR = 1.60f;
private final float KEY_LABEL_HORIZONTAL_PADDING_FACTOR = 0.80f;
private final String KEY_LABEL_REFERENCE_CHAR = "H";
private final int KEY_LABEL_OPTION_ALIGN_LEFT = 1;
private final int KEY_LABEL_OPTION_ALIGN_RIGHT = 2;
private final int KEY_LABEL_OPTION_ALIGN_BOTTOM = 8;
private final int KEY_LABEL_OPTION_FONT_NORMAL = 16;
private final int mKeyLabelHorizontalPadding;
private final UIHandler mHandler = new UIHandler();
@ -514,6 +513,8 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
mPreviewPopup.setAnimationStyle(R.style.KeyPreviewAnimation);
mDelayBeforePreview = res.getInteger(R.integer.config_delay_before_preview);
mDelayAfterPreview = res.getInteger(R.integer.config_delay_after_preview);
mKeyLabelHorizontalPadding = (int)res.getDimension(
R.dimen.key_label_horizontal_alignment_padding);
mMiniKeyboardParent = this;
mMiniKeyboardPopup = new PopupWindow(context);
@ -818,44 +819,22 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
canvas.translate(key.x + kbdPaddingLeft, key.y + kbdPaddingTop);
keyBackground.draw(canvas);
final int rowHeight = padding.top + key.height;
boolean drawHintIcon = true;
// Draw key label
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) {
labelSize = mLabelTextSize;
if ((key.labelOption & KEY_LABEL_OPTION_FONT_NORMAL) != 0) {
paint.setTypeface(Typeface.DEFAULT);
} else {
paint.setTypeface(Typeface.DEFAULT_BOLD);
}
} else {
labelSize = mKeyTextSize;
paint.setTypeface(mKeyTextStyle);
}
paint.setTextSize(labelSize);
Integer labelHeightValue = mTextHeightCache.get(labelSize);
final int labelCharHeight;
final int labelCharWidth;
if (labelHeightValue != null) {
labelCharHeight = labelHeightValue;
labelCharWidth = mTextWidthCache.get(labelSize);
} else {
Rect textBounds = new Rect();
paint.getTextBounds(KEY_LABEL_REFERENCE_CHAR, 0, 1, textBounds);
labelCharHeight = textBounds.height();
labelCharWidth = textBounds.width();
mTextHeightCache.put(labelSize, labelCharHeight);
mTextWidthCache.put(labelSize, labelCharWidth);
}
final int labelSize = getLabelSizeAndSetPaint(label, key, paint);
final int labelCharHeight = getLabelCharHeight(labelSize, paint);
// Vertical label text alignment.
final float baseline;
if ((key.labelOption & KEY_LABEL_OPTION_ALIGN_BOTTOM) != 0) {
baseline = key.height -
+ labelCharHeight * KEY_LABEL_VERTICAL_PADDING_FACTOR;
if (DEBUG_SHOW_ALIGN)
drawHorizontalLine(canvas, (int)baseline, key.width, 0xc0008000,
new Paint());
} else { // Align center
final float centerY = (key.height + padding.top - padding.bottom) / 2;
baseline = centerY
@ -864,16 +843,20 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
// Horizontal label text alignment
final int positionX;
if ((key.labelOption & KEY_LABEL_OPTION_ALIGN_LEFT) != 0) {
positionX = (int)(
labelCharWidth * KEY_LABEL_HORIZONTAL_PADDING_FACTOR + padding.left);
positionX = mKeyLabelHorizontalPadding + padding.left;
paint.setTextAlign(Align.LEFT);
if (DEBUG_SHOW_ALIGN)
drawVerticalLine(canvas, positionX, rowHeight, 0xc0800080, new Paint());
} else if ((key.labelOption & KEY_LABEL_OPTION_ALIGN_RIGHT) != 0) {
positionX = (int)(key.width
- labelCharWidth * KEY_LABEL_HORIZONTAL_PADDING_FACTOR - padding.right);
positionX = key.width - mKeyLabelHorizontalPadding - padding.right;
paint.setTextAlign(Align.RIGHT);
if (DEBUG_SHOW_ALIGN)
drawVerticalLine(canvas, positionX, rowHeight, 0xc0808000, new Paint());
} else {
positionX = (key.width + padding.left - padding.right) / 2;
paint.setTextAlign(Align.CENTER);
if (DEBUG_SHOW_ALIGN && label.length() > 1)
drawVerticalLine(canvas, positionX, rowHeight, 0xc0008080, new Paint());
}
// Set a drop shadow for the text
paint.setShadowLayer(mShadowRadius, 0, 0, mShadowColor);
@ -883,21 +866,44 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
}
// Draw key icon
if (key.label == null && key.icon != null) {
int drawableWidth = key.icon.getIntrinsicWidth();
int drawableHeight = key.icon.getIntrinsicHeight();
int drawableX = (key.width + padding.left - padding.right - drawableWidth) / 2;
int drawableY = (key.height + padding.top - padding.bottom - drawableHeight) / 2;
final int drawableWidth = key.icon.getIntrinsicWidth();
final int drawableHeight = key.icon.getIntrinsicHeight();
final int drawableX;
final int drawableY = (
key.height + padding.top - padding.bottom - drawableHeight) / 2;
if ((key.labelOption & KEY_LABEL_OPTION_ALIGN_LEFT) != 0) {
drawableX = padding.left + mKeyLabelHorizontalPadding;
if (DEBUG_SHOW_ALIGN)
drawVerticalLine(canvas, drawableX, rowHeight, 0xc0800080, new Paint());
} else if ((key.labelOption & KEY_LABEL_OPTION_ALIGN_RIGHT) != 0) {
drawableX = key.width - padding.right - mKeyLabelHorizontalPadding
- drawableWidth;
if (DEBUG_SHOW_ALIGN)
drawVerticalLine(canvas, drawableX + drawableWidth, rowHeight,
0xc0808000, new Paint());
} else { // Align center
drawableX = (key.width + padding.left - padding.right - drawableWidth) / 2;
if (DEBUG_SHOW_ALIGN)
drawVerticalLine(canvas, drawableX + drawableWidth / 2, rowHeight,
0xc0008080, new Paint());
}
drawIcon(canvas, key.icon, drawableX, drawableY, drawableWidth, drawableHeight);
if (DEBUG_SHOW_ALIGN)
drawRectangle(canvas, drawableX, drawableY, drawableWidth, drawableHeight,
0x80c00000, new Paint());
}
if (key.hintIcon != null && drawHintIcon) {
int drawableWidth = key.width;
int drawableHeight = key.height;
int drawableX = 0;
int drawableY = HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL;
final int drawableWidth = key.width;
final int drawableHeight = key.height;
final int drawableX = 0;
final int drawableY = HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL;
Drawable icon = (isManualTemporaryUpperCase
&& key.manualTemporaryUpperCaseHintIcon != null)
? key.manualTemporaryUpperCaseHintIcon : key.hintIcon;
drawIcon(canvas, icon, drawableX, drawableY, drawableWidth, drawableHeight);
if (DEBUG_SHOW_ALIGN)
drawRectangle(canvas, drawableX, drawableY, drawableWidth, drawableHeight,
0x80c0c000, new Paint());
}
canvas.translate(-key.x - kbdPaddingLeft, -key.y - kbdPaddingTop);
}
@ -945,13 +951,70 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
mDirtyRect.setEmpty();
}
private void drawIcon(Canvas canvas, Drawable icon, int x, int y, int width, int height) {
private int getLabelSizeAndSetPaint(CharSequence label, Key key, Paint paint) {
// For characters, use large font. For labels like "Done", use small font.
final int labelSize;
if (label.length() > 1 && key.codes.length < 2) {
labelSize = mLabelTextSize;
if ((key.labelOption & KEY_LABEL_OPTION_FONT_NORMAL) != 0) {
paint.setTypeface(Typeface.DEFAULT);
} else {
paint.setTypeface(Typeface.DEFAULT_BOLD);
}
} else {
labelSize = mKeyTextSize;
paint.setTypeface(mKeyTextStyle);
}
paint.setTextSize(labelSize);
return labelSize;
}
private int getLabelCharHeight(int labelSize, Paint paint) {
Integer labelHeightValue = mTextHeightCache.get(labelSize);
final int labelCharHeight;
if (labelHeightValue != null) {
labelCharHeight = labelHeightValue;
} else {
Rect textBounds = new Rect();
paint.getTextBounds(KEY_LABEL_REFERENCE_CHAR, 0, 1, textBounds);
labelCharHeight = textBounds.height();
mTextHeightCache.put(labelSize, labelCharHeight);
}
return labelCharHeight;
}
private static void drawIcon(Canvas canvas, Drawable icon, int x, int y, int width,
int height) {
canvas.translate(x, y);
icon.setBounds(0, 0, width, height);
icon.draw(canvas);
canvas.translate(-x, -y);
}
private static void drawHorizontalLine(Canvas canvas, int y, int w, int color, Paint paint) {
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(1.0f);
paint.setColor(color);
canvas.drawLine(0, y, w, y, paint);
}
private static void drawVerticalLine(Canvas canvas, int x, int h, int color, Paint paint) {
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(1.0f);
paint.setColor(color);
canvas.drawLine(x, 0, x, h, paint);
}
private static void drawRectangle(Canvas canvas, int x, int y, int w, int h, int color,
Paint paint) {
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(1.0f);
paint.setColor(color);
canvas.translate(x, y);
canvas.drawRect(0, 0, w, h, paint);
canvas.translate(-x, -y);
}
public void setForeground(boolean foreground) {
mInForeground = foreground;
}

View File

@ -104,7 +104,7 @@ public class KeyStyles {
try {
values[count++] = Integer.parseInt(st.nextToken());
} catch (NumberFormatException nfe) {
Log.e(TAG, "Error parsing integer CSV " + value);
Log.w(TAG, "Error parsing integer CSV " + value);
}
}
return values;
@ -163,6 +163,7 @@ public class KeyStyles {
readDrawable(a, R.styleable.BaseKeyboard_Key_keyIcon);
readDrawable(a, R.styleable.BaseKeyboard_Key_iconPreview);
readDrawable(a, R.styleable.BaseKeyboard_Key_keyHintIcon);
readDrawable(a, R.styleable.BaseKeyboard_Key_shiftedIcon);
readResourceId(a, R.styleable.BaseKeyboard_Key_popupKeyboard);
readBoolean(a, R.styleable.BaseKeyboard_Key_isModifier);
readBoolean(a, R.styleable.BaseKeyboard_Key_isSticky);

View File

@ -691,9 +691,11 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
).inflate(THEMES[newLayout], null);
tryGC = false;
} catch (OutOfMemoryError e) {
Log.w(TAG, "load keyboard failed: " + e);
tryGC = LatinIMEUtil.GCUtils.getInstance().tryGCOrWait(
mLayoutId + "," + newLayout, e);
} catch (InflateException e) {
Log.w(TAG, "load keyboard failed: " + e);
tryGC = LatinIMEUtil.GCUtils.getInstance().tryGCOrWait(
mLayoutId + "," + newLayout, e);
}

View File

@ -37,6 +37,7 @@ import android.view.ViewConfiguration;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class LatinKeyboard extends BaseKeyboard {
@ -45,7 +46,6 @@ public class LatinKeyboard extends BaseKeyboard {
private static final int OPACITY_FULLY_OPAQUE = 255;
private static final int SPACE_LED_LENGTH_PERCENT = 80;
private final Drawable mShiftedIcon;
private Drawable mShiftLockPreviewIcon;
private final HashMap<Key, Drawable> mNormalShiftIcons = new HashMap<Key, Drawable>();
private Drawable mSpaceIcon;
@ -89,11 +89,9 @@ public class LatinKeyboard extends BaseKeyboard {
mContext = context;
mRes = res;
if (id.mColorScheme == BaseKeyboardView.COLOR_SCHEME_BLACK) {
mShiftedIcon = res.getDrawable(R.drawable.sym_bkeyboard_shift_locked);
mSpaceBarTextShadowColor = res.getColor(
R.color.latinkeyboard_bar_language_shadow_black);
} else { // default color scheme is BaseKeyboardView.COLOR_SCHEME_WHITE
mShiftedIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked);
mSpaceBarTextShadowColor = res.getColor(
R.color.latinkeyboard_bar_language_shadow_white);
}
@ -132,9 +130,10 @@ public class LatinKeyboard extends BaseKeyboard {
}
public boolean setShiftLocked(boolean newShiftLockState) {
final Map<Key, Drawable> shiftedIcons = getShiftedIcons();
for (final Key key : getShiftKeys()) {
key.on = newShiftLockState;
key.icon = newShiftLockState ? mShiftedIcon : mNormalShiftIcons.get(key);
key.icon = newShiftLockState ? shiftedIcons.get(key) : mNormalShiftIcons.get(key);
}
mShiftState.setShiftLocked(newShiftLockState);
return true;
@ -149,11 +148,12 @@ public class LatinKeyboard extends BaseKeyboard {
if (getShiftKeys().size() == 0)
return super.setShifted(newShiftState);
final Map<Key, Drawable> shiftedIcons = getShiftedIcons();
for (final Key key : getShiftKeys()) {
if (!newShiftState && !mShiftState.isShiftLocked()) {
key.icon = mNormalShiftIcons.get(key);
} else if (newShiftState && !mShiftState.isShiftedOrShiftLocked()) {
key.icon = mShiftedIcon;
key.icon = shiftedIcons.get(key);
}
}
return mShiftState.setShifted(newShiftState);