Skip to content

Kotlin demo project that uses some Android Architecture Components (ViewModel and LiveData) with Dagger 2 and Coroutines

License

Notifications You must be signed in to change notification settings

fabioCollini/ArchitectureComponentsDemo

Repository files navigation

Android Architecture Components Demo

This is a Kotlin project that uses some Android Architecture Components (ViewModel and LiveData) with Dagger 2 and RxJava.

This project is a fork of official GithubBrowserSample, I converted it to kotlin and modified some architectural aspects to test ViewModel and LiveData features.

Main concepts

  • each ViewModel manages an immutable ViewState (implemented using a Kotlin data object)
  • a post will be available soon to explain the details of how the ViewModels and the UseCases manage the ViewStates
  • multi module project, thanks to Dagger Android the ui is splitted in multiple modules
  • Fragment args are managed using a companion object base class
  • JVM tests are written using Mockito and AssertK
  • Espresso tests are written using DaggerMock and Mockito
  • ViewModels are instantiated using a custom factory defined in Dagger application scope and replaced with a stub in Espresso tests
  • asynchronous tasks are managed using Coroutines (the rxjava branch contains the same example with RxJava singles instead of coroutines)

About

Kotlin demo project that uses some Android Architecture Components (ViewModel and LiveData) with Dagger 2 and Coroutines

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages