Fix appearance
This commit is contained in:
parent
095dffd80a
commit
41cf364438
@ -1,6 +1,7 @@
|
||||
package com.cringe_studios.cringe_authenticator.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.res.Configuration;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
@ -26,11 +27,22 @@ public class ThemeUtil {
|
||||
if(!SettingsUtil.isThemedBackgroundEnabled(activity)) return;
|
||||
|
||||
Theme theme = SettingsUtil.getTheme(activity);
|
||||
Appearance appearance = SettingsUtil.getAppearance(activity);
|
||||
|
||||
int nightMode = activity.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
boolean isNightMode;
|
||||
switch(nightMode) {
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
default:
|
||||
isNightMode = false;
|
||||
break;
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
isNightMode = true;
|
||||
break;
|
||||
}
|
||||
|
||||
View v = activity.findViewById(R.id.app_background);
|
||||
if(v != null) {
|
||||
v.setBackgroundResource(appearance == Appearance.LIGHT ? theme.getLightBackground() : theme.getDarkBackground());
|
||||
v.setBackgroundResource(!isNightMode ? theme.getLightBackground() : theme.getDarkBackground());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user