// Path: application/src/open/java/com/projectsexception/myapplist/app/MyAppListApplication.java
// public class MyAppListApplication extends Application {
// 
//     public static final String LOG_TAG = "MyAppList";
//     public static final int LOG_LEVEL = BuildConfig.DEBUG ? Log.DEBUG : Log.INFO;
// 
//     public void analyticsSetScreenName(String screenName) {
// 
//     }
// 
//     public void analyticsSend() {
// 
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         CustomLog.initLog(LOG_TAG, LOG_LEVEL);
//     }
// }
// 
// Path: application/src/main/java/com/projectsexception/myapplist/view/ThemeManager.java
// public class ThemeManager {
//     
//     private static int THEME = 0;
//     private static int PREF_THEME = 0;
// 
//     private static final int[] THEMES = {
//             R.style.MyAppListTheme,
//             R.style.MyAppListThemeLight,
//             R.style.MyAppListThemeFlavored,
//             R.style.MyAppListThemeLightFlavored
//     };
// 
//     private static final int[] PREF_THEMES = {
//             R.style.MyAppListTheme,
//             R.style.MyAppListThemeLight,
//             R.style.MyAppListTheme,
//             R.style.MyAppListThemeLight
//     };
// 
//     private static final int[] THEME_NAMES = {
//             R.string.theme_dark,
//             R.string.theme_light,
//             R.string.theme_dark_flavored,
//             R.string.theme_light_flavored
//     };
//     
//     public static int getTheme(Context context) {
//         if (THEME == 0) {
//             final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
//             THEME = THEMES[parseThemeValue(prefs.getString(MyAppListPreferenceActivity.KEY_THEME, "0"))];
//         }
//         return THEME;
//     }
// 
//     public static int getPreferenceTheme(Context context) {
//         if (PREF_THEME == 0) {
//             final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
//             PREF_THEME = PREF_THEMES[parseThemeValue(prefs.getString(MyAppListPreferenceActivity.KEY_THEME, "0"))];
//         }
//         return PREF_THEME;
//     }
// 
//     public static void changeTheme(String themeString) {
//         THEME = THEMES[parseThemeValue(themeString)];
//         PREF_THEME = PREF_THEMES[parseThemeValue(themeString)];
//     }
// 
//     public static void restartActivity(Activity activity) {
//         activity.finish();
//         Intent intent = new Intent(activity, activity.getClass());
//         intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
//         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//         activity.startActivity(intent);
//     }
// 
//     public static int getThemeName(String themeValue) {
//         return THEME_NAMES[parseThemeValue(themeValue)];
//     }
// 
//     public static boolean isFlavoredTheme(Context context) {
//         int actualTheme = getTheme(context);
//         return actualTheme == R.style.MyAppListThemeFlavored || actualTheme == R.style.MyAppListThemeLightFlavored;
//     }
// 
//     static int parseThemeValue(String themeValue) {
//         int value;
//         try {
//             value = Integer.parseInt(themeValue);
//         } catch (Exception e) {
//             value = 0;
//         }
//         return value % THEMES.length;
//     }
// 
// }


import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import com.projectsexception.myapplist.app.MyAppListApplication;
import com.projectsexception.myapplist.view.ThemeManager;
package com.projectsexception.myapplist;



public class BaseActivity extends ActionBarActivity {
    
    private int mTheme;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
// Path: application/src/open/java/com/projectsexception/myapplist/app/MyAppListApplication.java
// public class MyAppListApplication extends Application {
// 
//     public static final String LOG_TAG = "MyAppList";
//     public static final int LOG_LEVEL = BuildConfig.DEBUG ? Log.DEBUG : Log.INFO;
// 
//     public void analyticsSetScreenName(String screenName) {
// 
//     }
// 
//     public void analyticsSend() {
// 
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         CustomLog.initLog(LOG_TAG, LOG_LEVEL);
//     }
// }
// 
// Path: application/src/main/java/com/projectsexception/myapplist/view/ThemeManager.java
// public class ThemeManager {
//     
//     private static int THEME = 0;
//     private static int PREF_THEME = 0;
// 
//     private static final int[] THEMES = {
//             R.style.MyAppListTheme,
//             R.style.MyAppListThemeLight,
//             R.style.MyAppListThemeFlavored,
//             R.style.MyAppListThemeLightFlavored
//     };
// 
//     private static final int[] PREF_THEMES = {
//             R.style.MyAppListTheme,
//             R.style.MyAppListThemeLight,
//             R.style.MyAppListTheme,
//             R.style.MyAppListThemeLight
//     };
// 
//     private static final int[] THEME_NAMES = {
//             R.string.theme_dark,
//             R.string.theme_light,
//             R.string.theme_dark_flavored,
//             R.string.theme_light_flavored
//     };
//     
//     public static int getTheme(Context context) {
//         if (THEME == 0) {
//             final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
//             THEME = THEMES[parseThemeValue(prefs.getString(MyAppListPreferenceActivity.KEY_THEME, "0"))];
//         }
//         return THEME;
//     }
// 
//     public static int getPreferenceTheme(Context context) {
//         if (PREF_THEME == 0) {
//             final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
//             PREF_THEME = PREF_THEMES[parseThemeValue(prefs.getString(MyAppListPreferenceActivity.KEY_THEME, "0"))];
//         }
//         return PREF_THEME;
//     }
// 
//     public static void changeTheme(String themeString) {
//         THEME = THEMES[parseThemeValue(themeString)];
//         PREF_THEME = PREF_THEMES[parseThemeValue(themeString)];
//     }
// 
//     public static void restartActivity(Activity activity) {
//         activity.finish();
//         Intent intent = new Intent(activity, activity.getClass());
//         intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
//         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//         activity.startActivity(intent);
//     }
// 
//     public static int getThemeName(String themeValue) {
//         return THEME_NAMES[parseThemeValue(themeValue)];
//     }
// 
//     public static boolean isFlavoredTheme(Context context) {
//         int actualTheme = getTheme(context);
//         return actualTheme == R.style.MyAppListThemeFlavored || actualTheme == R.style.MyAppListThemeLightFlavored;
//     }
// 
//     static int parseThemeValue(String themeValue) {
//         int value;
//         try {
//             value = Integer.parseInt(themeValue);
//         } catch (Exception e) {
//             value = 0;
//         }
//         return value % THEMES.length;
//     }
// 
// }


// Path: application/src/main/java/com/projectsexception/myapplist/BaseActivity.java
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import com.projectsexception.myapplist.app.MyAppListApplication;
import com.projectsexception.myapplist.view.ThemeManager;

package com.projectsexception.myapplist;



public class BaseActivity extends ActionBarActivity {
    
    private int mTheme;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        mTheme = ThemeManager.getTheme(this);