summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/inputmethod
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2011-01-20 22:29:34 +0900
committerKen Wakasa <kwakasa@google.com>2011-01-21 00:46:26 +0900
commit5a813ba7f99f1c797ead4a58fdf05f91296158a4 (patch)
treef17d25d37595da274183e7743a309f4e6185f5ed /src/com/android/settings/inputmethod
parent9f7320132b7a5e7def378ae754c8c708759a8670 (diff)
downloadpackages_apps_Settings-5a813ba7f99f1c797ead4a58fdf05f91296158a4.tar.gz
packages_apps_Settings-5a813ba7f99f1c797ead4a58fdf05f91296158a4.tar.bz2
packages_apps_Settings-5a813ba7f99f1c797ead4a58fdf05f91296158a4.zip
Refine InputMethodInfo API
bug: 3370297 Change-Id: Ifaaad399586ee5b842f9b7762281d76e7969d24c
Diffstat (limited to 'src/com/android/settings/inputmethod')
-rw-r--r--src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java9
-rw-r--r--src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java12
-rw-r--r--src/com/android/settings/inputmethod/InputMethodConfig.java2
3 files changed, 15 insertions, 8 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
index 3ba06252c..0e5be2063 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
@@ -181,7 +181,8 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment {
for (int i = 0; i < N; ++i) {
final InputMethodInfo imi = mInputMethodProperties.get(i);
- if (imi.getSubtypes().size() <= 1) continue;
+ final int subtypeCount = imi.getSubtypeCount();
+ if (subtypeCount <= 1) continue;
final String imiId = imi.getId();
// Add this subtype to the list when no IME is specified or when the IME of this
// subtype is the specified IME.
@@ -205,10 +206,10 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment {
activeInputMethodsCategory.setTitle(R.string.active_input_method_subtypes);
root.addPreference(activeInputMethodsCategory);
- ArrayList<InputMethodSubtype> subtypes = imi.getSubtypes();
ArrayList<Preference> subtypePreferences = new ArrayList<Preference>();
- if (subtypes.size() > 0) {
- for (InputMethodSubtype subtype: subtypes) {
+ if (subtypeCount > 0) {
+ for (int j = 0; j < subtypeCount; ++j) {
+ InputMethodSubtype subtype = imi.getSubtypeAt(j);
CharSequence subtypeLabel;
int nameResId = subtype.getNameResId();
if (nameResId != 0) {
diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
index bc347faa3..80030418a 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
@@ -179,7 +179,9 @@ public class InputMethodAndSubtypeUtil {
HashSet<String> subtypesSet = enabledIMEAndSubtypesMap.get(imiId);
boolean subtypeCleared = false;
- for (InputMethodSubtype subtype : imi.getSubtypes()) {
+ final int subtypeCount = imi.getSubtypeCount();
+ for (int i = 0; i < subtypeCount; ++i) {
+ InputMethodSubtype subtype = imi.getSubtypeAt(i);
final String subtypeHashCodeStr = String.valueOf(subtype.hashCode());
CheckBoxPreference subtypePref = (CheckBoxPreference) context.findPreference(
imiId + subtypeHashCodeStr);
@@ -293,7 +295,9 @@ public class InputMethodAndSubtypeUtil {
PreferenceScreen preferenceScreen = context.getPreferenceScreen();
for (InputMethodInfo imi : inputMethodProperties) {
if (id.equals(imi.getId())) {
- for (InputMethodSubtype subtype : imi.getSubtypes()) {
+ final int subtypeCount = imi.getSubtypeCount();
+ for (int i = 0; i < subtypeCount; ++i) {
+ InputMethodSubtype subtype = imi.getSubtypeAt(i);
CheckBoxPreference pref = (CheckBoxPreference) preferenceScreen.findPreference(
id + subtype.hashCode());
if (pref != null) {
@@ -311,7 +315,9 @@ public class InputMethodAndSubtypeUtil {
for (InputMethodInfo imi : inputMethodProperties) {
String id = imi.getId();
HashSet<String> enabledSubtypesSet = enabledSubtypes.get(id);
- for (InputMethodSubtype subtype : imi.getSubtypes()) {
+ final int subtypeCount = imi.getSubtypeCount();
+ for (int i = 0; i < subtypeCount; ++i) {
+ InputMethodSubtype subtype = imi.getSubtypeAt(i);
String hashCode = String.valueOf(subtype.hashCode());
if (DEBUG) {
Log.d(TAG, "--- Set checked state: " + "id" + ", " + hashCode + ", "
diff --git a/src/com/android/settings/inputmethod/InputMethodConfig.java b/src/com/android/settings/inputmethod/InputMethodConfig.java
index 908fa05a2..22d4411f6 100644
--- a/src/com/android/settings/inputmethod/InputMethodConfig.java
+++ b/src/com/android/settings/inputmethod/InputMethodConfig.java
@@ -218,7 +218,7 @@ public class InputMethodConfig extends SettingsPreferenceFragment {
// Add subtype settings when this IME has two or more subtypes.
PreferenceScreen prefScreen = new PreferenceScreen(getActivity(), null);
prefScreen.setTitle(R.string.active_input_method_subtypes);
- if (imi.getSubtypes().size() > 1) {
+ if (imi.getSubtypeCount() > 1) {
intent = new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED