Stylianos Gakis
01/07/2022, 9:28 AMZoltan Demant
01/07/2022, 10:09 AMTash
01/07/2022, 10:14 AMStylianos Gakis
01/07/2022, 10:25 AMandroid:configChanges="colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
to my team without proper documentation behind it. I haven’t found issues myself but I know not to trust my own testing when it comes to stuff like configChanges.Csaba Szugyiczki
01/07/2022, 10:27 AMcurioustechizen
01/07/2022, 10:37 AMStylianos Gakis
01/07/2022, 10:42 AMfontWeightAdjustment
is not specified in this tivi sample, I wonder if it’s by accident or notcurioustechizen
01/07/2022, 10:42 AMonConfigurationChanged
).AndroidView
composable to embed XML views inside your Composable views.tad
01/08/2022, 5:44 AMcurioustechizen
01/08/2022, 10:35 AMView#onConfigurationChanged
is protected. Moreover even if you could call it, you don't know if the View reacts to it at all.Albert Chang
01/08/2022, 3:30 PMkey(LocalConfiguration.current) {
AndroidView()
}
to force recreate the view on configuration change.Stylianos Gakis
01/10/2022, 12:33 PMMdcTheme(setDefaultFontFamily = true, content = content)
I am actually not getting the updated version of the system theme.
Tested it by doing this
val isLight = MaterialTheme.colors.isLight
val isSystemInDarkMode = isSystemInDarkTheme()
SideEffect {
d { "isSystemInDarkMode: $isSystemInDarkMode" }
d { "isLight: $isLight" }
}
and it doesn’t change when I change the phone’s dark/light mode
When I change it to a plain
MaterialTheme(
colors = if (isSystemInDarkTheme()) { darkColors() } else { lightColors() },
content = content
)
The logging does work as it should, and the UI works as well provided I do the key() trick you’re showing above.
MdcTheme
seems to create and remember the theme parameters using this key which may be the culprit as to why it doesn’t recompose with the changes. This feels like a bug, or am I missing something super obvious?
p.s I am displaying a simple AndroidViewBinding(GenericErrorBinding::inflate)
key(LocalConfiguration.current) {
MdcTheme(setDefaultFontFamily = true, content = content)
}
But this is what we’re supposed to be getting for free from compose, now I’d be double-checking config changes and it might recompose twice for no reason on all of my composables? Not even sure though