isdarktheme now should work depending on the dark theme of the app v2

This commit is contained in:
gdlbo
2022-06-14 13:26:47 +03:00
parent 2f4603af26
commit bacf196a31
2 changed files with 10 additions and 9 deletions
@@ -326,7 +326,7 @@ public class Themes {
}
public static void systemThemeChanger() {
Boolean isDarkTheme = isDarkTheme();
boolean isDarkTheme = isDarkTheme();
if (isDarkTheme){
applyTheme(getDarkTheme(), getImDarkTheme());
@@ -334,23 +334,21 @@ public class Themes {
applyTheme(getLightTheme(), getImLightTheme());
}
edit().putBoolean("isdark", isDarkTheme).commit();
if (!systemtheme()) return;
if (!systemtheme()){
edit().putBoolean("isdark", isDarkTheme).commit();
return;
}
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
switch (currentNightMode) {
case Configuration.UI_MODE_NIGHT_UNDEFINED:
applyTheme(getLightTheme(), getImLightTheme());
edit().putBoolean("isdark", !isDarkTheme).commit();
break;
case Configuration.UI_MODE_NIGHT_NO:
edit().putBoolean("isdark", false).commit();
applyTheme(getLightTheme(), getImLightTheme());
edit().putBoolean("isdark", !isDarkTheme).commit();
break;
case Configuration.UI_MODE_NIGHT_YES:
edit().putBoolean("isdark", true).commit();
applyTheme(getDarkTheme(), getImDarkTheme());
edit().putBoolean("isdark", isDarkTheme).commit();
break;
}
}