• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.airbnb.lottie.samples
2 
3 import android.os.Bundle
4 import android.view.LayoutInflater
5 import android.view.View
6 import android.view.ViewGroup
7 import com.airbnb.epoxy.AsyncEpoxyController
8 import com.airbnb.epoxy.EpoxyController
9 import com.airbnb.lottie.samples.R.id.recyclerView
10 import com.airbnb.mvrx.BaseMvRxFragment
11 import kotlinx.android.synthetic.main.fragment_base.*
12 import kotlinx.android.synthetic.main.fragment_base.view.*
13 
14 
15 private class BaseEpoxyController(
16         private val buildModelsCallback: EpoxyController.() -> Unit
17 ) : AsyncEpoxyController() {
buildModelsnull18     override fun buildModels() {
19         buildModelsCallback()
20     }
21 }
22 
23 abstract class BaseEpoxyFragment : BaseMvRxFragment() {
24 
onCreateViewnull25     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? =
26             inflater.inflate(R.layout.fragment_base, container, false).apply {
27                 recyclerView.setController(BaseEpoxyController { buildModels() })
28             }
29 
invalidatenull30     override fun invalidate() {
31         recyclerView.requestModelBuild()
32     }
33 
buildModelsnull34     abstract fun EpoxyController.buildModels()
35 }