Skip to content

Instantly share code, notes, and snippets.

@lamvann
Created July 29, 2019 22:16
Show Gist options
  • Save lamvann/aa6e6cebd89cbf8d52b225d94c683946 to your computer and use it in GitHub Desktop.
Save lamvann/aa6e6cebd89cbf8d52b225d94c683946 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