Bug 1019726 - Part 2: exclude Maithili from locale switcher on Android < 21. r=margaret

This commit is contained in:
Richard Newman 2014-11-04 12:42:58 -08:00
parent 7375e28be3
commit c4d78a35cc

View File

@ -172,6 +172,12 @@ public class LocaleListPreference extends ListPreference {
* on this device without known issues.
*/
public boolean isUsable(CharacterValidator validator) {
if (Versions.preLollipop && this.tag.matches("[a-zA-Z]{3}.*")) {
// Earlier versions of Android can't load three-char locale code
// resources.
return false;
}
// Oh, for Java 7 switch statements.
if (this.tag.equals("bn-IN")) {
// Bengali sometimes has an English label if the Bengali script
@ -295,8 +301,11 @@ public class LocaleListPreference extends ListPreference {
values[0] = "";
for (int i = 0; i < count; ++i) {
entries[i + 1] = descriptors[i].getDisplayName();
values[i + 1] = descriptors[i].getTag();
final String displayName = descriptors[i].getDisplayName();
final String tag = descriptors[i].getTag();
Log.v(LOG_TAG, displayName + " => " + tag);
entries[i + 1] = displayName;
values[i + 1] = tag;
}
setEntries(entries);