Created
July 29, 2019 22:16
-
-
Save lamvann/aa6e6cebd89cbf8d52b225d94c683946 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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