Android Open Source - roommates Base Activity






From Project

Back to project page roommates.

License

The source code is released under:

Apache License

If you think the Android project roommates listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.mattieapps.roommates;
//from   w  w w  .  ja v a2s .c o  m
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.ActionBarActivity;

/**
 * Created by andrewmattie on 12/20/14.
 */
public abstract class BaseActivity extends ActionBarActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setAppTheme();

        super.onCreate(savedInstanceState);
    }

    public void setAppTheme(){
        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
        String themePref = preferences.getString("customAppColor", "Black");

        if (themePref.equals("Black")){
            setTheme(R.style.AppTheme);
        }
        if (themePref.equals("White")){
            setTheme(R.style.AppTheme_White);
        }
        if (themePref.equals("Red")){
            setTheme(R.style.AppTheme_Red);
        }
        if (themePref.equals("Pink")){
            setTheme(R.style.AppTheme_Pink);
        }
        if (themePref.equals("Purple")){
            setTheme(R.style.AppTheme_Purple);
        }
        if (themePref.equals("Blue[Indigo]")){
            setTheme(R.style.AppTheme_Blue);
        }
        if (themePref.equals("Teal")){
            setTheme(R.style.AppTheme_Teal);
        }
        if (themePref.equals("Green")){
            setTheme(R.style.AppTheme_Green);
        }
        if (themePref.equals("Amber")){
            setTheme(R.style.AppTheme_Amber);
        }
    }
}




Java Source Code List

com.mattieapps.roommates.ApplicationTest.java
com.mattieapps.roommates.BaseActivity.java
com.mattieapps.roommates.DrawerListAdapter.java
com.mattieapps.roommates.MainActivity.java
com.mattieapps.roommates.MainActivity.java
com.mattieapps.roommates.RentCalFragment.java
com.mattieapps.roommates.Settings.java
com.mattieapps.roommates.TipCalFragment.java