Created
March 6, 2015 22:23
-
-
Save lukaspili/45e5be2da3849e18498f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class App extends Application { | |
private MortarScope mortarScope; | |
private Component component; | |
@Override | |
public Object getSystemService(String name) { | |
return mortarScope.hasService(name) ? mortarScope.getService(name) : super.getSystemService(name); | |
} | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
component = Dagger_App_Component.create(); | |
component.inject(this); | |
mortarScope = MortarScope.buildRootScope() | |
.withService(DaggerService.SERVICE_NAME, component) | |
.build(); | |
} | |
@dagger.Component | |
@Singleton | |
public static interface Component { | |
RestClient restClient(); | |
SessionManager sessionManager(); | |
void inject(App app); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment