diff options
Diffstat (limited to 'java')
48 files changed, 1385 insertions, 990 deletions
diff --git a/java/res/drawable-hdpi/sym_keyboard_feedback_mic.png b/java/res/drawable-hdpi/sym_keyboard_feedback_mic.png Binary files differdeleted file mode 100644 index a88a19d0d..000000000 --- a/java/res/drawable-hdpi/sym_keyboard_feedback_mic.png +++ /dev/null diff --git a/java/res/drawable-hdpi/sym_keyboard_feedback_settings.png b/java/res/drawable-hdpi/sym_keyboard_feedback_settings.png Binary files differdeleted file mode 100644 index 6304b00ed..000000000 --- a/java/res/drawable-hdpi/sym_keyboard_feedback_settings.png +++ /dev/null diff --git a/java/res/drawable-hdpi/sym_keyboard_feedback_settings_holo.png b/java/res/drawable-hdpi/sym_keyboard_feedback_settings_holo.png Binary files differdeleted file mode 100644 index 960dd7873..000000000 --- a/java/res/drawable-hdpi/sym_keyboard_feedback_settings_holo.png +++ /dev/null diff --git a/java/res/drawable-mdpi/sym_keyboard_feedback_mic.png b/java/res/drawable-mdpi/sym_keyboard_feedback_mic.png Binary files differdeleted file mode 100644 index 3ed0782d3..000000000 --- a/java/res/drawable-mdpi/sym_keyboard_feedback_mic.png +++ /dev/null diff --git a/java/res/drawable-mdpi/sym_keyboard_feedback_settings.png b/java/res/drawable-mdpi/sym_keyboard_feedback_settings.png Binary files differdeleted file mode 100644 index 03bad1843..000000000 --- a/java/res/drawable-mdpi/sym_keyboard_feedback_settings.png +++ /dev/null diff --git a/java/res/drawable-mdpi/sym_keyboard_feedback_settings_holo.png b/java/res/drawable-mdpi/sym_keyboard_feedback_settings_holo.png Binary files differdeleted file mode 100644 index 453991ef3..000000000 --- a/java/res/drawable-mdpi/sym_keyboard_feedback_settings_holo.png +++ /dev/null diff --git a/java/res/drawable-xhdpi/sym_keyboard_feedback_mic.png b/java/res/drawable-xhdpi/sym_keyboard_feedback_mic.png Binary files differdeleted file mode 100644 index 5ac27ebad..000000000 --- a/java/res/drawable-xhdpi/sym_keyboard_feedback_mic.png +++ /dev/null diff --git a/java/res/drawable-xhdpi/sym_keyboard_feedback_settings.png b/java/res/drawable-xhdpi/sym_keyboard_feedback_settings.png Binary files differdeleted file mode 100644 index 021cafacb..000000000 --- a/java/res/drawable-xhdpi/sym_keyboard_feedback_settings.png +++ /dev/null diff --git a/java/res/drawable-xhdpi/sym_keyboard_feedback_settings_holo.png b/java/res/drawable-xhdpi/sym_keyboard_feedback_settings_holo.png Binary files differdeleted file mode 100644 index bc9a629ed..000000000 --- a/java/res/drawable-xhdpi/sym_keyboard_feedback_settings_holo.png +++ /dev/null diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index e569e83b1..77c657b09 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -180,8 +180,6 @@ <attr name="iconShortcutForLabel" format="reference" /> <attr name="iconShiftedShiftKey" format="reference" /> <attr name="iconPreviewTabKey" format="reference" /> - <attr name="iconPreviewSettingsKey" format="reference" /> - <attr name="iconPreviewShortcutKey" format="reference" /> </declare-styleable> <declare-styleable name="Keyboard_Key"> @@ -223,6 +221,7 @@ <flag name="withIconLeft" value="0x1000" /> <flag name="withIconRight" value="0x2000" /> <flag name="autoXScale" value="0x4000" /> + <flag name="noKeyPreview" value="0x8000" /> </attr> <!-- The icon to display on the key instead of the label. --> <attr name="keyIcon" format="enum"> @@ -246,8 +245,6 @@ <attr name="keyIconPreview" format="enum"> <!-- This should be aligned with KeyboardIcons.ICON_PREVIEW_* --> <enum name="iconPreviewTabKey" value="11" /> - <enum name="iconPreviewSettingsKey" value="12" /> - <enum name="iconPreviewShortcutKey" value="13" /> </attr> <!-- The key style to specify a set of key attributes defined by <key_style/> --> <attr name="keyStyle" format="string" /> diff --git a/java/res/values/config.xml b/java/res/values/config.xml index e4f5f377a..bad4bc625 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -63,6 +63,7 @@ <integer name="config_long_press_space_key_timeout">@integer/config_long_press_key_timeout</integer> <integer name="config_touch_noise_threshold_millis">40</integer> <integer name="config_double_spaces_turn_into_period_timeout">1100</integer> + <integer name="config_ignore_special_key_timeout">700</integer> <dimen name="config_touch_noise_threshold_distance">2.0mm</dimen> <!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. --> <string name="config_default_keyboard_theme_id" translatable="false">5</string> diff --git a/java/res/values/keyboard-icons-black.xml b/java/res/values/keyboard-icons-black.xml index 23d163c69..f767cb349 100644 --- a/java/res/values/keyboard-icons-black.xml +++ b/java/res/values/keyboard-icons-black.xml @@ -32,8 +32,6 @@ <item name="iconShortcutForLabel">@drawable/sym_bkeyboard_label_mic</item> <item name="iconShiftedShiftKey">@drawable/sym_bkeyboard_shift_locked</item> <item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item> - <item name="iconPreviewSettingsKey">@drawable/sym_keyboard_feedback_settings</item> - <item name="iconPreviewShortcutKey">@drawable/sym_keyboard_feedback_mic</item> <!-- LatinKeyboard icons --> <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item> <item name="disabledShortcutIcon">@drawable/sym_bkeyboard_voice_off</item> diff --git a/java/res/values/keyboard-icons-ics.xml b/java/res/values/keyboard-icons-ics.xml index 28859b670..f1021433d 100644 --- a/java/res/values/keyboard-icons-ics.xml +++ b/java/res/values/keyboard-icons-ics.xml @@ -31,8 +31,6 @@ <item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic_holo</item> <item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked_holo</item> <item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item> - <item name="iconPreviewSettingsKey">@drawable/sym_keyboard_feedback_settings_holo</item> - <item name="iconPreviewShortcutKey">@drawable/sym_keyboard_feedback_mic</item> <!-- LatinKeyboard icons --> <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item> <item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item> diff --git a/java/res/values/keyboard-icons-white.xml b/java/res/values/keyboard-icons-white.xml index a1765a44d..07ece66b1 100644 --- a/java/res/values/keyboard-icons-white.xml +++ b/java/res/values/keyboard-icons-white.xml @@ -28,8 +28,6 @@ <item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic</item> <item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked</item> <item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item> - <item name="iconPreviewSettingsKey">@drawable/sym_keyboard_feedback_settings</item> - <item name="iconPreviewShortcutKey">@drawable/sym_keyboard_feedback_mic</item> <!-- LatinKeyboard icons --> <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item> <item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item> diff --git a/java/res/xml-sw600dp-land/kbd_number.xml b/java/res/xml-sw600dp-land/kbd_number.xml new file mode 100644 index 000000000..7e3188b0f --- /dev/null +++ b/java/res/xml-sw600dp-land/kbd_number.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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. +*/ +--> + +<Keyboard + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyWidth="15.00%p" +> + <include + latin:keyboardLayout="@xml/kbd_rows_number" /> +</Keyboard> diff --git a/java/res/xml-sw600dp-land/kbd_phone.xml b/java/res/xml-sw600dp-land/kbd_phone.xml new file mode 100644 index 000000000..28df7efa3 --- /dev/null +++ b/java/res/xml-sw600dp-land/kbd_phone.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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. +*/ +--> + +<Keyboard + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyWidth="15.00%p" +> + <include + latin:keyboardLayout="@xml/kbd_rows_phone" /> +</Keyboard> diff --git a/java/res/xml-sw600dp-land/kbd_phone_shift.xml b/java/res/xml-sw600dp-land/kbd_phone_shift.xml new file mode 100644 index 000000000..daf1d18c5 --- /dev/null +++ b/java/res/xml-sw600dp-land/kbd_phone_shift.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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. +*/ +--> + +<Keyboard + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyWidth="15.00%p" +> + <include + latin:keyboardLayout="@xml/kbd_rows_phone_shift" /> +</Keyboard> diff --git a/java/res/xml-sw600dp/kbd_key_styles.xml b/java/res/xml-sw600dp/kbd_key_styles.xml index 0b6d87126..a9d12ed1d 100644 --- a/java/res/xml-sw600dp/kbd_key_styles.xml +++ b/java/res/xml-sw600dp/kbd_key_styles.xml @@ -44,24 +44,29 @@ latin:code="@integer/key_shift" latin:keyIcon="iconShiftKey" latin:keyIconShifted="iconShiftedShiftKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="sticky" /> <key-style latin:styleName="deleteKeyStyle" latin:code="@integer/key_delete" latin:keyIcon="iconDeleteKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" latin:isRepeatable="true" /> <key-style latin:styleName="returnKeyStyle" latin:code="@integer/key_return" latin:keyIcon="iconReturnKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="spaceKeyStyle" - latin:code="@integer/key_space" /> + latin:code="@integer/key_space" + latin:keyLabelOption="noKeyPreview" /> <key-style latin:styleName="nonSpecialBackgroundSpaceKeyStyle" - latin:code="@integer/key_space" /> + latin:code="@integer/key_space" + latin:keyLabelOption="noKeyPreview" /> <key-style latin:styleName="smileyKeyStyle" latin:keyLabel=":-)" @@ -73,13 +78,13 @@ latin:styleName="shortcutKeyStyle" latin:code="@integer/key_shortcut" latin:keyIcon="iconShortcutKey" - latin:keyIconPreview="iconPreviewShortcutKey" + latin:keyLabelOption="noKeyPreview" latin:parentStyle="f2PopupStyle" /> <key-style latin:styleName="settingsKeyStyle" latin:code="@integer/key_settings" latin:keyIcon="iconSettingsKey" - latin:keyIconPreview="iconPreviewSettingsKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="tabKeyStyle" @@ -91,21 +96,25 @@ latin:styleName="toSymbolKeyStyle" latin:code="@integer/key_switch_alpha_symbol" latin:keyLabel="@string/label_to_symbol_key" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="toAlphaKeyStyle" latin:code="@integer/key_switch_alpha_symbol" latin:keyLabel="@string/label_to_alpha_key" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="toMoreSymbolKeyStyle" latin:code="@integer/key_shift" latin:keyLabel="@string/label_to_more_symbol_for_tablet_key" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="backFromMoreSymbolKeyStyle" latin:code="@integer/key_shift" latin:keyLabel="@string/label_to_symbol_key" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="comKeyStyle" diff --git a/java/res/xml-sw600dp/kbd_number.xml b/java/res/xml-sw600dp/kbd_number.xml index 46114dedf..ad588d7ed 100644 --- a/java/res/xml-sw600dp/kbd_number.xml +++ b/java/res/xml-sw600dp/kbd_number.xml @@ -20,190 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyWidth="16.75%p" + latin:keyWidth="15.00%p" > <include - latin:keyboardLayout="@xml/kbd_key_styles" /> - <include - latin:keyboardLayout="@xml/kbd_numkey_styles" /> - <switch> - <case - latin:passwordInput="true" - > - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="24.875%p" /> - <Key - latin:keyStyle="num1KeyStyle" /> - <Key - latin:keyStyle="num2KeyStyle" /> - <Key - latin:keyStyle="num3KeyStyle" /> - <Key - latin:keyStyle="deleteKeyStyle" - latin:keyXPos="-11.00%p" - latin:keyWidth="fillRight" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="24.875%p" /> - <Key - latin:keyStyle="num4KeyStyle" /> - <Key - latin:keyStyle="num5KeyStyle" /> - <Key - latin:keyStyle="num6KeyStyle" /> - <Key - latin:keyStyle="returnKeyStyle" - latin:keyXPos="-11.00%p" - latin:keyWidth="fillRight" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="24.875%p" /> - <Key - latin:keyStyle="num7KeyStyle" /> - <Key - latin:keyStyle="num8KeyStyle" /> - <Key - latin:keyStyle="num9KeyStyle" /> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </Row> - <Row> - <Key - latin:keyStyle="tabKeyStyle" - latin:keyWidth="11.00%p" /> - <Spacer - latin:keyXPos="24.875%p" /> - <Key - latin:keyStyle="num0KeyStyle" /> - <Spacer - latin:keyXPos="-11.00%p" - latin:keyWidth="0%p" /> - <include - latin:keyboardLayout="@xml/kbd_qwerty_f2" /> - </Row> - </case> - <!-- latin:passwordInput="false" --> - <default> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="11.00%p" /> - <Key - latin:keyLabel="-" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="+" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="." - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="1" - latin:keyStyle="numKeyStyle" - latin:keyXPos="38.75%p" /> - <Key - latin:keyLabel="2" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyLabel="3" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyStyle="deleteKeyStyle" - latin:keyXPos="-11.00%p" - latin:keyWidth="fillBoth" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="11.00%p" /> - <Key - latin:keyStyle="numStarKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="/" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="," - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="4" - latin:keyStyle="numKeyStyle" - latin:keyXPos="38.75%p" /> - <Key - latin:keyLabel="5" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyLabel="6" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyStyle="returnKeyStyle" - latin:keyXPos="-11.00%p" - latin:keyWidth="fillBoth" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="11.00%p" /> - <Key - latin:keyLabel="(" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel=")" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="=" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="7" - latin:keyStyle="numKeyStyle" - latin:keyXPos="38.75%p" /> - <Key - latin:keyLabel="8" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyLabel="9" - latin:keyStyle="numKeyStyle" /> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </Row> - <Row> - <Key - latin:keyStyle="tabKeyStyle" - latin:keyWidth="11.00%p" /> - <Key - latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" - latin:keyWidth="27.75%p" /> - <Key - latin:keyStyle="numStarKeyStyle" - latin:keyXPos="38.75%p" /> - <Key - latin:keyLabel="0" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyLabel="#" - latin:keyStyle="numKeyStyle" /> - <Spacer - latin:keyXPos="-11.00%p" - latin:keyWidth="0%p" /> - <include - latin:keyboardLayout="@xml/kbd_qwerty_f2" /> - </Row> - </default> - </switch> + latin:keyboardLayout="@xml/kbd_rows_number" /> </Keyboard> diff --git a/java/res/xml-sw600dp/kbd_phone.xml b/java/res/xml-sw600dp/kbd_phone.xml index 303f8145b..ce769b8f7 100644 --- a/java/res/xml-sw600dp/kbd_phone.xml +++ b/java/res/xml-sw600dp/kbd_phone.xml @@ -20,104 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyWidth="16.75%p" + latin:keyWidth="15.00%p" > <include - latin:keyboardLayout="@xml/kbd_key_styles" /> - <include - latin:keyboardLayout="@xml/kbd_numkey_styles" /> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="15.625%p" /> - <Key - latin:keyLabel="-" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="+" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyStyle="num1KeyStyle" - latin:keyXPos="38.867%p" /> - <Key - latin:keyStyle="num2KeyStyle" /> - <Key - latin:keyStyle="num3KeyStyle" /> - <Key - latin:keyStyle="deleteKeyStyle" - latin:keyXPos="-11.00%p" - latin:keyWidth="fillBoth" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="15.625%p" /> - <Key - latin:keyLabel="," - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="." - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyStyle="num4KeyStyle" - latin:keyXPos="38.867%p" /> - <Key - latin:keyStyle="num5KeyStyle" /> - <Key - latin:keyStyle="num6KeyStyle" /> - <Key - latin:keyStyle="returnKeyStyle" - latin:keyXPos="-11.00%p" - latin:keyWidth="fillBoth" /> - </Row> - <Row> - <Key - latin:keyStyle="toMoreSymbolKeyStyle" - latin:keyWidth="11.0%p" /> - <Key - latin:keyLabel="(" - latin:keyStyle="numKeyStyle" - latin:keyXPos="15.625%p" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel=")" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyStyle="num7KeyStyle" - latin:keyXPos="38.867%p" /> - <Key - latin:keyStyle="num8KeyStyle" /> - <Key - latin:keyStyle="num9KeyStyle" /> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </Row> - <Row> - <Key - latin:keyStyle="tabKeyStyle" - latin:keyWidth="11.00%p" /> - <Key - latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" - latin:keyXPos="15.625%p" - latin:keyWidth="18.50%p" /> - <Key - latin:keyStyle="numStarKeyStyle" - latin:keyXPos="38.867%p" /> - <Key - latin:keyStyle="num0KeyStyle" /> - <Key - latin:keyLabel="#" - latin:keyStyle="numKeyStyle" /> - <Spacer - latin:keyXPos="-11.00%p" - latin:keyWidth="0%p" /> - <include - latin:keyboardLayout="@xml/kbd_qwerty_f2" /> - </Row> + latin:keyboardLayout="@xml/kbd_rows_phone" /> </Keyboard> diff --git a/java/res/xml-sw600dp/kbd_phone_shift.xml b/java/res/xml-sw600dp/kbd_phone_shift.xml index 4c4f8ad12..3753deb8c 100644 --- a/java/res/xml-sw600dp/kbd_phone_shift.xml +++ b/java/res/xml-sw600dp/kbd_phone_shift.xml @@ -20,116 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyWidth="16.75%p" + latin:keyWidth="15.00%p" > <include - latin:keyboardLayout="@xml/kbd_key_styles" /> - <include - latin:keyboardLayout="@xml/kbd_numkey_styles" /> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="11.00%p" /> - <Key - latin:keyLabel="-" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="+" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:code="44" - latin:keyLabel="@string/label_pause_key" - latin:keyLabelOption="followKeyHintLabelRatio|autoXScale" - latin:keyWidth="9.25%p" /> - <Key - latin:keyStyle="num1KeyStyle" - latin:keyXPos="38.867%p" /> - <Key - latin:keyStyle="num2KeyStyle" /> - <Key - latin:keyStyle="num3KeyStyle" /> - <Key - latin:keyStyle="deleteKeyStyle" - latin:keyXPos="-11.00%p" - latin:keyWidth="fillBoth" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="11.00%p" /> - <Key - latin:keyLabel="," - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="." - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:code="59" - latin:keyLabel="@string/label_wait_key" - latin:keyLabelOption="followKeyHintLabelRatio|autoXScale" - latin:keyWidth="9.25%p" /> - <Key - latin:keyStyle="num4KeyStyle" - latin:keyXPos="38.867%p" /> - <Key - latin:keyStyle="num5KeyStyle" /> - <Key - latin:keyStyle="num6KeyStyle" /> - <Key - latin:keyStyle="returnKeyStyle" - latin:keyXPos="-11.00%p" - latin:keyWidth="fillBoth" /> - </Row> - <Row> - <Key - latin:keyStyle="backFromMoreSymbolKeyStyle" - latin:keyWidth="11.00%p" /> - <Key - latin:keyLabel="(" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel=")" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyLabel="N" - latin:keyStyle="numKeyStyle" - latin:keyWidth="9.25%p" /> - <Key - latin:keyStyle="num7KeyStyle" - latin:keyXPos="38.867%p" /> - <Key - latin:keyStyle="num8KeyStyle" /> - <Key - latin:keyStyle="num9KeyStyle" /> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </Row> - <Row> - <Key - latin:keyStyle="tabKeyStyle" - latin:keyWidth="11.00%p" /> - <Key - latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" - latin:keyWidth="27.75%p" /> - <Key - latin:keyStyle="numStarKeyStyle" - latin:keyXPos="38.867%p" /> - <Key - latin:keyStyle="num0KeyStyle" /> - <Key - latin:keyLabel="#" - latin:keyStyle="numKeyStyle" /> - <Spacer - latin:keyXPos="-11.00%p" - latin:keyWidth="0%p" /> - <include - latin:keyboardLayout="@xml/kbd_qwerty_f2" /> - </Row> + latin:keyboardLayout="@xml/kbd_rows_phone_shift" /> </Keyboard> diff --git a/java/res/xml-sw600dp/kbd_rows_number.xml b/java/res/xml-sw600dp/kbd_rows_number.xml new file mode 100644 index 000000000..cfb24212b --- /dev/null +++ b/java/res/xml-sw600dp/kbd_rows_number.xml @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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" +> + <include + latin:keyboardLayout="@xml/kbd_key_styles" /> + <include + latin:keyboardLayout="@xml/kbd_numkey_styles" /> + <switch> + <case + latin:passwordInput="true" + > + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="27.50%p" /> + <Key + latin:keyStyle="num1KeyStyle" /> + <Key + latin:keyStyle="num2KeyStyle" /> + <Key + latin:keyStyle="num3KeyStyle" /> + <Key + latin:keyStyle="deleteKeyStyle" + latin:keyXPos="-11.00%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="27.50%p" /> + <Key + latin:keyStyle="num4KeyStyle" /> + <Key + latin:keyStyle="num5KeyStyle" /> + <Key + latin:keyStyle="num6KeyStyle" /> + <Key + latin:keyStyle="returnKeyStyle" + latin:keyXPos="-11.00%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="27.50%p" /> + <Key + latin:keyStyle="num7KeyStyle" /> + <Key + latin:keyStyle="num8KeyStyle" /> + <Key + latin:keyStyle="num9KeyStyle" /> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </Row> + <Row> + <Key + latin:keyStyle="tabKeyStyle" + latin:keyWidth="11.00%p" /> + <Key + latin:keyStyle="num0KeyStyle" + latin:keyXPos="42.50%p"/> + <Spacer + latin:keyXPos="-11.00%p" + latin:keyWidth="0%p" /> + <include + latin:keyboardLayout="@xml/kbd_qwerty_f2" /> + </Row> + </case> + <!-- latin:passwordInput="false" --> + <default> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="12.75%p" /> + <Key + latin:keyLabel="-" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="+" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="." + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="1" + latin:keyStyle="numKeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyLabel="2" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyLabel="3" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyStyle="deleteKeyStyle" + latin:keyXPos="-11.00%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="12.75%p" /> + <Key + latin:keyStyle="numStarKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="/" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="," + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="4" + latin:keyStyle="numKeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyLabel="5" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyLabel="6" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyStyle="returnKeyStyle" + latin:keyXPos="-11.00%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="12.75%p" /> + <Key + latin:keyLabel="(" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel=")" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="=" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="7" + latin:keyStyle="numKeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyLabel="8" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyLabel="9" + latin:keyStyle="numKeyStyle" /> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </Row> + <Row> + <Key + latin:keyStyle="numTabKeyStyle" + latin:keyWidth="11.00%p" /> + <Key + latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" + latin:keyWidth="27.75%p" + latin:keyXPos="12.75%p" /> + <Key + latin:keyStyle="numStarKeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyLabel="0" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyLabel="#" + latin:keyStyle="numKeyStyle" /> + <Spacer + latin:keyXPos="-11.00%p" + latin:keyWidth="0%p" /> + <include + latin:keyboardLayout="@xml/kbd_qwerty_f2" /> + </Row> + </default> + </switch> +</merge> diff --git a/java/res/xml-sw600dp/kbd_rows_phone.xml b/java/res/xml-sw600dp/kbd_rows_phone.xml new file mode 100644 index 000000000..69d058fd8 --- /dev/null +++ b/java/res/xml-sw600dp/kbd_rows_phone.xml @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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" +> + <include + latin:keyboardLayout="@xml/kbd_key_styles" /> + <include + latin:keyboardLayout="@xml/kbd_numkey_styles" /> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="17.375%p" /> + <Key + latin:keyLabel="-" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="+" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyStyle="num1KeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyStyle="num2KeyStyle" /> + <Key + latin:keyStyle="num3KeyStyle" /> + <Key + latin:keyStyle="deleteKeyStyle" + latin:keyXPos="-11.00%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="17.375%p" /> + <Key + latin:keyLabel="," + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="." + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyStyle="num4KeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyStyle="num5KeyStyle" /> + <Key + latin:keyStyle="num6KeyStyle" /> + <Key + latin:keyStyle="returnKeyStyle" + latin:keyXPos="-11.00%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <Key + latin:keyStyle="toMoreSymbolKeyStyle" + latin:keyWidth="11.0%p" /> + <Key + latin:keyLabel="(" + latin:keyStyle="numKeyStyle" + latin:keyXPos="17.375%p" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel=")" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyStyle="num7KeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyStyle="num8KeyStyle" /> + <Key + latin:keyStyle="num9KeyStyle" /> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </Row> + <Row> + <Key + latin:keyStyle="numTabKeyStyle" + latin:keyWidth="11.00%p" /> + <Key + latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" + latin:keyWidth="18.50%p" + latin:keyXPos="17.375%p" /> + <Key + latin:keyStyle="numStarKeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyStyle="num0KeyStyle" /> + <Key + latin:keyLabel="#" + latin:keyStyle="numKeyStyle" /> + <Spacer + latin:keyXPos="-11.00%p" + latin:keyWidth="0%p" /> + <include + latin:keyboardLayout="@xml/kbd_qwerty_f2" /> + </Row> +</merge> diff --git a/java/res/xml-sw600dp/kbd_rows_phone_shift.xml b/java/res/xml-sw600dp/kbd_rows_phone_shift.xml new file mode 100644 index 000000000..04db6780f --- /dev/null +++ b/java/res/xml-sw600dp/kbd_rows_phone_shift.xml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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" +> + <include + latin:keyboardLayout="@xml/kbd_key_styles" /> + <include + latin:keyboardLayout="@xml/kbd_numkey_styles" /> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="12.75%p" /> + <Key + latin:keyLabel="-" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="+" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyStyle="numPauseKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyStyle="num1KeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyStyle="num2KeyStyle" /> + <Key + latin:keyStyle="num3KeyStyle" /> + <Key + latin:keyStyle="deleteKeyStyle" + latin:keyXPos="-11.00%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="12.75%p" /> + <Key + latin:keyLabel="," + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="." + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyStyle="numWaitKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyStyle="num4KeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyStyle="num5KeyStyle" /> + <Key + latin:keyStyle="num6KeyStyle" /> + <Key + latin:keyStyle="returnKeyStyle" + latin:keyXPos="-11.00%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <Key + latin:keyStyle="backFromMoreSymbolKeyStyle" + latin:keyWidth="11.00%p" /> + <Key + latin:keyLabel="(" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" + latin:keyXPos="12.75%p" /> + <Key + latin:keyLabel=")" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyLabel="N" + latin:keyStyle="numKeyStyle" + latin:keyWidth="9.25%p" /> + <Key + latin:keyStyle="num7KeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyStyle="num8KeyStyle" /> + <Key + latin:keyStyle="num9KeyStyle" /> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </Row> + <Row> + <Key + latin:keyStyle="numTabKeyStyle" + latin:keyWidth="11.00%p" /> + <Key + latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" + latin:keyWidth="27.75%p" + latin:keyXPos="12.75%p" /> + <Key + latin:keyStyle="numStarKeyStyle" + latin:keyXPos="42.25%p" /> + <Key + latin:keyStyle="num0KeyStyle" /> + <Key + latin:keyLabel="#" + latin:keyStyle="numKeyStyle" /> + <Spacer + latin:keyXPos="-11.00%p" + latin:keyWidth="0%p" /> + <include + latin:keyboardLayout="@xml/kbd_qwerty_f2" /> + </Row> +</merge> diff --git a/java/res/xml-sw768dp-land/kbd_number.xml b/java/res/xml-sw768dp-land/kbd_number.xml new file mode 100644 index 000000000..3106dc34e --- /dev/null +++ b/java/res/xml-sw768dp-land/kbd_number.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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. +*/ +--> + +<Keyboard + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyWidth="13.250%p" +> + <include + latin:keyboardLayout="@xml/kbd_rows_number" /> +</Keyboard> diff --git a/java/res/xml-sw768dp-land/kbd_phone.xml b/java/res/xml-sw768dp-land/kbd_phone.xml new file mode 100644 index 000000000..7c7af5739 --- /dev/null +++ b/java/res/xml-sw768dp-land/kbd_phone.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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. +*/ +--> + +<Keyboard + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyWidth="13.250%p" +> + <include + latin:keyboardLayout="@xml/kbd_rows_phone" /> +</Keyboard> diff --git a/java/res/xml-sw768dp-land/kbd_phone_shift.xml b/java/res/xml-sw768dp-land/kbd_phone_shift.xml new file mode 100644 index 000000000..04b018cfe --- /dev/null +++ b/java/res/xml-sw768dp-land/kbd_phone_shift.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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. +*/ +--> + +<Keyboard + xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" + latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyWidth="13.250%p" +> + <include + latin:keyboardLayout="@xml/kbd_rows_phone_shift" /> +</Keyboard> diff --git a/java/res/xml-sw768dp/kbd_key_styles.xml b/java/res/xml-sw768dp/kbd_key_styles.xml index 686e7b66c..4e19509e7 100644 --- a/java/res/xml-sw768dp/kbd_key_styles.xml +++ b/java/res/xml-sw768dp/kbd_key_styles.xml @@ -26,24 +26,29 @@ latin:code="@integer/key_shift" latin:keyIcon="iconShiftKey" latin:keyIconShifted="iconShiftedShiftKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="sticky" /> <key-style latin:styleName="deleteKeyStyle" latin:code="@integer/key_delete" latin:keyIcon="iconDeleteKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" latin:isRepeatable="true" /> <key-style latin:styleName="returnKeyStyle" latin:code="@integer/key_return" latin:keyIcon="iconReturnKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="spaceKeyStyle" - latin:code="@integer/key_space" /> + latin:code="@integer/key_space" + latin:keyLabelOption="noKeyPreview" /> <key-style latin:styleName="nonSpecialBackgroundSpaceKeyStyle" - latin:code="@integer/key_space" /> + latin:code="@integer/key_space" + latin:keyLabelOption="noKeyPreview" /> <key-style latin:styleName="smileyKeyStyle" latin:keyLabel=":-)" @@ -55,13 +60,13 @@ latin:styleName="settingsKeyStyle" latin:code="@integer/key_settings" latin:keyIcon="iconSettingsKey" - latin:keyIconPreview="iconPreviewSettingsKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="shortcutKeyStyle" latin:code="@integer/key_shortcut" latin:keyIcon="iconShortcutKey" - latin:keyIconPreview="iconPreviewShortcutKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="tabKeyStyle" @@ -73,25 +78,25 @@ latin:styleName="toSymbolKeyStyle" latin:code="@integer/key_switch_alpha_symbol" latin:keyLabel="@string/label_to_symbol_key" - latin:keyLabelOption="fontNormal" + latin:keyLabelOption="fontNormal|noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="toAlphaKeyStyle" latin:code="@integer/key_switch_alpha_symbol" latin:keyLabel="@string/label_to_alpha_key" - latin:keyLabelOption="fontNormal" + latin:keyLabelOption="fontNormal|noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="toMoreSymbolKeyStyle" latin:code="@integer/key_shift" latin:keyLabel="@string/label_to_more_symbol_for_tablet_key" - latin:keyLabelOption="fontNormal" + latin:keyLabelOption="fontNormal|noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="backFromMoreSymbolKeyStyle" latin:code="@integer/key_shift" latin:keyLabel="@string/label_to_symbol_key" - latin:keyLabelOption="fontNormal" + latin:keyLabelOption="fontNormal|noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="comKeyStyle" diff --git a/java/res/xml-sw768dp/kbd_number.xml b/java/res/xml-sw768dp/kbd_number.xml index 369e91a77..74ce854cf 100644 --- a/java/res/xml-sw768dp/kbd_number.xml +++ b/java/res/xml-sw768dp/kbd_number.xml @@ -23,206 +23,5 @@ latin:keyWidth="13.250%p" > <include - latin:keyboardLayout="@xml/kbd_key_styles" /> - <include - latin:keyboardLayout="@xml/kbd_numkey_styles" /> - <switch> - <case - latin:passwordInput="true" - > - <Row> - <Key - latin:keyStyle="tabKeyStyle" - latin:keyLabelOption="alignLeft" - latin:keyWidth="11.172%p" /> - <Key - latin:keyStyle="num1KeyStyle" - latin:keyXPos="32.076%p" /> - <Key - latin:keyStyle="num2KeyStyle" /> - <Key - latin:keyStyle="num3KeyStyle" /> - <Key - latin:keyStyle="deleteKeyStyle" - latin:keyXPos="-11.172%p" - latin:keyWidth="fillRight" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="32.076%p" /> - <Key - latin:keyStyle="num4KeyStyle" /> - <Key - latin:keyStyle="num5KeyStyle" /> - <Key - latin:keyStyle="num6KeyStyle" /> - <Key - latin:keyStyle="returnKeyStyle" - latin:keyXPos="-11.172%p" - latin:keyWidth="fillRight" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="32.076%p" /> - <Key - latin:keyStyle="num7KeyStyle" /> - <Key - latin:keyStyle="num8KeyStyle" /> - <Key - latin:keyStyle="num9KeyStyle" /> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </Row> - <Row> - <Spacer - latin:keyXPos="32.076%p" /> - <Key - latin:keyStyle="num0KeyStyle" /> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </Row> - </case> - <!-- latin:passwordInput="false" --> - <default> - <Row> - <Key - latin:keyStyle="tabKeyStyle" - latin:keyLabelOption="alignLeft" - latin:keyWidth="11.172%p" /> - <Key - latin:keyLabel="-" - latin:keyStyle="numKeyStyle" - latin:keyXPos="13.829%p" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="+" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="." - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="1" - latin:keyStyle="numKeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyLabel="2" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyLabel="3" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyStyle="deleteKeyStyle" - latin:keyXPos="-11.172%p" - latin:keyWidth="fillRight" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="13.829%p" /> - <Key - latin:keyStyle="numStarKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="/" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="," - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="4" - latin:keyStyle="numKeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyLabel="5" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyLabel="6" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyStyle="returnKeyStyle" - latin:keyXPos="-11.172%p" - latin:keyWidth="fillRight" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="13.829%p" /> - <Key - latin:keyLabel="(" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel=")" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="=" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="7" - latin:keyStyle="numKeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyLabel="8" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyLabel="9" - latin:keyStyle="numKeyStyle" /> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </Row> - <Row> - <switch> - <case latin:hasSettingsKey="true"> - <Key - latin:keyStyle="settingsKeyStyle" - latin:keyWidth="8.047%p" /> - </case> - <default> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="8.047%p" /> - </default> - </switch> - <Key - latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" - latin:keyXPos="13.829%p" - latin:keyWidth="24.140%p" /> - <Key - latin:keyStyle="numStarKeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyLabel="0" - latin:keyStyle="numKeyStyle" /> - <Key - latin:keyLabel="#" - latin:keyStyle="numKeyStyle" /> - <switch> - <case - latin:shortcutKeyEnabled="true" - > - <Key - latin:keyStyle="shortcutKeyStyle" - latin:keyXPos="-8.047%p" - latin:keyWidth="fillRight" /> - </case> - <default> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </default> - </switch> - </Row> - </default> - </switch> + latin:keyboardLayout="@xml/kbd_rows_number" /> </Keyboard> diff --git a/java/res/xml-sw768dp/kbd_phone.xml b/java/res/xml-sw768dp/kbd_phone.xml index e55b1841a..0a9b8b53a 100644 --- a/java/res/xml-sw768dp/kbd_phone.xml +++ b/java/res/xml-sw768dp/kbd_phone.xml @@ -23,122 +23,5 @@ latin:keyWidth="13.250%p" > <include - latin:keyboardLayout="@xml/kbd_key_styles" /> - <include - latin:keyboardLayout="@xml/kbd_numkey_styles" /> - <Row> - <Key - latin:keyStyle="tabKeyStyle" - latin:keyLabelOption="alignLeft" - latin:keyWidth="11.172%p" /> - <Key - latin:keyLabel="-" - latin:keyStyle="numKeyStyle" - latin:keyXPos="20.400%p" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="+" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyStyle="num1KeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyStyle="num2KeyStyle" /> - <Key - latin:keyStyle="num3KeyStyle" /> - <Key - latin:keyStyle="deleteKeyStyle" - latin:keyXPos="-11.172%p" - latin:keyWidth="fillRight" /> - </Row> - <Row> - <Key - latin:keyStyle="toMoreSymbolKeyStyle" - latin:keyWidth="11.172%p" /> - <Key - latin:keyLabel="," - latin:keyStyle="numKeyStyle" - latin:keyXPos="20.400%p" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="." - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyStyle="num4KeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyStyle="num5KeyStyle" /> - <Key - latin:keyStyle="num6KeyStyle" /> - <Key - latin:keyStyle="returnKeyStyle" - latin:keyXPos="-11.172%p" - latin:keyWidth="fillRight" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="20.400%p" /> - <Key - latin:keyLabel="(" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel=")" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyStyle="num7KeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyStyle="num8KeyStyle" /> - <Key - latin:keyStyle="num9KeyStyle" /> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </Row> - <Row> - <switch> - <case latin:hasSettingsKey="true"> - <Key - latin:keyStyle="settingsKeyStyle" - latin:keyWidth="8.047%p" /> - </case> - <default> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="8.047%p" /> - </default> - </switch> - <Key - latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" - latin:keyXPos="20.400%p" - latin:keyWidth="16.084%p" /> - <Key - latin:keyStyle="numStarKeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyStyle="num0KeyStyle" /> - <Key - latin:keyLabel="#" - latin:keyStyle="numKeyStyle" /> - <switch> - <case - latin:shortcutKeyEnabled="true" - > - <Key - latin:keyStyle="shortcutKeyStyle" - latin:keyXPos="-8.047%p" - latin:keyWidth="fillRight" /> - </case> - <default> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </default> - </switch> - </Row> + latin:keyboardLayout="@xml/kbd_rows_phone" /> </Keyboard> diff --git a/java/res/xml-sw768dp/kbd_phone_shift.xml b/java/res/xml-sw768dp/kbd_phone_shift.xml index 46f67d311..055d70cd2 100644 --- a/java/res/xml-sw768dp/kbd_phone_shift.xml +++ b/java/res/xml-sw768dp/kbd_phone_shift.xml @@ -23,136 +23,5 @@ latin:keyWidth="13.250%p" > <include - latin:keyboardLayout="@xml/kbd_key_styles" /> - <include - latin:keyboardLayout="@xml/kbd_numkey_styles" /> - <Row> - <Key - latin:keyStyle="tabKeyStyle" - latin:keyLabelOption="alignLeft" - latin:keyWidth="11.172%p" /> - <Key - latin:keyLabel="-" - latin:keyStyle="numKeyStyle" - latin:keyXPos="13.829%p" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="+" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:code="44" - latin:keyLabel="@string/label_pause_key" - latin:keyLabelOption="followKeyHintLabelRatio|autoXScale" - latin:keyWidth="8.047%p" /> - <Key - latin:keyStyle="num1KeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyStyle="num2KeyStyle" /> - <Key - latin:keyStyle="num3KeyStyle" /> - <Key - latin:keyStyle="deleteKeyStyle" - latin:keyXPos="-11.172%p" - latin:keyWidth="fillRight" /> - </Row> - <Row> - <Key - latin:keyStyle="backFromMoreSymbolKeyStyle" - latin:keyWidth="11.172%p" /> - <Key - latin:keyLabel="," - latin:keyStyle="numKeyStyle" - latin:keyXPos="13.829%p" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="." - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:code="59" - latin:keyLabel="@string/label_wait_key" - latin:keyLabelOption="followKeyHintLabelRatio|autoXScale" - latin:keyWidth="8.047%p" /> - <Key - latin:keyStyle="num4KeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyStyle="num5KeyStyle" /> - <Key - latin:keyStyle="num6KeyStyle" /> - <Key - latin:keyStyle="returnKeyStyle" - latin:keyXPos="-11.172%p" - latin:keyWidth="fillRight" /> - </Row> - <Row> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="13.829%p" /> - <Key - latin:keyLabel="(" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel=")" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyLabel="N" - latin:keyStyle="numKeyStyle" - latin:keyWidth="8.047%p" /> - <Key - latin:keyStyle="num7KeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyStyle="num8KeyStyle" /> - <Key - latin:keyStyle="num9KeyStyle" /> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </Row> - <Row> - <switch> - <case latin:hasSettingsKey="true"> - <Key - latin:keyStyle="settingsKeyStyle" - latin:keyWidth="8.047%p" /> - </case> - <default> - <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> - <Spacer - latin:keyWidth="8.047%p" /> - </default> - </switch> - <Key - latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" - latin:keyXPos="13.829%p" - latin:keyWidth="24.140%p" /> - <Key - latin:keyStyle="numStarKeyStyle" - latin:keyXPos="43.125%p" /> - <Key - latin:keyStyle="num0KeyStyle" /> - <Key - latin:keyLabel="#" - latin:keyStyle="numKeyStyle" /> - <switch> - <case - latin:shortcutKeyEnabled="true" - > - <Key - latin:keyStyle="shortcutKeyStyle" - latin:keyXPos="-8.047%p" - latin:keyWidth="fillRight" /> - </case> - <default> - <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> - <Spacer - latin:keyWidth="0%p" /> - </default> - </switch> - </Row> + latin:keyboardLayout="@xml/kbd_rows_phone_shift" /> </Keyboard> diff --git a/java/res/xml-sw768dp/kbd_rows_number.xml b/java/res/xml-sw768dp/kbd_rows_number.xml new file mode 100644 index 000000000..c6a4193c3 --- /dev/null +++ b/java/res/xml-sw768dp/kbd_rows_number.xml @@ -0,0 +1,227 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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" +> + <include + latin:keyboardLayout="@xml/kbd_key_styles" /> + <include + latin:keyboardLayout="@xml/kbd_numkey_styles" /> + <switch> + <case + latin:passwordInput="true" + > + <Row> + <Key + latin:keyStyle="numTabKeyStyle" + latin:keyLabelOption="alignLeft" + latin:keyWidth="11.172%p" /> + <Key + latin:keyStyle="num1KeyStyle" + latin:keyXPos="32.076%p" /> + <Key + latin:keyStyle="num2KeyStyle" /> + <Key + latin:keyStyle="num3KeyStyle" /> + <Key + latin:keyStyle="deleteKeyStyle" + latin:keyXPos="-11.172%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="32.076%p" /> + <Key + latin:keyStyle="num4KeyStyle" /> + <Key + latin:keyStyle="num5KeyStyle" /> + <Key + latin:keyStyle="num6KeyStyle" /> + <Key + latin:keyStyle="returnKeyStyle" + latin:keyXPos="-11.172%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="32.076%p" /> + <Key + latin:keyStyle="num7KeyStyle" /> + <Key + latin:keyStyle="num8KeyStyle" /> + <Key + latin:keyStyle="num9KeyStyle" /> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </Row> + <Row> + <Spacer + latin:keyXPos="32.076%p" /> + <Key + latin:keyStyle="num0KeyStyle" /> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </Row> + </case> + <!-- latin:passwordInput="false" --> + <default> + <Row> + <Key + latin:keyStyle="tabKeyStyle" + latin:keyLabelOption="alignLeft" + latin:keyWidth="11.172%p" /> + <Key + latin:keyLabel="-" + latin:keyStyle="numKeyStyle" + latin:keyXPos="13.829%p" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="+" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="." + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="1" + latin:keyStyle="numKeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyLabel="2" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyLabel="3" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyStyle="deleteKeyStyle" + latin:keyXPos="-11.172%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="13.829%p" /> + <Key + latin:keyStyle="numStarKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="/" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="," + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="4" + latin:keyStyle="numKeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyLabel="5" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyLabel="6" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyStyle="returnKeyStyle" + latin:keyXPos="-11.172%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="13.829%p" /> + <Key + latin:keyLabel="(" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel=")" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="=" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="7" + latin:keyStyle="numKeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyLabel="8" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyLabel="9" + latin:keyStyle="numKeyStyle" /> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </Row> + <Row> + <switch> + <case latin:hasSettingsKey="true"> + <Key + latin:keyStyle="settingsKeyStyle" + latin:keyWidth="8.047%p" /> + </case> + <default> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="8.047%p" /> + </default> + </switch> + <Key + latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" + latin:keyXPos="13.829%p" + latin:keyWidth="24.140%p" /> + <Key + latin:keyStyle="numStarKeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyLabel="0" + latin:keyStyle="numKeyStyle" /> + <Key + latin:keyLabel="#" + latin:keyStyle="numKeyStyle" /> + <switch> + <case + latin:shortcutKeyEnabled="true" + > + <Key + latin:keyStyle="shortcutKeyStyle" + latin:keyXPos="-8.047%p" + latin:keyWidth="fillRight" /> + </case> + <default> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </default> + </switch> + </Row> + </default> + </switch> +</merge> diff --git a/java/res/xml-sw768dp/kbd_rows_phone.xml b/java/res/xml-sw768dp/kbd_rows_phone.xml new file mode 100644 index 000000000..de363756e --- /dev/null +++ b/java/res/xml-sw768dp/kbd_rows_phone.xml @@ -0,0 +1,143 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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" +> + <include + latin:keyboardLayout="@xml/kbd_key_styles" /> + <include + latin:keyboardLayout="@xml/kbd_numkey_styles" /> + <Row> + <Key + latin:keyStyle="numTabKeyStyle" + latin:keyLabelOption="alignLeft" + latin:keyWidth="11.172%p" /> + <Key + latin:keyLabel="-" + latin:keyStyle="numKeyStyle" + latin:keyXPos="20.400%p" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="+" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyStyle="num1KeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyStyle="num2KeyStyle" /> + <Key + latin:keyStyle="num3KeyStyle" /> + <Key + latin:keyStyle="deleteKeyStyle" + latin:keyXPos="-11.172%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <Key + latin:keyStyle="toMoreSymbolKeyStyle" + latin:keyWidth="11.172%p" /> + <Key + latin:keyLabel="," + latin:keyStyle="numKeyStyle" + latin:keyXPos="20.400%p" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="." + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyStyle="num4KeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyStyle="num5KeyStyle" /> + <Key + latin:keyStyle="num6KeyStyle" /> + <Key + latin:keyStyle="returnKeyStyle" + latin:keyXPos="-11.172%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="20.400%p" /> + <Key + latin:keyLabel="(" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel=")" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyStyle="num7KeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyStyle="num8KeyStyle" /> + <Key + latin:keyStyle="num9KeyStyle" /> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </Row> + <Row> + <switch> + <case latin:hasSettingsKey="true"> + <Key + latin:keyStyle="settingsKeyStyle" + latin:keyWidth="8.047%p" /> + </case> + <default> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="8.047%p" /> + </default> + </switch> + <Key + latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" + latin:keyXPos="20.400%p" + latin:keyWidth="16.084%p" /> + <Key + latin:keyStyle="numStarKeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyStyle="num0KeyStyle" /> + <Key + latin:keyLabel="#" + latin:keyStyle="numKeyStyle" /> + <switch> + <case + latin:shortcutKeyEnabled="true" + > + <Key + latin:keyStyle="shortcutKeyStyle" + latin:keyXPos="-8.047%p" + latin:keyWidth="fillRight" /> + </case> + <default> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </default> + </switch> + </Row> +</merge> diff --git a/java/res/xml-sw768dp/kbd_rows_phone_shift.xml b/java/res/xml-sw768dp/kbd_rows_phone_shift.xml new file mode 100644 index 000000000..b59013d2e --- /dev/null +++ b/java/res/xml-sw768dp/kbd_rows_phone_shift.xml @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2011, 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" +> + <include + latin:keyboardLayout="@xml/kbd_key_styles" /> + <include + latin:keyboardLayout="@xml/kbd_numkey_styles" /> + <Row> + <Key + latin:keyStyle="numTabKeyStyle" + latin:keyLabelOption="alignLeft" + latin:keyWidth="11.172%p" /> + <Key + latin:keyLabel="-" + latin:keyStyle="numKeyStyle" + latin:keyXPos="13.829%p" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="+" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyStyle="numPauseKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyStyle="num1KeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyStyle="num2KeyStyle" /> + <Key + latin:keyStyle="num3KeyStyle" /> + <Key + latin:keyStyle="deleteKeyStyle" + latin:keyXPos="-11.172%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <Key + latin:keyStyle="backFromMoreSymbolKeyStyle" + latin:keyWidth="11.172%p" /> + <Key + latin:keyLabel="," + latin:keyStyle="numKeyStyle" + latin:keyXPos="13.829%p" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="." + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyStyle="numWaitKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyStyle="num4KeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyStyle="num5KeyStyle" /> + <Key + latin:keyStyle="num6KeyStyle" /> + <Key + latin:keyStyle="returnKeyStyle" + latin:keyXPos="-11.172%p" + latin:keyWidth="fillRight" /> + </Row> + <Row> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="13.829%p" /> + <Key + latin:keyLabel="(" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel=")" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyLabel="N" + latin:keyStyle="numKeyStyle" + latin:keyWidth="8.047%p" /> + <Key + latin:keyStyle="num7KeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyStyle="num8KeyStyle" /> + <Key + latin:keyStyle="num9KeyStyle" /> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </Row> + <Row> + <switch> + <case latin:hasSettingsKey="true"> + <Key + latin:keyStyle="settingsKeyStyle" + latin:keyWidth="8.047%p" /> + </case> + <default> + <!-- Note: This Spacer prevents the below key from being marked as a left edge key. --> + <Spacer + latin:keyWidth="8.047%p" /> + </default> + </switch> + <Key + latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle" + latin:keyXPos="13.829%p" + latin:keyWidth="24.140%p" /> + <Key + latin:keyStyle="numStarKeyStyle" + latin:keyXPos="43.125%p" /> + <Key + latin:keyStyle="num0KeyStyle" /> + <Key + latin:keyLabel="#" + latin:keyStyle="numKeyStyle" /> + <switch> + <case + latin:shortcutKeyEnabled="true" + > + <Key + latin:keyStyle="shortcutKeyStyle" + latin:keyXPos="-8.047%p" + latin:keyWidth="fillRight" /> + </case> + <default> + <!-- Note: This Spacer prevents the above key from being marked as a right edge key. --> + <Spacer + latin:keyWidth="0%p" /> + </default> + </switch> + </Row> +</merge> diff --git a/java/res/xml/kbd_key_styles.xml b/java/res/xml/kbd_key_styles.xml index 11b1abb2a..3b7c3db47 100644 --- a/java/res/xml/kbd_key_styles.xml +++ b/java/res/xml/kbd_key_styles.xml @@ -67,11 +67,13 @@ latin:code="@integer/key_shift" latin:keyIcon="iconShiftKey" latin:keyIconShifted="iconShiftedShiftKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="sticky" /> <key-style latin:styleName="deleteKeyStyle" latin:code="@integer/key_delete" latin:keyIcon="iconDeleteKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" latin:isRepeatable="true" /> <!-- Return key style --> @@ -96,7 +98,7 @@ latin:styleName="returnKeyStyle" latin:code="@integer/key_return" latin:keyLabel="@string/label_go_key" - latin:keyLabelOption="autoXScale" + latin:keyLabelOption="autoXScale|noKeyPreview" latin:backgroundType="action" /> </case> <case @@ -106,7 +108,7 @@ latin:styleName="returnKeyStyle" latin:code="@integer/key_return" latin:keyLabel="@string/label_next_key" - latin:keyLabelOption="autoXScale" + latin:keyLabelOption="autoXScale|noKeyPreview" latin:backgroundType="action" /> </case> <case @@ -116,7 +118,7 @@ latin:styleName="returnKeyStyle" latin:code="@integer/key_return" latin:keyLabel="@string/label_done_key" - latin:keyLabelOption="autoXScale" + latin:keyLabelOption="autoXScale|noKeyPreview" latin:backgroundType="action" /> </case> <case @@ -126,7 +128,7 @@ latin:styleName="returnKeyStyle" latin:code="@integer/key_return" latin:keyLabel="@string/label_send_key" - latin:keyLabelOption="autoXScale" + latin:keyLabelOption="autoXScale|noKeyPreview" latin:backgroundType="action" /> </case> <case @@ -136,6 +138,7 @@ latin:styleName="returnKeyStyle" latin:code="@integer/key_return" latin:keyIcon="iconSearchKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="action" /> </case> <default> @@ -143,24 +146,26 @@ latin:styleName="returnKeyStyle" latin:code="@integer/key_return" latin:keyIcon="iconReturnKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> </default> </switch> <key-style latin:styleName="spaceKeyStyle" latin:code="@integer/key_space" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="shortcutKeyStyle" latin:code="@integer/key_shortcut" latin:keyIcon="iconShortcutKey" - latin:keyIconPreview="iconPreviewShortcutKey" + latin:keyLabelOption="noKeyPreview" latin:parentStyle="f1PopupStyle" /> <key-style latin:styleName="settingsKeyStyle" latin:code="@integer/key_settings" latin:keyIcon="iconSettingsKey" - latin:keyIconPreview="iconPreviewSettingsKey" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="tabKeyStyle" @@ -188,7 +193,7 @@ latin:code="@integer/key_switch_alpha_symbol" latin:keyIcon="iconShortcutForLabel" latin:keyLabel="@string/label_to_symbol_with_microphone_key" - latin:keyLabelOption="withIconRight" + latin:keyLabelOption="withIconRight|noKeyPreview" latin:backgroundType="functional" /> </case> <default> @@ -196,6 +201,7 @@ latin:styleName="toSymbolKeyStyle" latin:code="@integer/key_switch_alpha_symbol" latin:keyLabel="@string/label_to_symbol_key" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> </default> </switch> @@ -203,16 +209,19 @@ latin:styleName="toAlphaKeyStyle" latin:code="@integer/key_switch_alpha_symbol" latin:keyLabel="@string/label_to_alpha_key" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="toMoreSymbolKeyStyle" latin:code="@integer/key_shift" latin:keyLabel="@string/label_to_more_symbol_key" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="backFromMoreSymbolKeyStyle" latin:code="@integer/key_shift" latin:keyLabel="@string/label_to_symbol_key" + latin:keyLabelOption="noKeyPreview" latin:backgroundType="functional" /> <key-style latin:styleName="punctuationKeyStyle" diff --git a/java/res/xml/kbd_numkey_styles.xml b/java/res/xml/kbd_numkey_styles.xml index 5d5439906..42c0f6488 100644 --- a/java/res/xml/kbd_numkey_styles.xml +++ b/java/res/xml/kbd_numkey_styles.xml @@ -22,15 +22,21 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" > <key-style + latin:styleName="numKeyBaseStyle" + latin:keyLabelOption="noKeyPreview" /> + <key-style latin:styleName="numKeyStyle" - latin:keyLabelOption="largeLetter|followKeyLetterRatio" /> + latin:keyLabelOption="largeLetter|followKeyLetterRatio" + latin:parentStyle="numKeyBaseStyle" /> <key-style latin:styleName="numModeKeyStyle" - latin:keyLabelOption="fontNormal|followKeyLetterRatio" /> + latin:keyLabelOption="fontNormal|followKeyLetterRatio" + latin:parentStyle="numKeyBaseStyle" /> <key-style latin:styleName="numFunctionalKeyStyle" latin:keyLabelOption="largeLetter|followKeyLetterRatio" - latin:backgroundType="functional" /> + latin:backgroundType="functional" + latin:parentStyle="numKeyBaseStyle" /> <key-style latin:styleName="numberKeyStyle" latin:keyLabelOption="alignLeftOfCenter|hasHintLabel" @@ -100,7 +106,24 @@ latin:keyLabel="@string/label_to_phone_numeric_key" latin:parentStyle="numModeKeyStyle" /> <key-style + latin:styleName="numPauseKeyStyle" + latin:code="44" + latin:keyLabel="@string/label_pause_key" + latin:keyLabelOption="followKeyHintLabelRatio|autoXScale" + latin:parentStyle="numKeyBaseStyle" /> + <key-style + latin:styleName="numWaitKeyStyle" + latin:code="59" + latin:keyLabel="@string/label_wait_key" + latin:keyLabelOption="followKeyHintLabelRatio|autoXScale" + latin:parentStyle="numKeyBaseStyle" /> + <key-style + latin:styleName="numTabKeyStyle" + latin:keyLabelOption="noKeyPreview" + latin:parentStyle="tabKeyStyle" /> + <key-style latin:styleName="numSpaceKeyStyle" latin:code="@integer/key_space" - latin:keyIcon="iconSpaceKey" /> + latin:keyIcon="iconSpaceKey" + latin:parentStyle="numKeyBaseStyle" /> </merge> diff --git a/java/res/xml/kbd_rows_phone_shift.xml b/java/res/xml/kbd_rows_phone_shift.xml index 3c283d3e6..b39e2da8d 100644 --- a/java/res/xml/kbd_rows_phone_shift.xml +++ b/java/res/xml/kbd_rows_phone_shift.xml @@ -42,13 +42,12 @@ </Row> <Row> <Key - latin:keyLabel="N" /> + latin:keyLabel="N" + latin:keyStyle="numKeyBaseStyle" /> <!-- Pause is a comma. Check PhoneNumberUtils.java to see if this has changed. --> <Key - latin:code="44" - latin:keyLabel="@string/label_pause_key" - latin:keyLabelOption="followKeyHintLabelRatio|autoXScale" /> + latin:keyStyle="numPauseKeyStyle" /> <Key latin:keyLabel="," latin:keyStyle="numKeyStyle" /> @@ -62,9 +61,7 @@ latin:keyStyle="numStarKeyStyle" /> <!-- Wait is a semicolon. --> <Key - latin:code="59" - latin:keyLabel="@string/label_wait_key" - latin:keyLabelOption="followKeyHintLabelRatio|autoXScale" /> + latin:keyStyle="numWaitKeyStyle" /> <Key latin:keyLabel="#" latin:keyStyle="numKeyStyle" /> diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index f2014b771..5fefea77d 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -67,6 +67,7 @@ public class Key { private static final int LABEL_OPTION_WITH_ICON_LEFT = 0x1000; private static final int LABEL_OPTION_WITH_ICON_RIGHT = 0x2000; private static final int LABEL_OPTION_AUTO_X_SCALE = 0x4000; + private static final int LABEL_OPTION_NO_KEY_PREVIEW = 0x8000; /** Icon to display instead of a label. Icon takes precedence over a label */ private Drawable mIcon; @@ -386,6 +387,10 @@ public class Key { return (mLabelOption & LABEL_OPTION_AUTO_X_SCALE) != 0; } + public boolean noKeyPreview() { + return (mLabelOption & LABEL_OPTION_NO_KEY_PREVIEW) != 0; + } + public Drawable getIcon() { return mIcon; } diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index a8bc74551..4a28bf1de 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -217,10 +217,6 @@ public class Keyboard { return mId.isPhoneKeyboard(); } - public boolean isNumberKeyboard() { - return mId.isNumberKeyboard(); - } - public CharSequence adjustLabelCase(CharSequence label) { if (isShiftedOrShiftLocked() && !TextUtils.isEmpty(label) && label.length() < 3 && Character.isLowerCase(label.charAt(0))) { diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index 2e4988fb0..cf0637124 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -133,10 +133,6 @@ public class KeyboardId { return mXmlId == R.xml.kbd_phone_shift; } - public boolean isNumberKeyboard() { - return mMode == MODE_NUMBER; - } - @Override public boolean equals(Object other) { return other instanceof KeyboardId && equals((KeyboardId) other); diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java index b09628b3d..abf24ead2 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java @@ -263,20 +263,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke return mKeyTimerHandler; } - @Override - public void setKeyPreviewPopupEnabled(boolean previewEnabled, int delay) { - final Keyboard keyboard = getKeyboard(); - if (keyboard instanceof LatinKeyboard) { - final LatinKeyboard latinKeyboard = (LatinKeyboard)keyboard; - if (latinKeyboard.isPhoneKeyboard() || latinKeyboard.isNumberKeyboard()) { - // Phone and number keyboard never shows popup preview. - super.setKeyPreviewPopupEnabled(false, delay); - return; - } - } - super.setKeyPreviewPopupEnabled(previewEnabled, delay); - } - /** * Attaches a keyboard to this view. The keyboard can be switched at any time and the * view will re-layout itself to accommodate the keyboard. diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index d5986aa32..a3ec37c1b 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -343,7 +343,7 @@ public class PointerTracker { private void setPressedKeyGraphics(int keyIndex) { final Key key = getKey(keyIndex); if (key != null && key.isEnabled()) { - if (isKeyPreviewRequired(key)) { + if (!key.noKeyPreview()) { mDrawingProxy.showKeyPreview(keyIndex, this); } key.onPressed(); @@ -351,15 +351,6 @@ public class PointerTracker { } } - // The modifier key, such as shift key, should not show its key preview. - private static boolean isKeyPreviewRequired(Key key) { - final int code = key.mCode; - if (isModifierCode(code) || code == Keyboard.CODE_DELETE - || code == Keyboard.CODE_ENTER || code == Keyboard.CODE_SPACE) - return false; - return true; - } - public int getLastX() { return mLastX; } diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java index 2d8b7bf11..faa5f86f2 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java @@ -42,10 +42,8 @@ public class KeyboardIconsSet { private static final int ICON_SHIFTED_SHIFT_KEY = 10; // This should be aligned with Keyboard.keyIconPreview enum. private static final int ICON_PREVIEW_TAB_KEY = 11; - private static final int ICON_PREVIEW_SETTINGS_KEY = 12; - private static final int ICON_PREVIEW_SHORTCUT_KEY = 13; - private static final int ICON_LAST = 13; + private static final int ICON_LAST = 11; private final Drawable mIcons[] = new Drawable[ICON_LAST + 1]; @@ -73,10 +71,6 @@ public class KeyboardIconsSet { return ICON_SHIFTED_SHIFT_KEY; case R.styleable.Keyboard_iconPreviewTabKey: return ICON_PREVIEW_TAB_KEY; - case R.styleable.Keyboard_iconPreviewSettingsKey: - return ICON_PREVIEW_SETTINGS_KEY; - case R.styleable.Keyboard_iconPreviewShortcutKey: - return ICON_PREVIEW_SHORTCUT_KEY; default: return ICON_UNDEFINED; } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 0db452dcb..049b316b1 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -193,7 +193,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private UserDictionary mUserDictionary; private UserBigramDictionary mUserBigramDictionary; private UserUnigramDictionary mUserUnigramDictionary; - private boolean mIsUserDictionaryAvaliable; + private boolean mIsUserDictionaryAvailable; // TODO: Create an inner class to group options and pseudo-options to improve readability. // These variables are initialized according to the {@link EditorInfo#inputType}. @@ -251,13 +251,40 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private static final int MSG_FADEOUT_LANGUAGE_ON_SPACEBAR = 3; private static final int MSG_DISMISS_LANGUAGE_ON_SPACEBAR = 4; private static final int MSG_SPACE_TYPED = 5; - private static final int MSG_SET_BIGRAM_PREDICTIONS = 6; - private static final int MSG_PENDING_IMS_CALLBACK = 7; + private static final int MSG_KEY_TYPED = 6; + private static final int MSG_SET_BIGRAM_PREDICTIONS = 7; + private static final int MSG_PENDING_IMS_CALLBACK = 8; + + private int mDelayBeforeFadeoutLanguageOnSpacebar; + private int mDelayUpdateSuggestions; + private int mDelayUpdateShiftState; + private int mDurationOfFadeoutLanguageOnSpacebar; + private float mFinalFadeoutFactorOfLanguageOnSpacebar; + private long mDoubleSpacesTurnIntoPeriodTimeout; + private long mIgnoreSpecialKeyTimeout; public UIHandler(LatinIME outerInstance) { super(outerInstance); } + public void onCreate() { + final Resources res = getOuterInstance().getResources(); + mDelayBeforeFadeoutLanguageOnSpacebar = res.getInteger( + R.integer.config_delay_before_fadeout_language_on_spacebar); + mDelayUpdateSuggestions = + res.getInteger(R.integer.config_delay_update_suggestions); + mDelayUpdateShiftState = + res.getInteger(R.integer.config_delay_update_shift_state); + mDurationOfFadeoutLanguageOnSpacebar = res.getInteger( + R.integer.config_duration_of_fadeout_language_on_spacebar); + mFinalFadeoutFactorOfLanguageOnSpacebar = res.getInteger( + R.integer.config_final_fadeout_percentage_of_language_on_spacebar) / 100.0f; + mDoubleSpacesTurnIntoPeriodTimeout = res.getInteger( + R.integer.config_double_spaces_turn_into_period_timeout); + mIgnoreSpecialKeyTimeout = res.getInteger( + R.integer.config_ignore_special_key_timeout); + } + @Override public void handleMessage(Message msg) { final LatinIME latinIme = getOuterInstance(); @@ -280,17 +307,15 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar case MSG_FADEOUT_LANGUAGE_ON_SPACEBAR: if (inputView != null) { inputView.setSpacebarTextFadeFactor( - (1.0f + latinIme.mSettingsValues. - mFinalFadeoutFactorOfLanguageOnSpacebar) / 2, + (1.0f + mFinalFadeoutFactorOfLanguageOnSpacebar) / 2, (LatinKeyboard)msg.obj); } sendMessageDelayed(obtainMessage(MSG_DISMISS_LANGUAGE_ON_SPACEBAR, msg.obj), - latinIme.mSettingsValues.mDurationOfFadeoutLanguageOnSpacebar); + mDurationOfFadeoutLanguageOnSpacebar); break; case MSG_DISMISS_LANGUAGE_ON_SPACEBAR: if (inputView != null) { - inputView.setSpacebarTextFadeFactor( - latinIme.mSettingsValues.mFinalFadeoutFactorOfLanguageOnSpacebar, + inputView.setSpacebarTextFadeFactor(mFinalFadeoutFactorOfLanguageOnSpacebar, (LatinKeyboard)msg.obj); } break; @@ -299,8 +324,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void postUpdateSuggestions() { removeMessages(MSG_UPDATE_SUGGESTIONS); - sendMessageDelayed(obtainMessage(MSG_UPDATE_SUGGESTIONS), - getOuterInstance().mSettingsValues.mDelayUpdateSuggestions); + sendMessageDelayed(obtainMessage(MSG_UPDATE_SUGGESTIONS), mDelayUpdateSuggestions); } public void cancelUpdateSuggestions() { @@ -313,8 +337,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void postUpdateShiftKeyState() { removeMessages(MSG_UPDATE_SHIFT_STATE); - sendMessageDelayed(obtainMessage(MSG_UPDATE_SHIFT_STATE), - getOuterInstance().mSettingsValues.mDelayUpdateShiftState); + sendMessageDelayed(obtainMessage(MSG_UPDATE_SHIFT_STATE), mDelayUpdateShiftState); } public void cancelUpdateShiftState() { @@ -323,8 +346,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public void postUpdateBigramPredictions() { removeMessages(MSG_SET_BIGRAM_PREDICTIONS); - sendMessageDelayed(obtainMessage(MSG_SET_BIGRAM_PREDICTIONS), - getOuterInstance().mSettingsValues.mDelayUpdateSuggestions); + sendMessageDelayed(obtainMessage(MSG_SET_BIGRAM_PREDICTIONS), mDelayUpdateSuggestions); } public void cancelUpdateBigramPredictions() { @@ -344,26 +366,24 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final LatinKeyboard keyboard = latinIme.mKeyboardSwitcher.getLatinKeyboard(); // The language is always displayed when the delay is negative. final boolean needsToDisplayLanguage = localeChanged - || latinIme.mSettingsValues.mDelayBeforeFadeoutLanguageOnSpacebar < 0; + || mDelayBeforeFadeoutLanguageOnSpacebar < 0; // The language is never displayed when the delay is zero. - if (latinIme.mSettingsValues.mDelayBeforeFadeoutLanguageOnSpacebar != 0) { + if (mDelayBeforeFadeoutLanguageOnSpacebar != 0) { inputView.setSpacebarTextFadeFactor(needsToDisplayLanguage ? 1.0f - : latinIme.mSettingsValues.mFinalFadeoutFactorOfLanguageOnSpacebar, + : mFinalFadeoutFactorOfLanguageOnSpacebar, keyboard); } // The fadeout animation will start when the delay is positive. - if (localeChanged - && latinIme.mSettingsValues.mDelayBeforeFadeoutLanguageOnSpacebar > 0) { + if (localeChanged && mDelayBeforeFadeoutLanguageOnSpacebar > 0) { sendMessageDelayed(obtainMessage(MSG_FADEOUT_LANGUAGE_ON_SPACEBAR, keyboard), - latinIme.mSettingsValues.mDelayBeforeFadeoutLanguageOnSpacebar); + mDelayBeforeFadeoutLanguageOnSpacebar); } } } public void startDoubleSpacesTimer() { removeMessages(MSG_SPACE_TYPED); - sendMessageDelayed(obtainMessage(MSG_SPACE_TYPED), - getOuterInstance().mSettingsValues.mDoubleSpacesTurnIntoPeriodTimeout); + sendMessageDelayed(obtainMessage(MSG_SPACE_TYPED), mDoubleSpacesTurnIntoPeriodTimeout); } public void cancelDoubleSpacesTimer() { @@ -374,6 +394,15 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return hasMessages(MSG_SPACE_TYPED); } + public void startKeyTypedTimer() { + removeMessages(MSG_KEY_TYPED); + sendMessageDelayed(obtainMessage(MSG_KEY_TYPED), mIgnoreSpecialKeyTimeout); + } + + public boolean isIgnoringSpecialKey() { + return hasMessages(MSG_KEY_TYPED); + } + // Working variables for the following methods. private boolean mIsOrientationChanging; private boolean mPendingSuccesiveImsCallback; @@ -480,6 +509,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mSubtypeSwitcher = SubtypeSwitcher.getInstance(); mKeyboardSwitcher = KeyboardSwitcher.getInstance(); mVibrator = VibratorCompatWrapper.getInstance(this); + mHandler.onCreate(); DEBUG = LatinImeLogger.sDBG; final Resources res = getResources(); @@ -552,7 +582,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mUserDictionary = new UserDictionary(this, localeStr); mSuggest.setUserDictionary(mUserDictionary); - mIsUserDictionaryAvaliable = mUserDictionary.isEnabled(); + mIsUserDictionaryAvailable = mUserDictionary.isEnabled(); resetContactsDictionary(oldContactsDictionary); @@ -1271,12 +1301,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // Implementation of {@link KeyboardActionListener}. @Override public void onCodeInput(int primaryCode, int[] keyCodes, int x, int y) { - long when = SystemClock.uptimeMillis(); + final long when = SystemClock.uptimeMillis(); if (primaryCode != Keyboard.CODE_DELETE || when > mLastKeyTime + QUICK_PRESS) { mDeleteCount = 0; } mLastKeyTime = when; - KeyboardSwitcher switcher = mKeyboardSwitcher; + final KeyboardSwitcher switcher = mKeyboardSwitcher; final boolean distinctMultiTouch = switcher.hasDistinctMultitouch(); // The space state depends only on the last character pressed and its own previous // state. Here, we revert the space state to neutral if the key is actually modifying @@ -1290,6 +1320,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mHandler.cancelDoubleSpacesTimer(); } + boolean shouldStartKeyTypedTimer = true; switch (primaryCode) { case Keyboard.CODE_DELETE: mSpaceState = SPACE_STATE_NONE; @@ -1300,13 +1331,17 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar break; case Keyboard.CODE_SHIFT: // Shift key is handled in onPress() when device has distinct multi-touch panel. - if (!distinctMultiTouch) + if (!distinctMultiTouch) { switcher.toggleShift(); + } + shouldStartKeyTypedTimer = false; break; case Keyboard.CODE_SWITCH_ALPHA_SYMBOL: // Symbol key is handled in onPress() when device has distinct multi-touch panel. - if (!distinctMultiTouch) + if (!distinctMultiTouch) { switcher.changeKeyboardMode(); + } + shouldStartKeyTypedTimer = false; break; case Keyboard.CODE_CANCEL: if (!isShowingOptionDialog()) { @@ -1314,14 +1349,20 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } break; case Keyboard.CODE_SETTINGS: - onSettingsKeyPressed(); + if (!mHandler.isIgnoringSpecialKey()) { + onSettingsKeyPressed(); + } + shouldStartKeyTypedTimer = false; break; case Keyboard.CODE_CAPSLOCK: switcher.toggleCapsLock(); hapticAndAudioFeedback(primaryCode); break; case Keyboard.CODE_SHORTCUT: - mSubtypeSwitcher.switchToShortcutIME(); + if (!mHandler.isIgnoringSpecialKey()) { + mSubtypeSwitcher.switchToShortcutIME(); + } + shouldStartKeyTypedTimer = false; break; case Keyboard.CODE_TAB: handleTab(); @@ -1347,6 +1388,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar switcher.onKey(primaryCode); // Reset after any single keystroke mEnteredText = null; + if (shouldStartKeyTypedTimer) { + mHandler.startKeyTypedTimer(); + } } @Override @@ -1363,6 +1407,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mKeyboardSwitcher.onKey(Keyboard.CODE_DUMMY); mSpaceState = SPACE_STATE_NONE; mEnteredText = text; + mHandler.startKeyTypedTimer(); } @Override @@ -1498,6 +1543,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mComposingStateManager.onFinishComposingText(); } } + if (code == Keyboard.CODE_SINGLE_QUOTE && !isCursorTouchingWord()) { + mHasUncommittedTypedChars = false; + } final KeyboardSwitcher switcher = mKeyboardSwitcher; if (switcher.isShiftedOrShiftLocked()) { if (keyCodes == null || keyCodes[0] < Character.MIN_CODE_POINT @@ -1770,7 +1818,15 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // a boolean flag. Right now this is handled with a slight hack in // WhitelistDictionary#shouldForciblyAutoCorrectFrom. final boolean allowsToBeAutoCorrected = AutoCorrection.allowsToBeAutoCorrected( - mSuggest.getUnigramDictionaries(), typedWord, preferCapitalization()); + mSuggest.getUnigramDictionaries(), + // If the typed string ends with a single quote, for dictionary lookup purposes + // we behave as if the single quote was not here. Here, we are looking up the + // typed string in the dictionary (to avoid autocorrecting from an existing + // word, so for consistency this lookup should be made WITHOUT the trailing + // single quote. + wordComposer.isLastCharASingleQuote() + ? typedWord.subSequence(0, typedWord.length() - 1) : typedWord, + preferCapitalization()); if (mCorrectionMode == Suggest.CORRECTION_FULL || mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) { autoCorrectionAvailable |= (!allowsToBeAutoCorrected); @@ -1946,7 +2002,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // take a noticeable delay to update them which may feel uneasy. } if (showingAddToDictionaryHint) { - if (mIsUserDictionaryAvaliable) { + if (mIsUserDictionaryAvailable) { mSuggestionsView.showAddToDictionaryHint( suggestion, mSettingsValues.mHintToSaveText); } else { diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java index 9d5d89071..e5a041f11 100644 --- a/java/src/com/android/inputmethod/latin/Settings.java +++ b/java/src/com/android/inputmethod/latin/Settings.java @@ -102,13 +102,7 @@ public class Settings extends InputMethodSettingsActivity public static class Values { // From resources: - public final int mDelayBeforeFadeoutLanguageOnSpacebar; - public final int mDelayUpdateSuggestions; public final int mDelayUpdateOldSuggestions; - public final int mDelayUpdateShiftState; - public final int mDurationOfFadeoutLanguageOnSpacebar; - public final float mFinalFadeoutFactorOfLanguageOnSpacebar; - public final long mDoubleSpacesTurnIntoPeriodTimeout; public final String mWordSeparators; public final String mMagicSpaceStrippers; public final String mMagicSpaceSwappers; @@ -148,20 +142,8 @@ public class Settings extends InputMethodSettingsActivity } // Get the resources - mDelayBeforeFadeoutLanguageOnSpacebar = res.getInteger( - R.integer.config_delay_before_fadeout_language_on_spacebar); - mDelayUpdateSuggestions = - res.getInteger(R.integer.config_delay_update_suggestions); mDelayUpdateOldSuggestions = res.getInteger( R.integer.config_delay_update_old_suggestions); - mDelayUpdateShiftState = - res.getInteger(R.integer.config_delay_update_shift_state); - mDurationOfFadeoutLanguageOnSpacebar = res.getInteger( - R.integer.config_duration_of_fadeout_language_on_spacebar); - mFinalFadeoutFactorOfLanguageOnSpacebar = res.getInteger( - R.integer.config_final_fadeout_percentage_of_language_on_spacebar) / 100.0f; - mDoubleSpacesTurnIntoPeriodTimeout = res.getInteger( - R.integer.config_double_spaces_turn_into_period_timeout); mMagicSpaceStrippers = res.getString(R.string.magic_space_stripping_symbols); mMagicSpaceSwappers = res.getString(R.string.magic_space_swapping_symbols); String wordSeparators = mMagicSpaceStrippers + mMagicSpaceSwappers diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 97e91745c..5a3c348a9 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -20,6 +20,7 @@ import android.content.Context; import android.text.TextUtils; import android.util.Log; +import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.ProximityInfo; import java.io.File; @@ -81,6 +82,8 @@ public class Suggest implements Dictionary.WordCallback { public static final String DICT_KEY_USER_BIGRAM = "user_bigram"; public static final String DICT_KEY_WHITELIST ="whitelist"; + private static String SINGLE_QUOTE_AS_STRING = String.valueOf((char)Keyboard.CODE_SINGLE_QUOTE); + private static final boolean DBG = LatinImeLogger.sDBG; private AutoCorrection mAutoCorrection; @@ -101,11 +104,12 @@ public class Suggest implements Dictionary.WordCallback { private ArrayList<CharSequence> mSuggestions = new ArrayList<CharSequence>(); ArrayList<CharSequence> mBigramSuggestions = new ArrayList<CharSequence>(); - private CharSequence mTypedWord; + private CharSequence mConsideredWord; // TODO: Remove these member variables by passing more context to addWord() callback method private boolean mIsFirstCharCapitalized; private boolean mIsAllUpperCase; + private boolean mIsLastCharASingleQuote; private int mCorrectionMode = CORRECTION_BASIC; @@ -295,17 +299,19 @@ public class Suggest implements Dictionary.WordCallback { mAutoCorrection.init(); mIsFirstCharCapitalized = wordComposer.isFirstCharCapitalized(); mIsAllUpperCase = wordComposer.isAllUpperCase(); + mIsLastCharASingleQuote = wordComposer.isLastCharASingleQuote(); collectGarbage(mSuggestions, mPrefMaxSuggestions); Arrays.fill(mScores, 0); - // Save a lowercase version of the original word - String typedWord = wordComposer.getTypedWord(); + final String typedWord = wordComposer.getTypedWord(); + final String consideredWord = mIsLastCharASingleQuote + ? typedWord.substring(0, typedWord.length() - 1) : typedWord; if (typedWord != null) { // Treating USER_TYPED as UNIGRAM suggestion for logging now. LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED, Dictionary.DataType.UNIGRAM); } - mTypedWord = typedWord; + mConsideredWord = consideredWord; if (wordComposer.size() <= 1 && (mCorrectionMode == CORRECTION_FULL_BIGRAM || mCorrectionMode == CORRECTION_BASIC)) { @@ -321,7 +327,7 @@ public class Suggest implements Dictionary.WordCallback { for (final Dictionary dictionary : mBigramDictionaries.values()) { dictionary.getBigrams(wordComposer, prevWordForBigram, this); } - if (TextUtils.isEmpty(typedWord)) { + if (TextUtils.isEmpty(consideredWord)) { // Nothing entered: return all bigrams for the previous word int insertCount = Math.min(mBigramSuggestions.size(), mPrefMaxSuggestions); for (int i = 0; i < insertCount; ++i) { @@ -330,7 +336,7 @@ public class Suggest implements Dictionary.WordCallback { } else { // Word entered: return only bigrams that match the first char of the typed word @SuppressWarnings("null") - final char currentChar = typedWord.charAt(0); + final char currentChar = consideredWord.charAt(0); // TODO: Must pay attention to locale when changing case. final char currentCharUpper = Character.toUpperCase(currentChar); int count = 0; @@ -354,24 +360,32 @@ public class Suggest implements Dictionary.WordCallback { if (key.equals(DICT_KEY_USER_UNIGRAM) || key.equals(DICT_KEY_WHITELIST)) continue; final Dictionary dictionary = mUnigramDictionaries.get(key); - dictionary.getWords(wordComposer, this, proximityInfo); + if (mIsLastCharASingleQuote) { + final WordComposer tmpWordComposer = new WordComposer(wordComposer); + tmpWordComposer.deleteLast(); + dictionary.getWords(tmpWordComposer, this, proximityInfo); + } else { + dictionary.getWords(wordComposer, this, proximityInfo); + } } } - final String typedWordString = typedWord == null ? null : typedWord.toString(); + final String consideredWordString = + consideredWord == null ? null : consideredWord.toString(); CharSequence whitelistedWord = capitalizeWord(mIsAllUpperCase, mIsFirstCharCapitalized, - mWhiteListDictionary.getWhitelistedWord(typedWordString)); + mWhiteListDictionary.getWhitelistedWord(consideredWordString)); mAutoCorrection.updateAutoCorrectionStatus(mUnigramDictionaries, wordComposer, - mSuggestions, mScores, typedWord, mAutoCorrectionThreshold, mCorrectionMode, + mSuggestions, mScores, consideredWord, mAutoCorrectionThreshold, mCorrectionMode, whitelistedWord); if (whitelistedWord != null) { - mSuggestions.add(0, whitelistedWord); + mSuggestions.add(0, mIsLastCharASingleQuote + ? whitelistedWord + SINGLE_QUOTE_AS_STRING : whitelistedWord); } if (typedWord != null) { - mSuggestions.add(0, typedWordString); + mSuggestions.add(0, typedWord.toString()); } Utils.removeDupes(mSuggestions); @@ -424,7 +438,7 @@ public class Suggest implements Dictionary.WordCallback { int pos = 0; // Check if it's the same word, only caps are different - if (Utils.equalsIgnoreCase(mTypedWord, word, offset, length)) { + if (Utils.equalsIgnoreCase(mConsideredWord, word, offset, length)) { // TODO: remove this surrounding if clause and move this logic to // getSuggestedWordBuilder. if (suggestions.size() > 0) { @@ -486,6 +500,9 @@ public class Suggest implements Dictionary.WordCallback { } else { sb.append(word, offset, length); } + if (mIsLastCharASingleQuote) { + sb.appendCodePoint(Keyboard.CODE_SINGLE_QUOTE); + } suggestions.add(pos, sb); if (suggestions.size() > prefMaxSuggestions) { final CharSequence garbage = suggestions.remove(prefMaxSuggestions); diff --git a/java/src/com/android/inputmethod/latin/UserDictionary.java b/java/src/com/android/inputmethod/latin/UserDictionary.java index 0bbbf3995..3e53bb0a3 100644 --- a/java/src/com/android/inputmethod/latin/UserDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserDictionary.java @@ -134,7 +134,11 @@ public class UserDictionary extends ExpandableDictionary { final Cursor cursor = getContext().getContentResolver() .query(Words.CONTENT_URI, PROJECTION_QUERY, request.toString(), requestArguments, null); - addWords(cursor); + try { + addWords(cursor); + } finally { + if (null != cursor) cursor.close(); + } } public boolean isEnabled() { @@ -242,6 +246,5 @@ public class UserDictionary extends ExpandableDictionary { cursor.moveToNext(); } } - cursor.close(); } } diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index 7f3a54244..612b16071 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -16,9 +16,11 @@ package com.android.inputmethod.latin; +import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.KeyDetector; import java.util.ArrayList; +import java.util.Arrays; /** * A place to store the currently composing word with information such as adjacent key codes as well @@ -41,7 +43,9 @@ public class WordComposer { private int mCapsCount; private boolean mAutoCapitalized; - + // Cache this value for performance + private boolean mIsLastCharASingleQuote; + /** * Whether the user chose to capitalize the first char of the word. */ @@ -53,6 +57,7 @@ public class WordComposer { mTypedWord = new StringBuilder(N); mXCoordinates = new int[N]; mYCoordinates = new int[N]; + mIsLastCharASingleQuote = false; } public WordComposer(WordComposer source) { @@ -62,11 +67,12 @@ public class WordComposer { public void init(WordComposer source) { mCodes = new ArrayList<int[]>(source.mCodes); mTypedWord = new StringBuilder(source.mTypedWord); - mXCoordinates = source.mXCoordinates; - mYCoordinates = source.mYCoordinates; + mXCoordinates = Arrays.copyOf(source.mXCoordinates, source.mXCoordinates.length); + mYCoordinates = Arrays.copyOf(source.mYCoordinates, source.mYCoordinates.length); mCapsCount = source.mCapsCount; mIsFirstCharCapitalized = source.mIsFirstCharCapitalized; mAutoCapitalized = source.mAutoCapitalized; + mIsLastCharASingleQuote = source.mIsLastCharASingleQuote; } /** @@ -77,6 +83,7 @@ public class WordComposer { mTypedWord.setLength(0); mCapsCount = 0; mIsFirstCharCapitalized = false; + mIsLastCharASingleQuote = false; } /** @@ -126,6 +133,7 @@ public class WordComposer { mIsFirstCharCapitalized = isFirstCharCapitalized( newIndex, primaryCode, mIsFirstCharCapitalized); if (Character.isUpperCase(primaryCode)) mCapsCount++; + mIsLastCharASingleQuote = Keyboard.CODE_SINGLE_QUOTE == primaryCode; } /** @@ -157,6 +165,10 @@ public class WordComposer { } if (size() == 0) { mIsFirstCharCapitalized = false; + mIsLastCharASingleQuote = false; + } else { + mIsLastCharASingleQuote = + Keyboard.CODE_SINGLE_QUOTE == mTypedWord.codePointAt(mTypedWord.length() - 1); } } @@ -179,6 +191,10 @@ public class WordComposer { return mIsFirstCharCapitalized; } + public boolean isLastCharASingleQuote() { + return mIsLastCharASingleQuote; + } + /** * Whether or not all of the user typed chars are upper case * @return true if all user typed chars are upper case, false otherwise |