Created
July 31, 2019 01:50
-
-
Save lamvann/aa884fb649768b3f768e762e94962fff to your computer and use it in GitHub Desktop.
This file contains hidden or 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