Example usage for android.app Activity setTheme

List of usage examples for android.app Activity setTheme

Introduction

In this page you can find the example usage for android.app Activity setTheme.

Prototype

@Override
    public void setTheme(int resid) 

Source Link

Usage

From source file:Main.java

/**
 * This method sets the theme for the activity.
 * /*  w  ww .  j av  a2s  .  c om*/
 * @param activity
 *            context of the application
 */
public static void setTheme(Activity activity) {
    activity.setTheme(android.R.style.Theme_Black);
}

From source file:Main.java

public static void DefinirTheme(Activity activity, String titulo) {
    if (android.os.Build.VERSION.SDK_INT < 11) {
        activity.setTheme(android.R.style.Theme_Light);
        activity.setTitle(titulo);//  ww  w.  j  a  v a 2s. c  o  m
    } else {
        activity.setTheme(android.R.style.Theme_Holo_Light);

    }

}

From source file:org.voidsink.anewjkuapp.utils.UIUtils.java

public static void applyTheme(Activity activity) {
    activity.setTheme(getAppThemeResId(activity));
}

From source file:Main.java

/**
 * Overrides whatever theme the activity currently has with either
 * Theme_Holo_Light or Theme_Light, depending on OS support.
 *
 * @param activity//from  w w w. ja  v a  2s. com
 * @param useApplicationTheme
 */

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void setActivityTheme(Activity activity, boolean useApplicationTheme) {

    if (useApplicationTheme && 0 != activity.getApplicationInfo().theme) {
        activity.setTheme(activity.getApplicationInfo().theme);
    } else if (holoSupported()) {
        activity.setTheme(android.R.style.Theme_Holo_Light);
    } else {
        activity.setTheme(android.R.style.Theme_Light);
    }
}

From source file:com.viktorrudometkin.burramys.utils.UiUtils.java

static public void setPreferenceTheme(Activity a) {
    if (!PrefUtils.getBoolean(PrefUtils.LIGHT_THEME, false)) {
        a.setTheme(R.style.Theme_Dark);
    }/*  w  w  w . java2 s  .co  m*/
}

From source file:com.carlrice.reader.utils.UiUtils.java

static public void setPreferenceTheme(Activity a) {
    if (!PrefUtils.getBoolean(PrefUtils.LIGHT_THEME, true)) {
        a.setTheme(R.style.Theme_Dark);
    }//from  w  w  w  .  j a v  a2  s  . co  m
}

From source file:eu.power_switch.gui.ThemeHelper.java

/**
 * Apply a Theme to an Activity/*from  w  w w .  j  a  va  2  s.  co  m*/
 *
 * @param activity Activity to apply theme on
 */
public static void applyTheme(Activity activity) {
    switch (WearablePreferencesHandler.getTheme()) {
    case SettingsConstants.THEME_DARK_BLUE:
        activity.setTheme(R.style.PowerSwitchWearTheme_Dark_Blue);
        break;
    case SettingsConstants.THEME_DARK_RED:
        activity.setTheme(R.style.PowerSwitchWearTheme_Dark_Red);
        break;
    case SettingsConstants.THEME_LIGHT_BLUE:
        activity.setTheme(R.style.PowerSwitchWearTheme_Light_Blue);
        break;
    case SettingsConstants.THEME_LIGHT_RED:
        activity.setTheme(R.style.PowerSwitchWearTheme_Light_Red);
        break;
    default:
        activity.setTheme(R.style.PowerSwitchWearTheme_Dark_Blue);
        break;
    }
}

From source file:com.andryr.guitartuner.Utils.java

public static void setupActivityTheme(Activity activity) {
    boolean dark = Preferences.getBoolean(activity, activity.getString(R.string.pref_dark_theme_key), false);
    if (dark) {/*from   w ww. j a  v a  2s .  com*/
        activity.setTheme(R.style.AppThemeDark);
    } else {
        activity.setTheme(R.style.AppThemeLight);
    }
}

From source file:com.einzig.ipst2.util.ThemeHelper.java

public static void setSettingsTheme(Activity activity) {
    PreferencesHelper preferencesHelper = new PreferencesHelper(activity);
    if (preferencesHelper.getBool(preferencesHelper.themeKey())) {
        activity.setTheme(R.style.AppTheme_Dark);
    } else//from w  w  w.  j  a va  2  s .c  o  m
        activity.setTheme(R.style.AppTheme);
}

From source file:me.willowcheng.makerthings.util.Util.java

public static void setActivityTheme(Activity activity) {
    //        if (PreferenceManager.getDefaultSharedPreferences(activity).getString(Constants.PREFERENCE_THEME, "dark").equals("dark")) {
    //            activity.setTheme(R.style.HABDroid_Dark);
    //        } else {
    activity.setTheme(R.style.NavDrawerTheme);
    //        }// ww w  .ja va  2  s . c  om
}