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