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:com.jtechme.apphub.FDroidApp.java

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

From source file:org.solovyev.android.calculator.ActivityUi.java

public void onPreCreate(@Nonnull Activity activity) {
    final SharedPreferences preferences = App.getPreferences();

    theme = Preferences.Gui.getTheme(preferences);
    activity.setTheme(theme.getThemeId(activity));

    layout = Preferences.Gui.getLayout(preferences);
}

From source file:info.papdt.blacklight.support.Utility.java

public static void initDarkMode(Activity activity) {
    if (isDarkMode(activity)) {
        int theme = 0;

        try {/* w ww  .ja v a 2 s.c  o m*/
            theme = activity.getPackageManager().getActivityInfo(activity.getComponentName(), 0).theme;
        } catch (NameNotFoundException e) {
            return;
        }

        // Convert to dark theme
        if (theme == R.style.BL_Theme_Light) {
            theme = R.style.BL_Theme_Dark;
        } else if (theme == R.style.BL_Theme_Light_Translucent) {
            theme = R.style.BL_Theme_Dark_Translucent;
        } else if (theme == R.style.BL_Theme_Light_TranslucentActionBar_NoTranslucent) {
            theme = R.style.BL_Theme_Dark_TranslucentActionBar_NoTranslucent;
        } else if (theme == R.style.BL_Theme_Light_TranslucentActionBar) {
            theme = R.style.BL_Theme_Dark_TranslucentActionBar;
        } else if (theme == R.style.BL_Theme_Light_GradientActionBar) {
            theme = R.style.BL_Theme_Dark_GradientActionBar;
        } else if (theme == R.style.BL_Theme_Light_WithNav) {
            theme = R.style.BL_Theme_Dark_WithNav;
        }

        activity.setTheme(theme);
    }
}

From source file:com.zoffcc.applications.zanavi.Navit.java

public static void applySharedTheme(Activity act, int Theme_id) {
    act.setTheme(Theme_id);
}