// 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 TEST_MODE_KEY = "testMode";
// 
// 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 int TEST_RESULTS_RESULT = 0;


import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import androidx.fragment.app.FragmentTransaction;
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AppCompatActivity;
import static com.aepronunciation.ipa.MainActivity.NUMBER_OF_QUESTIONS_KEY;
import static com.aepronunciation.ipa.MainActivity.TEST_MODE_KEY;
import static com.aepronunciation.ipa.MainActivity.TEST_NAME_KEY;
import static com.aepronunciation.ipa.MainActivity.TEST_RESULTS_RESULT;
        contentFragment.setArguments(contentBundle);
        transaction.replace(R.id.test_content_frame, contentFragment);
        Fragment keyboardFragment = new KeyboardFragment();
        keyboardFragment.setArguments(keyboardBundle);
        transaction.replace(R.id.keyboard_frame, keyboardFragment);
        transaction.commit();

        // disable rotation for smaller devices
        if(getResources().getBoolean(R.bool.portrait_only)){
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        }
    }

    // required method for KeyboardFragment.KeyboardListener
    @Override
    public void onKeyTouched(String keyString) {

        // find the correct fragment and then perform the appropriate action on it
        Fragment f = getSupportFragmentManager().findFragmentById(R.id.test_content_frame);
        if (f instanceof TestContentFragment) {
            // update display
            TestContentFragment testContentFragment = (TestContentFragment) f;
            testContentFragment.onKeyTouched(keyString);
        }
    }

    @Override
    protected void onActivityResult (int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

// 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 TEST_MODE_KEY = "testMode";
// 
// 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 int TEST_RESULTS_RESULT = 0;


// Path: app/src/main/java/com/aepronunciation/ipa/TestActivity.java
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import androidx.fragment.app.FragmentTransaction;
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AppCompatActivity;
import static com.aepronunciation.ipa.MainActivity.NUMBER_OF_QUESTIONS_KEY;
import static com.aepronunciation.ipa.MainActivity.TEST_MODE_KEY;
import static com.aepronunciation.ipa.MainActivity.TEST_NAME_KEY;
import static com.aepronunciation.ipa.MainActivity.TEST_RESULTS_RESULT;

        contentFragment.setArguments(contentBundle);
        transaction.replace(R.id.test_content_frame, contentFragment);
        Fragment keyboardFragment = new KeyboardFragment();
        keyboardFragment.setArguments(keyboardBundle);
        transaction.replace(R.id.keyboard_frame, keyboardFragment);
        transaction.commit();

        // disable rotation for smaller devices
        if(getResources().getBoolean(R.bool.portrait_only)){
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        }
    }

    // required method for KeyboardFragment.KeyboardListener
    @Override
    public void onKeyTouched(String keyString) {

        // find the correct fragment and then perform the appropriate action on it
        Fragment f = getSupportFragmentManager().findFragmentById(R.id.test_content_frame);
        if (f instanceof TestContentFragment) {
            // update display
            TestContentFragment testContentFragment = (TestContentFragment) f;
            testContentFragment.onKeyTouched(keyString);
        }
    }

    @Override
    protected void onActivityResult (int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == TEST_RESULTS_RESULT) {