@Override public Object getSystemService(String name) { if (scope != null && scope.hasService(name)) { return scope.getService(name); } return super.getSystemService(name); }
@Override public Object getSystemService(String name) { // Note we dont create the scope here since this is usually called // before onCreate and we need to be able to fetch our scope name // on configuration changes return (mActivityScope != null && mActivityScope.hasService(name)) ? mActivityScope.getService(name) : super.getSystemService(name); }
@Override public Object getSystemService(String name) { if (rootScope == null) { rootScope = MortarScope.buildRootScope() .withService( ObjectGraphService.SERVICE_NAME, ObjectGraph.create(new ApplicationModule(this))) .build("Root"); } if (rootScope.hasService(name)) return rootScope.getService(name); return super.getSystemService(name); }
/** * Retreive the navigator from the nearest child of the current context Use this method from the * host of a navigator container view to retrieve the associated navigator */ public static Navigator find(Context context) { MortarScope scope = MortarScope.findChild(context, SCOPE_NAME); return scope != null ? scope.<Navigator>getService(SERVICE_NAME) : null; }