// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String NUMBER_OF_QUESTIONS_KEY = "numberOfQuestions";
// 
// 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/MainActivity.java
// public static final String TEST_NAME_KEY = "testName";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TEST_MODE_KEY = "testMode";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final int TEST_RESULTS_RESULT = 0;


import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import static android.content.Context.MODE_PRIVATE;
import static com.aepronunciation.ipa.MainActivity.NUMBER_OF_QUESTIONS_KEY;
import static com.aepronunciation.ipa.MainActivity.PREFS_NAME;
import static com.aepronunciation.ipa.MainActivity.TEST_NAME_KEY;
import static com.aepronunciation.ipa.MainActivity.TEST_MODE_KEY;
import static com.aepronunciation.ipa.MainActivity.TEST_RESULTS_RESULT;
package com.aepronunciation.ipa;




public class TestFragment extends Fragment implements View.OnClickListener {

    private static final String DEFAULT_QUESTIONS = "50";

    private EditText etName;
    private Spinner spinner;
    private RadioButton rbSingle;
    //private SharedPreferences settings;

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.tab_fragment_test, container, false);

        // setup name
        if (getActivity() == null) return view;
        SharedPreferences settings = getActivity().getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
        String defaultName = getString(R.string.test_default_name);
        String name = settings.getString(TEST_NAME_KEY, defaultName);
        etName = view.findViewById(R.id.etName);
        if (!name.equals(defaultName)) {
            etName.setText(name);
            etName.clearFocus();
        }

        // set up test mode
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String NUMBER_OF_QUESTIONS_KEY = "numberOfQuestions";
// 
// 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/MainActivity.java
// public static final String TEST_NAME_KEY = "testName";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TEST_MODE_KEY = "testMode";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final int TEST_RESULTS_RESULT = 0;


// Path: app/src/main/java/com/aepronunciation/ipa/TestFragment.java
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import static android.content.Context.MODE_PRIVATE;
import static com.aepronunciation.ipa.MainActivity.NUMBER_OF_QUESTIONS_KEY;
import static com.aepronunciation.ipa.MainActivity.PREFS_NAME;
import static com.aepronunciation.ipa.MainActivity.TEST_NAME_KEY;
import static com.aepronunciation.ipa.MainActivity.TEST_MODE_KEY;
import static com.aepronunciation.ipa.MainActivity.TEST_RESULTS_RESULT;

package com.aepronunciation.ipa;




public class TestFragment extends Fragment implements View.OnClickListener {

    private static final String DEFAULT_QUESTIONS = "50";

    private EditText etName;
    private Spinner spinner;
    private RadioButton rbSingle;
    //private SharedPreferences settings;

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.tab_fragment_test, container, false);

        // setup name
        if (getActivity() == null) return view;
        SharedPreferences settings = getActivity().getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
        String defaultName = getString(R.string.test_default_name);
        String name = settings.getString(TEST_NAME_KEY, defaultName);
        etName = view.findViewById(R.id.etName);
        if (!name.equals(defaultName)) {
            etName.setText(name);
            etName.clearFocus();
        }

        // set up test mode
        String testModeString = settings.getString(TEST_MODE_KEY, SoundMode.Single.getPersistentMemoryString());