Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8aec9571 authored by Narayan Kamath's avatar Narayan Kamath Committed by Android Git Automerger
Browse files

am 3bd0b010: Merge "Add an internal API to get all asset locales." into lmp-dev

* commit '3bd0b0105cae24e8265df73a2541dc2f0d630bfe':
  Add an internal API to get all asset locales.
parents 6c0e4ebd 0c434aed
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import android.widget.ListView;
import android.widget.TextView;

import java.text.Collator;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
@@ -106,11 +105,10 @@ public class LocalePicker extends ListFragment {
        return constructAdapter(context, layoutId, fieldId, false /* disable pseudolocales */);
    }

    public static ArrayAdapter<LocaleInfo> constructAdapter(Context context,
            final int layoutId, final int fieldId, final boolean isInDeveloperMode) {
    public static List<LocaleInfo> getAllAssetLocales(Context context, boolean isInDeveloperMode) {
        final Resources resources = context.getResources();

        String[] locales = Resources.getSystem().getAssets().getLocales();
        final String[] locales = Resources.getSystem().getAssets().getLocales();
        List<String> localeList = new ArrayList<String>(locales.length);
        Collections.addAll(localeList, locales);
        if (isInDeveloperMode) {
@@ -179,6 +177,13 @@ public class LocalePicker extends ListFragment {
        }

        Collections.sort(localeInfos);
        return localeInfos;
    }

    public static ArrayAdapter<LocaleInfo> constructAdapter(Context context,
            final int layoutId, final int fieldId, final boolean isInDeveloperMode) {
        final List<LocaleInfo> localeInfos = getAllAssetLocales(context, isInDeveloperMode);

        final LayoutInflater inflater =
                (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        return new ArrayAdapter<LocaleInfo>(context, layoutId, fieldId, localeInfos) {