andylamax
06/21/2020, 2:36 PMsetContent(Recomposer.current()) {} in fragments? and if we must pass a Recomposer as a parameter, in which scenario would I need to pass another Recomposer? say setContent(Recomposer.new()){} . If not, why is Recomposer.current() not a default parameter value in setContent?Adam Powell
06/21/2020, 4:00 PMRecomposer.current() altogether and reworking a bit of how creating a composition works in general. Recomposer.current() will be deprecated sometime in the future.Adam Powell
06/21/2020, 4:02 PMViewGroup.setContent extension altogether in favor of some sort of public AbstractComposeView that accepts a composable function as a required constructor parameterAdam Powell
06/21/2020, 4:03 PMAdam Powell
06/21/2020, 4:04 PMComposeView that would have a public setContent function, plus it could be a subclass for generated view subclasses from single composablesAdam Powell
06/21/2020, 4:04 PMAdam Powell
06/21/2020, 5:05 PMRecomposer.current() is thread-specific, and binding to the current thread by default has been a source of issues in other Android APIs over the years. Being explicit is better here. However when you're talking about the Activity extension, Activity UI always is bound to the ActivityThread - the main thread.Adam Powell
06/21/2020, 5:06 PMandylamax
06/21/2020, 5:40 PMAbstractComposeView going to look like?
class MyView : AbstractComposeView({
// . . . composables here
})Adam Powell
06/21/2020, 5:45 PMclass MyView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
) : AbstractComposeView(context, attrs) {
@Composable
override fun Content() {
// ...
}
}andylamax
06/22/2020, 4:12 AM