Replace the notion of "voice" with "shortcut" as many as possible
Bug: 4340933 Change-Id: I98b4eca5167cc3767a0868fae8f6436164adbe4dmain
parent
6a07d7ddd9
commit
c3afe2c244
|
@ -266,8 +266,8 @@
|
|||
<enum name="shortcutImeOrSettings" value="3" />
|
||||
</attr>
|
||||
<attr name="clobberSettingsKey" format="boolean" />
|
||||
<attr name="voiceKeyEnabled" format="boolean" />
|
||||
<attr name="hasVoiceKey" format="boolean" />
|
||||
<attr name="shortcutKeyEnabled" format="boolean" />
|
||||
<attr name="hasShortcutKey" format="boolean" />
|
||||
<attr name="imeAction" format="enum">
|
||||
<!-- This should be aligned with EditorInfo.IME_ACTION_* -->
|
||||
<enum name="actionUnspecified" value="0" />
|
||||
|
|
|
@ -34,13 +34,13 @@
|
|||
>
|
||||
<switch>
|
||||
<case
|
||||
latin:voiceKeyEnabled="true"
|
||||
latin:shortcutKeyEnabled="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle"
|
||||
latin:keyWidth="fillBoth" />
|
||||
</case>
|
||||
<!-- voiceKeyEnabled="false" -->
|
||||
<!-- shortcutKeyEnabled="false" -->
|
||||
<default>
|
||||
<Spacer />
|
||||
</default>
|
||||
|
@ -51,13 +51,13 @@
|
|||
>
|
||||
<switch>
|
||||
<case
|
||||
latin:voiceKeyEnabled="true"
|
||||
latin:shortcutKeyEnabled="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle"
|
||||
latin:keyWidth="fillBoth" />
|
||||
</case>
|
||||
<!-- voiceKeyEnabled="false" -->
|
||||
<!-- shortcutKeyEnabled="false" -->
|
||||
<default>
|
||||
<Key
|
||||
latin:keyStyle="settingsKeyStyle"
|
||||
|
|
|
@ -209,7 +209,7 @@
|
|||
latin:keyStyle="numKeyStyle" />
|
||||
<switch>
|
||||
<case
|
||||
latin:voiceKeyEnabled="true"
|
||||
latin:shortcutKeyEnabled="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle"
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
latin:keyStyle="numKeyStyle" />
|
||||
<switch>
|
||||
<case
|
||||
latin:voiceKeyEnabled="true"
|
||||
latin:shortcutKeyEnabled="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle"
|
||||
|
|
|
@ -139,7 +139,7 @@
|
|||
latin:keyStyle="numKeyStyle" />
|
||||
<switch>
|
||||
<case
|
||||
latin:voiceKeyEnabled="true"
|
||||
latin:shortcutKeyEnabled="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle"
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
</switch>
|
||||
<switch>
|
||||
<case
|
||||
latin:voiceKeyEnabled="true"
|
||||
latin:shortcutKeyEnabled="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle"
|
||||
|
|
|
@ -180,7 +180,7 @@
|
|||
latin:keyLabel="_" />
|
||||
<switch>
|
||||
<case
|
||||
latin:voiceKeyEnabled="true"
|
||||
latin:shortcutKeyEnabled="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle"
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
latin:keyWidth="37.500%p" />
|
||||
<switch>
|
||||
<case
|
||||
latin:voiceKeyEnabled="true"
|
||||
latin:shortcutKeyEnabled="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle"
|
||||
|
|
|
@ -169,11 +169,12 @@
|
|||
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. -->
|
||||
<!-- When this qwerty keyboard has no shortcut keys but shortcut key is enabled, then symbol
|
||||
keyboard will have a shortcut key. That means we should use
|
||||
iconToSymbolKeyWithShortcutKey here. -->
|
||||
<case
|
||||
latin:voiceKeyEnabled="true"
|
||||
latin:hasVoiceKey="false"
|
||||
latin:shortcutKeyEnabled="true"
|
||||
latin:hasShortcutKey="false"
|
||||
>
|
||||
<key-style
|
||||
latin:styleName="toSymbolKeyStyle"
|
||||
|
|
|
@ -45,13 +45,13 @@
|
|||
<default>
|
||||
<switch>
|
||||
<case
|
||||
latin:hasVoiceKey="true"
|
||||
latin:hasShortcutKey="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle"
|
||||
latin:keyWidth="9.2%p" />
|
||||
</case>
|
||||
<!-- latin:hasVoiceKey="false" -->
|
||||
<!-- latin:hasShortcutKey="false" -->
|
||||
<case
|
||||
latin:navigateAction="true"
|
||||
>
|
||||
|
@ -90,12 +90,12 @@
|
|||
<default>
|
||||
<switch>
|
||||
<case
|
||||
latin:hasVoiceKey="true"
|
||||
latin:hasShortcutKey="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle" />
|
||||
</case>
|
||||
<!-- latin:hasVoiceKey="false" -->
|
||||
<!-- latin:hasShortcutKey="false" -->
|
||||
<case
|
||||
latin:navigateAction="true"
|
||||
>
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
>
|
||||
<switch>
|
||||
<case
|
||||
latin:hasVoiceKey="true"
|
||||
latin:hasShortcutKey="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle"
|
||||
latin:keyWidth="9.2%p" />
|
||||
</case>
|
||||
<!-- latin:hasVoiceKey="false" -->
|
||||
<!-- latin:hasShortcutKey="false" -->
|
||||
<default>
|
||||
<Key
|
||||
latin:keyLabel="@string/keylabel_for_symbols_f1"
|
||||
|
@ -46,12 +46,12 @@
|
|||
<default>
|
||||
<switch>
|
||||
<case
|
||||
latin:hasVoiceKey="true"
|
||||
latin:hasShortcutKey="true"
|
||||
>
|
||||
<Key
|
||||
latin:keyStyle="shortcutKeyStyle" />
|
||||
</case>
|
||||
<!-- latin:hasVoiceKey="false" -->
|
||||
<!-- latin:hasShortcutKey="false" -->
|
||||
<default>
|
||||
<Key
|
||||
latin:keyLabel="@string/keylabel_for_symbols_f1"
|
||||
|
|
|
@ -55,8 +55,8 @@ public class KeyboardId {
|
|||
public final boolean mHasSettingsKey;
|
||||
public final int mF2KeyMode;
|
||||
public final boolean mClobberSettingsKey;
|
||||
public final boolean mVoiceKeyEnabled;
|
||||
public final boolean mHasVoiceKey;
|
||||
public final boolean mShortcutKeyEnabled;
|
||||
public final boolean mHasShortcutKey;
|
||||
public final int mImeAction;
|
||||
|
||||
public final String mXmlName;
|
||||
|
@ -66,7 +66,7 @@ public class KeyboardId {
|
|||
|
||||
public KeyboardId(String xmlName, int xmlId, Locale locale, int orientation, int width,
|
||||
int mode, EditorInfo attribute, boolean hasSettingsKey, int f2KeyMode,
|
||||
boolean clobberSettingsKey, boolean voiceKeyEnabled, boolean hasVoiceKey) {
|
||||
boolean clobberSettingsKey, boolean shortcutKeyEnabled, boolean hasShortcutKey) {
|
||||
final int inputType = (attribute != null) ? attribute.inputType : 0;
|
||||
final int imeOptions = (attribute != null) ? attribute.imeOptions : 0;
|
||||
this.mLocale = locale;
|
||||
|
@ -83,8 +83,8 @@ public class KeyboardId {
|
|||
this.mHasSettingsKey = hasSettingsKey;
|
||||
this.mF2KeyMode = f2KeyMode;
|
||||
this.mClobberSettingsKey = clobberSettingsKey;
|
||||
this.mVoiceKeyEnabled = voiceKeyEnabled;
|
||||
this.mHasVoiceKey = hasVoiceKey;
|
||||
this.mShortcutKeyEnabled = shortcutKeyEnabled;
|
||||
this.mHasShortcutKey = hasShortcutKey;
|
||||
// We are interested only in {@link EditorInfo#IME_MASK_ACTION} enum value and
|
||||
// {@link EditorInfo#IME_FLAG_NO_ENTER_ACTION}.
|
||||
this.mImeAction = imeOptions & (
|
||||
|
@ -104,8 +104,8 @@ public class KeyboardId {
|
|||
hasSettingsKey,
|
||||
f2KeyMode,
|
||||
clobberSettingsKey,
|
||||
voiceKeyEnabled,
|
||||
hasVoiceKey,
|
||||
shortcutKeyEnabled,
|
||||
hasShortcutKey,
|
||||
mImeAction,
|
||||
});
|
||||
}
|
||||
|
@ -119,7 +119,8 @@ public class KeyboardId {
|
|||
if (mWidth == width)
|
||||
return this;
|
||||
return new KeyboardId(mXmlName, mXmlId, mLocale, orientation, width, mMode, mAttribute,
|
||||
mHasSettingsKey, mF2KeyMode, mClobberSettingsKey, mVoiceKeyEnabled, mHasVoiceKey);
|
||||
mHasSettingsKey, mF2KeyMode, mClobberSettingsKey, mShortcutKeyEnabled,
|
||||
mHasShortcutKey);
|
||||
}
|
||||
|
||||
public int getXmlId() {
|
||||
|
@ -166,8 +167,8 @@ public class KeyboardId {
|
|||
&& other.mHasSettingsKey == this.mHasSettingsKey
|
||||
&& other.mF2KeyMode == this.mF2KeyMode
|
||||
&& other.mClobberSettingsKey == this.mClobberSettingsKey
|
||||
&& other.mVoiceKeyEnabled == this.mVoiceKeyEnabled
|
||||
&& other.mHasVoiceKey == this.mHasVoiceKey
|
||||
&& other.mShortcutKeyEnabled == this.mShortcutKeyEnabled
|
||||
&& other.mHasShortcutKey == this.mHasShortcutKey
|
||||
&& other.mImeAction == this.mImeAction;
|
||||
}
|
||||
|
||||
|
@ -189,8 +190,8 @@ public class KeyboardId {
|
|||
(mNavigateAction ? " navigateAction" : ""),
|
||||
(mPasswordInput ? " passwordInput" : ""),
|
||||
(mHasSettingsKey ? " hasSettingsKey" : ""),
|
||||
(mVoiceKeyEnabled ? " voiceKeyEnabled" : ""),
|
||||
(mHasVoiceKey ? " hasVoiceKey" : "")
|
||||
(mShortcutKeyEnabled ? " shortcutKeyEnabled" : ""),
|
||||
(mHasShortcutKey ? " hasShortcutKey" : "")
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -324,13 +324,13 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
mPackageName, LatinIME.IME_OPTION_NO_SETTINGS_KEY, editorInfo);
|
||||
final boolean hasSettingsKey = settingsKeyEnabled && !noSettingsKey;
|
||||
final int f2KeyMode = getF2KeyMode(settingsKeyEnabled, noSettingsKey);
|
||||
final boolean hasVoiceKey = voiceKeyEnabled && (isSymbols != voiceKeyOnMain);
|
||||
final boolean hasShortcutKey = voiceKeyEnabled && (isSymbols != voiceKeyOnMain);
|
||||
final Configuration conf = mResources.getConfiguration();
|
||||
|
||||
return new KeyboardId(
|
||||
mResources.getResourceEntryName(xmlId), xmlId, mSubtypeSwitcher.getInputLocale(),
|
||||
conf.orientation, mWindowWidthCache.getWidth(conf), mode, editorInfo,
|
||||
hasSettingsKey, f2KeyMode, noSettingsKey, voiceKeyEnabled, hasVoiceKey);
|
||||
hasSettingsKey, f2KeyMode, noSettingsKey, voiceKeyEnabled, hasShortcutKey);
|
||||
}
|
||||
|
||||
public int getKeyboardMode() {
|
||||
|
|
|
@ -494,10 +494,10 @@ public class KeyboardParser {
|
|||
R.styleable.Keyboard_Case_f2KeyMode, id.mF2KeyMode);
|
||||
final boolean clobberSettingsKeyMatched = matchBoolean(a,
|
||||
R.styleable.Keyboard_Case_clobberSettingsKey, id.mClobberSettingsKey);
|
||||
final boolean voiceEnabledMatched = matchBoolean(a,
|
||||
R.styleable.Keyboard_Case_voiceKeyEnabled, id.mVoiceKeyEnabled);
|
||||
final boolean voiceKeyMatched = matchBoolean(a,
|
||||
R.styleable.Keyboard_Case_hasVoiceKey, id.mHasVoiceKey);
|
||||
final boolean shortcutKeyEnabledMatched = matchBoolean(a,
|
||||
R.styleable.Keyboard_Case_shortcutKeyEnabled, id.mShortcutKeyEnabled);
|
||||
final boolean hasShortcutKeyMatched = matchBoolean(a,
|
||||
R.styleable.Keyboard_Case_hasShortcutKey, id.mHasShortcutKey);
|
||||
// As noted at {@link KeyboardId} class, we are interested only in enum value masked by
|
||||
// {@link android.view.inputmethod.EditorInfo#IME_MASK_ACTION} and
|
||||
// {@link android.view.inputmethod.EditorInfo#IME_FLAG_NO_ENTER_ACTION}. So matching
|
||||
|
@ -512,7 +512,7 @@ public class KeyboardParser {
|
|||
R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
|
||||
final boolean selected = modeMatched && navigateActionMatched && passwordInputMatched
|
||||
&& hasSettingsKeyMatched && f2KeyModeMatched && clobberSettingsKeyMatched
|
||||
&& voiceEnabledMatched && voiceKeyMatched && imeActionMatched &&
|
||||
&& shortcutKeyEnabledMatched && hasShortcutKeyMatched && imeActionMatched &&
|
||||
localeCodeMatched && languageCodeMatched && countryCodeMatched;
|
||||
|
||||
if (DEBUG) Log.d(TAG, String.format("<%s%s%s%s%s%s%s%s%s%s%s%s%s> %s", TAG_CASE,
|
||||
|
@ -524,8 +524,9 @@ public class KeyboardParser {
|
|||
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_hasVoiceKey, "hasVoiceKey"),
|
||||
booleanAttr(
|
||||
a, R.styleable.Keyboard_Case_shortcutKeyEnabled, "shortcutKeyEnabled"),
|
||||
booleanAttr(a, R.styleable.Keyboard_Case_hasShortcutKey, "hasShortcutKey"),
|
||||
textAttr(EditorInfoCompatUtils.imeOptionsName(
|
||||
a.getInt(R.styleable.Keyboard_Case_imeAction, -1)), "imeAction"),
|
||||
textAttr(a.getString(R.styleable.Keyboard_Case_localeCode), "localeCode"),
|
||||
|
|
Loading…
Reference in New Issue