Fix order of items in language menu.
Bug: 29571417 Change-Id: I682925afe7fe07f6300197e0b4064525f0799b4f
This commit is contained in:
@@ -62,31 +62,28 @@ class InputMethodSubtypePreference extends SwitchWithNoTextPreference {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (rhs instanceof InputMethodSubtypePreference) {
|
if (rhs instanceof InputMethodSubtypePreference) {
|
||||||
final InputMethodSubtypePreference pref = (InputMethodSubtypePreference) rhs;
|
final InputMethodSubtypePreference rhsPref = (InputMethodSubtypePreference) rhs;
|
||||||
|
if (mIsSystemLocale && !rhsPref.mIsSystemLocale) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!mIsSystemLocale && rhsPref.mIsSystemLocale) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (mIsSystemLanguage && !rhsPref.mIsSystemLanguage) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!mIsSystemLanguage && rhsPref.mIsSystemLanguage) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
final CharSequence t0 = getTitle();
|
final CharSequence t0 = getTitle();
|
||||||
final CharSequence t1 = rhs.getTitle();
|
final CharSequence t1 = rhs.getTitle();
|
||||||
if (TextUtils.equals(t0, t1)) {
|
if (t0 == null && t1 == null) {
|
||||||
return 0;
|
return Integer.compare(hashCode(), rhs.hashCode());
|
||||||
}
|
}
|
||||||
if (mIsSystemLocale) {
|
if (t0 != null && t1 != null) {
|
||||||
return -1;
|
return collator.compare(t0.toString(), t1.toString());
|
||||||
}
|
}
|
||||||
if (pref.mIsSystemLocale) {
|
return t0 == null ? -1 : 1;
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (mIsSystemLanguage) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (pref.mIsSystemLanguage) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(t0)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(t1)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return collator.compare(t0.toString(), t1.toString());
|
|
||||||
}
|
}
|
||||||
return super.compareTo(rhs);
|
return super.compareTo(rhs);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user