@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); flowSupport.onNewIntent(intent); }
@Override protected void onPause() { flowSupport.onPause(); super.onPause(); }
@Override protected void onResume() { super.onResume(); flowSupport.onResume(); }
@Override public Object onRetainCustomNonConfigurationInstance() { return flowSupport.onRetainNonConfigurationInstance(); }
/** * Inform the view about back events. */ @Override public void onBackPressed() { if (containerAsBackTarget.onBackPressed()) return; if (flowSupport.onBackPressed()) return; super.onBackPressed(); }
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); flowSupport.onSaveInstanceState(outState); getBundleServiceRunner(this).onSaveInstanceState(outState); }
@Override public Object getSystemService(String name) { Object flow = null; if (flowSupport != null) flow = flowSupport.getSystemService(name); return flow != null ? flow : (activityScope != null && activityScope.hasService(name)) ? activityScope.getService(name) : super.getSystemService(name); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Object appComponent = DaggerService.getDaggerComponent(MortarDemoApplication.instance()); Component component = DaggerService.createComponent(Component.class, appComponent); component.inject(this); String scopeName = getLocalClassName() + "-task-" + getTaskId(); MortarScope parentScope = MortarScope.getScope(getApplication()); activityScope = parentScope.findChild(scopeName); if (activityScope == null) { activityScope = parentScope.buildChild() .withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner()) .withService(DaggerService.SERVICE_NAME, component) .build(scopeName); } BundleServiceRunner.getBundleServiceRunner(activityScope).onCreate(savedInstanceState); actionBarOwner.takeView(this); setContentView(R.layout.root_layout); container = (PathContainerView) findViewById(R.id.container); containerAsBackTarget = (HandlesBack) container; FlowDelegate.NonConfigurationInstance nonConfig = (FlowDelegate.NonConfigurationInstance) getLastCustomNonConfigurationInstance(); History history = History.single(new ChatListScreen()); flowSupport = FlowDelegate.onCreate(nonConfig, getIntent(), savedInstanceState, new GsonParceler(new Gson()), history, this); }