/android-mvvm

A Model-View-ViewModel library for Android apps

Primary LanguageJavaApache License 2.0Apache-2.0

android-mvvm

A Model-View-ViewModel library for Android apps. Check Android-mvvm page for more information.

Build Status codecov Download Android Arsenal

Features

This library helps reduce boilerplate code in android applications:

  • a useful implementation of Model-View-ViewModel pattern by leveraging the new Android Data Binding.
  • automating bind ViewModel with view.
  • ViewModel is isolated from Activity/Fragment lifecycle. It's particularly good at surviving configuration changes when Android destroys your Activity and Views and replaces them with new ones.

Installation

repositories {
    maven { url "https://dl.bintray.com/a-zaiats/maven" }
}

dependencies {
    compile 'io.github.azaiats.androidmvvm:androidmvvm-core:0.2.1'
    compile 'io.github.azaiats.androidmvvm:androidmvvm-navigation:0.2.1' // optional
}

Don't forget to enable Data Binding in your module:

android {
    dataBinding {
        enabled = true;
    }
}

TODO

  • Add binding for custom android.view.View
  • Add binding for android.widget.ListView adapter
  • Add binding for android.support.v7.widget.RecyclerView adapter/viewHolder

Changelog

The changelog can be found in the release section

Contributors

The library was inspired by:

License

Copyright 2016 Andrei Zaiats

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.