Hello, team! In my project I using MVP architectur...
# android-architecture
a
Hello, team! In my project I using MVP architecture and have complex screen built on RecyclerView only. It has article content (blocks of text, images and so on), some section dividers and comments. So, question is: who should care about building such screen - presenter or view (adapter)? Should
View
have
View#setArticle
and
View#setComments
methods or only
View#setContent
? Now I have two methods. And it looks OK, but what if..?
stackoverflow 1
o
Hey @adolgiy Well, I don’t know what do you mean exactly by having
View#setArticle
and
View#setComments
methods or only
View#setContent
because it depends on what they’ll have inside. You just have to keep in mind that the view doesn’t execute anything out of its concerns (like building the data that will be shown), however this data should be provided by the presenter and the View will display it as it comes
a
View#setContent
means that presenter build final list with all data to display, including article's blocks, dividers, comments, loading more item and so on.
View#setArticle
and
View#setComments
means, that presenter only passes data related to article's blocks and comments, and View by itself decides, how to handle them. Second option looks like right way, because View's interface doesn't tell anything about RecyclerView. And first way forces me to use list-based screen layout.
@gildor SO is cool, but what I should search?)
g
@adolgiy Your question is not related to Kotlin. This is Slack about Kotlin, and all channels (except random) should be used only for discussion of Kotlin specific question. Do not search, ask question on SO or use any Android community like android-united to ask general Android questions
o
@adolgiy The second way seems more clean than the first one. I can’t see the big picture of the first option, but it looks like the presenter may end up doing some UI work by providing the final list
a
@ossama same thoughts
o
As @gildor said, you should use Android United slack android-united.slack.com for asking such questions, since the current one is meant for Kotlin stuff 🙂
a
@ossama can u send me invite? I am a member of androidchat.slack.com, but not of android-united.
g
@adolgiy You can request the invite here http://android-united.community/
o
Request the invite from here http://android-united.community/
a
@gildor @ossama cool, thx
o
You’re welcome 🙂