vendredi 24 mars 2017

MVP with Fragments and Container activities

Currently we are have a container activity that hold 2 buttons(next and cancel) along with a content layout that switches depending on the fragment. The fragments follow the mvp pattern but the omain questions seems to how to correctly implement the Next and Cancel button on click events. Would it be better to make a Presenter for the MainActivity and pass that through to the Fragment and have the fragment work with that for the two button events? Or should the Fragment create new onClicks for the button on each fragment change? My way of thinking seems to go along the lines, the two buttons can be considered part of the fragment view at that moment in time, so the Fragment should be concerned with handling them. But wouldnt this lead to more code writing? Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire