A View State Machine for Network Calls on Android
summary
Kotlin sealed classes implement a single NetworkingViewState sealed class that models init/loading/success/error for UI around network calls, replacing multiple show/hide methods. Data comes from an Rx Observable datastore, presenter emits a state object, activities bind via delegates.notObservable to animate transitions. Formatting moves into small view models so unit tests cover presentation logic. Example app “Game of Cones” compiles, tests run, and the change shrinks required edits from four files down to one.
AI-written summary · about
chapters (26)
- 0:00Introduction
- 0:58What is a View State Machine
- 1:19Project Overview
- 1:41Data Class
- 3:15MVP Architecture
- 3:49View Interface
- 4:19Presenter
- 6:45Update Presenter
- 8:13Update View Interface
- 10:38Updates
- 11:25Build
- 12:45Recap
- 14:03NetworkingViewState
- 16:07Main Presenter
- 16:59Main Presenter Update
- 18:07View Models
- 18:48IceCreamViewModel
- 19:47Review
- 20:21Activity fragment
- 20:36Network view state
- 21:35Property delegates
- 22:08Delegates not observable
- 24:22Property
- 24:55Questions
- 26:46How does it get initialized
- 29:08How to handle multiple view models
related talks
30mArchitecting an app with MVP and ViewModels
41mHandling View State and Events with RainbowCake
47mThe Rise of the State Machines: An Introduction to Predictable State Container–Based Architectures for Your Android Apps
38mArchitecture Agnostic UI Development
43mHelp! ViewModel
33mThe Rise of the State Machines
33mModel-View-Intent for
41mMVI: a Robust and Modern Architecture
