Anastasia Rozovskaya
09/20/2021, 10:27 AMAnastasia Rozovskaya
09/20/2021, 10:30 AMfun mapApiStateToColor(state: State): Color =
when (state) {
State.On -> Color.MyRed
State.Off -> Color.MyBlue
}
Anastasia Rozovskaya
09/20/2021, 10:34 AMprivate val isInDarkMode =
(resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES
But the thing is, that when I change a theme when application is running, the isInDarkMode
not changed and all the UI is updated apart from this case.
In a mapper function I use this variable like:
if (isInDarkMode) Color.MyLightRed else Color.MyRed
Anastasia Rozovskaya
09/20/2021, 10:43 AMisSystemInDarkTheme()
, but as we know it must be called from a composable scope and it seemed impossible to use @Composable
annotation in the DI module. The DI framework broke on generating necessary code.Csaba Szugyiczki
09/20/2021, 10:44 AMState
as is, and assigning the proper color to it in your View layerJavier
09/20/2021, 11:54 AMJavier
09/20/2021, 11:55 AMAnastasia Rozovskaya
09/20/2021, 12:36 PMJavier
09/20/2021, 12:51 PMAnastasia Rozovskaya
09/20/2021, 1:46 PM