Make F1 and Symbol keys static in XML file
Change-Id: If869f5ad4fe8f192f89a8679a4abde99a25e02e6main
parent
7c25ad473f
commit
04448c2978
|
@ -22,5 +22,4 @@
|
||||||
<bool name="default_popup_preview">false</bool>
|
<bool name="default_popup_preview">false</bool>
|
||||||
<bool name="config_enable_show_settings_key_option">false</bool>
|
<bool name="config_enable_show_settings_key_option">false</bool>
|
||||||
<bool name="config_dynamic_key_top_enter_key">false</bool>
|
<bool name="config_dynamic_key_top_enter_key">false</bool>
|
||||||
<bool name="config_dynamic_key_top_symbol_key">false</bool>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -149,7 +149,8 @@
|
||||||
<enum name="web" value="4" />
|
<enum name="web" value="4" />
|
||||||
<enum name="phone" value="5" />
|
<enum name="phone" value="5" />
|
||||||
</attr>
|
</attr>
|
||||||
<attr name="settingsKey" format="string" />
|
<attr name="hasSettingsKey" format="string" />
|
||||||
<attr name="voiceKey" format="string" />
|
<attr name="voiceKeyEnabled" format="string" />
|
||||||
|
<attr name="hasVoiceKey" format="string" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -32,5 +32,4 @@
|
||||||
<bool name="config_long_press_comma_for_settings_enabled">true</bool>
|
<bool name="config_long_press_comma_for_settings_enabled">true</bool>
|
||||||
<bool name="config_enable_show_settings_key_option">true</bool>
|
<bool name="config_enable_show_settings_key_option">true</bool>
|
||||||
<bool name="config_dynamic_key_top_enter_key">true</bool>
|
<bool name="config_dynamic_key_top_enter_key">true</bool>
|
||||||
<bool name="config_dynamic_key_top_symbol_key">true</bool>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -28,5 +28,4 @@
|
||||||
<!-- Keycode for F1 (function) key. This one switches between language switch & comma/.com -->
|
<!-- Keycode for F1 (function) key. This one switches between language switch & comma/.com -->
|
||||||
<integer name="key_settings">-100</integer>
|
<integer name="key_settings">-100</integer>
|
||||||
<integer name="key_voice">-102</integer>
|
<integer name="key_voice">-102</integer>
|
||||||
<integer name="key_f1">-103</integer>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<merge
|
||||||
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:mode="url"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:keyLabel="/"
|
||||||
|
latin:popupKeyboard="@xml/popup_slash"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</case>
|
||||||
|
<case
|
||||||
|
latin:mode="email"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:keyLabel="\@"
|
||||||
|
latin:popupKeyboard="@xml/popup_at"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</case>
|
||||||
|
<case
|
||||||
|
latin:hasVoiceKey="true"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_voice"
|
||||||
|
latin:popupKeyboard="@xml/popup_mic"
|
||||||
|
latin:keyIcon="@drawable/sym_bkeyboard_mic"
|
||||||
|
latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</case>
|
||||||
|
<default>
|
||||||
|
<Key
|
||||||
|
latin:keyLabel=","
|
||||||
|
latin:popupKeyboard="@xml/popup_comma"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
|
</merge>
|
|
@ -27,15 +27,12 @@
|
||||||
>
|
>
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="false"
|
latin:hasSettingsKey="false"
|
||||||
>
|
>
|
||||||
<Key
|
<include
|
||||||
latin:codes="@integer/key_symbol"
|
latin:keyboardLayout="@xml/kbd_qwerty_black_symbol" />
|
||||||
latin:keyLabel="@string/label_symbol_key"
|
<include
|
||||||
latin:keyWidth="20%p"
|
latin:keyboardLayout="@xml/kbd_qwerty_black_f1" />
|
||||||
latin:keyEdgeFlags="left" />
|
|
||||||
<Key
|
|
||||||
latin:codes="@integer/key_f1" />
|
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
latin:mode="web"
|
latin:mode="web"
|
||||||
|
@ -86,19 +83,16 @@
|
||||||
</switch>
|
</switch>
|
||||||
</case>
|
</case>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="true"
|
latin:hasSettingsKey="true"
|
||||||
>
|
>
|
||||||
<Key
|
<include
|
||||||
latin:codes="@integer/key_symbol"
|
latin:keyboardLayout="@xml/kbd_qwerty_black_symbol" />
|
||||||
latin:keyLabel="@string/label_symbol_key"
|
|
||||||
latin:keyWidth="15%p"
|
|
||||||
latin:keyEdgeFlags="left" />
|
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_settings"
|
latin:codes="@integer/key_settings"
|
||||||
latin:keyIcon="@drawable/sym_bkeyboard_settings"
|
latin:keyIcon="@drawable/sym_bkeyboard_settings"
|
||||||
latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
|
latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
|
||||||
<Key
|
<include
|
||||||
latin:codes="@integer/key_f1" />
|
latin:keyboardLayout="@xml/kbd_qwerty_black_f1" />
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
latin:mode="web"
|
latin:mode="web"
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<merge
|
||||||
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:hasSettingsKey="false"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<!-- When this qwerty keyboard has no voice key but voice key is enabled, then
|
||||||
|
symbol keyboard will have mic key. That means we should use "?123mic" key here.
|
||||||
|
-->
|
||||||
|
<case
|
||||||
|
latin:voiceKeyEnabled="true"
|
||||||
|
latin:hasVoiceKey="false"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_symbol"
|
||||||
|
latin:keyIcon="@drawable/sym_bkeyboard_123_mic"
|
||||||
|
latin:iconPreview="@drawable/sym_keyboard_feedback_123_mic"
|
||||||
|
latin:keyWidth="20%p"
|
||||||
|
latin:isModifier="true"
|
||||||
|
latin:keyEdgeFlags="left" />
|
||||||
|
</case>
|
||||||
|
<default>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_symbol"
|
||||||
|
latin:keyLabel="@string/label_symbol_key"
|
||||||
|
latin:keyWidth="20%p"
|
||||||
|
latin:isModifier="true"
|
||||||
|
latin:keyEdgeFlags="left" />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
|
</case>
|
||||||
|
<case
|
||||||
|
latin:hasSettingsKey="true"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<!-- When this qwerty keyboard has no voice key but voice key is enabled, then
|
||||||
|
symbol keyboard will have mic key. That means we should use "?123mic" key here.
|
||||||
|
-->
|
||||||
|
<case
|
||||||
|
latin:voiceKeyEnabled="true"
|
||||||
|
latin:hasVoiceKey="false"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_symbol"
|
||||||
|
latin:keyIcon="@drawable/sym_bkeyboard_123_mic"
|
||||||
|
latin:iconPreview="@drawable/sym_keyboard_feedback_123_mic"
|
||||||
|
latin:keyWidth="15%p"
|
||||||
|
latin:isModifier="true"
|
||||||
|
latin:keyEdgeFlags="left" />
|
||||||
|
</case>
|
||||||
|
<default>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_symbol"
|
||||||
|
latin:keyLabel="@string/label_symbol_key"
|
||||||
|
latin:keyWidth="15%p"
|
||||||
|
latin:isModifier="true"
|
||||||
|
latin:keyEdgeFlags="left" />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
|
</case>
|
||||||
|
</switch>
|
||||||
|
</merge>
|
|
@ -0,0 +1,62 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<merge
|
||||||
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:mode="url"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:keyLabel="/"
|
||||||
|
latin:popupKeyboard="@xml/popup_slash"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</case>
|
||||||
|
<case
|
||||||
|
latin:mode="email"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:keyLabel="\@"
|
||||||
|
latin:popupKeyboard="@xml/popup_at"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</case>
|
||||||
|
<case
|
||||||
|
latin:hasVoiceKey="true"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_voice"
|
||||||
|
latin:popupKeyboard="@xml/popup_mic"
|
||||||
|
latin:keyIcon="@drawable/sym_keyboard_mic"
|
||||||
|
latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</case>
|
||||||
|
<default>
|
||||||
|
<Key
|
||||||
|
latin:keyLabel=","
|
||||||
|
latin:popupKeyboard="@xml/popup_comma"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
|
</merge>
|
|
@ -27,17 +27,12 @@
|
||||||
>
|
>
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="false"
|
latin:hasSettingsKey="false"
|
||||||
>
|
>
|
||||||
<Key
|
<include
|
||||||
latin:codes="@integer/key_symbol"
|
latin:keyboardLayout="@xml/kbd_qwerty_symbol" />
|
||||||
latin:keyLabel="@string/label_symbol_key"
|
<include
|
||||||
latin:keyWidth="20%p"
|
latin:keyboardLayout="@xml/kbd_qwerty_f1" />
|
||||||
latin:isModifier="true"
|
|
||||||
latin:keyEdgeFlags="left" />
|
|
||||||
<Key
|
|
||||||
latin:codes="@integer/key_f1"
|
|
||||||
latin:isModifier="true" />
|
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
latin:mode="web"
|
latin:mode="web"
|
||||||
|
@ -94,22 +89,17 @@
|
||||||
</switch>
|
</switch>
|
||||||
</case>
|
</case>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="true"
|
latin:hasSettingsKey="true"
|
||||||
>
|
>
|
||||||
<Key
|
<include
|
||||||
latin:codes="@integer/key_symbol"
|
latin:keyboardLayout="@xml/kbd_qwerty_symbol" />
|
||||||
latin:keyLabel="@string/label_symbol_key"
|
|
||||||
latin:keyWidth="15%p"
|
|
||||||
latin:isModifier="true"
|
|
||||||
latin:keyEdgeFlags="left" />
|
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_settings"
|
latin:codes="@integer/key_settings"
|
||||||
latin:keyIcon="@drawable/sym_keyboard_settings"
|
latin:keyIcon="@drawable/sym_keyboard_settings"
|
||||||
latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
|
latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
|
||||||
latin:isModifier="true" />
|
latin:isModifier="true" />
|
||||||
<Key
|
<include
|
||||||
latin:codes="@integer/key_f1"
|
latin:keyboardLayout="@xml/kbd_qwerty_f1" />
|
||||||
latin:isModifier="true" />
|
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
latin:mode="web"
|
latin:mode="web"
|
||||||
|
@ -163,7 +153,7 @@
|
||||||
latin:keyWidth="15%p"
|
latin:keyWidth="15%p"
|
||||||
latin:isModifier="true"
|
latin:isModifier="true"
|
||||||
latin:keyEdgeFlags="right" />
|
latin:keyEdgeFlags="right" />
|
||||||
</case>
|
</case>
|
||||||
<default>
|
<default>
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_return"
|
latin:codes="@integer/key_return"
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<merge
|
||||||
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:hasSettingsKey="false"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<!-- When this qwerty keyboard has no voice key but voice key is enabled, then
|
||||||
|
symbol keyboard will have mic key. That means we should use "?123mic" key here.
|
||||||
|
-->
|
||||||
|
<case
|
||||||
|
latin:voiceKeyEnabled="true"
|
||||||
|
latin:hasVoiceKey="false"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_symbol"
|
||||||
|
latin:keyIcon="@drawable/sym_keyboard_123_mic"
|
||||||
|
latin:iconPreview="@drawable/sym_keyboard_feedback_123_mic"
|
||||||
|
latin:keyWidth="20%p"
|
||||||
|
latin:isModifier="true"
|
||||||
|
latin:keyEdgeFlags="left" />
|
||||||
|
</case>
|
||||||
|
<default>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_symbol"
|
||||||
|
latin:keyLabel="@string/label_symbol_key"
|
||||||
|
latin:keyWidth="20%p"
|
||||||
|
latin:isModifier="true"
|
||||||
|
latin:keyEdgeFlags="left" />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
|
</case>
|
||||||
|
<case
|
||||||
|
latin:hasSettingsKey="true"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<!-- When this qwerty keyboard has no voice key but voice key is enabled, then
|
||||||
|
symbol keyboard will have mic key. That means we should use "?123mic" key here.
|
||||||
|
-->
|
||||||
|
<case
|
||||||
|
latin:voiceKeyEnabled="true"
|
||||||
|
latin:hasVoiceKey="false"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_symbol"
|
||||||
|
latin:keyIcon="@drawable/sym_keyboard_123_mic"
|
||||||
|
latin:iconPreview="@drawable/sym_keyboard_feedback_123_mic"
|
||||||
|
latin:keyWidth="15%p"
|
||||||
|
latin:isModifier="true"
|
||||||
|
latin:keyEdgeFlags="left" />
|
||||||
|
</case>
|
||||||
|
<default>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_symbol"
|
||||||
|
latin:keyLabel="@string/label_symbol_key"
|
||||||
|
latin:keyWidth="15%p"
|
||||||
|
latin:isModifier="true"
|
||||||
|
latin:keyEdgeFlags="left" />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
|
</case>
|
||||||
|
</switch>
|
||||||
|
</merge>
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<merge
|
||||||
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:hasVoiceKey="true"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_voice"
|
||||||
|
latin:popupKeyboard="@xml/popup_mic"
|
||||||
|
latin:keyIcon="@drawable/sym_bkeyboard_mic"
|
||||||
|
latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</case>
|
||||||
|
<case
|
||||||
|
latin:hasVoiceKey="false"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:keyLabel=","
|
||||||
|
latin:popupKeyboard="@xml/popup_comma"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</case>
|
||||||
|
</switch>
|
||||||
|
</merge>
|
|
@ -26,15 +26,15 @@
|
||||||
>
|
>
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="false"
|
latin:hasSettingsKey="false"
|
||||||
>
|
>
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_symbol"
|
latin:codes="@integer/key_symbol"
|
||||||
latin:keyLabel="@string/label_alpha_key"
|
latin:keyLabel="@string/label_alpha_key"
|
||||||
latin:keyWidth="20%p"
|
latin:keyWidth="20%p"
|
||||||
latin:keyEdgeFlags="left" />
|
latin:keyEdgeFlags="left" />
|
||||||
<Key
|
<include
|
||||||
latin:codes="@integer/key_f1" />
|
latin:keyboardLayout="@xml/kbd_symbols_black_f1" />
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_space"
|
latin:codes="@integer/key_space"
|
||||||
latin:keyIcon="@drawable/sym_bkeyboard_space"
|
latin:keyIcon="@drawable/sym_bkeyboard_space"
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
</switch>
|
</switch>
|
||||||
</case>
|
</case>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="true"
|
latin:hasSettingsKey="true"
|
||||||
>
|
>
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_symbol"
|
latin:codes="@integer/key_symbol"
|
||||||
|
@ -78,8 +78,8 @@
|
||||||
latin:codes="@integer/key_settings"
|
latin:codes="@integer/key_settings"
|
||||||
latin:keyIcon="@drawable/sym_bkeyboard_settings"
|
latin:keyIcon="@drawable/sym_bkeyboard_settings"
|
||||||
latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
|
latin:iconPreview="@drawable/sym_keyboard_feedback_settings" />
|
||||||
<Key
|
<include
|
||||||
latin:codes="@integer/key_f1" />
|
latin:keyboardLayout="@xml/kbd_symbols_black_f1" />
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_space"
|
latin:codes="@integer/key_space"
|
||||||
latin:keyIcon="@drawable/sym_bkeyboard_space"
|
latin:keyIcon="@drawable/sym_bkeyboard_space"
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<merge
|
||||||
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:hasVoiceKey="true"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:codes="@integer/key_voice"
|
||||||
|
latin:popupKeyboard="@xml/popup_mic"
|
||||||
|
latin:keyIcon="@drawable/sym_keyboard_mic"
|
||||||
|
latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</case>
|
||||||
|
<case
|
||||||
|
latin:hasVoiceKey="false"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:keyLabel=","
|
||||||
|
latin:popupKeyboard="@xml/popup_comma"
|
||||||
|
latin:keyHintIcon="@drawable/hint_popup"
|
||||||
|
latin:isModifier="true" />
|
||||||
|
</case>
|
||||||
|
</switch>
|
||||||
|
</merge>
|
|
@ -26,7 +26,7 @@
|
||||||
>
|
>
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="false"
|
latin:hasSettingsKey="false"
|
||||||
>
|
>
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_symbol"
|
latin:codes="@integer/key_symbol"
|
||||||
|
@ -34,9 +34,8 @@
|
||||||
latin:keyWidth="20%p"
|
latin:keyWidth="20%p"
|
||||||
latin:isModifier="true"
|
latin:isModifier="true"
|
||||||
latin:keyEdgeFlags="left" />
|
latin:keyEdgeFlags="left" />
|
||||||
<Key
|
<include
|
||||||
latin:codes="@integer/key_f1"
|
latin:keyboardLayout="@xml/kbd_symbols_f1" />
|
||||||
latin:isModifier="true" />
|
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_space"
|
latin:codes="@integer/key_space"
|
||||||
latin:keyIcon="@drawable/sym_keyboard_space"
|
latin:keyIcon="@drawable/sym_keyboard_space"
|
||||||
|
@ -73,7 +72,7 @@
|
||||||
</switch>
|
</switch>
|
||||||
</case>
|
</case>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="true"
|
latin:hasSettingsKey="true"
|
||||||
>
|
>
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_symbol"
|
latin:codes="@integer/key_symbol"
|
||||||
|
@ -86,9 +85,8 @@
|
||||||
latin:keyIcon="@drawable/sym_keyboard_settings"
|
latin:keyIcon="@drawable/sym_keyboard_settings"
|
||||||
latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
|
latin:iconPreview="@drawable/sym_keyboard_feedback_settings"
|
||||||
latin:isModifier="true" />
|
latin:isModifier="true" />
|
||||||
<Key
|
<include
|
||||||
latin:codes="@integer/key_f1"
|
latin:keyboardLayout="@xml/kbd_symbols_f1" />
|
||||||
latin:isModifier="true" />
|
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_space"
|
latin:codes="@integer/key_space"
|
||||||
latin:keyIcon="@drawable/sym_keyboard_space"
|
latin:keyIcon="@drawable/sym_keyboard_space"
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
>
|
>
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="false"
|
latin:hasSettingsKey="false"
|
||||||
>
|
>
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_symbol"
|
latin:codes="@integer/key_symbol"
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
</switch>
|
</switch>
|
||||||
</case>
|
</case>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="true"
|
latin:hasSettingsKey="true"
|
||||||
>
|
>
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_symbol"
|
latin:codes="@integer/key_symbol"
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
>
|
>
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="false"
|
latin:hasSettingsKey="false"
|
||||||
>
|
>
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_symbol"
|
latin:codes="@integer/key_symbol"
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
</switch>
|
</switch>
|
||||||
</case>
|
</case>
|
||||||
<case
|
<case
|
||||||
latin:settingsKey="true"
|
latin:hasSettingsKey="true"
|
||||||
>
|
>
|
||||||
<Key
|
<Key
|
||||||
latin:codes="@integer/key_symbol"
|
latin:codes="@integer/key_symbol"
|
||||||
|
|
|
@ -107,7 +107,6 @@ import java.util.List;
|
||||||
public class BaseKeyboardParser {
|
public class BaseKeyboardParser {
|
||||||
private static final String TAG = "BaseKeyboardParser";
|
private static final String TAG = "BaseKeyboardParser";
|
||||||
private static final boolean DEBUG_TAG = false;
|
private static final boolean DEBUG_TAG = false;
|
||||||
private static final boolean DEBUG_PARSER = false;
|
|
||||||
|
|
||||||
// Keyboard XML Tags
|
// Keyboard XML Tags
|
||||||
private static final String TAG_KEYBOARD = "Keyboard";
|
private static final String TAG_KEYBOARD = "Keyboard";
|
||||||
|
@ -144,7 +143,6 @@ public class BaseKeyboardParser {
|
||||||
|
|
||||||
public void parseKeyboard(XmlResourceParser parser)
|
public void parseKeyboard(XmlResourceParser parser)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseKeyboard", false);
|
|
||||||
int event;
|
int event;
|
||||||
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
|
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
|
||||||
if (event == XmlResourceParser.START_TAG) {
|
if (event == XmlResourceParser.START_TAG) {
|
||||||
|
@ -159,7 +157,6 @@ public class BaseKeyboardParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DEBUG_PARSER) debugLeaveMethod("parseKeyboard", false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseKeyboardAttributes(XmlResourceParser parser) {
|
private void parseKeyboardAttributes(XmlResourceParser parser) {
|
||||||
|
@ -181,7 +178,6 @@ public class BaseKeyboardParser {
|
||||||
|
|
||||||
private void parseKeyboardContent(XmlResourceParser parser, List<Key> keys)
|
private void parseKeyboardContent(XmlResourceParser parser, List<Key> keys)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseKeyboardContent", keys == null);
|
|
||||||
int event;
|
int event;
|
||||||
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
|
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
|
||||||
if (event == XmlResourceParser.START_TAG) {
|
if (event == XmlResourceParser.START_TAG) {
|
||||||
|
@ -214,12 +210,10 @@ public class BaseKeyboardParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DEBUG_PARSER) debugLeaveMethod("parseKeyboardContent", keys == null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseRowContent(XmlResourceParser parser, Row row, List<Key> keys)
|
private void parseRowContent(XmlResourceParser parser, Row row, List<Key> keys)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseRowContent", keys == null);
|
|
||||||
int event;
|
int event;
|
||||||
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
|
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
|
||||||
if (event == XmlResourceParser.START_TAG) {
|
if (event == XmlResourceParser.START_TAG) {
|
||||||
|
@ -252,12 +246,10 @@ public class BaseKeyboardParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DEBUG_PARSER) debugLeaveMethod("parseRowContent", keys == null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseKey(XmlResourceParser parser, Row row, List<Key> keys)
|
private void parseKey(XmlResourceParser parser, Row row, List<Key> keys)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseKey", keys == null);
|
|
||||||
if (keys == null) {
|
if (keys == null) {
|
||||||
checkEndTag(TAG_KEY, parser);
|
checkEndTag(TAG_KEY, parser);
|
||||||
} else {
|
} else {
|
||||||
|
@ -272,7 +264,6 @@ public class BaseKeyboardParser {
|
||||||
|
|
||||||
private void parseSpacer(XmlResourceParser parser, List<Key> keys)
|
private void parseSpacer(XmlResourceParser parser, List<Key> keys)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseSpacer", keys == null);
|
|
||||||
if (keys == null) {
|
if (keys == null) {
|
||||||
checkEndTag(TAG_SPACER, parser);
|
checkEndTag(TAG_SPACER, parser);
|
||||||
} else {
|
} else {
|
||||||
|
@ -288,16 +279,12 @@ public class BaseKeyboardParser {
|
||||||
|
|
||||||
private void parseIncludeKeyboardContent(XmlResourceParser parser, List<Key> keys)
|
private void parseIncludeKeyboardContent(XmlResourceParser parser, List<Key> keys)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseIncludeKeyboardContent", keys == null);
|
|
||||||
parseIncludeInternal(parser, null, keys);
|
parseIncludeInternal(parser, null, keys);
|
||||||
if (DEBUG_PARSER) debugLeaveMethod("parseIncludeKeyboardContent", keys == null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseIncludeRowContent(XmlResourceParser parser, Row row, List<Key> keys)
|
private void parseIncludeRowContent(XmlResourceParser parser, Row row, List<Key> keys)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseIncludeRowContent", keys == null);
|
|
||||||
parseIncludeInternal(parser, row, keys);
|
parseIncludeInternal(parser, row, keys);
|
||||||
if (DEBUG_PARSER) debugLeaveMethod("parseIncludeRowContent", keys == null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseIncludeInternal(XmlResourceParser parser, Row row, List<Key> keys)
|
private void parseIncludeInternal(XmlResourceParser parser, Row row, List<Key> keys)
|
||||||
|
@ -320,7 +307,6 @@ public class BaseKeyboardParser {
|
||||||
|
|
||||||
private void parseMerge(XmlResourceParser parser, Row row, List<Key> keys)
|
private void parseMerge(XmlResourceParser parser, Row row, List<Key> keys)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseMerge", keys == null);
|
|
||||||
int event;
|
int event;
|
||||||
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
|
while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) {
|
||||||
if (event == XmlResourceParser.START_TAG) {
|
if (event == XmlResourceParser.START_TAG) {
|
||||||
|
@ -339,21 +325,16 @@ public class BaseKeyboardParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DEBUG_PARSER) debugLeaveMethod("parseMerge", keys == null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseSwitchKeyboardContent(XmlResourceParser parser, List<Key> keys)
|
private void parseSwitchKeyboardContent(XmlResourceParser parser, List<Key> keys)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseSwitchKeyboardContent", keys == null);
|
|
||||||
parseSwitchInternal(parser, null, keys);
|
parseSwitchInternal(parser, null, keys);
|
||||||
if (DEBUG_PARSER) debugLeaveMethod("parseSwitchKeyboardContent", keys == null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseSwitchRowContent(XmlResourceParser parser, Row row, List<Key> keys)
|
private void parseSwitchRowContent(XmlResourceParser parser, Row row, List<Key> keys)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseSwitchRowContent", keys == null);
|
|
||||||
parseSwitchInternal(parser, row, keys);
|
parseSwitchInternal(parser, row, keys);
|
||||||
if (DEBUG_PARSER) debugLeaveMethod("parseSwitchRowContent", keys == null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseSwitchInternal(XmlResourceParser parser, Row row, List<Key> keys)
|
private void parseSwitchInternal(XmlResourceParser parser, Row row, List<Key> keys)
|
||||||
|
@ -386,7 +367,6 @@ public class BaseKeyboardParser {
|
||||||
|
|
||||||
private boolean parseCase(XmlResourceParser parser, Row row, List<Key> keys)
|
private boolean parseCase(XmlResourceParser parser, Row row, List<Key> keys)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseCase", keys == null);
|
|
||||||
final boolean selected = parseCaseCondition(parser);
|
final boolean selected = parseCaseCondition(parser);
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
// Processing Rows.
|
// Processing Rows.
|
||||||
|
@ -395,46 +375,67 @@ public class BaseKeyboardParser {
|
||||||
// Processing Keys.
|
// Processing Keys.
|
||||||
parseRowContent(parser, row, selected ? keys : null);
|
parseRowContent(parser, row, selected ? keys : null);
|
||||||
}
|
}
|
||||||
if (DEBUG_PARSER) debugLeaveMethod("parseCase", keys == null || !selected);
|
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean parseCaseCondition(XmlResourceParser parser) {
|
private boolean parseCaseCondition(XmlResourceParser parser) {
|
||||||
final BaseKeyboard keyboard = mKeyboard;
|
final KeyboardId id = mKeyboard.mId;
|
||||||
final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser),
|
|
||||||
R.styleable.BaseKeyboard_Case);
|
|
||||||
final int mode = a.getInt(R.styleable.BaseKeyboard_Case_mode, -1);
|
|
||||||
final String settingsKey = a.getString(R.styleable.BaseKeyboard_Case_settingsKey);
|
|
||||||
final String voiceKey = a.getString(R.styleable.BaseKeyboard_Case_voiceKey);
|
|
||||||
a.recycle();
|
|
||||||
|
|
||||||
final KeyboardId id = keyboard.mId;
|
|
||||||
if (id == null)
|
if (id == null)
|
||||||
return true;
|
return true;
|
||||||
final boolean modeMatched = (mode == -1 || id.mMode == mode);
|
|
||||||
final boolean settingsKeyMatched = (settingsKey == null
|
final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser),
|
||||||
|| id.mHasSettingsKey == Boolean.parseBoolean(settingsKey));
|
R.styleable.BaseKeyboard_Case);
|
||||||
final boolean voiceKeyMatched = (voiceKey == null
|
try {
|
||||||
|| id.mHasVoiceKey == Boolean.parseBoolean(voiceKey));
|
final boolean modeMatched = matchInteger(
|
||||||
final boolean selected = modeMatched && settingsKeyMatched && voiceKeyMatched;
|
a, R.styleable.BaseKeyboard_Case_mode, id.mMode);
|
||||||
if (DEBUG_TAG) {
|
final boolean settingsKeyMatched = matchBoolean(
|
||||||
|
a, R.styleable.BaseKeyboard_Case_hasSettingsKey, id.mHasSettingsKey);
|
||||||
|
final boolean voiceEnabledMatched = matchBoolean(
|
||||||
|
a, R.styleable.BaseKeyboard_Case_voiceKeyEnabled, id.mVoiceKeyEnabled);
|
||||||
|
final boolean voiceKeyMatched = matchBoolean(
|
||||||
|
a, R.styleable.BaseKeyboard_Case_hasVoiceKey, id.mHasVoiceKey);
|
||||||
|
|
||||||
|
final boolean selected = modeMatched && settingsKeyMatched
|
||||||
|
&& voiceEnabledMatched && voiceKeyMatched;
|
||||||
|
|
||||||
|
if (DEBUG_TAG) {
|
||||||
Log.d(TAG, "parseCaseCondition: " + Boolean.toString(selected).toUpperCase()
|
Log.d(TAG, "parseCaseCondition: " + Boolean.toString(selected).toUpperCase()
|
||||||
+ (mode != -1 ? " mode=" + mode : "")
|
+ debugInteger(a,
|
||||||
+ (settingsKey != null ? " settingsKey="+settingsKey : "")
|
R.styleable.BaseKeyboard_Case_mode, "mode")
|
||||||
+ (voiceKey != null ? " voiceKey=" + voiceKey : ""));
|
+ debugBoolean(a,
|
||||||
|
R.styleable.BaseKeyboard_Case_hasSettingsKey, "hasSettingsKey")
|
||||||
|
+ debugBoolean(a,
|
||||||
|
R.styleable.BaseKeyboard_Case_voiceKeyEnabled, "voiceKeyEnabled")
|
||||||
|
+ debugBoolean(a,
|
||||||
|
R.styleable.BaseKeyboard_Case_hasVoiceKey, "hasVoiceKey")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return selected;
|
||||||
|
} finally {
|
||||||
|
a.recycle();
|
||||||
}
|
}
|
||||||
return selected;
|
}
|
||||||
|
|
||||||
|
private static boolean matchInteger(TypedArray a, int index, int value) {
|
||||||
|
// If <case> does not have "index" attribute, that means this <case> is wild-card for the
|
||||||
|
// attribute.
|
||||||
|
return !a.hasValue(index) || a.getInt(index, 0) == value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean matchBoolean(TypedArray a, int index, boolean value) {
|
||||||
|
// If <case> does not have "index" attribute, that means this <case> is wild-card for the
|
||||||
|
// attribute.
|
||||||
|
return !a.hasValue(index) || a.getBoolean(index, false) == value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean parseDefault(XmlResourceParser parser, Row row, List<Key> keys)
|
private boolean parseDefault(XmlResourceParser parser, Row row, List<Key> keys)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG_PARSER) debugEnterMethod("parseDefault", keys == null);
|
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
parseKeyboardContent(parser, keys);
|
parseKeyboardContent(parser, keys);
|
||||||
} else {
|
} else {
|
||||||
parseRowContent(parser, row, keys);
|
parseRowContent(parser, row, keys);
|
||||||
}
|
}
|
||||||
if (DEBUG_PARSER) debugLeaveMethod("parseDefault", keys == null);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,14 +513,6 @@ public class BaseKeyboardParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void debugEnterMethod(String title, boolean skip) {
|
|
||||||
Log.d(TAG, title + ": enter" + (skip ? " skip" : ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void debugLeaveMethod(String title, boolean skip) {
|
|
||||||
Log.d(TAG, title + ": leave" + (skip ? " skip" : ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void debugStartTag(String title, String tag, boolean skip) {
|
private static void debugStartTag(String title, String tag, boolean skip) {
|
||||||
Log.d(TAG, title + ": <" + tag + ">" + (skip ? " skip" : ""));
|
Log.d(TAG, title + ": <" + tag + ">" + (skip ? " skip" : ""));
|
||||||
}
|
}
|
||||||
|
@ -527,4 +520,12 @@ public class BaseKeyboardParser {
|
||||||
private static void debugEndTag(String title, String tag, boolean skip) {
|
private static void debugEndTag(String title, String tag, boolean skip) {
|
||||||
Log.d(TAG, title + ": </" + tag + ">" + (skip ? " skip" : ""));
|
Log.d(TAG, title + ": </" + tag + ">" + (skip ? " skip" : ""));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private static String debugInteger(TypedArray a, int index, String name) {
|
||||||
|
return a.hasValue(index) ? name + "=" + a.getInt(index, 0) : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String debugBoolean(TypedArray a, int index, String name) {
|
||||||
|
return a.hasValue(index) ? name + "=" + a.getBoolean(index, false) : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
/** mIsAutoCompletionActive indicates that auto completed word will be input instead of
|
/** mIsAutoCompletionActive indicates that auto completed word will be input instead of
|
||||||
* what user actually typed. */
|
* what user actually typed. */
|
||||||
private boolean mIsAutoCompletionActive;
|
private boolean mIsAutoCompletionActive;
|
||||||
private boolean mVoiceButtonEnabled;
|
private boolean mVoiceKeyEnabled;
|
||||||
private boolean mVoiceButtonOnPrimary;
|
private boolean mVoiceButtonOnPrimary;
|
||||||
private int mSymbolsModeState = SYMBOLS_MODE_STATE_NONE;
|
private int mSymbolsModeState = SYMBOLS_MODE_STATE_NONE;
|
||||||
|
|
||||||
|
@ -139,12 +139,13 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
final int mode = mMode;
|
final int mode = mMode;
|
||||||
final int colorScheme = getCharColorId();
|
final int colorScheme = getCharColorId();
|
||||||
final boolean hasSettingsKey = mHasSettingsKey;
|
final boolean hasSettingsKey = mHasSettingsKey;
|
||||||
final boolean hasVoiceKey = mVoiceButtonEnabled && !mVoiceButtonOnPrimary;
|
final boolean voiceKeyEnabled = mVoiceKeyEnabled;
|
||||||
|
final boolean hasVoiceKey = voiceKeyEnabled && !mVoiceButtonOnPrimary;
|
||||||
final int imeOptions = mImeOptions;
|
final int imeOptions = mImeOptions;
|
||||||
mSymbolsId = new KeyboardId(locale, orientation, mode,
|
mSymbolsId = new KeyboardId(locale, orientation, mode, KBD_SYMBOLS,
|
||||||
KBD_SYMBOLS, colorScheme, hasSettingsKey, hasVoiceKey, imeOptions, true);
|
colorScheme, hasSettingsKey, voiceKeyEnabled, hasVoiceKey, imeOptions, true);
|
||||||
mSymbolsShiftedId = new KeyboardId(locale, orientation, mode,
|
mSymbolsShiftedId = new KeyboardId(locale, orientation, mode, KBD_SYMBOLS_SHIFT,
|
||||||
KBD_SYMBOLS_SHIFT, colorScheme, hasSettingsKey, hasVoiceKey, imeOptions, true);
|
colorScheme, hasSettingsKey, voiceKeyEnabled, hasVoiceKey, imeOptions, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,6 +159,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
public final int[] mXmlArray;
|
public final int[] mXmlArray;
|
||||||
public final int mColorScheme;
|
public final int mColorScheme;
|
||||||
public final boolean mHasSettingsKey;
|
public final boolean mHasSettingsKey;
|
||||||
|
public final boolean mVoiceKeyEnabled;
|
||||||
public final boolean mHasVoiceKey;
|
public final boolean mHasVoiceKey;
|
||||||
public final int mImeOptions;
|
public final int mImeOptions;
|
||||||
public final boolean mEnableShiftLock;
|
public final boolean mEnableShiftLock;
|
||||||
|
@ -165,14 +167,15 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
private final int mHashCode;
|
private final int mHashCode;
|
||||||
|
|
||||||
public KeyboardId(Locale locale, int orientation, int mode,
|
public KeyboardId(Locale locale, int orientation, int mode,
|
||||||
int[] xmlArray, int colorScheme, boolean hasSettingsKey, boolean hasVoiceKey,
|
int[] xmlArray, int colorScheme, boolean hasSettingsKey, boolean voiceKeyEnabled,
|
||||||
int imeOptions, boolean enableShiftLock) {
|
boolean hasVoiceKey, int imeOptions, boolean enableShiftLock) {
|
||||||
this.mLocale = locale;
|
this.mLocale = locale;
|
||||||
this.mOrientation = orientation;
|
this.mOrientation = orientation;
|
||||||
this.mMode = mode;
|
this.mMode = mode;
|
||||||
this.mXmlArray = xmlArray;
|
this.mXmlArray = xmlArray;
|
||||||
this.mColorScheme = colorScheme;
|
this.mColorScheme = colorScheme;
|
||||||
this.mHasSettingsKey = hasSettingsKey;
|
this.mHasSettingsKey = hasSettingsKey;
|
||||||
|
this.mVoiceKeyEnabled = voiceKeyEnabled;
|
||||||
this.mHasVoiceKey = hasVoiceKey;
|
this.mHasVoiceKey = hasVoiceKey;
|
||||||
this.mImeOptions = imeOptions;
|
this.mImeOptions = imeOptions;
|
||||||
this.mEnableShiftLock = enableShiftLock;
|
this.mEnableShiftLock = enableShiftLock;
|
||||||
|
@ -184,6 +187,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
xmlArray,
|
xmlArray,
|
||||||
colorScheme,
|
colorScheme,
|
||||||
hasSettingsKey,
|
hasSettingsKey,
|
||||||
|
voiceKeyEnabled,
|
||||||
hasVoiceKey,
|
hasVoiceKey,
|
||||||
imeOptions,
|
imeOptions,
|
||||||
enableShiftLock,
|
enableShiftLock,
|
||||||
|
@ -210,6 +214,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
&& other.mXmlArray == this.mXmlArray
|
&& other.mXmlArray == this.mXmlArray
|
||||||
&& other.mColorScheme == this.mColorScheme
|
&& other.mColorScheme == this.mColorScheme
|
||||||
&& other.mHasSettingsKey == this.mHasSettingsKey
|
&& other.mHasSettingsKey == this.mHasSettingsKey
|
||||||
|
&& other.mVoiceKeyEnabled == this.mVoiceKeyEnabled
|
||||||
&& other.mHasVoiceKey == this.mHasVoiceKey
|
&& other.mHasVoiceKey == this.mHasVoiceKey
|
||||||
&& other.mImeOptions == this.mImeOptions
|
&& other.mImeOptions == this.mImeOptions
|
||||||
&& other.mEnableShiftLock == this.mEnableShiftLock;
|
&& other.mEnableShiftLock == this.mEnableShiftLock;
|
||||||
|
@ -222,7 +227,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("[%s %s %5s imeOptions=0x%08x xml=0x%08x %s%s%s%s]",
|
return String.format("[%s %s %5s imeOptions=0x%08x xml=0x%08x %s%s%s%s%s]",
|
||||||
mLocale,
|
mLocale,
|
||||||
(mOrientation == 1 ? "port" : "land"),
|
(mOrientation == 1 ? "port" : "land"),
|
||||||
modeName(mMode),
|
modeName(mMode),
|
||||||
|
@ -230,6 +235,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
mXmlArray[0],
|
mXmlArray[0],
|
||||||
(mColorScheme == CHAR_THEME_COLOR_WHITE ? "white" : "black"),
|
(mColorScheme == CHAR_THEME_COLOR_WHITE ? "white" : "black"),
|
||||||
(mHasSettingsKey ? " hasSettingsKey" : ""),
|
(mHasSettingsKey ? " hasSettingsKey" : ""),
|
||||||
|
(mVoiceKeyEnabled ? " voiceKeyEnabled" : ""),
|
||||||
(mHasVoiceKey ? " hasVoiceKey" : ""),
|
(mHasVoiceKey ? " hasVoiceKey" : ""),
|
||||||
(mEnableShiftLock ? " enableShiftLock" : ""));
|
(mEnableShiftLock ? " enableShiftLock" : ""));
|
||||||
}
|
}
|
||||||
|
@ -248,14 +254,14 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasVoiceKey(boolean isSymbols) {
|
private boolean hasVoiceKey(boolean isSymbols) {
|
||||||
return mVoiceButtonEnabled && (isSymbols != mVoiceButtonOnPrimary);
|
return mVoiceKeyEnabled && (isSymbols != mVoiceButtonOnPrimary);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadKeyboard(int mode, int imeOptions, boolean voiceButtonEnabled,
|
public void loadKeyboard(int mode, int imeOptions, boolean voiceKeyEnabled,
|
||||||
boolean voiceButtonOnPrimary) {
|
boolean voiceButtonOnPrimary) {
|
||||||
mSymbolsModeState = SYMBOLS_MODE_STATE_NONE;
|
mSymbolsModeState = SYMBOLS_MODE_STATE_NONE;
|
||||||
try {
|
try {
|
||||||
loadKeyboardInternal(mode, imeOptions, voiceButtonEnabled, voiceButtonOnPrimary,
|
loadKeyboardInternal(mode, imeOptions, voiceKeyEnabled, voiceButtonOnPrimary,
|
||||||
false);
|
false);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
|
@ -270,7 +276,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
|
|
||||||
mMode = mode;
|
mMode = mode;
|
||||||
mImeOptions = imeOptions;
|
mImeOptions = imeOptions;
|
||||||
mVoiceButtonEnabled = voiceButtonEnabled;
|
mVoiceKeyEnabled = voiceButtonEnabled;
|
||||||
mVoiceButtonOnPrimary = voiceButtonOnPrimary;
|
mVoiceButtonOnPrimary = voiceButtonOnPrimary;
|
||||||
mIsSymbols = isSymbols;
|
mIsSymbols = isSymbols;
|
||||||
// Update the settings key state because number of enabled IMEs could have been changed
|
// Update the settings key state because number of enabled IMEs could have been changed
|
||||||
|
@ -298,11 +304,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
final Locale savedLocale = mSubtypeSwitcher.changeSystemLocale(
|
final Locale savedLocale = mSubtypeSwitcher.changeSystemLocale(
|
||||||
mSubtypeSwitcher.getInputLocale());
|
mSubtypeSwitcher.getInputLocale());
|
||||||
|
|
||||||
final int xml = id.getXmlId();
|
|
||||||
keyboard = new LatinKeyboard(mInputMethodService, id);
|
keyboard = new LatinKeyboard(mInputMethodService, id);
|
||||||
keyboard.setVoiceMode(
|
|
||||||
hasVoiceKey(xml == R.xml.kbd_symbols || xml == R.xml.kbd_symbols_black),
|
|
||||||
mVoiceButtonEnabled);
|
|
||||||
keyboard.setImeOptions(res, id.mMode, id.mImeOptions);
|
keyboard.setImeOptions(res, id.mMode, id.mImeOptions);
|
||||||
keyboard.setColorOfSymbolIcons(isBlackSym(id.mColorScheme));
|
keyboard.setColorOfSymbolIcons(isBlackSym(id.mColorScheme));
|
||||||
|
|
||||||
|
@ -340,8 +342,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
}
|
}
|
||||||
final int orientation = mInputMethodService.getResources().getConfiguration().orientation;
|
final int orientation = mInputMethodService.getResources().getConfiguration().orientation;
|
||||||
final Locale locale = mSubtypeSwitcher.getInputLocale();
|
final Locale locale = mSubtypeSwitcher.getInputLocale();
|
||||||
return new KeyboardId(locale, orientation, mode, xmlArray,
|
return new KeyboardId(locale, orientation, mode, xmlArray, charColorId,
|
||||||
charColorId, mHasSettingsKey, hasVoiceKey, imeOptions, enableShiftLock);
|
mHasSettingsKey, mVoiceKeyEnabled, hasVoiceKey, imeOptions, enableShiftLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getKeyboardMode() {
|
public int getKeyboardMode() {
|
||||||
|
@ -605,7 +607,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleKeyboardMode() {
|
private void toggleKeyboardMode() {
|
||||||
loadKeyboardInternal(mMode, mImeOptions, mVoiceButtonEnabled, mVoiceButtonOnPrimary,
|
loadKeyboardInternal(mMode, mImeOptions, mVoiceKeyEnabled, mVoiceButtonOnPrimary,
|
||||||
!mIsSymbols);
|
!mIsSymbols);
|
||||||
if (mIsSymbols) {
|
if (mIsSymbols) {
|
||||||
mSymbolsModeState = SYMBOLS_MODE_STATE_BEGIN;
|
mSymbolsModeState = SYMBOLS_MODE_STATE_BEGIN;
|
||||||
|
|
|
@ -200,7 +200,7 @@ public class LatinIME extends InputMethodService
|
||||||
private boolean mLocaleSupportedForVoiceInput;
|
private boolean mLocaleSupportedForVoiceInput;
|
||||||
private boolean mIsShowingHint;
|
private boolean mIsShowingHint;
|
||||||
private int mCorrectionMode;
|
private int mCorrectionMode;
|
||||||
private boolean mVoiceButtonEnabled;
|
private boolean mVoiceKeyEnabled;
|
||||||
private boolean mVoiceButtonOnPrimary;
|
private boolean mVoiceButtonOnPrimary;
|
||||||
private int mOrientation;
|
private int mOrientation;
|
||||||
private List<CharSequence> mSuggestPuncList;
|
private List<CharSequence> mSuggestPuncList;
|
||||||
|
@ -531,7 +531,7 @@ public class LatinIME extends InputMethodService
|
||||||
final int mode = mKeyboardSwitcher.getKeyboardMode();
|
final int mode = mKeyboardSwitcher.getKeyboardMode();
|
||||||
final EditorInfo attribute = getCurrentInputEditorInfo();
|
final EditorInfo attribute = getCurrentInputEditorInfo();
|
||||||
final int imeOptions = (attribute != null) ? attribute.imeOptions : 0;
|
final int imeOptions = (attribute != null) ? attribute.imeOptions : 0;
|
||||||
mKeyboardSwitcher.loadKeyboard(mode, imeOptions, mVoiceButtonEnabled,
|
mKeyboardSwitcher.loadKeyboard(mode, imeOptions, mVoiceKeyEnabled,
|
||||||
mVoiceButtonOnPrimary);
|
mVoiceButtonOnPrimary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,8 +679,7 @@ public class LatinIME extends InputMethodService
|
||||||
mJustAddedAutoSpace = false;
|
mJustAddedAutoSpace = false;
|
||||||
|
|
||||||
loadSettings(attribute);
|
loadSettings(attribute);
|
||||||
switcher.loadKeyboard(mode, attribute.imeOptions, mVoiceButtonEnabled,
|
switcher.loadKeyboard(mode, attribute.imeOptions, mVoiceKeyEnabled, mVoiceButtonOnPrimary);
|
||||||
mVoiceButtonOnPrimary);
|
|
||||||
switcher.updateShiftState();
|
switcher.updateShiftState();
|
||||||
|
|
||||||
setCandidatesViewShownInternal(isCandidateStripVisible(),
|
setCandidatesViewShownInternal(isCandidateStripVisible(),
|
||||||
|
@ -2222,7 +2221,7 @@ public class LatinIME extends InputMethodService
|
||||||
final int mode = switcher.getKeyboardMode();
|
final int mode = switcher.getKeyboardMode();
|
||||||
final EditorInfo attribute = getCurrentInputEditorInfo();
|
final EditorInfo attribute = getCurrentInputEditorInfo();
|
||||||
final int imeOptions = (attribute != null) ? attribute.imeOptions : 0;
|
final int imeOptions = (attribute != null) ? attribute.imeOptions : 0;
|
||||||
switcher.loadKeyboard(mode, imeOptions, mVoiceButtonEnabled,
|
switcher.loadKeyboard(mode, imeOptions, mVoiceKeyEnabled,
|
||||||
mVoiceButtonOnPrimary);
|
mVoiceButtonOnPrimary);
|
||||||
initSuggest();
|
initSuggest();
|
||||||
switcher.updateShiftState();
|
switcher.updateShiftState();
|
||||||
|
@ -2468,7 +2467,7 @@ public class LatinIME extends InputMethodService
|
||||||
if (VOICE_INSTALLED) {
|
if (VOICE_INSTALLED) {
|
||||||
final String voiceMode = sp.getString(PREF_VOICE_MODE,
|
final String voiceMode = sp.getString(PREF_VOICE_MODE,
|
||||||
getString(R.string.voice_mode_main));
|
getString(R.string.voice_mode_main));
|
||||||
mVoiceButtonEnabled = !voiceMode.equals(getString(R.string.voice_mode_off))
|
mVoiceKeyEnabled = !voiceMode.equals(getString(R.string.voice_mode_off))
|
||||||
&& shouldShowVoiceButton(makeFieldContext(), attribute);
|
&& shouldShowVoiceButton(makeFieldContext(), attribute);
|
||||||
mVoiceButtonOnPrimary = voiceMode.equals(getString(R.string.voice_mode_main));
|
mVoiceButtonOnPrimary = voiceMode.equals(getString(R.string.voice_mode_main));
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,29 +52,16 @@ public class LatinKeyboard extends BaseKeyboard {
|
||||||
private Drawable mSpaceIcon;
|
private Drawable mSpaceIcon;
|
||||||
private Drawable mSpaceAutoCompletionIndicator;
|
private Drawable mSpaceAutoCompletionIndicator;
|
||||||
private Drawable mSpacePreviewIcon;
|
private Drawable mSpacePreviewIcon;
|
||||||
private Drawable mMicIcon;
|
|
||||||
private Drawable mMicPreviewIcon;
|
|
||||||
private Drawable m123MicIcon;
|
|
||||||
private Drawable m123MicPreviewIcon;
|
|
||||||
private final Drawable mButtonArrowLeftIcon;
|
private final Drawable mButtonArrowLeftIcon;
|
||||||
private final Drawable mButtonArrowRightIcon;
|
private final Drawable mButtonArrowRightIcon;
|
||||||
private Key mEnterKey;
|
private Key mEnterKey;
|
||||||
private Key mF1Key;
|
|
||||||
private final Drawable mHintIcon;
|
|
||||||
private Key mSpaceKey;
|
private Key mSpaceKey;
|
||||||
private Key m123Key;
|
|
||||||
private int mSpaceKeyIndex = -1;
|
private int mSpaceKeyIndex = -1;
|
||||||
private int mSpaceDragStartX;
|
private int mSpaceDragStartX;
|
||||||
private int mSpaceDragLastDiff;
|
private int mSpaceDragLastDiff;
|
||||||
private final Resources mRes;
|
private final Resources mRes;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private int mMode; // TODO: remove this and use the corresponding mode in the parent class
|
|
||||||
// Whether this keyboard has voice icon on it
|
|
||||||
private boolean mHasVoiceButton;
|
|
||||||
// Whether voice icon is enabled at all
|
|
||||||
private boolean mVoiceEnabled;
|
|
||||||
private final boolean mIsAlphaKeyboard;
|
private final boolean mIsAlphaKeyboard;
|
||||||
private CharSequence m123Label;
|
|
||||||
private boolean mCurrentlyInSpace;
|
private boolean mCurrentlyInSpace;
|
||||||
private SlidingLocaleDrawable mSlidingLocaleIcon;
|
private SlidingLocaleDrawable mSlidingLocaleIcon;
|
||||||
private int[] mPrefLetterFrequencies;
|
private int[] mPrefLetterFrequencies;
|
||||||
|
@ -112,22 +99,14 @@ public class LatinKeyboard extends BaseKeyboard {
|
||||||
final Resources res = context.getResources();
|
final Resources res = context.getResources();
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mRes = res;
|
mRes = res;
|
||||||
mMode = id.mMode;
|
|
||||||
mShiftedIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked);
|
mShiftedIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked);
|
||||||
mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked);
|
mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked);
|
||||||
setDefaultBounds(mShiftLockPreviewIcon);
|
setDefaultBounds(mShiftLockPreviewIcon);
|
||||||
mSpaceIcon = res.getDrawable(R.drawable.sym_keyboard_space);
|
mSpaceIcon = res.getDrawable(R.drawable.sym_keyboard_space);
|
||||||
mSpaceAutoCompletionIndicator = res.getDrawable(R.drawable.sym_keyboard_space_led);
|
mSpaceAutoCompletionIndicator = res.getDrawable(R.drawable.sym_keyboard_space_led);
|
||||||
mSpacePreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_space);
|
mSpacePreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_space);
|
||||||
mMicIcon = res.getDrawable(R.drawable.sym_keyboard_mic);
|
|
||||||
mMicPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_mic);
|
|
||||||
setDefaultBounds(mMicPreviewIcon);
|
|
||||||
mButtonArrowLeftIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_left);
|
mButtonArrowLeftIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_left);
|
||||||
mButtonArrowRightIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_right);
|
mButtonArrowRightIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_right);
|
||||||
m123MicIcon = res.getDrawable(R.drawable.sym_keyboard_123_mic);
|
|
||||||
m123MicPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_123_mic);
|
|
||||||
mHintIcon = res.getDrawable(R.drawable.hint_popup);
|
|
||||||
setDefaultBounds(m123MicPreviewIcon);
|
|
||||||
sSpacebarVerticalCorrection = res.getDimensionPixelOffset(
|
sSpacebarVerticalCorrection = res.getDimensionPixelOffset(
|
||||||
R.dimen.spacebar_vertical_correction);
|
R.dimen.spacebar_vertical_correction);
|
||||||
final int xmlLayoutResId = id.getXmlId();
|
final int xmlLayoutResId = id.getXmlId();
|
||||||
|
@ -154,16 +133,9 @@ public class LatinKeyboard extends BaseKeyboard {
|
||||||
case LatinIME.KEYCODE_ENTER:
|
case LatinIME.KEYCODE_ENTER:
|
||||||
mEnterKey = key;
|
mEnterKey = key;
|
||||||
break;
|
break;
|
||||||
case LatinKeyboardView.KEYCODE_F1:
|
|
||||||
mF1Key = key;
|
|
||||||
break;
|
|
||||||
case LatinIME.KEYCODE_SPACE:
|
case LatinIME.KEYCODE_SPACE:
|
||||||
mSpaceKey = key;
|
mSpaceKey = key;
|
||||||
break;
|
break;
|
||||||
case KEYCODE_MODE_CHANGE:
|
|
||||||
m123Key = key;
|
|
||||||
m123Label = key.label;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
|
@ -180,7 +152,6 @@ public class LatinKeyboard extends BaseKeyboard {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setImeOptions(Resources res, int mode, int options) {
|
public void setImeOptions(Resources res, int mode, int options) {
|
||||||
mMode = mode;
|
|
||||||
if (mEnterKey == null)
|
if (mEnterKey == null)
|
||||||
return;
|
return;
|
||||||
final boolean configDynamicKeyTopEnterKey = res.getBoolean(
|
final boolean configDynamicKeyTopEnterKey = res.getBoolean(
|
||||||
|
@ -290,87 +261,10 @@ public class LatinKeyboard extends BaseKeyboard {
|
||||||
if (isBlack) {
|
if (isBlack) {
|
||||||
mShiftedIcon = res.getDrawable(R.drawable.sym_bkeyboard_shift_locked);
|
mShiftedIcon = res.getDrawable(R.drawable.sym_bkeyboard_shift_locked);
|
||||||
mSpaceIcon = res.getDrawable(R.drawable.sym_bkeyboard_space);
|
mSpaceIcon = res.getDrawable(R.drawable.sym_bkeyboard_space);
|
||||||
mMicIcon = res.getDrawable(R.drawable.sym_bkeyboard_mic);
|
|
||||||
m123MicIcon = res.getDrawable(R.drawable.sym_bkeyboard_123_mic);
|
|
||||||
} else {
|
} else {
|
||||||
mShiftedIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked);
|
mShiftedIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked);
|
||||||
mSpaceIcon = res.getDrawable(R.drawable.sym_keyboard_space);
|
mSpaceIcon = res.getDrawable(R.drawable.sym_keyboard_space);
|
||||||
mMicIcon = res.getDrawable(R.drawable.sym_keyboard_mic);
|
|
||||||
m123MicIcon = res.getDrawable(R.drawable.sym_keyboard_123_mic);
|
|
||||||
}
|
}
|
||||||
updateDynamicKeys();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoiceMode(boolean hasVoiceButton, boolean hasVoice) {
|
|
||||||
mHasVoiceButton = hasVoiceButton;
|
|
||||||
mVoiceEnabled = hasVoice;
|
|
||||||
updateDynamicKeys();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateDynamicKeys() {
|
|
||||||
update123Key();
|
|
||||||
updateF1Key();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void update123Key() {
|
|
||||||
final boolean configDynamicKeyTopSymbolKey = mRes.getBoolean(
|
|
||||||
R.bool.config_dynamic_key_top_symbol_key);
|
|
||||||
// Update KEYCODE_MODE_CHANGE key only on alphabet mode, not on symbol mode.
|
|
||||||
if (m123Key != null && mIsAlphaKeyboard) {
|
|
||||||
if (configDynamicKeyTopSymbolKey && mVoiceEnabled && !mHasVoiceButton) {
|
|
||||||
m123Key.icon = m123MicIcon;
|
|
||||||
m123Key.iconPreview = m123MicPreviewIcon;
|
|
||||||
m123Key.label = null;
|
|
||||||
} else {
|
|
||||||
m123Key.icon = null;
|
|
||||||
m123Key.iconPreview = null;
|
|
||||||
m123Key.label = m123Label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateF1Key() {
|
|
||||||
// Update KEYCODE_F1 key. Please note that some keyboard layouts have no F1 key.
|
|
||||||
if (mF1Key == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (mIsAlphaKeyboard) {
|
|
||||||
if (mMode == KeyboardSwitcher.MODE_URL) {
|
|
||||||
setNonMicF1Key(mF1Key, "/", R.xml.popup_slash);
|
|
||||||
} else if (mMode == KeyboardSwitcher.MODE_EMAIL) {
|
|
||||||
setNonMicF1Key(mF1Key, "@", R.xml.popup_at);
|
|
||||||
} else {
|
|
||||||
if (mVoiceEnabled && mHasVoiceButton) {
|
|
||||||
setMicF1Key(mF1Key);
|
|
||||||
} else {
|
|
||||||
setNonMicF1Key(mF1Key, ",", R.xml.popup_comma);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else { // Symbols keyboard
|
|
||||||
if (mVoiceEnabled && mHasVoiceButton) {
|
|
||||||
setMicF1Key(mF1Key);
|
|
||||||
} else {
|
|
||||||
setNonMicF1Key(mF1Key, ",", R.xml.popup_comma);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setMicF1Key(Key key) {
|
|
||||||
key.label = null;
|
|
||||||
key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE };
|
|
||||||
key.popupResId = R.xml.popup_mic;
|
|
||||||
key.icon = mMicIcon;
|
|
||||||
key.hintIcon = mHintIcon;
|
|
||||||
key.iconPreview = mMicPreviewIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setNonMicF1Key(Key key, String label, int popupResId) {
|
|
||||||
key.label = label;
|
|
||||||
key.codes = new int[] { label.charAt(0) };
|
|
||||||
key.popupResId = popupResId;
|
|
||||||
key.icon = null;
|
|
||||||
key.hintIcon = mHintIcon;
|
|
||||||
key.iconPreview = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,8 +34,8 @@ public class LatinKeyboardView extends BaseKeyboardView {
|
||||||
|
|
||||||
public static final int KEYCODE_OPTIONS = -100;
|
public static final int KEYCODE_OPTIONS = -100;
|
||||||
public static final int KEYCODE_OPTIONS_LONGPRESS = -101;
|
public static final int KEYCODE_OPTIONS_LONGPRESS = -101;
|
||||||
|
// TODO: remove this once LatinIME stops referring to this.
|
||||||
public static final int KEYCODE_VOICE = -102;
|
public static final int KEYCODE_VOICE = -102;
|
||||||
public static final int KEYCODE_F1 = -103;
|
|
||||||
public static final int KEYCODE_NEXT_LANGUAGE = -104;
|
public static final int KEYCODE_NEXT_LANGUAGE = -104;
|
||||||
public static final int KEYCODE_PREV_LANGUAGE = -105;
|
public static final int KEYCODE_PREV_LANGUAGE = -105;
|
||||||
public static final int KEYCODE_CAPSLOCK = -106;
|
public static final int KEYCODE_CAPSLOCK = -106;
|
||||||
|
|
Loading…
Reference in New Issue