LiveData beyond VIewModels
summary
LiveData and ViewModel become the wiring for a reactive UI: use state live data + actions as a simple state machine, apply Transformations.map/switchMap for derived streams, and expose one-off side effects with an EventLiveData to avoid duplicate replays. Concrete examples show a Tinder chat UI with GIF/Bitmoji buttons modeled as sub‑state machines, custom LiveData for button groups, and data binding to attach viewgroups — the pattern reduces monolithic presenters/ViewModels, survives config changes, and keeps UI code declarative and testable.
AI-written summary · about
chapters (19)
- 0:00Introduction and speakers
- 1:10Complex UI hierarchy example
- 3:57Fragment communication challenges
- 5:21MVP limitations with complex UIs
- 7:29UI is intrinsically reactive
- 9:55ViewModel and LiveData basics
- 11:20LiveData as BehaviorSubject
- 13:26LiveData transformations
- 15:13UI as a reactive network
- 18:24State machines and UI states
- 22:41Implementing state machines in Kotlin
- 24:46Transmitting state updates with LiveData
- 27:33Handling side effects in ViewModel
- 29:38Tinder chat state example
- 33:29Sub-states and custom LiveData
- 35:58Benefits of state-based UI
- 37:01Taking the pattern further
- 39:09Custom LiveData and memory
- 40:52Q&A
related talks
28mLifecycle, LiveData, ViewModels - The inner wiring
41mViewModels, LiveData and Lifecycles, oh my!
19mFun with LiveData
23mLifecycle, LiveData, Viewmodels - The inner wiring
39mSimple MVI: A LiveData Based MVI Approach
41mMVI: a Robust and Modern Architecture
38mArchitecture Agnostic UI Development
35mModel View Intent, Embracing Reactive UI's
