Skip to content
Snippets Groups Projects
Commit e060d1a5 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka Committed by Android (Google) Code Review
Browse files

Merge "Fix using keyboard layout display name in custom input style spinner"

parents 0df78d46 a245be68
No related branches found
No related tags found
No related merge requests found
......@@ -109,18 +109,15 @@ public class AdditionalSubtypeSettings extends PreferenceFragment {
}
static class KeyboardLayoutSetItem extends Pair<String, String> {
public KeyboardLayoutSetItem(String keyboardLayoutSetName) {
super(keyboardLayoutSetName, getDisplayName(keyboardLayoutSetName));
public KeyboardLayoutSetItem(InputMethodSubtype subtype) {
super(SubtypeLocale.getKeyboardLayoutSetName(subtype),
SubtypeLocale.getKeyboardLayoutSetDisplayName(subtype));
}
@Override
public String toString() {
return second;
}
private static String getDisplayName(String keyboardLayoutSetName) {
return keyboardLayoutSetName.toUpperCase();
}
}
static class KeyboardLayoutSetAdapter extends ArrayAdapter<KeyboardLayoutSetItem> {
......@@ -130,7 +127,10 @@ public class AdditionalSubtypeSettings extends PreferenceFragment {
// TODO: Should filter out already existing combinations of locale and layout.
for (final String layout : SubtypeLocale.getPredefinedKeyboardLayoutSet()) {
add(new KeyboardLayoutSetItem(layout));
// This is a dummy subtype with NO_LANGUAGE, only for display.
final InputMethodSubtype subtype = AdditionalSubtype.createAdditionalSubtype(
SubtypeLocale.NO_LANGUAGE, layout, null);
add(new KeyboardLayoutSetItem(subtype));
}
}
}
......@@ -196,8 +196,7 @@ public class AdditionalSubtypeSettings extends PreferenceFragment {
.setNegativeButton(R.string.remove, this);
final SubtypeLocaleItem localeItem = SubtypeLocaleAdapter.createItem(
context, mSubtype.getLocale());
final KeyboardLayoutSetItem layoutItem = new KeyboardLayoutSetItem(
SubtypeLocale.getKeyboardLayoutSetName(mSubtype));
final KeyboardLayoutSetItem layoutItem = new KeyboardLayoutSetItem(mSubtype);
setSpinnerPosition(mSubtypeLocaleSpinner, localeItem);
setSpinnerPosition(mKeyboardLayoutSetSpinner, layoutItem);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment