You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks a lot for your project, he give a clean MVP implementation for Android. However I miss an important part; the navigation.
Imagine that you allow users to add Character. You add a button to the list with a callback method to the presenter : onAddCharacterButtonClicked and then ?
A naive implementation can be to invoke a method on the view : setAddFormVisible(true) but then the view has to decide how you would present the form (display a view, open a dialog, move to another activity, ..). I dislike this solution.
The other solution is then to manage that from the presenter. He can decide to add a Fragment to the view, or open it as a dialog, or start another activity. But then you cannot test your presenter because he has direct dependencies to the Context or FragmentManager.
Some use an EventBus to send a message who is received by the Application or current Activity. But, again, I dislike the idea to use "system events" to handle navigation.
My current solution is to write a Navigator who decide what to do (dialog, activity, ..) and has everything to do it :
Hi there,
Thanks a lot for your project, he give a clean MVP implementation for Android. However I miss an important part; the navigation.
Imagine that you allow users to add
Character
. You add a button to the list with a callback method to the presenter :onAddCharacterButtonClicked
and then ?setAddFormVisible(true)
but then the view has to decide how you would present the form (display a view, open a dialog, move to another activity, ..). I dislike this solution.Fragment
to the view, or open it as a dialog, or start another activity. But then you cannot test your presenter because he has direct dependencies to theContext
orFragmentManager
.EventBus
to send a message who is received by theApplication
or currentActivity
. But, again, I dislike the idea to use "system events" to handle navigation.Navigator
who decide what to do (dialog, activity, ..) and has everything to do it :So that I can test everything inside plain Junit tests. This is also the solution used in EffectiveAndroidUI
Do you have a better approach ? Did you plan to describe it in your project ?
The text was updated successfully, but these errors were encountered: