• Stars
    star
    137
  • Rank 266,121 (Top 6 %)
  • Language
    Kotlin
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

to learn android MVVM and unit test

android-mvvm-unittest

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.

E01 - Simple Activity

Simple Data Binding, ViewModel, LiveData on an Activity.

Simple Unit Test with Espresso.

E01a - Simple Activity and Two-way binding

Base on E01

MediatorLiveData to merge events of two LiveData

E02 - Simple Fragment with some animations

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.

E02a - Simple Fragment with some animations and DI library

Based on E02.

Dependency Injection with Kodein DI as a elegant way to decouple the logic.

E03 - RecyclerView

Simple Data Binding, ViewModel, LiveData on a RecyclerView.

Implementation of Add, Remove and Edit actions.

E04 - Request Permission

Request Permission on MVVM.

Transformaions.map to convert strings to a simple format.

MockK for unit test.

E05 - Interaction between 2 Fragments

Reuse E02.

A Fragment knows two ViewModel, so two views observe one ViewModel.

ListAdapter for RecyclerView.

E06 - Infinite RecyclerView

Paging library

E07 - Change Screen

Using Coordinator for ViewModel. By doing so, changing screen logic are in one place.

Transition Framework