Dark theme for EULA

This commit is contained in:
M66B
2021-02-28 09:32:21 +01:00
parent d6a231ee36
commit 2fc2ec48c9
3 changed files with 13 additions and 5 deletions

View File

@@ -861,6 +861,13 @@ public class Helper {
view.setLayoutParams(lparam);
}
static boolean isNight(Context context) {
// https://developer.android.com/guide/topics/ui/look-and-feel/darktheme#configuration_changes
int uiMode = context.getResources().getConfiguration().uiMode;
Log.i("UI mode=" + uiMode);
return ((uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES);
}
static boolean isDarkTheme(Context context) {
TypedValue tv = new TypedValue();
context.getTheme().resolveAttribute(R.attr.themeName, tv, true);