package io.jari.dumpert.activities;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.ActionBarActivity;
import io.jari.dumpert.R;


public class BaseActivity extends ActionBarActivity{
    public SharedPreferences preferences;
    public boolean dontApplyTheme = false;

    void setTheme() {
        String theme = preferences.getString("theme", "green");

        if(theme.equals("green")) {
            //default theme, do nothing
        } else if(theme.equals("blue")) {
            super.setTheme(R.style.Theme_Dumpert_Blue);
        } else if(theme.equals("red")) {
            super.setTheme(R.style.Theme_Dumpert_Red);
        } else if(theme.equals("pink")) {
            super.setTheme(R.style.Theme_Dumpert_Pink);
        } else if(theme.equals("orange")) {
            super.setTheme(R.style.Theme_Dumpert_Orange);
        } else if(theme.equals("bluegray")) {
            super.setTheme(R.style.Theme_Dumpert_BlueGray);
        } else if(theme.equals("webartisans")) {
            super.setTheme(R.style.Theme_Dumpert_WebArtisans);
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        preferences = PreferenceManager.getDefaultSharedPreferences(this);

        if(!dontApplyTheme) this.setTheme();
        super.onCreate(savedInstanceState);
        if(!dontApplyTheme) this.setTheme(); // if we don't call it again here theme doesn't get properly acquired #justandroidthings
    }
}

@@ -174,24 +174,24 @@
 v7.app.A
-ctionBar
+ppCompat
 Activity
@@ -192,16 +192,17 @@
 tivity;%0A
+%0A
 import i
@@ -260,24 +260,24 @@
 ds A
-ctionBar
+ppCompat
 Activity
 %7B%0A  
@@ -272,16 +272,17 @@
 Activity
+ 
 %7B%0A    pu

use AppCompatActivity instead of ActionBarActivity