diff options
Diffstat (limited to 'src/com/android/settings/inputmethod')
-rw-r--r-- | src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java | 9 | ||||
-rw-r--r-- | src/com/android/settings/inputmethod/KeyboardLayoutPicker.java | 28 |
2 files changed, 16 insertions, 21 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java index cc2cf0a..ac9a27b 100644 --- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java +++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java @@ -31,27 +31,23 @@ import android.content.pm.PackageManager; import android.content.res.Configuration; import android.database.ContentObserver; import android.hardware.input.InputManager; -import android.hardware.input.InputManager.KeyboardLayout; +import android.hardware.input.KeyboardLayout; import android.os.Bundle; import android.os.Handler; import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceCategory; -import android.preference.PreferenceGroup; import android.preference.PreferenceScreen; import android.provider.Settings; import android.provider.Settings.System; import android.text.TextUtils; import android.view.InputDevice; -import android.view.KeyCharacterMap; -import android.view.KeyCharacterMap.UnavailableException; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; import java.util.ArrayList; import java.util.Collections; -import java.util.Comparator; import java.util.List; import java.util.Set; @@ -373,11 +369,12 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment for (int i = 0; i < devices.length; i++) { InputDevice device = InputDevice.getDevice(devices[i]); if (device != null + && !device.isVirtual() && (device.getSources() & InputDevice.SOURCE_KEYBOARD) != 0 && device.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC) { final String inputDeviceDescriptor = device.getDescriptor(); final String keyboardLayoutDescriptor = - im.getInputDeviceKeyboardLayoutDescriptor(inputDeviceDescriptor); + im.getKeyboardLayoutForInputDevice(inputDeviceDescriptor); final KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ? im.getKeyboardLayout(keyboardLayoutDescriptor) : null; diff --git a/src/com/android/settings/inputmethod/KeyboardLayoutPicker.java b/src/com/android/settings/inputmethod/KeyboardLayoutPicker.java index 472df3a..4cfae56 100644 --- a/src/com/android/settings/inputmethod/KeyboardLayoutPicker.java +++ b/src/com/android/settings/inputmethod/KeyboardLayoutPicker.java @@ -24,19 +24,17 @@ import android.content.AsyncTaskLoader; import android.content.Context; import android.content.Loader; import android.hardware.input.InputManager; -import android.hardware.input.InputManager.KeyboardLayout; +import android.hardware.input.KeyboardLayout; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; -import android.widget.ListAdapter; import android.widget.ListView; -import java.util.Collections; -import java.util.List; +import java.util.Arrays; public class KeyboardLayoutPicker extends ListFragment - implements LoaderCallbacks<List<KeyboardLayout>> { + implements LoaderCallbacks<KeyboardLayout[]> { private static final String TAG = "KeyboardLayoutPicker"; private String mInputDeviceDescriptor; @@ -73,46 +71,46 @@ public class KeyboardLayoutPicker extends ListFragment if (mInputDeviceDescriptor != null) { KeyboardLayout c = (KeyboardLayout)l.getItemAtPosition(position); InputManager im = (InputManager)getActivity().getSystemService(Context.INPUT_SERVICE); - im.setInputDeviceKeyboardLayoutDescriptor(mInputDeviceDescriptor, c.getDescriptor()); + im.setKeyboardLayoutForInputDevice(mInputDeviceDescriptor, c.getDescriptor()); } getActivity().finish(); } @Override - public Loader<List<KeyboardLayout>> onCreateLoader(int id, Bundle args) { + public Loader<KeyboardLayout[]> onCreateLoader(int id, Bundle args) { return new KeyboardLayoutLoader(getActivity()); } @Override - public void onLoadFinished(Loader<List<KeyboardLayout>> loader, - List<KeyboardLayout> data) { + public void onLoadFinished(Loader<KeyboardLayout[]> loader, + KeyboardLayout[] data) { setListAdapter(new KeyboardLayoutAdapter(getActivity(), data)); } @Override - public void onLoaderReset(Loader<List<KeyboardLayout>> loader) { + public void onLoaderReset(Loader<KeyboardLayout[]> loader) { setListAdapter(null); } private static final class KeyboardLayoutAdapter extends ArrayAdapter<KeyboardLayout> { - public KeyboardLayoutAdapter(Context context, List<KeyboardLayout> list) { + public KeyboardLayoutAdapter(Context context, KeyboardLayout[] list) { super(context, android.R.layout.simple_list_item_1, list); } } private static final class KeyboardLayoutLoader - extends AsyncTaskLoader<List<KeyboardLayout>> { + extends AsyncTaskLoader<KeyboardLayout[]> { public KeyboardLayoutLoader(Context context) { super(context); } @Override - public List<KeyboardLayout> loadInBackground() { + public KeyboardLayout[] loadInBackground() { InputManager im = (InputManager)getContext().getSystemService(Context.INPUT_SERVICE); - List<KeyboardLayout> list = im.getKeyboardLayouts(); - Collections.sort(list); + KeyboardLayout[] list = im.getKeyboardLayouts(); + Arrays.sort(list); return list; } |