-
Notifications
You must be signed in to change notification settings - Fork 842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for DialogFragment #14
Comments
I will have a look at |
Yes, that's what I've done in my current project. |
I've been experimenting with this library a tiny bit this afternoon and was looking for a similiar I think the best and most flexible solution for this is a delegate interface / abstraction similar to what we can find in the latest support library update. So I would expect this library to provide abstract MVP implementations for the most common base classes, but if I cannot find a particular implementation, I can still extend the support to any type of Activity, Fragment, etc that I'm looking for. |
Yep, actually, the ViewState implementation already works like that by using a delegate. Have a look at |
Yes, please rename to make them more clear with the design pattern. Igor
|
I have written a new blog post which describes how to use the delegate. See "Tip 22" (scroll down to the end of the page) |
@sockeqwe your blog page show 404 error :D is there any example for dialogfragment in your project? |
@siavashabdoli I have updated the linke: http://hannesdorfmann.com/android/mosby-playbook |
@sockeqwe Yes, I see but we can't extend your library class directly in this one. I have to implement MvpViewStateDelegateCallback and implement attaching detaching and all MVP logic, is it right? |
@sockeqwe I read your blog post and understand how to use the delegate. However, your example code for a DialogFragment uses a custom view. Where should I call the |
@sockeqwe I see that we use a MvpViewStateDelegateCallback in the document. Is this only available in mosby3? |
@SuperThomasLab @liuzhen2008 it might have been renamed in Mosby3 (or moved into another package, but it there is the same class also in Mosby 2 (and Mosby 1). I have to update the docs #185 |
@sockeqwe Any idea what the name is in mosby2? I see BaseMvpViewStateDelegateCallback and FragmentMvpDelegate. Where can I find the document to properly initialize a "ViewState"? |
I think it was |
@sockeqwe Are you planning on adding base implementations for DialogFragment or should it be handled by developer by design? |
Not planned to add a DialogFragment base implementation for MVP, MVP ViewState and MVI (mainly because of time constraints) but if such a base implementation is that straight forward as it is with any other Fragment (just adding the corresponding delegate) then we can add it to this library. Do you wanna send a pull request? |
If I'll manage to implement it I'll surely make a PR, but currently (sadly) I just need a fast working solution for my specific MVP case for my work so please do not consider it 'incoming asap' :). Btw, big thanks(!) for your work with Mosby, awesome blog posts, The Context podcast and everything! 👍 |
Thank you very much! If you use traditional Fragment lifecycle callbacks and setup your Dialog's view in |
I'm not sure if it is a good idea to even add this to mosby. It's yet another thing to maintain and I can't imagine how busy someone like @sockeqwe must be anyways. The suggested solution of adding the delegate worked with no problems. If anyone stumbles upon this and wants to copy paste an implementation for MVI check out this gist. |
It's almost exactly the same as regular Fragment, I'm not sure if there is an easy way to share the boilerplate code between them.
If anyone does try to add support for DialogFragments, this will keep the dialog on the screen for orientation changes.
The text was updated successfully, but these errors were encountered: