Use no language "zz" to disable shortcut key
Change-Id: Ifba5bbd4298ecf84cc5e0ebdb4fc8494eafff62emain
parent
23bcd664c0
commit
b082c95a2b
|
@ -403,11 +403,6 @@
|
||||||
<attr name="parentStyle" format="string" />
|
<attr name="parentStyle" format="string" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="KeyboardSet">
|
|
||||||
<!-- Disable shortcut key. Shortcut key is enabled by default. -->
|
|
||||||
<attr name="disableShortcutKey" format="boolean" />
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
<declare-styleable name="KeyboardSet_Element">
|
<declare-styleable name="KeyboardSet_Element">
|
||||||
<!-- This should be aligned with KeyboardId.ELEMENT_* -->
|
<!-- This should be aligned with KeyboardId.ELEMENT_* -->
|
||||||
<attr name="elementName" format="enum">
|
<attr name="elementName" format="enum">
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<KeyboardSet
|
<KeyboardSet
|
||||||
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
|
||||||
latin:disableShortcutKey="true" >
|
|
||||||
<Element
|
<Element
|
||||||
latin:elementName="alphabet"
|
latin:elementName="alphabet"
|
||||||
latin:elementKeyboard="@xml/kbd_qwerty"
|
latin:elementKeyboard="@xml/kbd_qwerty"
|
||||||
|
|
|
@ -100,7 +100,6 @@ public class KeyboardSet {
|
||||||
int mMode;
|
int mMode;
|
||||||
EditorInfo mEditorInfo;
|
EditorInfo mEditorInfo;
|
||||||
boolean mTouchPositionCorrectionEnabled;
|
boolean mTouchPositionCorrectionEnabled;
|
||||||
boolean mDisableShortcutKey;
|
|
||||||
boolean mVoiceKeyEnabled;
|
boolean mVoiceKeyEnabled;
|
||||||
boolean mVoiceKeyOnMain;
|
boolean mVoiceKeyOnMain;
|
||||||
boolean mNoSettingsKey;
|
boolean mNoSettingsKey;
|
||||||
|
@ -206,7 +205,8 @@ public class KeyboardSet {
|
||||||
final Params params = mParams;
|
final Params params = mParams;
|
||||||
final boolean isSymbols = (keyboardSetElementId == KeyboardId.ELEMENT_SYMBOLS
|
final boolean isSymbols = (keyboardSetElementId == KeyboardId.ELEMENT_SYMBOLS
|
||||||
|| keyboardSetElementId == KeyboardId.ELEMENT_SYMBOLS_SHIFTED);
|
|| keyboardSetElementId == KeyboardId.ELEMENT_SYMBOLS_SHIFTED);
|
||||||
final boolean voiceKeyEnabled = params.mVoiceKeyEnabled && !params.mDisableShortcutKey;
|
final boolean noLanguage = params.mLocale.getLanguage().equals(SubtypeLocale.NO_LANGUAGE);
|
||||||
|
final boolean voiceKeyEnabled = params.mVoiceKeyEnabled && !noLanguage;
|
||||||
final boolean hasShortcutKey = voiceKeyEnabled && (isSymbols != params.mVoiceKeyOnMain);
|
final boolean hasShortcutKey = voiceKeyEnabled && (isSymbols != params.mVoiceKeyOnMain);
|
||||||
return new KeyboardId(keyboardSetElementId, params.mLocale, params.mOrientation,
|
return new KeyboardId(keyboardSetElementId, params.mLocale, params.mOrientation,
|
||||||
params.mWidth, params.mMode, params.mEditorInfo, params.mNoSettingsKey,
|
params.mWidth, params.mMode, params.mEditorInfo, params.mNoSettingsKey,
|
||||||
|
@ -303,11 +303,6 @@ public class KeyboardSet {
|
||||||
if (event == XmlPullParser.START_TAG) {
|
if (event == XmlPullParser.START_TAG) {
|
||||||
final String tag = parser.getName();
|
final String tag = parser.getName();
|
||||||
if (TAG_KEYBOARD_SET.equals(tag)) {
|
if (TAG_KEYBOARD_SET.equals(tag)) {
|
||||||
final TypedArray a = mResources.obtainAttributes(
|
|
||||||
Xml.asAttributeSet(parser), R.styleable.KeyboardSet);
|
|
||||||
mParams.mDisableShortcutKey = a.getBoolean(
|
|
||||||
R.styleable.KeyboardSet_disableShortcutKey, false);
|
|
||||||
a.recycle();
|
|
||||||
parseKeyboardSetContent(parser);
|
parseKeyboardSetContent(parser);
|
||||||
} else {
|
} else {
|
||||||
throw new XmlParseUtils.IllegalStartTag(parser, TAG_KEYBOARD_SET);
|
throw new XmlParseUtils.IllegalStartTag(parser, TAG_KEYBOARD_SET);
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Locale;
|
||||||
|
|
||||||
public class SubtypeLocale {
|
public class SubtypeLocale {
|
||||||
// Special language code to represent "no language".
|
// Special language code to represent "no language".
|
||||||
/* package for test */ static final String NO_LANGUAGE = "zz";
|
public static final String NO_LANGUAGE = "zz";
|
||||||
// Special country code to represent "QWERTY".
|
// Special country code to represent "QWERTY".
|
||||||
/* package for test */ static final String QWERTY = "QY";
|
/* package for test */ static final String QWERTY = "QY";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue