android10 / android10/Android-CleanArchitecture

Questions about what the view must do

Aperta
#126 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub
discussion question
Lingua principale
Java
Stelle
15.5k
Fork
3.3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I have been studying this project for a while now and I have a few questions
that are not so clear to me.

1 - In this project the verification for internet connection is made in the
data layer, but this seems not to be the best thing to do because
you need to have android framework code in this layer. To me, the only
layer that must have framework specific code is the view layer, or I'm missing something? Put
the connection verification in this layer is a problem?

2 - If the view has some buttons but these buttons only do simple things,
like start another activity or fire a share intent, I need to pass these events
to presenter and then bring back to the view? Or the view itself could react to them?

3 - Suppose the fragment/activity needs to take a screenshot of some view in the screen (e.g. an item in the recyclerview) and save this screenshot in gallery. For me, the right way to do that is to do this in background. Because that way we don't block the UI. But, following this project principles
I will need a use case to that and so, I will need to pass the view (the view that I need to take the screenshot), down in the layers. This use case will have
a lot of framework specific code (e.g. generate bitmap from view. Save in gallery) and this does not seem right. My solution for this specific case is to
create a simple Observable in the fragment/activity and do that job right there,
but this way the view layer now has some kind of "logic", is this a problem?
What is the best way to do that?

Thanks!

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.