Search in sources :

Example 1 with ActivityHostedRouter

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

the class LifecycleHandler method getRouter.

@NonNull
public Router getRouter(@NonNull ViewGroup container, @Nullable Bundle savedInstanceState) {
    ActivityHostedRouter router = routerMap.get(getRouterHashKey(container));
    if (router == null) {
        router = new ActivityHostedRouter();
        router.setHost(this, container);
        if (savedInstanceState != null) {
            Bundle routerSavedState = savedInstanceState.getBundle(KEY_ROUTER_STATE_PREFIX + router.getContainerId());
            if (routerSavedState != null) {
                router.restoreInstanceState(routerSavedState);
            }
        }
        routerMap.put(getRouterHashKey(container), router);
    } else {
        router.setHost(this, container);
    }
    return router;
}
Also used : Bundle(android.os.Bundle) ActivityHostedRouter(com.bluelinelabs.conductor.ActivityHostedRouter) NonNull(android.support.annotation.NonNull)

Aggregations

Bundle (android.os.Bundle)1 NonNull (android.support.annotation.NonNull)1 ActivityHostedRouter (com.bluelinelabs.conductor.ActivityHostedRouter)1