// 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 long TIME_DEFAULT = 0;
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_LEARN_DOUBLE_KEY = "timeLearnDouble";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_LEARN_SINGLE_KEY = "timeLearnSingle";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_PRACTICE_DOUBLE_KEY = "timePracticeDouble";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_PRACTICE_SINGLE_KEY = "timePracticeSingle";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_TEST_DOUBLE_KEY = "timeTestDouble";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_TEST_SINGLE_KEY = "timeTestSingle";


import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import java.lang.ref.WeakReference;
import static com.aepronunciation.ipa.MainActivity.PREFS_NAME;
import static com.aepronunciation.ipa.MainActivity.TIME_DEFAULT;
import static com.aepronunciation.ipa.MainActivity.TIME_LEARN_DOUBLE_KEY;
import static com.aepronunciation.ipa.MainActivity.TIME_LEARN_SINGLE_KEY;
import static com.aepronunciation.ipa.MainActivity.TIME_PRACTICE_DOUBLE_KEY;
import static com.aepronunciation.ipa.MainActivity.TIME_PRACTICE_SINGLE_KEY;
import static com.aepronunciation.ipa.MainActivity.TIME_TEST_DOUBLE_KEY;
import static com.aepronunciation.ipa.MainActivity.TIME_TEST_SINGLE_KEY;
        // add up the times
        long totalTime = learnSingleTime + learnDoubleTime + practiceSingleTime
                + practiceDoubleTime + testSingleTime + testDoubleTime;
        // format in human readable
        tvTime.setText(TimeUtil.getTimeString(totalTime));

        // Get the high scores
        new GetHighScores(this).execute();
    }

    public void timeDetailsClick(View v) {

        // Start learn activity
        Intent intent = new Intent(this, HistoryTimeActivity.class);
        startActivity(intent);
    }

    public void testDetailsClick(View v) {

        // Start learn activity
        Intent intent = new Intent(this, HistoryTestsActivity.class);
        startActivity(intent);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // handle arrow click here
        if (item.getItemId() == android.R.id.home) {
            finish(); // close this activity and return to preview activity (if there is any)
        }
// 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 long TIME_DEFAULT = 0;
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_LEARN_DOUBLE_KEY = "timeLearnDouble";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_LEARN_SINGLE_KEY = "timeLearnSingle";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_PRACTICE_DOUBLE_KEY = "timePracticeDouble";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_PRACTICE_SINGLE_KEY = "timePracticeSingle";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_TEST_DOUBLE_KEY = "timeTestDouble";
// 
// Path: app/src/main/java/com/aepronunciation/ipa/MainActivity.java
// public static final String TIME_TEST_SINGLE_KEY = "timeTestSingle";


// Path: app/src/main/java/com/aepronunciation/ipa/HistoryActivity.java
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import java.lang.ref.WeakReference;
import static com.aepronunciation.ipa.MainActivity.PREFS_NAME;
import static com.aepronunciation.ipa.MainActivity.TIME_DEFAULT;
import static com.aepronunciation.ipa.MainActivity.TIME_LEARN_DOUBLE_KEY;
import static com.aepronunciation.ipa.MainActivity.TIME_LEARN_SINGLE_KEY;
import static com.aepronunciation.ipa.MainActivity.TIME_PRACTICE_DOUBLE_KEY;
import static com.aepronunciation.ipa.MainActivity.TIME_PRACTICE_SINGLE_KEY;
import static com.aepronunciation.ipa.MainActivity.TIME_TEST_DOUBLE_KEY;
import static com.aepronunciation.ipa.MainActivity.TIME_TEST_SINGLE_KEY;

        // add up the times
        long totalTime = learnSingleTime + learnDoubleTime + practiceSingleTime
                + practiceDoubleTime + testSingleTime + testDoubleTime;
        // format in human readable
        tvTime.setText(TimeUtil.getTimeString(totalTime));

        // Get the high scores
        new GetHighScores(this).execute();
    }

    public void timeDetailsClick(View v) {

        // Start learn activity
        Intent intent = new Intent(this, HistoryTimeActivity.class);
        startActivity(intent);
    }

    public void testDetailsClick(View v) {

        // Start learn activity
        Intent intent = new Intent(this, HistoryTestsActivity.class);
        startActivity(intent);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // handle arrow click here
        if (item.getItemId() == android.R.id.home) {
            finish(); // close this activity and return to preview activity (if there is any)
        }
        return super.onOptionsItemSelected(item);