use of com.zhuinden.statebundle.StateBundle in project simple-stack by Zhuinden.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
NonConfigurationInstance nonConfigurationInstance = (NonConfigurationInstance) getLastCustomNonConfigurationInstance();
if (nonConfigurationInstance != null) {
serviceManager = nonConfigurationInstance.serviceManager;
serviceTree = serviceManager.getServiceTree();
} else {
serviceTree = new ServiceTree();
serviceTree.createRootNode(TAG);
serviceManager = new NestSupportServiceManager(serviceTree, TAG);
serviceManager.setRestoredStates(savedInstanceState != null ? savedInstanceState.getParcelable("SERVICE_BUNDLE") : new StateBundle());
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
backstack = Navigator.configure().setStateChanger(DefaultStateChanger.configure().setExternalStateChanger(this).create(this, root)).setStateClearStrategy(new PreserveTreeScopesStrategy(serviceTree)).install(this, root, HistoryBuilder.single(MainKey.create()));
}
use of com.zhuinden.statebundle.StateBundle in project simple-stack by Zhuinden.
the class CloudSyncView method toBundle.
@Override
@NonNull
public StateBundle toBundle() {
StateBundle bundle = new StateBundle();
bundle.putString("HELLO", "WORLD");
return bundle;
}
use of com.zhuinden.statebundle.StateBundle 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()));
}
use of com.zhuinden.statebundle.StateBundle in project simple-stack by Zhuinden.
the class NestSupportServiceManager method persistStates.
public StateBundle persistStates() {
StateBundle serviceStates = new StateBundle();
serviceTree.traverseTree(ServiceTree.Walk.PRE_ORDER, (node, cancellationToken) -> {
StateBundle keyBundle = new StateBundle();
for (ServiceTree.Node.Entry entry : node.getBoundServices()) {
if (entry.getService() instanceof Bundleable) {
keyBundle.putParcelable(entry.getName(), ((Bundleable) entry.getService()).toBundle());
}
}
serviceStates.putParcelable(node.getKey().toString(), keyBundle);
});
return serviceStates;
}
use of com.zhuinden.statebundle.StateBundle in project simple-stack by Zhuinden.
the class TasksPresenter method toBundle.
@Override
public StateBundle toBundle() {
StateBundle bundle = new StateBundle();
bundle.putString("FILTERING", filterType.getValue().name());
return bundle;
}
Aggregations