mkoslacz / Moviper

A Mosby based VIPER library for Android
Apache License 2.0
77 stars 9 forks source link

Sample case when using a view you cannot extend (e.g. DialogFragment) #45

Open elprl opened 7 years ago

elprl commented 7 years ago

What do you recommend doing when you cannot extend ViperFragment or ViperActivity? Let's say I have a custom view that already extends DialogFragment, what's the approach to rigging up / binding the presenter, interactor, router? I can't seem to find a suitable sample that fits this need.

mkoslacz commented 7 years ago

In the regular case I just try to attach Moviper internals to the given element. Actually, we do use DialogFragment with Moviper in our projects, but we haven't yet pushed and released appropriate classes. I'll do it in few days.

If it's not your case, just try to rewrite the root of the flavor you use, ie if you use the ViperAiPassive flavor, follow its inheritance chain (on the example of a Fragment):

ViperAiPassiveFragment -> ViperAiFragment -> MvpAiFragment -> Fragment

and try to rewrite it using another base class, ie DialogFragment instead of Fragment, but as I said, you don't need to do it if you need DialogFragment - I'll release it very soon.

mkoslacz commented 5 years ago

Well, obviously I have not pushed that to the project, but I will consider adding that to the upcoming Moviper 3.0. I'm not closing the issue as it's not fixed yet.