diff --git a/app/src/main/java/eu/faircode/email/SimpleTask.java b/app/src/main/java/eu/faircode/email/SimpleTask.java index 06b9a1ae38..bc8b80232f 100644 --- a/app/src/main/java/eu/faircode/email/SimpleTask.java +++ b/app/src/main/java/eu/faircode/email/SimpleTask.java @@ -62,6 +62,7 @@ public abstract class SimpleTask implements LifecycleObserver { private static PowerManager.WakeLock wl = null; private static ExecutorService globalExecutor = null; + private static int themeId = -1; @SuppressLint("StaticFieldLeak") private static Context themedContext = null; private static final List tasks = new ArrayList<>(); @@ -158,10 +159,11 @@ public abstract class SimpleTask implements LifecycleObserver { } }; - if (themedContext == null) - themedContext = new ContextThemeWrapper( - context.getApplicationContext(), - FragmentDialogTheme.getTheme(context)); + int themeId = FragmentDialogTheme.getTheme(context); + if (themedContext == null || SimpleTask.themeId != themeId) { + SimpleTask.themeId = themeId; + themedContext = new ContextThemeWrapper(context.getApplicationContext(), themeId); + } future = getExecutor(context).submit(new Runnable() { private Object data;