Interesting idea, I’ll definitely play around with the sample code.
So far I’ve retained presenters using scoped Dagger 2 components using Mortar. It does work, but it needs quite a bit of boilerplate code and it’s far from trivial — so I’m looking at other options too.
I have 2 questions:
- You mentioned that presenters for Fragments will only be available in the ‘onResume’ stage. Doesn’t this cause some problems during e.g. rotations? Suppose for example that the Fragment has a ListView inside of it, and the data for the list adapter comes from the Presenter. That data needs to be there and bound to the adapter in the ‘onCreateView’ stage so that the ListView can correctly retain it’s pre-rotation state — e.g. it’s scrolling position.
- How do you think this solution would work with plain Views instead of Fragments / Activities?