Search in sources :

Example 1 with RouterTransaction

use of com.bluelinelabs.conductor.RouterTransaction in project Conductor by bluelinelabs.

the class RouterPagerAdapter method isViewFromObject.

@Override
public boolean isViewFromObject(View view, Object object) {
    Router router = (Router) object;
    final List<RouterTransaction> backstack = router.getBackstack();
    for (RouterTransaction transaction : backstack) {
        if (transaction.controller().getView() == view) {
            return true;
        }
    }
    return false;
}
Also used : RouterTransaction(com.bluelinelabs.conductor.RouterTransaction) Router(com.bluelinelabs.conductor.Router)

Example 2 with RouterTransaction

use of com.bluelinelabs.conductor.RouterTransaction in project Conductor by bluelinelabs.

the class RouterPagerAdapter method instantiateItem.

@Override
public Object instantiateItem(ViewGroup container, int position) {
    final String name = makeRouterName(container.getId(), getItemId(position));
    Router router = host.getChildRouter(container, name);
    if (!router.hasRootController()) {
        Bundle routerSavedState = savedPages.get(position);
        if (routerSavedState != null) {
            router.restoreInstanceState(routerSavedState);
            savedPages.remove(position);
            savedPageHistory.remove((Integer) position);
        }
    }
    router.rebindIfNeeded();
    configureRouter(router, position);
    if (router != currentPrimaryRouter) {
        for (RouterTransaction transaction : router.getBackstack()) {
            transaction.controller().setOptionsMenuHidden(true);
        }
    }
    visibleRouters.put(position, router);
    return router;
}
Also used : RouterTransaction(com.bluelinelabs.conductor.RouterTransaction) Bundle(android.os.Bundle) Router(com.bluelinelabs.conductor.Router)

Aggregations

Router (com.bluelinelabs.conductor.Router)2 RouterTransaction (com.bluelinelabs.conductor.RouterTransaction)2 Bundle (android.os.Bundle)1