fixed isDarkMode implementation
This commit is contained in:
parent
4f823cb6bd
commit
602efbc930
1 changed files with 13 additions and 7 deletions
|
@ -67,15 +67,21 @@ public class ThemeChooser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDarkTheme(Context context) {
|
public boolean isDarkTheme(Context context) {
|
||||||
if(AppCompatDelegate.MODE_NIGHT_YES == AppCompatDelegate.getDefaultNightMode()) {
|
switch(AppCompatDelegate.getDefaultNightMode()) {
|
||||||
return true;
|
case AppCompatDelegate.MODE_NIGHT_YES:
|
||||||
}
|
return true;
|
||||||
|
|
||||||
int nightModeFlags = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
case AppCompatDelegate.MODE_NIGHT_AUTO:
|
||||||
if(Configuration.UI_MODE_NIGHT_YES == nightModeFlags) {
|
int nightModeFlags = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||||
return true;
|
if(Configuration.UI_MODE_NIGHT_YES == nightModeFlags) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// fallthrough is deliberate
|
||||||
|
case AppCompatDelegate.MODE_NIGHT_NO:
|
||||||
|
// fallthrough is deliberate
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getSelectedTheme(Context context, boolean forceReloadCache) {
|
public Integer getSelectedTheme(Context context, boolean forceReloadCache) {
|
||||||
|
|
Loading…
Reference in a new issue