Use no language "zz" to disable shortcut key

Change-Id: Ifba5bbd4298ecf84cc5e0ebdb4fc8494eafff62e
main
Tadashi G. Takaoka 2012-04-04 14:35:55 +09:00
parent 23bcd664c0
commit b082c95a2b
4 changed files with 4 additions and 15 deletions

View File

@ -403,11 +403,6 @@
<attr name="parentStyle" format="string" />
</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">
<!-- This should be aligned with KeyboardId.ELEMENT_* -->
<attr name="elementName" format="enum">

View File

@ -19,8 +19,7 @@
-->
<KeyboardSet
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:disableShortcutKey="true" >
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
<Element
latin:elementName="alphabet"
latin:elementKeyboard="@xml/kbd_qwerty"

View File

@ -100,7 +100,6 @@ public class KeyboardSet {
int mMode;
EditorInfo mEditorInfo;
boolean mTouchPositionCorrectionEnabled;
boolean mDisableShortcutKey;
boolean mVoiceKeyEnabled;
boolean mVoiceKeyOnMain;
boolean mNoSettingsKey;
@ -206,7 +205,8 @@ public class KeyboardSet {
final Params params = mParams;
final boolean isSymbols = (keyboardSetElementId == KeyboardId.ELEMENT_SYMBOLS
|| 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);
return new KeyboardId(keyboardSetElementId, params.mLocale, params.mOrientation,
params.mWidth, params.mMode, params.mEditorInfo, params.mNoSettingsKey,
@ -303,11 +303,6 @@ public class KeyboardSet {
if (event == XmlPullParser.START_TAG) {
final String tag = parser.getName();
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);
} else {
throw new XmlParseUtils.IllegalStartTag(parser, TAG_KEYBOARD_SET);

View File

@ -23,7 +23,7 @@ import java.util.Locale;
public class SubtypeLocale {
// 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".
/* package for test */ static final String QWERTY = "QY";