Skip to content

Instantly share code, notes, and snippets.

@lamvann
Created July 31, 2019 01:50
Show Gist options
  • Select an option

  • Save lamvann/aa884fb649768b3f768e762e94962fff to your computer and use it in GitHub Desktop.

Select an option

Save lamvann/aa884fb649768b3f768e762e94962fff to your computer and use it in GitHub Desktop.
class PopularMoviesActivity : BaseActivity(), PopularMoviesContract.View {
private val tvMainText: TextView by bindView(R.id.mainText)
private val btnMainButton: Button by bindView(R.id.mainButton)
lateinit var presenter: PopularMoviesPresenter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
createPresenter()
presenter.attach(this)
setupListeners()
}
// Ugly boiler-plate code that will be removed using DI
private fun createPresenter() {
presenter = PopularMoviesPresenter(PopularMoviesModel())
}
override fun setupListeners() =
btnMainButton.setOnClickListener {
presenter.getPopularMovies(autoDisposable)
}
override fun updateText(content: String) {
tvMainText.text = content
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment