In my application there are 2 views both have 70% common fields like name, icon etc. One view is about list( contains 2-3 fields). On clicking the list , the next view which is the details should be called.
Other functionality in both views is same. e.g while loading , presenter will be called to load data from the url. (The URL for both views is different). The common functionality includes
- Load XML data from URL
- Set the loading progress bar in activity
- Removing the progress bar.
- 50% methods for setting the activity views will be common.
- Call the xml parser
The differences will be view specific:
- The fields are only 50% common.
- the action on button click
My doubt is shall I use 2 presenters or one presenter for both the views. Many methods are different , while many are same in the 2 presenters. I am planning to use 2 presenters. But many code is same for both presenters. How to reuse code between presenters.
Shall I use helper class, or shall both presenter have the same base class. Or shall i use the startegy pattern? WhatWhich is the right way to do it in MVP? Or all are correct. design strategy?:
- Shall I use helper class
- Shall both presenters have the same base class.
- Shall i use the startegy pattern? What is the right way to do it in MVP? Or all are correct.