MVI on Android
Jan 22 2019 · Video Course (1 hr, 34 mins) · Intermediate
In this course, you will use RxJava to build an app using the Model-View-Intent architecture, learning about components like intents, results, and state.
Version
- Kotlin 1.3, Android 5.0, Studio 3.2


From Intention to Action
Let's introduce the Model-View-Intent architecture, identify the sample project we'll be working with, and see an outline of the course.
Model-View-Intent
7:36Learn about the origins and theory of MVI, and get introduced to the MVI event cycle, which we'll use throughout the course.
The Starter Project
2:54Take a tour through the starter project code, and learn how it differs from the code in our other architecture courses.
Prerequisites
3:21See a summary of prereqs for the course, which include intermediate knowledge of Android, experience with sealed classes, and a basic understanding of RxJava.
MVI Base Interfaces
2:14Create the base interfaces that will be used for the MVI component types, and define behavior for the View and ViewModel classes within MVI.
Defining Intents
4:12Identify the MVI intents for each screen of the app, and create Kotlin sealed classes to represent the intents
Challenge: Intents
0:45Practice defining an intent for the Add Creature screen on your own, through a hands-on challenge. Then see a solution.
Defining Actions
1:39Identify the MVI actions for each screen of the app, and create Kotlin sealed classes to represent the actions.
Challenge: Actions
0:58Practice defining an action for the Add Creature screen on your own, through a hands-on challenge. Then see a solution.
Conclusion
0:43Let's review where you are within the overall MVI cycle, and discuss what's next: building out the remainder of the cycle.
Results, State, and the View
Introduction
1:28Let's review what you'll be doing in this part of the course, building out the second half of the MVI cycle and finishing the app.
Define results for the All Creatures screen, then use an Rx ObservableTransformer to process actions into results.
Define results for the Add Creature screen, then use an Rx ObservableTransformer to process actions into results.
Challenge: Results
2:14Practice defining results and a processor for the Add Creature screen on your own, through a hands-on challenge. Then see a solution.
Defining View State
3:17Learn how to think about the state of your screen's view, and define a view state for both screens of the app.
Reducing to State
11:13See how reducers are used to combine previous view state with results to create a new view state, and define view state classes for each screen.
Challenge: State
2:21Practice defining a reducer for the Add Creature screen on your own, through a hands-on challenge. Then see a solution.
ViewModels
5:29Complete the remainder of code needed for the app ViewModels, by turning intents into actions, processing to results, and reducing results to new view state.
Rendering the View 1
6:50Add a ViewModel property for the All Creatures screen, bind to the ViewModel, and render view state to the screen.
Rendering the View 2
10:03Add a ViewModel property for the Add Creature screen, bind to the ViewModel, and render view state to the screen.
Testing MVI
4:55Learn about how to set up tests for an MVI ViewModel class, using JUnit and Mockito. Then define tests for the loading intent on the All Creatures screen.
Conclusion
3:16Let's review what you learned in this course, discuss the benefits of the MVI architecture, and see where to go from here.
Next course in this Learning Path
Who is this for?
This course is for intermediate Android developers who have previously been exposed to architecture considerations on Android. They have potentially used patterns like MVP and MVVM but are looking to use MVI for the first time or have used MVI but are looking for a deeper understanding of the pattern.
Covered concepts
Students will learn:
- The concepts and structure of the MVI pattern
- MVI actions and intents
- How to build an app using MVI
- How to test an MVI app
- Where MVI fits in within a more complicated app architecture
- How to define and process results
- How to define a view state and render it to the screen
Comments