Mavericks

Mavericks: 自动驾驶的安卓系统。「MvRx: Android on Autopilot」

  • 所有者: airbnb/mavericks
  • 平台:
  • 許可證: Apache License 2.0
  • 分類:
  • 主題:
  • 喜歡:
    1
      比較:

Github星跟蹤圖

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

概覽

名稱與所有者airbnb/mavericks
主編程語言Kotlin
編程語言Kotlin (語言數: 3)
平台
許可證Apache License 2.0
發布數44
最新版本名稱v3.0.9 (發布於 )
第一版名稱v0.0.5 (發布於 )
創建於2018-07-02 22:11:45
推送於2024-04-16 22:18:19
最后一次提交
星數5.7k
關注者數102
派生數495
提交數382
已啟用問題?
問題數355
打開的問題數56
拉請求數300
打開的拉請求數5
關閉的拉請求數49
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?
去到頂部