SHARE
TWEET

Untitled

a guest Aug 25th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data class HelloWorldState(val title: String = "Hello World") : MvRxState
  2.  
  3. class HelloWorldViewModel(initialState: HelloWorldState) : MyBaseMvRxViewModel<HelloWorldState>(initialState, debugMode = BuildConfig.DEBUG) {
  4.     fun getMoreExcited() = setState { copy(title = "$title!") }
  5. }
  6.  
  7. class HelloWorldFragment : BaseFragment() {
  8.     private val viewModel: HelloWorldViewModel by fragmentViewModel()
  9.  
  10.     override fun EpoxyController.buildModels() = withState(viewModel) { state ->
  11.         header {
  12.             title(state.title)
  13.         }
  14.         basicRow {
  15.             onClick { viewModel.getMoreExcited() }
  16.         }
  17.     }
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top