Don't crash when uiMode is set to UI_MODE_NIGHT_UNDEFINED

This commit is contained in:
Alexander Bakker 2021-02-21 17:08:05 +01:00
parent a519b31bd3
commit a6ab669811

View file

@ -121,13 +121,10 @@ public abstract class AegisActivity extends AppCompatActivity implements AegisAp
if (theme == Theme.SYSTEM || theme == Theme.SYSTEM_AMOLED) {
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
switch (currentNightMode) {
case Configuration.UI_MODE_NIGHT_NO:
theme = Theme.LIGHT;
break;
case Configuration.UI_MODE_NIGHT_YES:
theme = theme == Theme.SYSTEM_AMOLED ? Theme.AMOLED : Theme.DARK;
break;
if (currentNightMode == Configuration.UI_MODE_NIGHT_YES) {
theme = theme == Theme.SYSTEM_AMOLED ? Theme.AMOLED : Theme.DARK;
} else {
theme = Theme.LIGHT;
}
}