Add RichInputMethodSubtype.getKeyboardLayoutSetName

Change-Id: I90cc74ee882e8aa2b243885d3b994223ca3b6f44
main
Tadashi G. Takaoka 2014-11-12 15:36:59 -08:00
parent c4b6ac72c5
commit 6de31466b0
5 changed files with 8 additions and 7 deletions

View File

@ -294,7 +294,7 @@ public final class KeyboardLayoutSet {
: subtype; : subtype;
mParams.mSubtype = keyboardSubtype; mParams.mSubtype = keyboardSubtype;
mParams.mKeyboardLayoutSetName = KEYBOARD_LAYOUT_SET_RESOURCE_PREFIX mParams.mKeyboardLayoutSetName = KEYBOARD_LAYOUT_SET_RESOURCE_PREFIX
+ SubtypeLocaleUtils.getKeyboardLayoutSetName(keyboardSubtype); + keyboardSubtype.getKeyboardLayoutSetName();
return this; return this;
} }

View File

@ -648,7 +648,7 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
try { try {
final boolean keyboardLayoutSetMatched = matchString(caseAttr, final boolean keyboardLayoutSetMatched = matchString(caseAttr,
R.styleable.Keyboard_Case_keyboardLayoutSet, R.styleable.Keyboard_Case_keyboardLayoutSet,
SubtypeLocaleUtils.getKeyboardLayoutSetName(id.mSubtype)); id.mSubtype.getKeyboardLayoutSetName());
final boolean keyboardLayoutSetElementMatched = matchTypedValue(caseAttr, final boolean keyboardLayoutSetElementMatched = matchTypedValue(caseAttr,
R.styleable.Keyboard_Case_keyboardLayoutSetElement, id.mElementId, R.styleable.Keyboard_Case_keyboardLayoutSetElement, id.mElementId,
KeyboardId.elementIdToName(id.mElementId)); KeyboardId.elementIdToName(id.mElementId));

View File

@ -52,7 +52,7 @@ public final class LanguageOnSpacebarHelper {
return FORMAT_TYPE_MULTIPLE; return FORMAT_TYPE_MULTIPLE;
} }
final String keyboardLanguage = locales[0].getLanguage(); final String keyboardLanguage = locales[0].getLanguage();
final String keyboardLayout = SubtypeLocaleUtils.getKeyboardLayoutSetName(subtype); final String keyboardLayout = subtype.getKeyboardLayoutSetName();
int sameLanguageAndLayoutCount = 0; int sameLanguageAndLayoutCount = 0;
for (final InputMethodSubtype ims : mEnabledSubtypes) { for (final InputMethodSubtype ims : mEnabledSubtypes) {
final String language = SubtypeLocaleUtils.getSubtypeLocale(ims).getLanguage(); final String language = SubtypeLocaleUtils.getSubtypeLocale(ims).getLanguage();

View File

@ -142,6 +142,11 @@ public final class RichInputMethodSubtype {
@Nonnull @Nonnull
public InputMethodSubtype getRawSubtype() { return mSubtype; } public InputMethodSubtype getRawSubtype() { return mSubtype; }
@Nonnull
public String getKeyboardLayoutSetName() {
return SubtypeLocaleUtils.getKeyboardLayoutSetName(mSubtype);
}
// Dummy no language QWERTY subtype. See {@link R.xml.method}. // Dummy no language QWERTY subtype. See {@link R.xml.method}.
private static final int SUBTYPE_ID_OF_DUMMY_NO_LANGUAGE_SUBTYPE = 0xdde0bfd3; private static final int SUBTYPE_ID_OF_DUMMY_NO_LANGUAGE_SUBTYPE = 0xdde0bfd3;
private static final String EXTRA_VALUE_OF_DUMMY_NO_LANGUAGE_SUBTYPE = private static final String EXTRA_VALUE_OF_DUMMY_NO_LANGUAGE_SUBTYPE =

View File

@ -334,10 +334,6 @@ public final class SubtypeLocaleUtils {
} }
@Nonnull @Nonnull
public static String getKeyboardLayoutSetName(@Nonnull final RichInputMethodSubtype subtype) {
return getKeyboardLayoutSetName(subtype.getRawSubtype());
}
public static String getKeyboardLayoutSetName(final InputMethodSubtype subtype) { public static String getKeyboardLayoutSetName(final InputMethodSubtype subtype) {
String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET); String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET);
if (keyboardLayoutSet == null) { if (keyboardLayoutSet == null) {