am 50265509: Merge "Always clear hashcodes when input method settings is changed" into honeycomb

* commit '5026550964ab62ff116958739321493fd8ff4f88':
  Always clear hashcodes when input method settings is changed
This commit is contained in:
satok
2011-01-19 07:13:53 -08:00
committed by Android Git Automerger

View File

@@ -177,12 +177,20 @@ public class InputMethodAndSubtypeUtil {
enabledIMEAndSubtypesMap.put(imiId, new HashSet<String>()); enabledIMEAndSubtypesMap.put(imiId, new HashSet<String>());
} }
HashSet<String> subtypesSet = enabledIMEAndSubtypesMap.get(imiId); HashSet<String> subtypesSet = enabledIMEAndSubtypesMap.get(imiId);
boolean subtypeCleared = false;
for (InputMethodSubtype subtype : imi.getSubtypes()) { for (InputMethodSubtype subtype : imi.getSubtypes()) {
final String subtypeHashCodeStr = String.valueOf(subtype.hashCode()); final String subtypeHashCodeStr = String.valueOf(subtype.hashCode());
CheckBoxPreference subtypePref = (CheckBoxPreference) context.findPreference( CheckBoxPreference subtypePref = (CheckBoxPreference) context.findPreference(
imiId + subtypeHashCodeStr); imiId + subtypeHashCodeStr);
// In the Configure input method screen which does not have subtype preferences. // In the Configure input method screen which does not have subtype preferences.
if (subtypePref == null) continue; if (subtypePref == null) continue;
// Once subtype checkbox is found, subtypeSet needs to be cleared.
// Because of system change, hashCode value could have been changed.
if (!subtypeCleared) {
subtypesSet.clear();
subtypeCleared = true;
}
if (subtypePref.isChecked()) { if (subtypePref.isChecked()) {
subtypesSet.add(subtypeHashCodeStr); subtypesSet.add(subtypeHashCodeStr);
if (isCurrentInputMethod) { if (isCurrentInputMethod) {