MCPcopy Create free account
hub / github.com/M66B/NetGuard / setTheme

Method setTheme

app/src/main/java/eu/faircode/netguard/Util.java:500–519  ·  view source on GitHub ↗
(Context context)

Source from the content-addressed store, hash-verified

498 }
499
500 public static void setTheme(Context context) {
501 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
502 boolean dark = prefs.getBoolean("dark_theme", false);
503 String theme = prefs.getString("theme", "teal");
504 if (theme.equals("teal"))
505 context.setTheme(dark ? R.style.AppThemeTealDark : R.style.AppThemeTeal);
506 else if (theme.equals("blue"))
507 context.setTheme(dark ? R.style.AppThemeBlueDark : R.style.AppThemeBlue);
508 else if (theme.equals("purple"))
509 context.setTheme(dark ? R.style.AppThemePurpleDark : R.style.AppThemePurple);
510 else if (theme.equals("amber"))
511 context.setTheme(dark ? R.style.AppThemeAmberDark : R.style.AppThemeAmber);
512 else if (theme.equals("orange"))
513 context.setTheme(dark ? R.style.AppThemeOrangeDark : R.style.AppThemeOrange);
514 else if (theme.equals("green"))
515 context.setTheme(dark ? R.style.AppThemeGreenDark : R.style.AppThemeGreen);
516
517 if (context instanceof Activity && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
518 setTaskColor(context);
519 }
520
521 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
522 private static void setTaskColor(Context context) {

Callers 8

onCreateMethod · 0.95
onCreateMethod · 0.95
onCreateMethod · 0.95
onCreateMethod · 0.95
onCreateMethod · 0.95
onCreateMethod · 0.95
onCreateMethod · 0.95

Calls 2

setTaskColorMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected