~/talk

MVVM & Nested Fragments/Views: ViewModel Contracts

Talkat droidcon SF 2019 · 2019-11-18..11-19· [android, frontend-architecture]
links:none on file
links:none on file
slides:none on file

Claim: define small interface-based ViewModel Contracts that fragments expect and pass the parent ViewModel class in their arguments so fragments obtain the parent instance via ViewModelProvider and cast it to the contract. Uses LiveData, ViewModelProvider/ViewModelFactory, LiveData transformations and simple extension helpers. Built a registration flow (username email interests + persistent progress card) and refactor removes the activity as mediator, yields plug-and-play reusable fragments and clearer state mapping instead of a monolithic shared ViewModel. Sample code on GitHub; approach works in production.

AI-written summary · about

  1. 0:00Introduction and motivation
  2. 1:07Fragment communication challenges
  3. 5:38Registration flow example
  4. 8:47MVVM and ViewModel basics
  5. 12:36ViewModel contracts concept
  6. 16:24Implementation steps
  7. 21:59Key benefits and takeaways
  8. 23:06Resources and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.