am 5a813ba7
: Refine InputMethodInfo API
* commit '5a813ba7f99f1c797ead4a58fdf05f91296158a4': Refine InputMethodInfo API
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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 + ", "
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user