{"id":13608538,"url":"https://github.com/arthur3486/android-mvvm","last_synced_at":"2026-01-21T07:15:51.259Z","repository":{"id":89017552,"uuid":"178744323","full_name":"arthur3486/android-mvvm","owner":"arthur3486","description":"Android library designed to greatly simplify the implementation process of an MVVM-based application by providing all the means necessary to solve the common problems and avoid the annoying boilerplate code. ","archived":false,"fork":false,"pushed_at":"2023-03-05T01:48:08.000Z","size":39074,"stargazers_count":110,"open_issues_count":0,"forks_count":22,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-07T14:40:22.518Z","etag":null,"topics":["android","android-app","android-application","android-library","android-mvvm","android-mvvm-architecture","clean-architecture","dagger","dagger2","databinding","mvvm","navigation-architecture-component","okhttp","retrofit","room","rxandroid","rxjava","rxjava2","solid","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arthur3486.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-03-31T21:29:26.000Z","updated_at":"2023-11-10T08:42:00.000Z","dependencies_parsed_at":"2023-06-13T13:45:27.327Z","dependency_job_id":null,"html_url":"https://github.com/arthur3486/android-mvvm","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthur3486%2Fandroid-mvvm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthur3486%2Fandroid-mvvm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthur3486%2Fandroid-mvvm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthur3486%2Fandroid-mvvm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arthur3486","download_url":"https://codeload.github.com/arthur3486/android-mvvm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248605161,"owners_count":21132120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-app","android-application","android-library","android-mvvm","android-mvvm-architecture","clean-architecture","dagger","dagger2","databinding","mvvm","navigation-architecture-component","okhttp","retrofit","room","rxandroid","rxjava","rxjava2","solid","sqlite"],"created_at":"2024-08-01T19:01:28.095Z","updated_at":"2026-01-21T07:15:51.222Z","avatar_url":"https://github.com/arthur3486.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# Android MVVM Library + Comprehensive Demo Application\n\n\u003e ***Android library designed to greatly simplify the implementation process of an MVVM-based application by providing all the means necessary to solve the common problems and avoid the annoying boilerplate code.\n\u003cbr\u003e\u003cbr\u003e The library is accompanied by a comprehensive Demo Application that is built around MVVM and Clean Architecture concepts. The Demo Application utilizes such popular libraries as: [RxJava](https://github.com/ReactiveX/RxJava), [Dagger2](https://github.com/google/dagger), [Android Navigation Architecture Component](https://developer.android.com/guide/navigation), [OkHttp](https://github.com/square/okhttp), [Retrofit](https://github.com/square/retrofit), [Room](https://developer.android.com/topic/libraries/architecture/room), [Glide](https://github.com/bumptech/glide).***\n\n**Android MVVM Library** will make the implementation of your MVVM-based application a trivial task thus allowing you to spend more time focusing on other important things.\n\n[ ![Download](https://api.bintray.com/packages/arthurimsacc/maven/mvvm-core/images/download.svg) ](https://bintray.com/arthurimsacc/maven/mvvm-core/_latestVersion)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Platform](https://img.shields.io/badge/platform-Android-green.svg)](http://developer.android.com/index.html)\n![](https://img.shields.io/badge/API-18%2B-green.svg?style=flat)\n![](https://travis-ci.org/arthur3486/android-mvvm.svg?branch=master)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Android%20MVVM%20Library-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/7719)\n\n## Contents\n\n* [Demo](#demo)\n* [Getting Started](#getting-started)\n* [Modules](#modules)\n* [Basic Implementation](#basic-implementation)\n* [Dagger Based Implementation](#dagger-based-implementation)\n* [Navigation Component Based Implementation](#navigation-component-based-implementation)\n* [Navigation Component and Dagger Based Implementation](#navigation-component-and-dagger-based-implementation)\n* [Compilation](#compilation)\n* [Contribution](#contribution)\n* [Hall of Fame](#hall-of-fame)\n* [License](#license)\n\n## Demo\n\n***Marvel Universe*** Application is an application built around MVVM and Clean Architecture concepts, as well as the data provided by the [Marvel API](https://developer.marvel.com/). The application allows you to browse through the Marvel comics, events and characters; each of the aforementioned entities is accompanied by a corresponding detailed overview screen, which gives you even more insight into the Marvel Universe.\n\n### Screenshots\n\n\u003cdiv style=\"dispaly:flex\"\u003e\n    \u003cimg src=\"https://github.com/arthur3486/android-mvvm/blob/master/screenshot_1.jpg\" width=\"30%\"\u003e\n    \u003cimg src=\"https://github.com/arthur3486/android-mvvm/blob/master/screenshot_2.jpg\" width=\"30%\"\u003e\n    \u003cimg src=\"https://github.com/arthur3486/android-mvvm/blob/master/screenshot_3.jpg\" width=\"30%\"\u003e\n\u003c/div\u003e\n\u003cdiv style=\"dispaly:flex\"\u003e\n    \u003cimg src=\"https://github.com/arthur3486/android-mvvm/blob/master/screenshot_4.jpg\" width=\"30%\"\u003e\n    \u003cimg src=\"https://github.com/arthur3486/android-mvvm/blob/master/screenshot_5.jpg\" width=\"30%\"\u003e\n    \u003cimg src=\"https://github.com/arthur3486/android-mvvm/blob/master/screenshot_6.jpg\" width=\"30%\"\u003e\n\u003c/div\u003e\n\n### Application Architecture\n\n![Application Architecture](https://github.com/arthur3486/android-mvvm/blob/master/app_architecture.png)\n\n## Getting Started\n\n### Prerequisites\n\n**1. Make sure that you've added the `jcenter()` repository to your top-level `build.gradle` file.**\n\n````groovy\nbuildscript {\n    //...\n    repositories {\n        //...\n        jcenter()\n    }\n    //...\n}\n````\n\n**2. Enable the **jetifier** and **androidX** support in the top-level `gradle.properties` file.**\n\n````groovy\n//...\nandroid.enableJetifier=true\nandroid.useAndroidX=true\n//....\n````\n\n**3. Update your `compileSdkVersion` in the module-level `build.gradle` file to **29+**.**\n\n````groovy\n//...\nandroid {\n    //...\n    compileSdkVersion 29\n    //...\n}\n//...\n````\n\n**4. Enable the Data Binding in the module-level `build.gradle` file.**\n\n````groovy\n//...\nandroid {\n    //...\n    dataBinding {\n        enabled true\n    }\n    //...\n}\n//...\n````\n\n**5. Replace your `com.android.support.appcompat.*` dependency with the new `androidx.appcompat.*` alternative.**\n\n````groovy\n//...\ndependencies {\n    //...\n    implementation \"androidx.appcompat:appcompat:1.0.2\"\n    //...\n}\n//...\n````\n\n**6. Add the [Android Lifecycle (ViewModel)](https://developer.android.com/topic/libraries/architecture/viewmodel), [RxJava](https://github.com/ReactiveX/RxJava) and [RxBus](https://github.com/arthur3486/rxbus) dependencies to the module-level `build.gradle` file.**\n\n````groovy\n//...\ndependencies {\n    //...\n    implementation \"androidx.lifecycle:lifecycle-viewmodel:2.0.0\"\n    implementation \"io.reactivex.rxjava2:rxjava:2.2.12\"\n    implementation \"io.reactivex.rxjava2:rxandroid:2.1.1\"\n    implementation \"com.arthurivanets.rxbus:rxbus:1.1.0\"\n    //...\n}\n//...\n````\n\n### Android MVVM Dependencies\n\nThe basic implementation must include the core module\n\u003e ***Latest version:*** [ ![Download](https://api.bintray.com/packages/arthurimsacc/maven/mvvm-core/images/download.svg) ](https://bintray.com/arthurimsacc/maven/mvvm-core/_latestVersion)\n\n`implementation \"com.arthurivanets.mvvm:mvvm-core:X.Y.Z\"`\n\nWhich should be added to your module-level `build.gradle` file.\n\n````groovy\next {\n    //...\n    androidMvvmLibraryVersion = \"1.3.1\"\n}\n\ndependencies {\n    //...\n    implementation \"com.arthurivanets.mvvm:mvvm-core:$androidMvvmLibraryVersion\"\n}\n````\n\nAfter that you can proceed with further implementation.\n\u003e ***See: [Basic Implementation](#basic-implementation), [Dagger Based Implementation](#dagger-based-implementation), [Navigation Component Based Implementation](#navigation-component-based-implementation), [Navigation Component and Dagger Based Implementation](#navigation-component-and-dagger-based-implementation)***\n\n## Modules\n\nThe library is comprised of several modules, namely:\n\n* [`mvvm-core`](https://github.com/arthur3486/android-mvvm/tree/master/mvvm/src/main/java/com/arthurivanets/mvvm) - core implementation (Required)\n* [`mvvm-dagger`](https://github.com/arthur3486/android-mvvm/tree/master/mvvm-dagger/src/main/java/com/arthurivanets/mvvm/dagger) - Dagger DI based implementation (Optional)\n* [`mvvm-navigation`](https://github.com/arthur3486/android-mvvm/tree/master/mvvm-navigation/src/main/java/com/arthurivanets/mvvm/navigation) - Android Navigation Component based implementation (Optional)\n* [`mvvm-navigation-dagger`](https://github.com/arthur3486/android-mvvm/tree/master/mvvm-navigation-dagger/src/main/java/com/arthurivanets/mvvm/navigation/dagger) - Android Navigation Component + Dagger DI based implementation (Optional)\n\nThe [`mvvm-core`](https://github.com/arthur3486/android-mvvm/tree/master/mvvm/src/main/java/com/arthurivanets/mvvm) module is a core module the other modules depend on. It provides all the means necessary to create the MVVM-based Fragments and Activities, as well the corresponding ViewModels. (***See: [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/MvvmFragment.kt), [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/MvvmActivity.kt), [`BaseViewModel`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/BaseViewModel.kt), [`AbstractViewModel`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/AbstractViewModel.kt), [`Command`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/events/Command.kt), [`ViewState`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/events/ViewState.kt), [`Route`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/events/Route.kt)***)\n\nThe [`mvvm-dagger`](https://github.com/arthur3486/android-mvvm/tree/master/mvvm-dagger/src/main/java/com/arthurivanets/mvvm/dagger) module is a module that provides the [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-dagger/src/main/java/com/arthurivanets/mvvm/dagger/MvvmActivity.kt) and [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-dagger/src/main/java/com/arthurivanets/mvvm/dagger/MvvmFragment.kt) implementations that automatically handle the injection of the [`Dagger DI`](https://github.com/google/dagger) dependencies.\n\nThe [`mvvm-navigation`](https://github.com/arthur3486/android-mvvm/tree/master/mvvm-navigation/src/main/java/com/arthurivanets/mvvm/navigation) module is a module that provides the [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation/src/main/java/com/arthurivanets/mvvm/navigation/MvvmActivity.kt) and [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation/src/main/java/com/arthurivanets/mvvm/navigation/MvvmFragment.kt) implementations with built-in support for the [`Android Navigation Component`](https://developer.android.com/guide/navigation) based navigation.\n\n[`mvvm-navigation-dagger`](https://github.com/arthur3486/android-mvvm/tree/master/mvvm-navigation-dagger/src/main/java/com/arthurivanets/mvvm/navigation/dagger) module is a module that provides the [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation-dagger/src/main/java/com/arthurivanets/mvvm/navigation/dagger/MvvmActivity.kt) and [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation-dagger/src/main/java/com/arthurivanets/mvvm/navigation/dagger/MvvmFragment.kt) implementations that have both the built-in support for the [`Android Navigation Component`](https://developer.android.com/guide/navigation) based navigation and automatic handling of the injection of the [`Dagger DI`](https://github.com/google/dagger) dependencies.\n\n## Basic Implementation\n\nThe basic implementation consists of 5 simple steps, namely:\n1) Creation of the ViewModel\n2) Creation of the ViewModel-specific View States \u0026 Commands\n3) Creation of the application screen routes\n4) Creation of the `layout.xml` for the Activity/Fragment\n5) Implementation of the Activity/Fragment\n\n\u003cbr\u003e\n\nSo, let's start with the creation of the ViewModel for our Activity and/or Fragment.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eSimpleViewModel.kt [contract] (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````kotlin\ninterface SimpleViewModel : BaseViewModel {\n\n    // The rest of your observable fields and event propagation methods should be defined here\n\n}\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The ViewModel contract should implement the [`BaseViewModel`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/BaseViewModel.kt) interface.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eSimpleViewModelImpl.kt [concrete implementation] (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````kotlin\nclass SimpleViewModelImpl : AbstractViewModel(), SimpleViewModel {\n\n    // Your concrete implementation...\n\n}\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The concrete implementation of the ViewModel should extend the [`AbstractViewModel`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/AbstractViewModel.kt) class and implement the corresponding contract interface.\n\n\u003cbr\u003e\n\nThen, create the ViewModel-specific View States \u0026 Commands.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eGeneralViewStates.kt (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````kotlin\nsealed class GeneralViewStates\u003cT\u003e(payload : T? = null) : ViewState\u003cT\u003e(payload) {\n\n    class Initial : GeneralViewStates\u003cUnit\u003e()\n\n    class Loading\u003cT\u003e(payload : T? = null) : GeneralViewStates\u003cT\u003e(payload)\n\n    class Success\u003cT\u003e(payload : T? = null) : GeneralViewStates\u003cT\u003e(payload)\n\n    class Error\u003cT\u003e(payload : T? = null) : GeneralViewStates\u003cT\u003e(payload)\n\n    // The rest of your View State go here...\n\n}\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The implementation of the ViewModel-specific View States should be based upon the [`ViewState`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/events/ViewState.kt) class.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eGeneralViewModelCommands.kt (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````kotlin\nsealed class GeneralViewModelCommands\u003cT\u003e(payload : T? = null) : Command\u003cT\u003e(payload) {\n\n    class ShowToast(text : String) : GeneralViewModelCommands\u003cString\u003e(text)\n\n    class RestartApplication : GeneralViewModelCommands\u003cUnit\u003e()\n\n    // The rest of your ViewModel Commands go here...\n\n}\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The implementation of the ViewModel-specific Commands should be based upon the [`Command`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/events/Command.kt) class.\n\n\u003cbr\u003e\n\nThen, create the application screen routes.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eMarvelRoutes.kt (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````kotlin\nsealed class MarvelRoutes\u003cT\u003e(payload : T? = null) : Route\u003cT\u003e(payload) {\n\n    class CharacterInfoScreen(character : Character) : MarvelRoutes\u003cCharacter\u003e(character)\n\n    class ComicsInfoScreen(comics : Comics) : MarvelRoutes\u003cComics\u003e(comics)\n\n    class EventInfoScreen(event : Event) : MarvelRoutes\u003cEvent\u003e(event)\n\n    // The rest of your Application Routes go here...\n\n}\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The implementation of the Application Screen Routes should be based upon the [`Route`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/events/Route.kt) class.\n\n\u003cbr\u003e\n\nAfter that, let's create the `layout.xml` files for both our Activity and Fragment.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eactivity_simple_mvvm.xml + fragment_simple_mvvm.xml (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003clayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\u003e\n\n    \u003c!-- Data-binding-related --\u003e\n\n    \u003cdata\u003e\n\n        \u003cvariable\n            name=\"viewModel\"\n            type=\"com.yourapplication.sample.SimpleViewModel\"/\u003e\n\n    \u003c/data\u003e\n\n    \u003c!-- The Content Layout --\u003e\n    \u003c!-- Your content layout goes here... --\u003e\n\n\u003c/layout\u003e\n````\n\n\u003c/p\u003e\u003c/details\u003e\u003cbr\u003e\n\nFinally, let's implement the MVVM-based Activity and Fragment.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eSimpleMvvmActivity.kt (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````kotlin\nimport com.arthurivanets.mvvm.MvvmActivity\n\nclass SimpleMvvmActivity : MvvmActivity\u003cActivitySimpleMvvmBinding, SimpleViewModel\u003e() {\n\n    private lateinit var localViewModel : SimpleViewModel\n\n    override fun injectDependencies() {\n        // Initialize your View Model here...\n        localViewModel = SimpleViewModelImpl()\n    }\n\n    // The rest of the Activity Initialization goes here...\n\n    override fun onRegisterObservables() {\n        // Register your ViewModel's observable fields here...\n    }\n\n    override fun onHandleCommand(command : Command\u003c*\u003e) {\n        // handle the ViewModel-specific command here... (e.g. Restart the Application, Show Toast, etc.)\n    }\n\n    override fun onViewStateChanged(state : ViewState\u003c*\u003e) {\n        // handle the View State Change here... (adjust your UI correspondingly)\n    }\n\n    override fun onRoute(route : Route\u003c*\u003e) {\n        // handle the Application Route here... (navigate to the corresponding screen)\n    }\n\n    override fun getLayoutId() : Int {\n        return R.layout.activity_simple_mvvm\n    }\n\n    override fun getBindingVariable() : Int {\n        return BR.viewModel\n    }\n\n    override fun getViewModel() : SimpleViewModel {\n        return localViewModel\n    }\n\n}\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The implementation of the MVVM Activity should be based upon the Core [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/MvvmActivity.kt) class.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eSimpleMvvmFragment.kt (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````kotlin\nimport com.arthurivanets.mvvm.MvvmFragment\n\nclass SimpleMvvmFragment : MvvmFragment\u003cFragmentSimpleMvvmBinding, SimpleViewModel\u003e() {\n\n    private lateinit var localViewModel : SimpleViewModel\n\n    override fun injectDependencies() {\n        // Initialize your View Model here...\n        localViewModel = SimpleViewModelImpl()\n    }\n\n    // The rest of the Fragment Initialization goes here...\n\n    override fun onRegisterObservables() {\n        // Register your ViewModel's observable fields here...\n    }\n\n    override fun onHandleCommand(command : Command\u003c*\u003e) {\n        // handle the ViewModel-specific command here... (e.g. Restart the Application, Show Toast, etc.)\n    }\n\n    override fun onViewStateChanged(state : ViewState\u003c*\u003e) {\n        // handle the View State Change here... (adjust your UI correspondingly)\n    }\n\n    override fun onRoute(route : Route\u003c*\u003e) {\n        // handle the Application Route here... (navigate to the corresponding screen)\n    }\n\n    override fun getLayoutId() : Int {\n        return R.layout.fragment_simple_mvvm\n    }\n\n    override fun getBindingVariable() : Int {\n        return BR.viewModel\n    }\n\n    override fun getViewModel() : SimpleViewModel {\n        return localViewModel\n    }\n\n}\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The implementation of the MVVM Fragment should be based upon the Core [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/MvvmFragment.kt) class.\n\n\u003cbr\u003e\n\nThe [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/MvvmActivity.kt), [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/MvvmFragment.kt) and [`AbstractViewModel`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/AbstractViewModel.kt) classes provide many convenience methods for dealing with the lifecycle of the ObservableField subscriptions and Rx disposbles, so it's definitely a good idea to look through the implementations in order to familiarize yourself with the available APIs.\n\n\u003e ***See: [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/MvvmActivity.kt), [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/MvvmFragment.kt), [`BaseViewModel`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/BaseViewModel.kt), [`AbstractViewModel`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/AbstractViewModel.kt), [`Command`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/events/Command.kt), [`ViewState`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/events/ViewState.kt), [`Route`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm/src/main/java/com/arthurivanets/mvvm/events/Route.kt), [`GeneralViewStates`](https://github.com/arthur3486/android-mvvm/blob/master/app/src/main/java/com/arthurivanets/sample/ui/base/GeneralViewStates.kt), [`MarvelRoutes`](https://github.com/arthur3486/android-mvvm/blob/master/app/src/main/java/com/arthurivanets/sample/ui/base/MarvelRoutes.kt)***\n\n## Dagger Based Implementation\n\nThe Dagger-based implementation process is almost identical to the one of the [Basic Implementation](basic-implementation), the only thing that's different here is the fact that you need to use the [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation-dagger/src/main/java/com/arthurivanets/mvvm/navigation/dagger/MvvmActivity.kt) and [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation-dagger/src/main/java/com/arthurivanets/mvvm/navigation/dagger/MvvmFragment.kt) provided by the [`mvvm-dagger`](https://github.com/arthur3486/android-mvvm/tree/master/mvvm-navigation-dagger/src/main/java/com/arthurivanets/mvvm/navigation/dagger) module instead of the ones coming from the [`mvvm-core`](https://github.com/arthur3486/android-mvvm/tree/master/mvvm/src/main/java/com/arthurivanets/mvvm) module.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eSimpleMvvmActivity.kt (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````kotlin\nimport com.arthurivanets.mvvm.dagger.MvvmActivity\n\nclass SimpleMvvmActivity : MvvmActivity\u003cActivitySimpleMvvmBinding, SimpleViewModel\u003e() {\n\n    @Inject\n    private lateinit var localViewModel : SimpleViewModel\n\n    // The rest of the Activity Initialization goes here...\n\n    override fun onRegisterObservables() {\n        // Register your ViewModel's observable fields here...\n    }\n\n    override fun onHandleCommand(command : Command\u003c*\u003e) {\n        // handle the ViewModel-specific command here... (e.g. Restart the Application, Show Toast, etc.)\n    }\n\n    override fun onViewStateChanged(state : ViewState\u003c*\u003e) {\n        // handle the View State Change here... (adjust your UI correspondingly)\n    }\n\n    override fun onRoute(route : Route\u003c*\u003e) {\n        // handle the Application Route here... (navigate to the corresponding screen)\n    }\n\n    override fun getLayoutId() : Int {\n        return R.layout.activity_simple_mvvm\n    }\n\n    override fun getBindingVariable() : Int {\n        return BR.viewModel\n    }\n\n    override fun getViewModel() : SimpleViewModel {\n        return localViewModel\n    }\n\n}\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The implementation of the MVVM Activity should be based upon the Dagger [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-dagger/src/main/java/com/arthurivanets/mvvm/dagger/MvvmActivity.kt) class.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eSimpleMvvmFragment.kt (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````kotlin\nimport com.arthurivanets.mvvm.dagger.MvvmFragment\n\nclass SimpleMvvmFragment : MvvmFragment\u003cFragmentSimpleMvvmBinding, SimpleViewModel\u003e() {\n\n    @Inject\n    private lateinit var localViewModel : SimpleViewModel\n\n    // The rest of the Fragment Initialization goes here...\n\n    override fun onRegisterObservables() {\n        // Register your ViewModel's observable fields here...\n    }\n\n    override fun onHandleCommand(command : Command\u003c*\u003e) {\n        // handle the ViewModel-specific command here... (e.g. Restart the Application, Show Toast, etc.)\n    }\n\n    override fun onViewStateChanged(state : ViewState\u003c*\u003e) {\n        // handle the View State Change here... (adjust your UI correspondingly)\n    }\n\n    override fun onRoute(route : Route\u003c*\u003e) {\n        // handle the Application Route here... (navigate to the corresponding screen)\n    }\n\n    override fun getLayoutId() : Int {\n        return R.layout.fragment_simple_mvvm\n    }\n\n    override fun getBindingVariable() : Int {\n        return BR.viewModel\n    }\n\n    override fun getViewModel() : SimpleViewModel {\n        return localViewModel\n    }\n\n}\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The implementation of the MVVM Fragment should be based upon the Dagger [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-dagger/src/main/java/com/arthurivanets/mvvm/dagger/MvvmFragment.kt) class.\n\n\u003e ***See: [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-dagger/src/main/java/com/arthurivanets/mvvm/dagger/MvvmActivity.kt), [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-dagger/src/main/java/com/arthurivanets/mvvm/dagger/MvvmFragment.kt)***\n\n## Navigation Component Based Implementation\n\nThe Navigation Component based implementation process has many things in common with the [Basic Implementation](basic-implementation); the differences are shown in the code snippets below.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eactivity_host.xml (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003clayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\u003e\n\n    \u003c!-- Data-binding-related --\u003e\n\n    \u003cdata\u003e\n\n        \u003cvariable\n            name=\"viewModel\"\n            type=\"com.yourapplication.sample.StubViewModel\"/\u003e\n\n    \u003c/data\u003e\n\n    \u003c!-- The Actual Layout --\u003e\n\n    \u003ccom.google.android.material.internal.ScrimInsetsFrameLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:fitsSystemWindows=\"true\"\u003e\n\n        \u003cfragment\n            android:id=\"@+id/nav_host_fragment\"\n            android:name=\"com.arthurivanets.mvvm.navigation.MvvmNavHostFragment\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            app:defaultNavHost=\"true\"\n            app:navGraph=\"@navigation/your_navigation_graph\"/\u003e\n\n    \u003c/com.google.android.material.internal.ScrimInsetsFrameLayout\u003e\n\n\u003c/layout\u003e\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The [`MvvmNavHostFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation/src/main/java/com/arthurivanets/mvvm/navigation/MvvmNavHostFragment.kt) should be used as a Navigation Host Fragment of the Host Activity.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eHostActivity.kt (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````kotlin\nimport com.arthurivanets.mvvm.navigation.MvvmActivity\n\nclass HostActivity : MvvmActivity\u003cActivityHostBinding, StubViewModel\u003e() {\n\n    private var localViewModel : StubViewModel\n\n    override fun injectDependencies() {\n        localViewModel = StubViewModelImpl()\n    }\n\n    override fun getLayoutId() : Int {\n        return R.layout.activity_host\n    }\n\n    override fun getBindingVariable() : Int {\n        return BR.viewModel\n    }\n\n    override fun getViewModel() : HostActivityViewModel {\n        return localViewModel\n    }\n\n    override fun getNavigationGraphId() : Int {\n        return R.navigation.your_navigation_graph\n    }\n\n}\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The implementation of the Host Activity should be based upon the Navigation [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation/src/main/java/com/arthurivanets/mvvm/navigation/MvvmActivity.kt) class.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eSimpleMvvmFragment.kt (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n````kotlin\nimport com.arthurivanets.mvvm.navigation.MvvmFragment\n\nclass SimpleMvvmFragment : MvvmFragment\u003cFragmentSimpleMvvmBinding, SimpleViewModel\u003e() {\n\n    private lateinit var localViewModel : SimpleViewModel\n\n    override fun injectDependencies() {\n        // Initialize your View Model here...\n        localViewModel = SimpleViewModelImpl()\n    }\n\n    // The rest of the Fragment Initialization goes here...\n\n    override fun onRegisterObservables() {\n        // Register your ViewModel's observable fields here...\n    }\n\n    override fun onHandleCommand(command : Command\u003c*\u003e) {\n        // handle the ViewModel-specific command here... (e.g. Restart the Application, Show Toast, etc.)\n    }\n\n    override fun onViewStateChanged(state : ViewState\u003c*\u003e) {\n        // handle the View State Change here... (adjust your UI correspondingly)\n    }\n\n    override fun onRoute(route : Route\u003c*\u003e) {\n        // handle the Application Route here... (navigate to the corresponding screen)\n    }\n\n    override fun getLayoutId() : Int {\n        return R.layout.fragment_simple_mvvm\n    }\n\n    override fun getBindingVariable() : Int {\n        return BR.viewModel\n    }\n\n    override fun getViewModel() : SimpleViewModel {\n        return localViewModel\n    }\n\n}\n````\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003e The implementation of the MVVM Fragment should be based upon the Navigation [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation/src/main/java/com/arthurivanets/mvvm/navigation/MvvmFragment.kt) class.\n\n\u003e ***See: [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation/src/main/java/com/arthurivanets/mvvm/navigation/MvvmActivity.kt), [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation/src/main/java/com/arthurivanets/mvvm/navigation/MvvmFragment.kt), [`MvvmNavHostFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation/src/main/java/com/arthurivanets/mvvm/navigation/MvvmNavHostFragment.kt)***\n\n## Navigation Component and Dagger Based Implementation\n\nShares many implementation-specific aspects with the previously described implementation types and is used in the [`Demo Application`](https://github.com/arthur3486/android-mvvm/tree/master/app/src/main).\n\n\u003e ***See: [`MvvmActivity`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation-dagger/src/main/java/com/arthurivanets/mvvm/navigation/dagger/MvvmActivity.kt), [`MvvmFragment`](https://github.com/arthur3486/android-mvvm/blob/master/mvvm-navigation-dagger/src/main/java/com/arthurivanets/mvvm/navigation/dagger/MvvmFragment.kt)***\n\n## Compilation\n\nIn order to compile the [`app`](https://github.com/arthur3486/android-mvvm/tree/master/app/src/main) module you need to obtain the `PUBLIC_API_KEY` and `PRIVATE_API_KEY` from the [`Marvel API`](https://developer.marvel.com/) portal, which should be saved in either global `gradle.properties` file or the project-specific one thereafter.\n\n***gradle.properties***\n````groovy\nmarvelApiPublicKey=PUBLIC_API_KEY\nmarvelApiPrivateKey=PRIVATE_API_KEY\n````\n\n## Contribution\n\nSee the [CONTRIBUTING.md](CONTRIBUTING.md) file.\n\n## Hall of Fame\n\n\u003e Using Android MVVM Library in your app and want it to get listed here? Email me at arthur.ivanets.work@gmail.com!\n\n## License\n\n Android MVVM Library is licensed under the [Apache 2.0 License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthur3486%2Fandroid-mvvm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farthur3486%2Fandroid-mvvm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthur3486%2Fandroid-mvvm/lists"}