Skip to content
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

How to handle ViewPager with new conductor version? #43

Open
PaulEHugon opened this issue May 29, 2020 · 5 comments
Open

How to handle ViewPager with new conductor version? #43

PaulEHugon opened this issue May 29, 2020 · 5 comments

Comments

@PaulEHugon
Copy link

PaulEHugon commented May 29, 2020

Hi There,
Seems like ControllerPagerAdapter is deprecated. But if I put the new implementation of the conductor view pager into my build gradle(implementation 'com.bluelinelabs:conductor-viewpager:3.0.0-rc5') then all my controller that extends RestoreViewOnCreateMviController are screaming the following:

Cannot access 'com.bluelinelabs.conductor.RestoreViewOnCreateController' which is a supertype of 'com....controllers.homeadmin.HomeAdminController'. Check your module classpath for missing or conflicting dependencies

Does it mean i will have to change all my controllers to extends Controller and implements
MvpView, MviConductorDelegateCallback<V, P> to be able to use the latest conductor version?

@PaulEHugon
Copy link
Author

All right so to make it work with the latest conductor version one has to modify the MviConductorLifecycleListener class. The new conductor version LifecycleListener is not a class but an interface.Just exchange

public class MviConductorLifecycleListener<V extends MvpView, P extends MviPresenter<V, ?>>
    extends Controller.LifecycleListener

with

public class MviConductorLifecycleListener<V extends MvpView,P extends MviPresenter<V,?>> implements Controller.LifecycleListener

Then declare your controllers like this:

class SplashController:Controller,SplashView,
    MviConductorDelegateCallback<SplashView, SplashPresenter> {


    init {
        addLifecycleListener(MviConductorLifecycleListener(this,true))
    }
}

Hope it helps others

@Wrakor
Copy link

Wrakor commented Jun 3, 2020

Another alternative would be to make a duplicate of the the MviController and MviConductorLifecycleListener classes. Change your custom MviController to use the new MviConductorLifecycleListener that now has a "implements" instead of the "extends".

And you can go back to use something like:

class HomeController : MviController<HomeMviView, HomePresenter>(), HomeMviView

@sockeqwe
Copy link
Owner

sockeqwe commented Jun 3, 2020

@PaulEHugon I did not use latest conductor version yet so I didnt move Mosby to support Conductor 3.0

@PaulEHugon do you want to send a PR to add support for conductor 3.0? I dont have time and energy to spend effort on supporting Mosby + Conductor as I dont use conductor.

@PaulEHugon
Copy link
Author

@Wrakor indeed you are correct

@sockeqwe Yes I will try to do a PR. Any particular reason you are not using Conductor?

@PaulEHugon
Copy link
Author

@sockeqwe the PR is in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants