https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
a

adolgiy

03/23/2018, 8:59 AM
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

ossama

03/23/2018, 9:55 AM
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

adolgiy

03/23/2018, 10:01 AM
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

gildor

03/23/2018, 10:06 AM
@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

ossama

03/23/2018, 10:10 AM
@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

adolgiy

03/23/2018, 10:12 AM
@ossama same thoughts
o

ossama

03/23/2018, 10:13 AM
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

adolgiy

03/23/2018, 10:14 AM
@ossama can u send me invite? I am a member of androidchat.slack.com, but not of android-united.
g

gildor

03/23/2018, 10:15 AM
@adolgiy You can request the invite here http://android-united.community/
o

ossama

03/23/2018, 10:15 AM
Request the invite from here http://android-united.community/
a

adolgiy

03/23/2018, 10:16 AM
@gildor @ossama cool, thx
o

ossama

03/23/2018, 10:16 AM
You’re welcome 🙂
4 Views