Fix "Show settings key" option on 7" device
Cherry-pic I993ac772 from Honeycomb-MR2. Bug: 4586882 Change-Id: Ie74138523a3ae7958c7bec674c49aa0ab1a72d05main
parent
75d7fb6675
commit
cd96a691b1
|
@ -277,6 +277,14 @@
|
||||||
<attr name="navigateAction" format="boolean" />
|
<attr name="navigateAction" format="boolean" />
|
||||||
<attr name="passwordInput" format="boolean" />
|
<attr name="passwordInput" format="boolean" />
|
||||||
<attr name="hasSettingsKey" format="boolean" />
|
<attr name="hasSettingsKey" format="boolean" />
|
||||||
|
<!-- This should be aligned with KeyboardID.F2KEY_MODE_* -->
|
||||||
|
<attr name="f2KeyMode" format="enum">
|
||||||
|
<enum name="none" value="0" />
|
||||||
|
<enum name="settings" value="1" />
|
||||||
|
<enum name="shortcutIme" value="2" />
|
||||||
|
<enum name="shortcutImeOrSettings" value="3" />
|
||||||
|
</attr>
|
||||||
|
<attr name="clobberSettingsKey" format="boolean" />
|
||||||
<attr name="voiceKeyEnabled" format="boolean" />
|
<attr name="voiceKeyEnabled" format="boolean" />
|
||||||
<attr name="hasVoiceKey" format="boolean" />
|
<attr name="hasVoiceKey" format="boolean" />
|
||||||
<attr name="imeAction" format="enum">
|
<attr name="imeAction" format="enum">
|
||||||
|
|
|
@ -25,6 +25,23 @@
|
||||||
<key-style
|
<key-style
|
||||||
latin:styleName="functionalKeyStyle"
|
latin:styleName="functionalKeyStyle"
|
||||||
latin:isFunctional="true" />
|
latin:isFunctional="true" />
|
||||||
|
<!-- Base key style for the key which may have settings key as popup key -->
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:clobberSettingsKey="true"
|
||||||
|
>
|
||||||
|
<key-style
|
||||||
|
latin:styleName="settingsPopupStyle"
|
||||||
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
|
</case>
|
||||||
|
<default>
|
||||||
|
<key-style
|
||||||
|
latin:styleName="settingsPopupStyle"
|
||||||
|
latin:keyLabelOption="popupHint"
|
||||||
|
latin:popupCharacters="\@icon/5|\@integer/key_settings"
|
||||||
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
<!-- Functional key styles -->
|
<!-- Functional key styles -->
|
||||||
<key-style
|
<key-style
|
||||||
latin:styleName="shiftKeyStyle"
|
latin:styleName="shiftKeyStyle"
|
||||||
|
@ -59,28 +76,18 @@
|
||||||
latin:keyLabelOption="popupHint"
|
latin:keyLabelOption="popupHint"
|
||||||
latin:popupCharacters="@string/alternates_for_smiley"
|
latin:popupCharacters="@string/alternates_for_smiley"
|
||||||
latin:maxPopupKeyboardColumn="5" />
|
latin:maxPopupKeyboardColumn="5" />
|
||||||
<switch>
|
<key-style
|
||||||
<case
|
latin:styleName="shortcutKeyStyle"
|
||||||
latin:voiceKeyEnabled="true"
|
latin:code="@integer/key_shortcut"
|
||||||
>
|
latin:keyIcon="iconShortcutKey"
|
||||||
<key-style
|
latin:keyIconPreview="iconPreviewShortcutKey"
|
||||||
latin:styleName="shortcutOrSettingsKeyStyle"
|
latin:parentStyle="settingsPopupStyle" />
|
||||||
latin:code="@integer/key_shortcut"
|
<key-style
|
||||||
latin:keyIcon="iconShortcutKey"
|
latin:styleName="settingsKeyStyle"
|
||||||
latin:keyIconPreview="iconPreviewShortcutKey"
|
latin:code="@integer/key_settings"
|
||||||
latin:keyLabelOption="popupHint"
|
latin:keyIcon="iconSettingsKey"
|
||||||
latin:popupCharacters="\@icon/5|\@integer/key_settings"
|
latin:keyIconPreview="iconPreviewSettingsKey"
|
||||||
latin:parentStyle="functionalKeyStyle" />
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
</case>
|
|
||||||
<default>
|
|
||||||
<key-style
|
|
||||||
latin:styleName="shortcutOrSettingsKeyStyle"
|
|
||||||
latin:code="@integer/key_settings"
|
|
||||||
latin:keyIcon="iconSettingsKey"
|
|
||||||
latin:keyIconPreview="iconPreviewSettingsKey"
|
|
||||||
latin:parentStyle="functionalKeyStyle" />
|
|
||||||
</default>
|
|
||||||
</switch>
|
|
||||||
<key-style
|
<key-style
|
||||||
latin:styleName="tabKeyStyle"
|
latin:styleName="tabKeyStyle"
|
||||||
latin:code="@integer/key_tab"
|
latin:code="@integer/key_tab"
|
||||||
|
|
|
@ -78,12 +78,11 @@
|
||||||
latin:keyXPos="24.875%p" />
|
latin:keyXPos="24.875%p" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyStyle="num0KeyStyle" />
|
latin:keyStyle="num0KeyStyle" />
|
||||||
<Spacer />
|
<Spacer
|
||||||
<Key
|
|
||||||
latin:keyStyle="shortcutOrSettingsKeyStyle"
|
|
||||||
latin:keyXPos="-11.00%p"
|
latin:keyXPos="-11.00%p"
|
||||||
latin:keyWidth="fillRight"
|
latin:keyWidth="0%p" />
|
||||||
latin:keyEdgeFlags="right" />
|
<include
|
||||||
|
latin:keyboardLayout="@xml/kbd_qwerty_f2" />
|
||||||
</Row>
|
</Row>
|
||||||
</case>
|
</case>
|
||||||
<!-- latin:passwordInput="false" -->
|
<!-- latin:passwordInput="false" -->
|
||||||
|
@ -185,11 +184,11 @@
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="#"
|
latin:keyLabel="#"
|
||||||
latin:keyStyle="numLabelStyle" />
|
latin:keyStyle="numLabelStyle" />
|
||||||
<Key
|
<Spacer
|
||||||
latin:keyStyle="shortcutOrSettingsKeyStyle"
|
|
||||||
latin:keyXPos="-11.00%p"
|
latin:keyXPos="-11.00%p"
|
||||||
latin:keyWidth="fillBoth"
|
latin:keyWidth="0%p" />
|
||||||
latin:keyEdgeFlags="right" />
|
<include
|
||||||
|
latin:keyboardLayout="@xml/kbd_qwerty_f2" />
|
||||||
</Row>
|
</Row>
|
||||||
</default>
|
</default>
|
||||||
</switch>
|
</switch>
|
||||||
|
|
|
@ -115,10 +115,10 @@
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="#"
|
latin:keyLabel="#"
|
||||||
latin:keyStyle="numLabelStyle" />
|
latin:keyStyle="numLabelStyle" />
|
||||||
<Key
|
<Spacer
|
||||||
latin:keyStyle="shortcutOrSettingsKeyStyle"
|
|
||||||
latin:keyXPos="-11.00%p"
|
latin:keyXPos="-11.00%p"
|
||||||
latin:keyWidth="fillBoth"
|
latin:keyWidth="0%p" />
|
||||||
latin:keyEdgeFlags="right" />
|
<include
|
||||||
|
latin:keyboardLayout="@xml/kbd_qwerty_f2" />
|
||||||
</Row>
|
</Row>
|
||||||
</Keyboard>
|
</Keyboard>
|
||||||
|
|
|
@ -125,10 +125,10 @@
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="#"
|
latin:keyLabel="#"
|
||||||
latin:keyStyle="numLabelStyle" />
|
latin:keyStyle="numLabelStyle" />
|
||||||
<Key
|
<Spacer
|
||||||
latin:keyStyle="shortcutOrSettingsKeyStyle"
|
|
||||||
latin:keyXPos="-11.00%p"
|
latin:keyXPos="-11.00%p"
|
||||||
latin:keyWidth="fillBoth"
|
latin:keyWidth="0%p" />
|
||||||
latin:keyEdgeFlags="right" />
|
<include
|
||||||
|
latin:keyboardLayout="@xml/kbd_qwerty_f2" />
|
||||||
</Row>
|
</Row>
|
||||||
</Keyboard>
|
</Keyboard>
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?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"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:f2KeyMode="settings"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:keyStyle="settingsKeyStyle"
|
||||||
|
latin:keyWidth="fillBoth"
|
||||||
|
latin:keyEdgeFlags="right" />
|
||||||
|
</case>
|
||||||
|
<case
|
||||||
|
latin:f2KeyMode="shortcutIme"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:voiceKeyEnabled="true"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:keyStyle="micKeyStyle"
|
||||||
|
latin:keyWidth="fillBoth"
|
||||||
|
latin:keyEdgeFlags="right" />
|
||||||
|
</case>
|
||||||
|
<!-- voiceKeyEnabled="false" -->
|
||||||
|
<default>
|
||||||
|
<Spacer />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
|
</case>
|
||||||
|
<case
|
||||||
|
latin:f2KeyMode="shortcutImeOrSettings"
|
||||||
|
>
|
||||||
|
<switch>
|
||||||
|
<case
|
||||||
|
latin:voiceKeyEnabled="true"
|
||||||
|
>
|
||||||
|
<Key
|
||||||
|
latin:keyStyle="micKeyStyle"
|
||||||
|
latin:keyWidth="fillBoth"
|
||||||
|
latin:keyEdgeFlags="right" />
|
||||||
|
</case>
|
||||||
|
<!-- voiceKeyEnabled="false" -->
|
||||||
|
<default>
|
||||||
|
<Key
|
||||||
|
latin:keyStyle="settingsKeyStyle"
|
||||||
|
latin:keyWidth="fillBoth"
|
||||||
|
latin:keyEdgeFlags="right" />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
|
</case>
|
||||||
|
<!-- f2KeyMode="none" -->
|
||||||
|
<default>
|
||||||
|
<Spacer />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
|
</merge>
|
|
@ -154,10 +154,10 @@
|
||||||
</switch>
|
</switch>
|
||||||
</default>
|
</default>
|
||||||
</switch>
|
</switch>
|
||||||
<Key
|
<Spacer
|
||||||
latin:keyStyle="shortcutOrSettingsKeyStyle"
|
latin:keyXPos="-10.00%p"
|
||||||
latin:keyXPos="-10.0%p"
|
latin:keyWidth="0%p" />
|
||||||
latin:keyWidth="fillBoth"
|
<include
|
||||||
latin:keyEdgeFlags="right" />
|
latin:keyboardLayout="@xml/kbd_qwerty_f2" />
|
||||||
</Row>
|
</Row>
|
||||||
</merge>
|
</merge>
|
||||||
|
|
|
@ -209,10 +209,10 @@
|
||||||
latin:keyWidth="9.750%p" />
|
latin:keyWidth="9.750%p" />
|
||||||
</default>
|
</default>
|
||||||
</switch>
|
</switch>
|
||||||
<Key
|
<Spacer
|
||||||
latin:keyStyle="shortcutOrSettingsKeyStyle"
|
latin:keyXPos="-10.00%p"
|
||||||
latin:keyXPos="-10.0%p"
|
latin:keyWidth="0%p" />
|
||||||
latin:keyWidth="fillBoth"
|
<include
|
||||||
latin:keyEdgeFlags="right" />
|
latin:keyboardLayout="@xml/kbd_qwerty_f2" />
|
||||||
</Row>
|
</Row>
|
||||||
</Keyboard>
|
</Keyboard>
|
||||||
|
|
|
@ -147,10 +147,10 @@
|
||||||
latin:keyStyle="spaceKeyStyle"
|
latin:keyStyle="spaceKeyStyle"
|
||||||
latin:keyXPos="30.750%p"
|
latin:keyXPos="30.750%p"
|
||||||
latin:keyWidth="39.750%p" />
|
latin:keyWidth="39.750%p" />
|
||||||
<Key
|
<Spacer
|
||||||
latin:keyStyle="shortcutOrSettingsKeyStyle"
|
latin:keyXPos="-10.00%p"
|
||||||
latin:keyXPos="-10.0%p"
|
latin:keyWidth="0%p" />
|
||||||
latin:keyWidth="fillRight"
|
<include
|
||||||
latin:keyEdgeFlags="right" />
|
latin:keyboardLayout="@xml/kbd_qwerty_f2" />
|
||||||
</Row>
|
</Row>
|
||||||
</Keyboard>
|
</Keyboard>
|
||||||
|
|
|
@ -28,13 +28,21 @@
|
||||||
<!-- Base key style for the key which may have settings key as popup key -->
|
<!-- Base key style for the key which may have settings key as popup key -->
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
|
latin:clobberSettingsKey="true"
|
||||||
|
>
|
||||||
|
<key-style
|
||||||
|
latin:styleName="settingsPopupStyle"
|
||||||
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
|
</case>
|
||||||
|
<case
|
||||||
|
latin:clobberSettingsKey="false"
|
||||||
latin:hasSettingsKey="true"
|
latin:hasSettingsKey="true"
|
||||||
>
|
>
|
||||||
<key-style
|
<key-style
|
||||||
latin:styleName="settingsPopupStyle"
|
latin:styleName="settingsPopupStyle"
|
||||||
latin:parentStyle="functionalKeyStyle" />
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
</case>
|
</case>
|
||||||
<!-- latin:hasSettingsKey="false" -->
|
<!-- clobberSettingsKey="false" and hasSettingsKey="false" -->
|
||||||
<default>
|
<default>
|
||||||
<key-style
|
<key-style
|
||||||
latin:styleName="settingsPopupStyle"
|
latin:styleName="settingsPopupStyle"
|
||||||
|
@ -57,57 +65,6 @@
|
||||||
latin:keyIcon="iconDeleteKey"
|
latin:keyIcon="iconDeleteKey"
|
||||||
latin:parentStyle="functionalKeyStyle"
|
latin:parentStyle="functionalKeyStyle"
|
||||||
latin:isRepeatable="true" />
|
latin:isRepeatable="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-style
|
|
||||||
latin:styleName="toSymbolKeyStyle"
|
|
||||||
latin:code="@integer/key_switch_alpha_symbol"
|
|
||||||
latin:keyIcon="iconToSymbolKeyWithShortcut"
|
|
||||||
latin:parentStyle="functionalKeyStyle" />
|
|
||||||
</case>
|
|
||||||
<default>
|
|
||||||
<key-style
|
|
||||||
latin:styleName="toSymbolKeyStyle"
|
|
||||||
latin:code="@integer/key_switch_alpha_symbol"
|
|
||||||
latin:keyLabel="@string/label_to_symbol_key"
|
|
||||||
latin:parentStyle="functionalKeyStyle" />
|
|
||||||
</default>
|
|
||||||
</switch>
|
|
||||||
<key-style
|
|
||||||
latin:styleName="settingsKeyStyle"
|
|
||||||
latin:code="@integer/key_settings"
|
|
||||||
latin:keyIcon="iconSettingsKey"
|
|
||||||
latin:keyIconPreview="iconPreviewSettingsKey"
|
|
||||||
latin:parentStyle="functionalKeyStyle" />
|
|
||||||
<key-style
|
|
||||||
latin:styleName="spaceKeyStyle"
|
|
||||||
latin:code="@integer/key_space"
|
|
||||||
latin:keyIconPreview="iconPreviewSpaceKey"
|
|
||||||
latin:parentStyle="functionalKeyStyle" />
|
|
||||||
<key-style
|
|
||||||
latin:styleName="tabKeyStyle"
|
|
||||||
latin:code="@integer/key_tab"
|
|
||||||
latin:keyIcon="iconTabKey"
|
|
||||||
latin:keyIconPreview="iconPreviewTabKey"
|
|
||||||
latin:parentStyle="functionalKeyStyle" />
|
|
||||||
<key-style
|
|
||||||
latin:styleName="shortcutKeyStyle"
|
|
||||||
latin:code="@integer/key_shortcut"
|
|
||||||
latin:keyIcon="iconShortcutKey"
|
|
||||||
latin:keyIconPreview="iconPreviewShortcutKey"
|
|
||||||
latin:parentStyle="settingsPopupStyle" />
|
|
||||||
<!-- Note: This key style is not for functional tab key. This is used for the tab key which is
|
|
||||||
laid out as normal letter key. -->
|
|
||||||
<key-style
|
|
||||||
latin:styleName="nonSpecialBackgroundTabKeyStyle"
|
|
||||||
latin:code="@integer/key_tab"
|
|
||||||
latin:keyIcon="iconTabKey"
|
|
||||||
latin:keyIconPreview="iconPreviewTabKey" />
|
|
||||||
<!-- Return key style -->
|
<!-- Return key style -->
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
|
@ -163,6 +120,65 @@
|
||||||
latin:parentStyle="functionalKeyStyle" />
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
</default>
|
</default>
|
||||||
</switch>
|
</switch>
|
||||||
|
<key-style
|
||||||
|
latin:styleName="spaceKeyStyle"
|
||||||
|
latin:code="@integer/key_space"
|
||||||
|
latin:keyIconPreview="iconPreviewSpaceKey"
|
||||||
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
|
<key-style
|
||||||
|
latin:styleName="smileyKeyStyle"
|
||||||
|
latin:keyLabel=":-)"
|
||||||
|
latin:keyOutputText=":-) "
|
||||||
|
latin:keyLabelOption="popupHint"
|
||||||
|
latin:popupCharacters="@string/alternates_for_smiley"
|
||||||
|
latin:maxPopupKeyboardColumn="5"
|
||||||
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
|
<key-style
|
||||||
|
latin:styleName="shortcutKeyStyle"
|
||||||
|
latin:code="@integer/key_shortcut"
|
||||||
|
latin:keyIcon="iconShortcutKey"
|
||||||
|
latin:keyIconPreview="iconPreviewShortcutKey"
|
||||||
|
latin:parentStyle="settingsPopupStyle" />
|
||||||
|
<key-style
|
||||||
|
latin:styleName="settingsKeyStyle"
|
||||||
|
latin:code="@integer/key_settings"
|
||||||
|
latin:keyIcon="iconSettingsKey"
|
||||||
|
latin:keyIconPreview="iconPreviewSettingsKey"
|
||||||
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
|
<key-style
|
||||||
|
latin:styleName="tabKeyStyle"
|
||||||
|
latin:code="@integer/key_tab"
|
||||||
|
latin:keyIcon="iconTabKey"
|
||||||
|
latin:keyIconPreview="iconPreviewTabKey"
|
||||||
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
|
<!-- Note: This key style is not for functional tab key. This is used for the tab key which is
|
||||||
|
laid out as normal letter key. -->
|
||||||
|
<key-style
|
||||||
|
latin:styleName="nonSpecialBackgroundTabKeyStyle"
|
||||||
|
latin:code="@integer/key_tab"
|
||||||
|
latin:keyIcon="iconTabKey"
|
||||||
|
latin:keyIconPreview="iconPreviewTabKey" />
|
||||||
|
<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-style
|
||||||
|
latin:styleName="toSymbolKeyStyle"
|
||||||
|
latin:code="@integer/key_switch_alpha_symbol"
|
||||||
|
latin:keyIcon="iconToSymbolKeyWithShortcut"
|
||||||
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
|
</case>
|
||||||
|
<default>
|
||||||
|
<key-style
|
||||||
|
latin:styleName="toSymbolKeyStyle"
|
||||||
|
latin:code="@integer/key_switch_alpha_symbol"
|
||||||
|
latin:keyLabel="@string/label_to_symbol_key"
|
||||||
|
latin:parentStyle="functionalKeyStyle" />
|
||||||
|
</default>
|
||||||
|
</switch>
|
||||||
<key-style
|
<key-style
|
||||||
latin:styleName="toAlphaKeyStyle"
|
latin:styleName="toAlphaKeyStyle"
|
||||||
latin:code="@integer/key_switch_alpha_symbol"
|
latin:code="@integer/key_switch_alpha_symbol"
|
||||||
|
@ -174,14 +190,6 @@
|
||||||
latin:keyLabel="@string/label_alt_key"
|
latin:keyLabel="@string/label_alt_key"
|
||||||
latin:parentStyle="functionalKeyStyle"
|
latin:parentStyle="functionalKeyStyle"
|
||||||
latin:isSticky="true" />
|
latin:isSticky="true" />
|
||||||
<key-style
|
|
||||||
latin:styleName="smileyKeyStyle"
|
|
||||||
latin:keyLabel=":-)"
|
|
||||||
latin:keyOutputText=":-) "
|
|
||||||
latin:keyLabelOption="popupHint"
|
|
||||||
latin:popupCharacters="@string/alternates_for_smiley"
|
|
||||||
latin:maxPopupKeyboardColumn="5"
|
|
||||||
latin:parentStyle="functionalKeyStyle" />
|
|
||||||
<switch>
|
<switch>
|
||||||
<case
|
<case
|
||||||
latin:passwordInput="true"
|
latin:passwordInput="true"
|
||||||
|
|
|
@ -37,6 +37,11 @@ public class KeyboardId {
|
||||||
public static final int MODE_PHONE = 4;
|
public static final int MODE_PHONE = 4;
|
||||||
public static final int MODE_NUMBER = 5;
|
public static final int MODE_NUMBER = 5;
|
||||||
|
|
||||||
|
public static final int F2KEY_MODE_NONE = 0;
|
||||||
|
public static final int F2KEY_MODE_SETTINGS = 1;
|
||||||
|
public static final int F2KEY_MODE_SHORTCUT_IME = 2;
|
||||||
|
public static final int F2KEY_MODE_SHORTCUT_IME_OR_SETTINGS = 3;
|
||||||
|
|
||||||
public final Locale mLocale;
|
public final Locale mLocale;
|
||||||
public final int mOrientation;
|
public final int mOrientation;
|
||||||
public final int mWidth;
|
public final int mWidth;
|
||||||
|
@ -44,7 +49,10 @@ public class KeyboardId {
|
||||||
public final int mXmlId;
|
public final int mXmlId;
|
||||||
public final boolean mNavigateAction;
|
public final boolean mNavigateAction;
|
||||||
public final boolean mPasswordInput;
|
public final boolean mPasswordInput;
|
||||||
|
// TODO: Clean up these booleans and modes.
|
||||||
public final boolean mHasSettingsKey;
|
public final boolean mHasSettingsKey;
|
||||||
|
public final int mF2KeyMode;
|
||||||
|
public final boolean mClobberSettingsKey;
|
||||||
public final boolean mVoiceKeyEnabled;
|
public final boolean mVoiceKeyEnabled;
|
||||||
public final boolean mHasVoiceKey;
|
public final boolean mHasVoiceKey;
|
||||||
public final int mImeAction;
|
public final int mImeAction;
|
||||||
|
@ -56,8 +64,9 @@ public class KeyboardId {
|
||||||
private final int mHashCode;
|
private final int mHashCode;
|
||||||
|
|
||||||
public KeyboardId(String xmlName, int xmlId, Locale locale, int orientation, int width,
|
public KeyboardId(String xmlName, int xmlId, Locale locale, int orientation, int width,
|
||||||
int mode, EditorInfo attribute, boolean hasSettingsKey, boolean voiceKeyEnabled,
|
int mode, EditorInfo attribute, boolean hasSettingsKey, int f2KeyMode,
|
||||||
boolean hasVoiceKey, boolean enableShiftLock) {
|
boolean clobberSettingsKey, boolean voiceKeyEnabled, boolean hasVoiceKey,
|
||||||
|
boolean enableShiftLock) {
|
||||||
final int inputType = (attribute != null) ? attribute.inputType : 0;
|
final int inputType = (attribute != null) ? attribute.inputType : 0;
|
||||||
final int imeOptions = (attribute != null) ? attribute.imeOptions : 0;
|
final int imeOptions = (attribute != null) ? attribute.imeOptions : 0;
|
||||||
this.mLocale = locale;
|
this.mLocale = locale;
|
||||||
|
@ -72,6 +81,8 @@ public class KeyboardId {
|
||||||
this.mPasswordInput = InputTypeCompatUtils.isPasswordInputType(inputType)
|
this.mPasswordInput = InputTypeCompatUtils.isPasswordInputType(inputType)
|
||||||
|| InputTypeCompatUtils.isVisiblePasswordInputType(inputType);
|
|| InputTypeCompatUtils.isVisiblePasswordInputType(inputType);
|
||||||
this.mHasSettingsKey = hasSettingsKey;
|
this.mHasSettingsKey = hasSettingsKey;
|
||||||
|
this.mF2KeyMode = f2KeyMode;
|
||||||
|
this.mClobberSettingsKey = clobberSettingsKey;
|
||||||
this.mVoiceKeyEnabled = voiceKeyEnabled;
|
this.mVoiceKeyEnabled = voiceKeyEnabled;
|
||||||
this.mHasVoiceKey = hasVoiceKey;
|
this.mHasVoiceKey = hasVoiceKey;
|
||||||
// We are interested only in {@link EditorInfo#IME_MASK_ACTION} enum value and
|
// We are interested only in {@link EditorInfo#IME_MASK_ACTION} enum value and
|
||||||
|
@ -92,6 +103,8 @@ public class KeyboardId {
|
||||||
mNavigateAction,
|
mNavigateAction,
|
||||||
mPasswordInput,
|
mPasswordInput,
|
||||||
hasSettingsKey,
|
hasSettingsKey,
|
||||||
|
f2KeyMode,
|
||||||
|
clobberSettingsKey,
|
||||||
voiceKeyEnabled,
|
voiceKeyEnabled,
|
||||||
hasVoiceKey,
|
hasVoiceKey,
|
||||||
mImeAction,
|
mImeAction,
|
||||||
|
@ -101,14 +114,16 @@ public class KeyboardId {
|
||||||
|
|
||||||
public KeyboardId cloneWithNewLayout(String xmlName, int xmlId) {
|
public KeyboardId cloneWithNewLayout(String xmlName, int xmlId) {
|
||||||
return new KeyboardId(xmlName, xmlId, mLocale, mOrientation, mWidth, mMode, mAttribute,
|
return new KeyboardId(xmlName, xmlId, mLocale, mOrientation, mWidth, mMode, mAttribute,
|
||||||
mHasSettingsKey, mVoiceKeyEnabled, mHasVoiceKey, mEnableShiftLock);
|
mHasSettingsKey, mF2KeyMode, mClobberSettingsKey, mVoiceKeyEnabled, mHasVoiceKey,
|
||||||
|
mEnableShiftLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyboardId cloneWithNewGeometry(int width) {
|
public KeyboardId cloneWithNewGeometry(int width) {
|
||||||
if (mWidth == width)
|
if (mWidth == width)
|
||||||
return this;
|
return this;
|
||||||
return new KeyboardId(mXmlName, mXmlId, mLocale, mOrientation, width, mMode, mAttribute,
|
return new KeyboardId(mXmlName, mXmlId, mLocale, mOrientation, width, mMode, mAttribute,
|
||||||
mHasSettingsKey, mVoiceKeyEnabled, mHasVoiceKey, mEnableShiftLock);
|
mHasSettingsKey, mF2KeyMode, mClobberSettingsKey, mVoiceKeyEnabled, mHasVoiceKey,
|
||||||
|
mEnableShiftLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getXmlId() {
|
public int getXmlId() {
|
||||||
|
@ -149,6 +164,8 @@ public class KeyboardId {
|
||||||
&& other.mNavigateAction == this.mNavigateAction
|
&& other.mNavigateAction == this.mNavigateAction
|
||||||
&& other.mPasswordInput == this.mPasswordInput
|
&& other.mPasswordInput == this.mPasswordInput
|
||||||
&& other.mHasSettingsKey == this.mHasSettingsKey
|
&& other.mHasSettingsKey == this.mHasSettingsKey
|
||||||
|
&& other.mF2KeyMode == this.mF2KeyMode
|
||||||
|
&& other.mClobberSettingsKey == this.mClobberSettingsKey
|
||||||
&& other.mVoiceKeyEnabled == this.mVoiceKeyEnabled
|
&& other.mVoiceKeyEnabled == this.mVoiceKeyEnabled
|
||||||
&& other.mHasVoiceKey == this.mHasVoiceKey
|
&& other.mHasVoiceKey == this.mHasVoiceKey
|
||||||
&& other.mImeAction == this.mImeAction
|
&& other.mImeAction == this.mImeAction
|
||||||
|
@ -162,12 +179,14 @@ public class KeyboardId {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("[%s.xml %s %s%d %s %s %s%s%s%s%s%s]",
|
return String.format("[%s.xml %s %s%d %s %s %s%s%s%s%s%s%s%s]",
|
||||||
mXmlName,
|
mXmlName,
|
||||||
mLocale,
|
mLocale,
|
||||||
(mOrientation == 1 ? "port" : "land"), mWidth,
|
(mOrientation == 1 ? "port" : "land"), mWidth,
|
||||||
modeName(mMode),
|
modeName(mMode),
|
||||||
EditorInfoCompatUtils.imeOptionsName(mImeAction),
|
EditorInfoCompatUtils.imeOptionsName(mImeAction),
|
||||||
|
f2KeyModeName(mF2KeyMode),
|
||||||
|
(mClobberSettingsKey ? " clobberSettingsKey" : ""),
|
||||||
(mNavigateAction ? " navigateAction" : ""),
|
(mNavigateAction ? " navigateAction" : ""),
|
||||||
(mPasswordInput ? " passwordInput" : ""),
|
(mPasswordInput ? " passwordInput" : ""),
|
||||||
(mHasSettingsKey ? " hasSettingsKey" : ""),
|
(mHasSettingsKey ? " hasSettingsKey" : ""),
|
||||||
|
@ -185,7 +204,17 @@ public class KeyboardId {
|
||||||
case MODE_IM: return "im";
|
case MODE_IM: return "im";
|
||||||
case MODE_PHONE: return "phone";
|
case MODE_PHONE: return "phone";
|
||||||
case MODE_NUMBER: return "number";
|
case MODE_NUMBER: return "number";
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String f2KeyModeName(int f2KeyMode) {
|
||||||
|
switch (f2KeyMode) {
|
||||||
|
case F2KEY_MODE_NONE: return "none";
|
||||||
|
case F2KEY_MODE_SETTINGS: return "settings";
|
||||||
|
case F2KEY_MODE_SHORTCUT_IME: return "shortcutIme";
|
||||||
|
case F2KEY_MODE_SHORTCUT_IME_OR_SETTINGS: return "shortcutImeOrSettings";
|
||||||
|
default: return null;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,6 +285,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final boolean hasSettingsKey = hasSettingsKey(attribute);
|
final boolean hasSettingsKey = hasSettingsKey(attribute);
|
||||||
|
final int f2KeyMode = getF2KeyMode(mPrefs, mInputMethodService, attribute);
|
||||||
|
final boolean clobberSettingsKey = Utils.inPrivateImeOptions(
|
||||||
|
mInputMethodService.getPackageName(), LatinIME.IME_OPTION_NO_SETTINGS_KEY,
|
||||||
|
attribute);
|
||||||
final Resources res = mInputMethodService.getResources();
|
final Resources res = mInputMethodService.getResources();
|
||||||
final int orientation = res.getConfiguration().orientation;
|
final int orientation = res.getConfiguration().orientation;
|
||||||
if (mKeyboardWidth == 0)
|
if (mKeyboardWidth == 0)
|
||||||
|
@ -292,7 +296,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
final Locale locale = mSubtypeSwitcher.getInputLocale();
|
final Locale locale = mSubtypeSwitcher.getInputLocale();
|
||||||
return new KeyboardId(
|
return new KeyboardId(
|
||||||
res.getResourceEntryName(xmlId), xmlId, locale, orientation, mKeyboardWidth,
|
res.getResourceEntryName(xmlId), xmlId, locale, orientation, mKeyboardWidth,
|
||||||
mode, attribute, hasSettingsKey, mVoiceKeyEnabled, hasVoiceKey, enableShiftLock);
|
mode, attribute, hasSettingsKey, f2KeyMode, clobberSettingsKey, mVoiceKeyEnabled,
|
||||||
|
hasVoiceKey, enableShiftLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyboardId makeSiblingKeyboardId(KeyboardId base, int alphabet, int phone) {
|
private KeyboardId makeSiblingKeyboardId(KeyboardId base, int alphabet, int phone) {
|
||||||
|
@ -806,16 +811,16 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean getSettingsKeyMode(SharedPreferences prefs, Context context) {
|
private static boolean getSettingsKeyMode(SharedPreferences prefs, Context context) {
|
||||||
Resources resources = context.getResources();
|
final Resources res = context.getResources();
|
||||||
final boolean showSettingsKeyOption = resources.getBoolean(
|
final boolean showSettingsKeyOption = res.getBoolean(
|
||||||
R.bool.config_enable_show_settings_key_option);
|
R.bool.config_enable_show_settings_key_option);
|
||||||
if (showSettingsKeyOption) {
|
if (showSettingsKeyOption) {
|
||||||
final String settingsKeyMode = prefs.getString(Settings.PREF_SETTINGS_KEY,
|
final String settingsKeyMode = prefs.getString(Settings.PREF_SETTINGS_KEY,
|
||||||
resources.getString(DEFAULT_SETTINGS_KEY_MODE));
|
res.getString(DEFAULT_SETTINGS_KEY_MODE));
|
||||||
// We show the settings key when 1) SETTINGS_KEY_MODE_ALWAYS_SHOW or
|
// We show the settings key when 1) SETTINGS_KEY_MODE_ALWAYS_SHOW or
|
||||||
// 2) SETTINGS_KEY_MODE_AUTO and there are two or more enabled IMEs on the system
|
// 2) SETTINGS_KEY_MODE_AUTO and there are two or more enabled IMEs on the system
|
||||||
if (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_ALWAYS_SHOW))
|
if (settingsKeyMode.equals(res.getString(SETTINGS_KEY_MODE_ALWAYS_SHOW))
|
||||||
|| (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_AUTO))
|
|| (settingsKeyMode.equals(res.getString(SETTINGS_KEY_MODE_AUTO))
|
||||||
&& Utils.hasMultipleEnabledIMEsOrSubtypes(
|
&& Utils.hasMultipleEnabledIMEsOrSubtypes(
|
||||||
(InputMethodManagerCompatWrapper.getInstance(context))))) {
|
(InputMethodManagerCompatWrapper.getInstance(context))))) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -825,4 +830,21 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
// If the show settings key option is disabled, we always try showing the settings key.
|
// If the show settings key option is disabled, we always try showing the settings key.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int getF2KeyMode(SharedPreferences prefs, Context context,
|
||||||
|
EditorInfo attribute) {
|
||||||
|
final boolean clobberSettingsKey = Utils.inPrivateImeOptions(
|
||||||
|
context.getPackageName(), LatinIME.IME_OPTION_NO_SETTINGS_KEY, attribute);
|
||||||
|
final Resources res = context.getResources();
|
||||||
|
final String settingsKeyMode = prefs.getString(Settings.PREF_SETTINGS_KEY,
|
||||||
|
res.getString(DEFAULT_SETTINGS_KEY_MODE));
|
||||||
|
if (settingsKeyMode.equals(res.getString(SETTINGS_KEY_MODE_AUTO))) {
|
||||||
|
return clobberSettingsKey ? KeyboardId.F2KEY_MODE_SHORTCUT_IME
|
||||||
|
: KeyboardId.F2KEY_MODE_SHORTCUT_IME_OR_SETTINGS;
|
||||||
|
} else if (settingsKeyMode.equals(res.getString(SETTINGS_KEY_MODE_ALWAYS_SHOW))) {
|
||||||
|
return clobberSettingsKey ? KeyboardId.F2KEY_MODE_NONE : KeyboardId.F2KEY_MODE_SETTINGS;
|
||||||
|
} else { // SETTINGS_KEY_MODE_ALWAYS_HIDE
|
||||||
|
return KeyboardId.F2KEY_MODE_SHORTCUT_IME;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,8 +487,12 @@ public class KeyboardParser {
|
||||||
R.styleable.Keyboard_Case_navigateAction, id.mNavigateAction);
|
R.styleable.Keyboard_Case_navigateAction, id.mNavigateAction);
|
||||||
final boolean passwordInputMatched = matchBoolean(a,
|
final boolean passwordInputMatched = matchBoolean(a,
|
||||||
R.styleable.Keyboard_Case_passwordInput, id.mPasswordInput);
|
R.styleable.Keyboard_Case_passwordInput, id.mPasswordInput);
|
||||||
final boolean settingsKeyMatched = matchBoolean(a,
|
final boolean hasSettingsKeyMatched = matchBoolean(a,
|
||||||
R.styleable.Keyboard_Case_hasSettingsKey, id.mHasSettingsKey);
|
R.styleable.Keyboard_Case_hasSettingsKey, id.mHasSettingsKey);
|
||||||
|
final boolean f2KeyModeMatched = matchInteger(a,
|
||||||
|
R.styleable.Keyboard_Case_f2KeyMode, id.mF2KeyMode);
|
||||||
|
final boolean clobberSettingsKeyMatched = matchBoolean(a,
|
||||||
|
R.styleable.Keyboard_Case_clobberSettingsKey, id.mClobberSettingsKey);
|
||||||
final boolean voiceEnabledMatched = matchBoolean(a,
|
final boolean voiceEnabledMatched = matchBoolean(a,
|
||||||
R.styleable.Keyboard_Case_voiceKeyEnabled, id.mVoiceKeyEnabled);
|
R.styleable.Keyboard_Case_voiceKeyEnabled, id.mVoiceKeyEnabled);
|
||||||
final boolean voiceKeyMatched = matchBoolean(a,
|
final boolean voiceKeyMatched = matchBoolean(a,
|
||||||
|
@ -506,15 +510,19 @@ public class KeyboardParser {
|
||||||
final boolean countryCodeMatched = matchString(a,
|
final boolean countryCodeMatched = matchString(a,
|
||||||
R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
|
R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
|
||||||
final boolean selected = modeMatched && navigateActionMatched && passwordInputMatched
|
final boolean selected = modeMatched && navigateActionMatched && passwordInputMatched
|
||||||
&& settingsKeyMatched && voiceEnabledMatched && voiceKeyMatched
|
&& hasSettingsKeyMatched && f2KeyModeMatched && clobberSettingsKeyMatched
|
||||||
&& imeActionMatched && localeCodeMatched && languageCodeMatched
|
&& voiceEnabledMatched && voiceKeyMatched && imeActionMatched &&
|
||||||
&& countryCodeMatched;
|
localeCodeMatched && languageCodeMatched && countryCodeMatched;
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, String.format("<%s%s%s%s%s%s%s%s%s%s%s> %s", TAG_CASE,
|
if (DEBUG) Log.d(TAG, String.format("<%s%s%s%s%s%s%s%s%s%s%s%s%s> %s", TAG_CASE,
|
||||||
textAttr(a.getString(R.styleable.Keyboard_Case_mode), "mode"),
|
textAttr(a.getString(R.styleable.Keyboard_Case_mode), "mode"),
|
||||||
booleanAttr(a, R.styleable.Keyboard_Case_navigateAction, "navigateAction"),
|
booleanAttr(a, R.styleable.Keyboard_Case_navigateAction, "navigateAction"),
|
||||||
booleanAttr(a, R.styleable.Keyboard_Case_passwordInput, "passwordInput"),
|
booleanAttr(a, R.styleable.Keyboard_Case_passwordInput, "passwordInput"),
|
||||||
booleanAttr(a, R.styleable.Keyboard_Case_hasSettingsKey, "hasSettingsKey"),
|
booleanAttr(a, R.styleable.Keyboard_Case_hasSettingsKey, "hasSettingsKey"),
|
||||||
|
textAttr(KeyboardId.f2KeyModeName(
|
||||||
|
a.getInt(R.styleable.Keyboard_Case_f2KeyMode, -1)), "f2KeyMode"),
|
||||||
|
booleanAttr(a, R.styleable.Keyboard_Case_clobberSettingsKey,
|
||||||
|
"clobberSettingsKey"),
|
||||||
booleanAttr(a, R.styleable.Keyboard_Case_voiceKeyEnabled, "voiceKeyEnabled"),
|
booleanAttr(a, R.styleable.Keyboard_Case_voiceKeyEnabled, "voiceKeyEnabled"),
|
||||||
booleanAttr(a, R.styleable.Keyboard_Case_hasVoiceKey, "hasVoiceKey"),
|
booleanAttr(a, R.styleable.Keyboard_Case_hasVoiceKey, "hasVoiceKey"),
|
||||||
textAttr(EditorInfoCompatUtils.imeOptionsName(
|
textAttr(EditorInfoCompatUtils.imeOptionsName(
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class SuggestTestsBase extends AndroidTestCase {
|
||||||
return new KeyboardId(locale.toString() + " keyboard",
|
return new KeyboardId(locale.toString() + " keyboard",
|
||||||
com.android.inputmethod.latin.R.xml.kbd_qwerty, locale,
|
com.android.inputmethod.latin.R.xml.kbd_qwerty, locale,
|
||||||
Configuration.ORIENTATION_LANDSCAPE, displayWidth, KeyboardId.MODE_TEXT,
|
Configuration.ORIENTATION_LANDSCAPE, displayWidth, KeyboardId.MODE_TEXT,
|
||||||
new EditorInfo(), false, false, false, false);
|
new EditorInfo(), false, KeyboardId.F2KEY_MODE_NONE, false, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected InputStream openTestRawResource(int resIdInTest) {
|
protected InputStream openTestRawResource(int resIdInTest) {
|
||||||
|
|
Loading…
Reference in New Issue