// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/util/LocaleUtil.java
// public abstract class LocaleUtil {
//     private static final boolean DEBUG = BuildConfig.DEBUG;
// 
//     private static final String TAG = LogUtils.makeLogTag(LocaleUtil.class);
// 
//     private LocaleUtil() {
// 
//     }
// 
//     /**
//      * Tries to get the name for the country
//      *
//      * @param code language code, for example en
//      * @return the country name or the code
//      */
//     public static String getCountryName(@NonNull String code) {
//         try {
//             return LocaleUtils.toLocale("en_" + code.toUpperCase(Locale.ENGLISH)).getDisplayCountry();
//         } catch (IllegalArgumentException ex) {
//             if (DEBUG) {
//                 Log.i(TAG, "couldn't resolve " + code, ex);
//             }
// 
//             return code;
//         }
//     }
// 
//     public static List<String> getCountryNames(Set<String> codes) {
//         List<String> names = new ArrayList<>();
// 
//         for (String code : codes) {
//             String resolved = getCountryName(code);
// 
//             if (!names.contains(resolved)) {
//                 names.add(resolved);
//             }
//         }
// 
//         Collections.sort(names);
// 
//         return Collections.unmodifiableList(names);
//     }
// }


import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AlertDialog;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.FragmentArg;
import org.fitchfamily.android.gsmlocation.util.LocaleUtil;
import java.util.TreeSet;

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        listener = (Listener) activity;
    }

    @Override
    public void onDetach() {
        super.onDetach();
        listener = null;
    }

    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final String[] choices = new String[numbers.size()];
        final boolean[] checked = new boolean[choices.length];
        final int[] numbers = new int[choices.length];

        int i = 0;
        for (int number : this.numbers) {
            choices[i] = String.valueOf(number);
            checked[i] = listener.isMccEnabled(number);
            numbers[i] = number;

            i++;
        }

        return new AlertDialog.Builder(getActivity())
// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/util/LocaleUtil.java
// public abstract class LocaleUtil {
//     private static final boolean DEBUG = BuildConfig.DEBUG;
// 
//     private static final String TAG = LogUtils.makeLogTag(LocaleUtil.class);
// 
//     private LocaleUtil() {
// 
//     }
// 
//     /**
//      * Tries to get the name for the country
//      *
//      * @param code language code, for example en
//      * @return the country name or the code
//      */
//     public static String getCountryName(@NonNull String code) {
//         try {
//             return LocaleUtils.toLocale("en_" + code.toUpperCase(Locale.ENGLISH)).getDisplayCountry();
//         } catch (IllegalArgumentException ex) {
//             if (DEBUG) {
//                 Log.i(TAG, "couldn't resolve " + code, ex);
//             }
// 
//             return code;
//         }
//     }
// 
//     public static List<String> getCountryNames(Set<String> codes) {
//         List<String> names = new ArrayList<>();
// 
//         for (String code : codes) {
//             String resolved = getCountryName(code);
// 
//             if (!names.contains(resolved)) {
//                 names.add(resolved);
//             }
//         }
// 
//         Collections.sort(names);
// 
//         return Collections.unmodifiableList(names);
//     }
// }


// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/ui/settings/mcc/AreaDialogFragment.java
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AlertDialog;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.FragmentArg;
import org.fitchfamily.android.gsmlocation.util.LocaleUtil;
import java.util.TreeSet;


    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        listener = (Listener) activity;
    }

    @Override
    public void onDetach() {
        super.onDetach();
        listener = null;
    }

    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final String[] choices = new String[numbers.size()];
        final boolean[] checked = new boolean[choices.length];
        final int[] numbers = new int[choices.length];

        int i = 0;
        for (int number : this.numbers) {
            choices[i] = String.valueOf(number);
            checked[i] = listener.isMccEnabled(number);
            numbers[i] = number;

            i++;
        }

        return new AlertDialog.Builder(getActivity())
                .setTitle(LocaleUtil.getCountryName(code))