lilypuchi
05/31/2022, 2:16 PMLocalConfiguration.current
line exists in calculateWindowSizeClass(activity: Activity)
? Am I wrong in thinking that it does nothing here? 🤔
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]ndroidWindowSizeClass.android.kt;l=37?q=calculateWindowSi&sq=Filip Wiesner
05/31/2022, 2:18 PM// Observe view configuration changes and recalculate the size class on each change. We can't
// use Activity#onConfigurationChanged as this will sometimes fail to be called on different
// API levels, hence why this function needs to be @Composable so we can observe the
// ComposeView's configuration changes.
lilypuchi
05/31/2022, 2:19 PMLocalConfiguration.current
triggers Recomposition? 🤔Filip Wiesner
05/31/2022, 2:20 PMLouis Pullen-Freilich [G]
05/31/2022, 2:21 PMLocalConfiguration.current
changes. And LocalConfiguration.current
changes whenever onConfigurationChanged
is called on the ComposeView
. So essentially this will recompose everytime onConfigurationChanged
is called on the viewnitrog42
05/31/2022, 2:32 PM@Composable
@ReadOnlyComposable
private fun resources(): Resources {
LocalConfiguration.current
return LocalContext.current.resources
}
@Composable
@ReadOnlyComposable
fun stringResource(@StringRes id: Int): String {
val resources = resources()
return resources.getString(id)
}
lilypuchi
05/31/2022, 2:33 PMhfhbd
05/31/2022, 2:43 PMresources
need to call LocalConfiguration.current
twice?lilypuchi
05/31/2022, 2:44 PMLocalContext
not config :blob-sweat-smile:hfhbd
05/31/2022, 2:44 PMLandry Norris
05/31/2022, 3:51 PM