Use correct theme to get system accent

This commit is contained in:
Suphon Thanakornpakapong
2021-06-25 23:51:44 +07:00
parent a477cf5a16
commit 25cfb3841e
@@ -45,7 +45,8 @@ fun Context.getSystemAccent(darkTheme: Boolean): Int {
res.getColor(colorId)
} else {
val typedValue = TypedValue()
val contextWrapper = ContextThemeWrapper(this, android.R.style.Theme_DeviceDefault_DayNight)
val theme = if (darkTheme) android.R.style.Theme_DeviceDefault else android.R.style.Theme_DeviceDefault_Light
val contextWrapper = ContextThemeWrapper(this, theme)
contextWrapper.theme.resolveAttribute(android.R.attr.colorAccent, typedValue, true)
typedValue.data
}