mardi 19 janvier 2016

Android MVP Best Practice

Consider the situation where we have an activity with a container (full width and height FrameLayout). The container needs to be replace with 3 Fragments once at a time.

Fragment1: contains two buttons only (Login and Sign up) Fragment2: Login layout Fragment3: Sign up layout

Initially, Fragment1 replaces the container. User clicks 'Login' -> Fragment2 replaces the container User clicks 'Sign up' -> Fragment3 replaces the container

My understanding is that we have to create 3 separate Viewer interfaces that should be implemented by Fragment1, Fragment2 and Fragment3

We should also have 3 Presenter classes. Each presenter handles the logic in a Fragment.

If that is the case, what should be in the Viewer and Presenter for Fragment1? Please let me know if the would be a better approach for such a scenario.

Thanks and sorry for the long post!

Aucun commentaire:

Enregistrer un commentaire