For example, I have EditProjectFragment
which contains few elements:
TextView
(project name)ColorPicker
(project color)Spinner
(project type)
Let's see:
- Project name will be restored by TextView itself
- Who must store project's color?
- Who must store spinner's value?
It seems to be ViewState
's responsibility. For example, when user picks color, View
calls presenter.onProjectColorPicked(color)
. Then, Presenter
will call view.setProjectColor(color)
. Or View
should update ViewState
directly, without calling Presenter
if it doesn't need?
Another example. User adds photo in EditNoteFragment. User picks photo(presenter.pickPhoto()
) -> presenter.addPhoto(photo)
called and notify View
to add photo to ViewState
&show it.
Should View
update Note
object by itself? Should it be done by Presenter? In the first case it means that ViewState
will provide methods like getNote()/setNote(note)
that will be used by View. Should I duplicate Note-reference via updating it in View.setNote(note)
method? The second case means that I probably should store Note
object in Presenter
and just update View
without passing Note
in it. But it looks like a wrong way.
In other words: what View
must do without Presenter
's help(add a photo to Note
object?) and what things with it(button clicks etc)?