Ngo Doan
Ngo Doan
Jul 27, 2017 · 1 min read

Nice approach!! I have a little contribution to this approach is that the way I am defining the behavior of View and Presenter by using interface Contract like this:

interface RepositoriesListContract {

interface View {
//the behavior of Fragment or Activity
}

interface Presenter {
//the behavior of Presenter
}
interface AdapterPresenter {
fun onBindRepositoryRowViewAtPosition(position: Int, holderView: RowView)
fun getRepositoriesRowsCount(): Int
}
interface RowView {
fun setStartCount(startCount: Int)
fun setTitle(title: String)
}}

And define contructor of Adapter like this:

constructor(presenter: RepositoriesListContract.AdatperPresenter)

I think it is clear to see the contract between Adapter and ViewHolder and be sure that the presenter of Adapter uses only the method which it actually needs.

What do you think about all of this?
Thanks!

Sorry for my bad english

    Ngo Doan

    Written by

    Ngo Doan

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade