Add label for default keyboard layout.

Bug: 6110399
Change-Id: I2431b99884cbd01de32f8cd6c14a3afbd18b5020
This commit is contained in:
Jeff Brown
2012-04-17 13:55:15 -07:00
parent afdadec674
commit 512d0cb3eb
3 changed files with 10 additions and 2 deletions

View File

@@ -2633,6 +2633,8 @@
<string name="keyboard_layout_picker_title">Choose keyboard layout</string>
<!-- String to show when no keyboard layouts are available. [CHAR LIMIT=60] -->
<string name="keyboard_layout_picker_empty_text">No keyboard layouts are available.</string>
<!-- Label of the default keyboard layout. [CHAR LIMIT=35] -->
<string name="keyboard_layout_default_label">Default</string>
<!-- User dictionary settings --><skip />
<!-- User dictionary settings, The titlebar text of the User dictionary settings screen. -->

View File

@@ -420,6 +420,8 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
pref.setTitle(device.getName());
if (keyboardLayout != null) {
pref.setSummary(keyboardLayout.getLabel());
} else {
pref.setSummary(R.string.keyboard_layout_default_label);
}
pref.setIntent(intent);
mHardKeyboardPreferenceList.add(pref);

View File

@@ -110,8 +110,12 @@ public class KeyboardLayoutPicker extends ListFragment
public KeyboardLayout[] loadInBackground() {
InputManager im = (InputManager)getContext().getSystemService(Context.INPUT_SERVICE);
KeyboardLayout[] list = im.getKeyboardLayouts();
Arrays.sort(list);
return list;
KeyboardLayout[] listWithDefault = new KeyboardLayout[list.length + 1];
listWithDefault[0] = new KeyboardLayout(null,
getContext().getString(R.string.keyboard_layout_default_label));
System.arraycopy(list, 0, listWithDefault, 1, list.length);
Arrays.sort(listWithDefault);
return listWithDefault;
}
@Override