chris
06/30/2020, 1:57 AM@Composable
Profile( username: String, name: String, location: String, activityTotals: List<ActivityTotals>? = null )
The activityTotals come back afterwards. Since Profile isn’t an object I can’t expose a property to update with the new value. Would I expose a state or pass in an observable or do something else?Adam Powell
06/30/2020, 2:04 AMchris
06/30/2020, 2:12 AMviewModel.detailedAthlete.observe(viewLifecycleOwner, Observer { athlete ->
profilezone.setContent{ Profile(athlete.username, athlete.name, athlete.location))
}chris
06/30/2020, 2:13 AMchris
06/30/2020, 2:13 AMAdam Powell
06/30/2020, 2:18 AMView and may only be called by another composable function. Analogous code from a @Composable caller might look something like this:
val athlete by viewModel.detailedAthlete.observeAsState()
Profile(athlete.username, athlete.name, athlete.location)Adam Powell
06/30/2020, 2:19 AMchris
06/30/2020, 2:22 AMViewGroup.setViewContent right?
edit: I see it’s going away. Never mind.Adam Powell
06/30/2020, 2:24 AMViewGroup.setContent extension rather than setViewContent for now, but yes. You'll want to call that extension on a FrameLayout or similar since ViewGroup.setContent doesn't give you much control over the child LayoutParams or orderingchris
06/30/2020, 2:24 AMAdam Powell
06/30/2020, 2:25 AM