Update settings for aux imes
Change-Id: I7528241eb0882fa5fae2a80e380375683cce2075
This commit is contained in:
@@ -169,9 +169,10 @@ public class InputMethodAndSubtypeUtil {
|
||||
final boolean isImeChecked = (pref instanceof CheckBoxPreference) ?
|
||||
((CheckBoxPreference) pref).isChecked()
|
||||
: enabledIMEAndSubtypesMap.containsKey(imiId);
|
||||
boolean isCurrentInputMethod = imiId.equals(currentInputMethodId);
|
||||
boolean systemIme = isSystemIme(imi);
|
||||
if (((onlyOneIME || systemIme) && !hasHardKeyboard) || isImeChecked) {
|
||||
final boolean isCurrentInputMethod = imiId.equals(currentInputMethodId);
|
||||
final boolean auxIme = isAuxiliaryIme(imi);
|
||||
final boolean systemIme = isSystemIme(imi);
|
||||
if (((onlyOneIME || (systemIme && !auxIme)) && !hasHardKeyboard) || isImeChecked) {
|
||||
if (!enabledIMEAndSubtypesMap.containsKey(imiId)) {
|
||||
// imiId has just been enabled
|
||||
enabledIMEAndSubtypesMap.put(imiId, new HashSet<String>());
|
||||
@@ -342,4 +343,19 @@ public class InputMethodAndSubtypeUtil {
|
||||
return (property.getServiceInfo().applicationInfo.flags
|
||||
& ApplicationInfo.FLAG_SYSTEM) != 0;
|
||||
}
|
||||
|
||||
public static boolean isAuxiliaryIme(InputMethodInfo imi) {
|
||||
final int subtypeCount = imi.getSubtypeCount();
|
||||
if (subtypeCount == 0) {
|
||||
return false;
|
||||
} else {
|
||||
for (int i = 0; i < subtypeCount; ++i) {
|
||||
final InputMethodSubtype subtype = imi.getSubtypeAt(i);
|
||||
if (!subtype.isAuxiliary()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -69,20 +69,8 @@ public class InputMethodPreference extends CheckBoxPreference
|
||||
mImi = imi;
|
||||
updateSummary();
|
||||
mIsSystemIme = InputMethodAndSubtypeUtil.isSystemIme(imi);
|
||||
final int subtypeCount = imi.getSubtypeCount();
|
||||
boolean onlyAux = true;
|
||||
if (subtypeCount == 0) {
|
||||
onlyAux = false;
|
||||
} else {
|
||||
for (int i = 0; i < subtypeCount; ++i) {
|
||||
final InputMethodSubtype subtype = imi.getSubtypeAt(i);
|
||||
if (!subtype.isAuxiliary()) {
|
||||
onlyAux = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (imiCount <= 1 || (mIsSystemIme && !onlyAux)) {
|
||||
final boolean isAuxIme = InputMethodAndSubtypeUtil.isAuxiliaryIme(imi);
|
||||
if (imiCount <= 1 || (mIsSystemIme && !isAuxIme)) {
|
||||
setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user