Vinay Gaba
06/16/2022, 8:38 PMAdam Powell
06/16/2022, 9:03 PMremember {}
anything you need and don't worry about the rest"ViewModel
has a lot of guidance yet to write about as it relates to compose, and we have a number of ideas around a smaller, more deliberate rememberRetained
companion to rememberSaveable
Vinay Gaba
06/16/2022, 9:19 PMAdam Powell
06/16/2022, 9:22 PMAlex Vanyo
06/17/2022, 7:44 PMandroid:configChanges
or dealing with retained state, is to write UI without that built-in, implicit “oh, activity recreation will wipe away all of this and let me start this from scratch”
Compose generally make that a lot easier to do, and therefore have more robust handling for components that can react to both app-generated changes and system-generated changes.
Things like: “what if the window size changes?” “what if the font size changes?” “what if the locale changes?” might not be at the front of your mind when relying on activity recreation to handle them.
Compose makes it a lot easier to observe and react to those changes, without relying on the system to recreate the world for you. And then you also get a more reusable component that can do the right thing when you’re resizing it yourself due to an animation or state update hiding or showing something somewhere else.