summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/inputmethod
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2014-08-09 20:35:11 -0700
committerMichael Wright <michaelwr@google.com>2014-08-11 13:02:01 -0700
commit02d501433dd58df1c2cdc2dd60599b7fca1a242a (patch)
tree867a34bcf69285f92eb0c0b7b3f3aa1157883167 /src/com/android/settings/inputmethod
parent092c62f1f3811f205c764fcb5b8347ec8fed67e6 (diff)
downloadpackages_apps_Settings-02d501433dd58df1c2cdc2dd60599b7fca1a242a.zip
packages_apps_Settings-02d501433dd58df1c2cdc2dd60599b7fca1a242a.tar.gz
packages_apps_Settings-02d501433dd58df1c2cdc2dd60599b7fca1a242a.tar.bz2
Show physical keyboard settings even when IME is enabled.
The WindowManager lies about the configuration in order to get the IME to show but the Settings page should still show the physical keyboard options if one is connected though, so remove the configuration check and just always check to see if there's a full keyboard connected. Bug: 14066881 Change-Id: I085fe4160f3524f3c95737a6809ee03fec5230b4
Diffstat (limited to 'src/com/android/settings/inputmethod')
-rw-r--r--src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java180
1 files changed, 88 insertions, 92 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index 1601cd0..ced6350 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -564,35 +564,33 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
private void updateHardKeyboards() {
mHardKeyboardPreferenceList.clear();
- if (getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY) {
- final int[] devices = InputDevice.getDeviceIds();
- for (int i = 0; i < devices.length; i++) {
- InputDevice device = InputDevice.getDevice(devices[i]);
- if (device != null
- && !device.isVirtual()
- && device.isFullKeyboard()) {
- final InputDeviceIdentifier identifier = device.getIdentifier();
- final String keyboardLayoutDescriptor =
- mIm.getCurrentKeyboardLayoutForInputDevice(identifier);
- final KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
- mIm.getKeyboardLayout(keyboardLayoutDescriptor) : null;
-
- final PreferenceScreen pref = new PreferenceScreen(getActivity(), null);
- pref.setTitle(device.getName());
- if (keyboardLayout != null) {
- pref.setSummary(keyboardLayout.toString());
- } else {
- pref.setSummary(R.string.keyboard_layout_default_label);
- }
- pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- showKeyboardLayoutDialog(identifier);
- return true;
- }
- });
- mHardKeyboardPreferenceList.add(pref);
+ final int[] devices = InputDevice.getDeviceIds();
+ for (int i = 0; i < devices.length; i++) {
+ InputDevice device = InputDevice.getDevice(devices[i]);
+ if (device != null
+ && !device.isVirtual()
+ && device.isFullKeyboard()) {
+ final InputDeviceIdentifier identifier = device.getIdentifier();
+ final String keyboardLayoutDescriptor =
+ mIm.getCurrentKeyboardLayoutForInputDevice(identifier);
+ final KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
+ mIm.getKeyboardLayout(keyboardLayoutDescriptor) : null;
+
+ final PreferenceScreen pref = new PreferenceScreen(getActivity(), null);
+ pref.setTitle(device.getName());
+ if (keyboardLayout != null) {
+ pref.setSummary(keyboardLayout.toString());
+ } else {
+ pref.setSummary(R.string.keyboard_layout_default_label);
}
+ pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ showKeyboardLayoutDialog(identifier);
+ return true;
+ }
+ });
+ mHardKeyboardPreferenceList.add(pref);
}
}
@@ -795,76 +793,74 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
// Hard keyboards
InputManager inputManager = (InputManager) context.getSystemService(
Context.INPUT_SERVICE);
- if (resources.getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY) {
- boolean hasHardKeyboards = false;
-
- final int[] devices = InputDevice.getDeviceIds();
- for (int i = 0; i < devices.length; i++) {
- InputDevice device = InputDevice.getDevice(devices[i]);
- if (device == null || device.isVirtual() || !device.isFullKeyboard()) {
- continue;
- }
+ boolean hasHardKeyboards = false;
- hasHardKeyboards = true;
+ final int[] devices = InputDevice.getDeviceIds();
+ for (int i = 0; i < devices.length; i++) {
+ InputDevice device = InputDevice.getDevice(devices[i]);
+ if (device == null || device.isVirtual() || !device.isFullKeyboard()) {
+ continue;
+ }
- InputDeviceIdentifier identifier = device.getIdentifier();
- String keyboardLayoutDescriptor =
- inputManager.getCurrentKeyboardLayoutForInputDevice(identifier);
- KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
- inputManager.getKeyboardLayout(keyboardLayoutDescriptor) : null;
+ hasHardKeyboards = true;
- String summary;
- if (keyboardLayout != null) {
- summary = keyboardLayout.toString();
- } else {
- summary = context.getString(R.string.keyboard_layout_default_label);
- }
+ InputDeviceIdentifier identifier = device.getIdentifier();
+ String keyboardLayoutDescriptor =
+ inputManager.getCurrentKeyboardLayoutForInputDevice(identifier);
+ KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
+ inputManager.getKeyboardLayout(keyboardLayoutDescriptor) : null;
- indexable = new SearchIndexableRaw(context);
- indexable.key = device.getName();
- indexable.title = device.getName();
- indexable.summaryOn = summary;
- indexable.summaryOff = summary;
- indexable.screenTitle = screenTitle;
- indexables.add(indexable);
+ String summary;
+ if (keyboardLayout != null) {
+ summary = keyboardLayout.toString();
+ } else {
+ summary = context.getString(R.string.keyboard_layout_default_label);
}
- if (hasHardKeyboards) {
- // Hard keyboard category.
- indexable = new SearchIndexableRaw(context);
- indexable.key = "builtin_keyboard_settings";
- indexable.title = context.getString(
- R.string.builtin_keyboard_settings_title);
- indexable.screenTitle = screenTitle;
- indexables.add(indexable);
-
- // Auto replace.
- indexable = new SearchIndexableRaw(context);
- indexable.key = "auto_replace";
- indexable.title = context.getString(R.string.auto_replace);
- indexable.summaryOn = context.getString(R.string.auto_replace_summary);
- indexable.summaryOff = context.getString(R.string.auto_replace_summary);
- indexable.screenTitle = screenTitle;
- indexables.add(indexable);
-
- // Auto caps.
- indexable = new SearchIndexableRaw(context);
- indexable.key = "auto_caps";
- indexable.title = context.getString(R.string.auto_caps);
- indexable.summaryOn = context.getString(R.string.auto_caps_summary);
- indexable.summaryOff = context.getString(R.string.auto_caps_summary);
- indexable.screenTitle = screenTitle;
- indexables.add(indexable);
-
- // Auto punctuate.
- indexable = new SearchIndexableRaw(context);
- indexable.key = "auto_punctuate";
- indexable.title = context.getString(R.string.auto_punctuate);
- indexable.summaryOn = context.getString(R.string.auto_punctuate_summary);
- indexable.summaryOff = context.getString(R.string.auto_punctuate_summary);
- indexable.screenTitle = screenTitle;
- indexables.add(indexable);
- }
+ indexable = new SearchIndexableRaw(context);
+ indexable.key = device.getName();
+ indexable.title = device.getName();
+ indexable.summaryOn = summary;
+ indexable.summaryOff = summary;
+ indexable.screenTitle = screenTitle;
+ indexables.add(indexable);
+ }
+
+ if (hasHardKeyboards) {
+ // Hard keyboard category.
+ indexable = new SearchIndexableRaw(context);
+ indexable.key = "builtin_keyboard_settings";
+ indexable.title = context.getString(
+ R.string.builtin_keyboard_settings_title);
+ indexable.screenTitle = screenTitle;
+ indexables.add(indexable);
+
+ // Auto replace.
+ indexable = new SearchIndexableRaw(context);
+ indexable.key = "auto_replace";
+ indexable.title = context.getString(R.string.auto_replace);
+ indexable.summaryOn = context.getString(R.string.auto_replace_summary);
+ indexable.summaryOff = context.getString(R.string.auto_replace_summary);
+ indexable.screenTitle = screenTitle;
+ indexables.add(indexable);
+
+ // Auto caps.
+ indexable = new SearchIndexableRaw(context);
+ indexable.key = "auto_caps";
+ indexable.title = context.getString(R.string.auto_caps);
+ indexable.summaryOn = context.getString(R.string.auto_caps_summary);
+ indexable.summaryOff = context.getString(R.string.auto_caps_summary);
+ indexable.screenTitle = screenTitle;
+ indexables.add(indexable);
+
+ // Auto punctuate.
+ indexable = new SearchIndexableRaw(context);
+ indexable.key = "auto_punctuate";
+ indexable.title = context.getString(R.string.auto_punctuate);
+ indexable.summaryOn = context.getString(R.string.auto_punctuate_summary);
+ indexable.summaryOff = context.getString(R.string.auto_punctuate_summary);
+ indexable.screenTitle = screenTitle;
+ indexables.add(indexable);
}
// Voice recognizers.