am ad596491: am 942b8379: am 97352608: Merge "Don\'t show the pseudolocales unless we\'re in developer mode." into lmp-dev
* commit 'ad596491749d7e167282b06699476bd110d88ab2': Don't show the pseudolocales unless we're in developer mode.
This commit is contained in:
@@ -27,6 +27,7 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -50,10 +51,6 @@ public class LocalePicker extends ListFragment {
|
||||
public void onLocaleSelected(Locale locale);
|
||||
}
|
||||
|
||||
protected boolean isInDeveloperMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
LocaleSelectionListener mListener; // default to null
|
||||
|
||||
public static class LocaleInfo implements Comparable<LocaleInfo> {
|
||||
@@ -86,40 +83,17 @@ public class LocalePicker extends ListFragment {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an Adapter object containing Locale information. Content is sorted by
|
||||
* {@link LocaleInfo#label}.
|
||||
*/
|
||||
public static ArrayAdapter<LocaleInfo> constructAdapter(Context context) {
|
||||
return constructAdapter(context, false /* disable pesudolocales */);
|
||||
}
|
||||
|
||||
public static ArrayAdapter<LocaleInfo> constructAdapter(Context context,
|
||||
final boolean isInDeveloperMode) {
|
||||
return constructAdapter(context, R.layout.locale_picker_item, R.id.locale,
|
||||
isInDeveloperMode);
|
||||
}
|
||||
|
||||
public static ArrayAdapter<LocaleInfo> constructAdapter(Context context,
|
||||
final int layoutId, final int fieldId) {
|
||||
return constructAdapter(context, layoutId, fieldId, false /* disable pseudolocales */);
|
||||
}
|
||||
|
||||
public static List<LocaleInfo> getAllAssetLocales(Context context, boolean isInDeveloperMode) {
|
||||
final Resources resources = context.getResources();
|
||||
|
||||
final String[] locales = Resources.getSystem().getAssets().getLocales();
|
||||
List<String> localeList = new ArrayList<String>(locales.length);
|
||||
Collections.addAll(localeList, locales);
|
||||
if (isInDeveloperMode) {
|
||||
if (!localeList.contains("zz_ZZ")) {
|
||||
localeList.add("zz_ZZ");
|
||||
}
|
||||
/** - TODO: Enable when zz_ZY Pseudolocale is complete
|
||||
* if (!localeList.contains("zz_ZY")) {
|
||||
* localeList.add("zz_ZY");
|
||||
* }
|
||||
*/
|
||||
|
||||
// Don't show the pseudolocales unless we're in developer mode. http://b/17190407.
|
||||
if (!isInDeveloperMode) {
|
||||
localeList.remove("ar-XB");
|
||||
localeList.remove("en-XA");
|
||||
}
|
||||
|
||||
Collections.sort(localeList);
|
||||
@@ -160,14 +134,7 @@ public class LocalePicker extends ListFragment {
|
||||
localeInfos.add(new LocaleInfo(toTitleCase(
|
||||
getDisplayName(l, specialLocaleCodes, specialLocaleNames)), l));
|
||||
} else {
|
||||
String displayName;
|
||||
if (locale.equals("zz_ZZ")) {
|
||||
displayName = "[Developer] Accented English";
|
||||
} else if (locale.equals("zz_ZY")) {
|
||||
displayName = "[Developer] Fake Bi-Directional";
|
||||
} else {
|
||||
displayName = toTitleCase(l.getDisplayLanguage(l));
|
||||
}
|
||||
String displayName = toTitleCase(l.getDisplayLanguage(l));
|
||||
if (DEBUG) {
|
||||
Log.v(TAG, "adding "+displayName);
|
||||
}
|
||||
@@ -180,8 +147,18 @@ public class LocalePicker extends ListFragment {
|
||||
return localeInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an Adapter object containing Locale information. Content is sorted by
|
||||
* {@link LocaleInfo#label}.
|
||||
*/
|
||||
public static ArrayAdapter<LocaleInfo> constructAdapter(Context context) {
|
||||
return constructAdapter(context, R.layout.locale_picker_item, R.id.locale);
|
||||
}
|
||||
|
||||
public static ArrayAdapter<LocaleInfo> constructAdapter(Context context,
|
||||
final int layoutId, final int fieldId, final boolean isInDeveloperMode) {
|
||||
final int layoutId, final int fieldId) {
|
||||
boolean isInDeveloperMode = Settings.Global.getInt(context.getContentResolver(),
|
||||
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
|
||||
final List<LocaleInfo> localeInfos = getAllAssetLocales(context, isInDeveloperMode);
|
||||
|
||||
final LayoutInflater inflater =
|
||||
@@ -232,8 +209,7 @@ public class LocalePicker extends ListFragment {
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
final ArrayAdapter<LocaleInfo> adapter = constructAdapter(getActivity(),
|
||||
isInDeveloperMode());
|
||||
final ArrayAdapter<LocaleInfo> adapter = constructAdapter(getActivity());
|
||||
setListAdapter(adapter);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user