-
Notifications
You must be signed in to change notification settings - Fork 155
Give presenters a safer hook for view detaching #156
Comments
I feel pretty good about decoupling Presenter and Bundler. That should be a pretty mechanical change to delegation, and would significantly simplify Presenter. Less sure about de-scoping Bundler. |
Paves the way to closing issue #103 |
Just to clarify: does that mean that we'll need to reimplement the current Presenter view handling code in a subclass? |
No. It means the contract would be that you can hold on to the View passed into onTakeView() yourself, and you should drop it when onDropView() is called. But the current debouncing behavior would still be in place. We just no longer have a getView() method that's hard to document. Instead there's "here's your view," and "you should forget about that view now". On Mon, May 4, 2015 at 4:44 PM Pierre-Yves Ricau [email protected]
|
Ok. So technically the change means:
|
My bet:
If my bet is wrong for your particular app, there's nothing stopping you from introducing a Presenter subclass to use as a base class for your own presenters. |
The change to make the API symmetric is separate from the decision to hide I do like the fact that the new API is more minimal, less side-effecty. |
I don't think it's a completely separate decision. Making the API symmetric makes getView/hasView superfluous. |
Talked about this some more. Also starting to seem like enterScope / exitScope should not be built into presenter. Orthogonal concerns. |
Would it be possible to somehow obtain the bundle during onDropView(), so that extra stuff about the view can be saved and later easily obtained back during onTakeView()? |
Good stuff. I assume Btw, whenever view invokes presenter's callbacks, it could just pass |
Yes, exactly. |
Drop getView(), replace onLoad(Bundle) with onTakeView(View,Bundle) and onDropView(), make dropView() final.
Lifecycle becomes:
With onSave(Bundle) being called any arbitrary number of times between enter and exit.
Also worth thinking about decoupling Presenter and Bundle entirely.
The text was updated successfully, but these errors were encountered: