// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String PRACTICE_MODE_IS_SINGLE_KEY = "practiceMode";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String PREFS_NAME = "MyPrefsFile";


import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import androidx.appcompat.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import java.util.ArrayList;
import static android.content.Context.MODE_PRIVATE;
import static com.aepronunciation.ipa.MainActivity.PRACTICE_MODE_IS_SINGLE_KEY;
import static com.aepronunciation.ipa.MainActivity.PREFS_NAME;
    private SelectSoundDialogListener mListener;
    private RadioButton rbSingle;
    private RadioButton rbDouble;
    private CheckBox cbVowelsCategory;
    private CheckBox cbConsonantsCategory;
    private CheckBox[] checkBoxesVowels;
    private CheckBox[] checkBoxesConsonants;
    private CheckBox cbSchwa;
    private CheckBox cbUnstressedEr;
    private CheckBox cbGlottalStop;
    private CheckBox cbFlapT;
    private Button positiveButton;
    private boolean listenerDisabled = false;

    @Override
    @NonNull
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        LayoutInflater inflater = getActivity().getLayoutInflater();
        View view = inflater.inflate(R.layout.dialog_select_sound, null);

        rbSingle = view.findViewById(R.id.radio_single);
        rbDouble = view.findViewById(R.id.radio_double);
        cbSchwa = view.findViewById(R.id.cb_shwua);
        cbUnstressedEr = view.findViewById(R.id.cb_er_unstressed);
        cbGlottalStop = view.findViewById(R.id.cb_glottal_stop);
        cbFlapT = view.findViewById(R.id.cb_flap_t);

        // get saved practice mode
        SharedPreferences settings = getActivity().getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String PRACTICE_MODE_IS_SINGLE_KEY = "practiceMode";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String PREFS_NAME = "MyPrefsFile";


// Path: app/src/main/java/com/aepronunciation/ipa/SelectSoundDialogFragment.java
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import androidx.appcompat.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import java.util.ArrayList;
import static android.content.Context.MODE_PRIVATE;
import static com.aepronunciation.ipa.MainActivity.PRACTICE_MODE_IS_SINGLE_KEY;
import static com.aepronunciation.ipa.MainActivity.PREFS_NAME;

    private SelectSoundDialogListener mListener;
    private RadioButton rbSingle;
    private RadioButton rbDouble;
    private CheckBox cbVowelsCategory;
    private CheckBox cbConsonantsCategory;
    private CheckBox[] checkBoxesVowels;
    private CheckBox[] checkBoxesConsonants;
    private CheckBox cbSchwa;
    private CheckBox cbUnstressedEr;
    private CheckBox cbGlottalStop;
    private CheckBox cbFlapT;
    private Button positiveButton;
    private boolean listenerDisabled = false;

    @Override
    @NonNull
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        LayoutInflater inflater = getActivity().getLayoutInflater();
        View view = inflater.inflate(R.layout.dialog_select_sound, null);

        rbSingle = view.findViewById(R.id.radio_single);
        rbDouble = view.findViewById(R.id.radio_double);
        cbSchwa = view.findViewById(R.id.cb_shwua);
        cbUnstressedEr = view.findViewById(R.id.cb_er_unstressed);
        cbGlottalStop = view.findViewById(R.id.cb_glottal_stop);
        cbFlapT = view.findViewById(R.id.cb_flap_t);

        // get saved practice mode
        SharedPreferences settings = getActivity().getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
        boolean isSingle = settings.getBoolean(PRACTICE_MODE_IS_SINGLE_KEY, true);