To learn android MVVM based on Android Architecture Components and unit test.
- Kotlin ❤️
- Start with basic and simple.
- Each example should has a unit test at least or more.
Simple Data Binding, ViewModel, LiveData on an Activity.
Simple Unit Test with Espresso.
Base on E01
MediatorLiveData to merge events of two LiveData
Simple Data Binding, ViewModel, LiveData on a Fragment.
Some animations with lottie(resources by Eddy Gann).
Custom binding attribute onAnimationEnd
using
BindingAdapter.
For single Fragment android instrumented test, there is a dummy activity which only works on debug and test that implemented with debug Source set and @RestrictTo annotation.
For unit test, it needs to decouple the logic that getting boolean result from ViewModel. so ViewModelProvider.Factory is here.
Based on E02.
Dependency Injection with Kodein DI as a elegant way to decouple the logic.
Simple Data Binding,
ViewModel,
LiveData on a RecyclerView
.
Implementation of Add, Remove and Edit actions.
Request Permission on MVVM.
Transformaions.map to convert strings to a simple format.
MockK for unit test.
Reuse E02.
A Fragment knows two ViewModel
, so two views observe one ViewModel
.
ListAdapter for RecyclerView
.
Using Coordinator for ViewModel
. By doing so, changing screen logic are in one place.