MVVM & Nested Fragments/Views - ViewModel Contracts
Marcos Paulo Damasceno & Bret Erickson
Senior Android Engineer & Android Engineering Manager
Marcos is a Senior Android Dev who has been working with android for 8 years now. He carries in his career big projects in Canada for companies like Bell, AmpMe and GCM Group and he has worked in great companies like TransitApp and Shopify. Active in the Android community for quite some time now, Marcos is a Google Developer Expert for Android and has given many talks in big conferences like Droidcon NYC, Android TO, Droidcon London and many others. He is passionate about UI, User Experience and architecture and advocates for awesome looking apps before Material Design was a thing. Today Marcos is working as a Senior Android Developer at Tinder working on new features and projects.
Software craftsman with over six years of tech startup experience building high quality Android apps
As smartphones get more and more powerful and with bigger screens, the complexity of tasks that people want to be able to do with them follow the same growth. Google has become very opinionated about how to do architecture and best practices, but examples are often overly simplified and not very dynamic. Fragments are making a comeback, combined with LiveData and ViewModels. As we adopt these architecture components into our apps, how can we build support for complex use cases with multiple fragments on screen? Should each fragment have a ViewModel? What about custom views? ViewModel Contracts propose the idea of having fragments (and potentially custom views) declare a ViewModel & LiveData via interface to abstract out all of the communication details between nested fragments and their parents. In this talk, we explain in detail how to implement them, how architecture components deal with ViewModels, ViewModelFactories and how we can reuse them.