package anabalica.github.io.meowletters;

import android.app.Activity;
import android.os.Bundle;


/**
 * This is the activity that allows to access, view and change game settings.
 * Settings include username setup, sound on/off.
 *
 * For future, possible settings:
 *  - setup for colorblind
 *  - choice of alphabet
 *  - interface language
 *  - inversion of the alphabet (practise it backwards)
 *
 * @author Ana Balica
 */
public class SettingsActivity extends Activity {

    public final static String PREF_NICKNAME = "pref_nickname";
    public final static String PREF_ALPHABET = "pref_alphabet";
    public final static String PREF_SOUND = "pref_sound";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        getFragmentManager().beginTransaction()
                .replace(android.R.id.content, new SettingsFragment())
                .commit();
    }
}

@@ -83,17 +83,162 @@
 oid.
-os.Bundle
+content.SharedPreferences;%0Aimport android.os.Bundle;%0Aimport android.preference.PreferenceManager;%0A%0Aimport anabalica.github.io.meowletters.letters.Alphabet
 ;%0A%0A%0A
@@ -1072,11 +1072,315 @@
 );%0A    %7D
+%0A%0A    @Override%0A    protected void onPause() %7B%0A        super.onPause();%0A%0A        SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);%0A        String alphabetName = sharedPrefs.getString(SettingsActivity.PREF_ALPHABET, %22%22);%0A%0A        Alphabet.setCurrent(alphabetName);%0A    %7D
 %0A%7D%0A

set current alphabet when leaving SettingsActivity