Skip to content
MvRx: Android on Autopilot
Kotlin Other
  1. Kotlin 99.0%
  2. Other 1.0%
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea/codeStyles Added Detekt and Ktlint (#191) Jan 22, 2019
counter Use SavedStateRegistry for persisting state (#254) Oct 16, 2019
dogs Use SavedStateRegistry for persisting state (#254) Oct 16, 2019
gradle/wrapper Upgrade Kotlin to 1.3.50, AGP to 3.5.0, and Gradle to 5.6 (#275) Aug 29, 2019
hellodagger feat: Add a sample app to demonstrate usage of Dagger and AssistedInj… Nov 12, 2019
libs Added Detekt and Ktlint (#191) Jan 22, 2019
mvrx Use SavedStateRegistry for persisting state (#254) Oct 16, 2019
sample Use SavedStateRegistry for persisting state (#254) Oct 16, 2019
testing Prepare for next release (#306) Oct 11, 2019
todomvrx Use SavedStateRegistry for persisting state (#254) Oct 16, 2019
.gitignore Prevent private props from crashing in debug (#178) Jan 14, 2019
.travis.yml 1.2.0-SNAPSHOT and enable SNAPSHOT auto deploy (#277) Sep 4, 2019
CHANGELOG.md 1.3.0 release (#311) Oct 29, 2019
LICENSE Initial commit Jul 2, 2018
README.md Use x.y.z in the readme Apr 3, 2019
build.gradle Remove extra proguard dependency (#310) Nov 15, 2019
deploy_snapshot.sh 1.2.0-SNAPSHOT and enable SNAPSHOT auto deploy (#277) Sep 4, 2019
detekt Added Detekt and Ktlint (#191) Jan 22, 2019
detekt.yml Added Detekt and Ktlint (#191) Jan 22, 2019
gradle.properties 1.3.0 release (#311) Oct 29, 2019
gradlew
gradlew.bat Initialized gradle Aug 7, 2018
settings.gradle feat: Add a sample app to demonstrate usage of Dagger and AssistedInj… Nov 12, 2019
setup_hooks Converted dogs module from Epoxy to data binding (#272) Aug 30, 2019

README.md

MvRx: Android on Autopilot

For full documentation, check out the wiki

MvRx (pronounced mavericks) is the Android framework from Airbnb that we use for nearly all product development at Airbnb.

When we began creating MvRx, our goal was not to create yet another architecture pattern for Airbnb, it was to make building products easier, faster, and more fun. All of our decisions have built on that. We believe that for MvRx to be successful, it must be effective for building everything from the simplest of screens to the most complex in our app.

This is what it looks like:

data class HelloWorldState(val title: String = "Hello World") : MvRxState

/**
 * Refer to the wiki for how to set up your base ViewModel.
 */
class HelloWorldViewModel(initialState: HelloWorldState) : MyBaseMvRxViewModel<HelloWorldState>(initialState, debugMode = BuildConfig.DEBUG) {
    fun getMoreExcited() = setState { copy(title = "$title!") }
}

class HelloWorldFragment : BaseFragment() {
    private val viewModel: HelloWorldViewModel by fragmentViewModel()

    override fun EpoxyController.buildModels() = withState(viewModel) { state ->
        header {
            title(state.title)
        }
        basicRow { 
            onClick { viewModel.getMoreExcited() }
        }
    }
}

Installation

Gradle is the only supported build configuration, so just add the dependency to your project build.gradle file:

dependencies {
  implementation 'com.airbnb.android:mvrx:x.y.z'
}

The latest version of mvrx is Maven Central

For full documentation, check out the wiki

You can’t perform that action at this time.