Skip to content

Android MVVM boilerplate inspired by android-boilerplate and powered by data-binding

Notifications You must be signed in to change notification settings

njleonzhang/Android-MVVM-boilerplate

Repository files navigation

Android-MVVM-boilerplate

Android MVVM boilerplate inspired by android-boilerplate and powered by data-binding

Archetcture

It's similar to android-boilerplate, differences:

  • Presenter to ViewModel
  • EventBus to RxBus
  • shareReferenceHelper is not proxied by data manager, but a static tools.

Tech-stack

  • Data-Binding
  • RxJava2
  • Retrofit2
  • OKHttp

Code Organization

  • binding —> binding adapters for databinding
  • data —> Model(network, database)
  • ui —> View and ViewModel(ui and business logic)
  • util —> common tools
  • widget —> common widget

UML

Details

MVC / MVP / MVVM

We support all 3 in this project.

  • Some page is simple, With MVVM, you need create at least 2 new files(class), With MVP, you need more files(class), why not just adopt MVC?
  • Someone in your team, does not love MVVM, and used to work in MVP. OK, Forced love does not last.
  • For all 3 architectures, Activity and Fragment are wrapped and easy to initialize.

Check base folder for more details.

NetWork

Leverage Retrofit2 and RxJava2 to parse response and handle error(including loading) in common place, we just deal with data in business logic.

Check DataManager for more details

recycle view binding

No need to write adapter agian and agian, with data-binding and BaseBindingRecycleViewAdapter, we just need provide a layout file and the array of data, then we get a recycleView

RxBus

Leverage Rxjava to post none-sticky event, no need to override any Activity method, and really easy and clean to use.

Check RxBus for more details.

About

Android MVVM boilerplate inspired by android-boilerplate and powered by data-binding

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages