very slight optimize when not using amoled themes

This commit is contained in:
Jays2Kings 2021-09-11 11:59:01 -04:00
parent 3c5fc24058
commit 52fb2a8be9

View file

@ -102,10 +102,10 @@ fun AppCompatActivity.getThemeWithExtras(theme: Resources.Theme, preferences: Pr
val useAmoled =
(isInNightMode() || preferences.nightMode().get() == AppCompatDelegate.MODE_NIGHT_YES) &&
preferences.themeDarkAmoled().get()
if (oldTheme != null) {
if (oldTheme != null && useAmoled) {
val array = oldTheme.obtainStyledAttributes(intArrayOf(R.attr.background))
val bg = array.getColor(0, 0)
if (bg == Color.BLACK && useAmoled) {
if (bg == Color.BLACK) {
return oldTheme
}
}