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) ?
|
final boolean isImeChecked = (pref instanceof CheckBoxPreference) ?
|
||||||
((CheckBoxPreference) pref).isChecked()
|
((CheckBoxPreference) pref).isChecked()
|
||||||
: enabledIMEAndSubtypesMap.containsKey(imiId);
|
: enabledIMEAndSubtypesMap.containsKey(imiId);
|
||||||
boolean isCurrentInputMethod = imiId.equals(currentInputMethodId);
|
final boolean isCurrentInputMethod = imiId.equals(currentInputMethodId);
|
||||||
boolean systemIme = isSystemIme(imi);
|
final boolean auxIme = isAuxiliaryIme(imi);
|
||||||
if (((onlyOneIME || systemIme) && !hasHardKeyboard) || isImeChecked) {
|
final boolean systemIme = isSystemIme(imi);
|
||||||
|
if (((onlyOneIME || (systemIme && !auxIme)) && !hasHardKeyboard) || isImeChecked) {
|
||||||
if (!enabledIMEAndSubtypesMap.containsKey(imiId)) {
|
if (!enabledIMEAndSubtypesMap.containsKey(imiId)) {
|
||||||
// imiId has just been enabled
|
// imiId has just been enabled
|
||||||
enabledIMEAndSubtypesMap.put(imiId, new HashSet<String>());
|
enabledIMEAndSubtypesMap.put(imiId, new HashSet<String>());
|
||||||
@@ -342,4 +343,19 @@ public class InputMethodAndSubtypeUtil {
|
|||||||
return (property.getServiceInfo().applicationInfo.flags
|
return (property.getServiceInfo().applicationInfo.flags
|
||||||
& ApplicationInfo.FLAG_SYSTEM) != 0;
|
& 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;
|
mImi = imi;
|
||||||
updateSummary();
|
updateSummary();
|
||||||
mIsSystemIme = InputMethodAndSubtypeUtil.isSystemIme(imi);
|
mIsSystemIme = InputMethodAndSubtypeUtil.isSystemIme(imi);
|
||||||
final int subtypeCount = imi.getSubtypeCount();
|
final boolean isAuxIme = InputMethodAndSubtypeUtil.isAuxiliaryIme(imi);
|
||||||
boolean onlyAux = true;
|
if (imiCount <= 1 || (mIsSystemIme && !isAuxIme)) {
|
||||||
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)) {
|
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user