Search in sources :

Example 1 with ServiceManager

use of com.zhuinden.simpleservicesexample.utils.ServiceManager in project simple-stack by Zhuinden.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    NonConfigurationInstance nonConfigurationInstance = (NonConfigurationInstance) getLastCustomNonConfigurationInstance();
    if (nonConfigurationInstance != null) {
        serviceManager = nonConfigurationInstance.serviceManager;
        serviceTree = serviceManager.getServiceTree();
    } else {
        serviceTree = new ServiceTree();
        serviceTree.createRootNode(TAG);
        serviceManager = new ServiceManager(serviceTree, TAG);
    }
    serviceManager.setRestoredStates(savedInstanceState != null ? savedInstanceState.getParcelable(ServiceManager.SERVICE_STATES) : new StateBundle());
    Navigator.configure().setStateChanger(DefaultStateChanger.configure().setExternalStateChanger(this).create(this, root)).install(this, root, HistoryBuilder.single(A.create()));
}
Also used : ServiceManager(com.zhuinden.simpleservicesexample.utils.ServiceManager) ServiceTree(com.zhuinden.servicetree.ServiceTree) StateBundle(com.zhuinden.statebundle.StateBundle)

Aggregations

ServiceTree (com.zhuinden.servicetree.ServiceTree)1 ServiceManager (com.zhuinden.simpleservicesexample.utils.ServiceManager)1 StateBundle (com.zhuinden.statebundle.StateBundle)1