Use correct theme to get system accent
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user