Created
October 18, 2016 13:55
-
-
Save frogermcs/8fbb97357819e6a276593bd30909fc48 to your computer and use it in GitHub Desktop.
This file contains 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 MyApplication extends Application implements HasActivitySubcomponentBuilders { | |
@Inject | |
Map<Class<? extends Activity>, ActivityComponentBuilder> activityComponentBuilders; | |
private AppComponent appComponent; | |
public static HasActivitySubcomponentBuilders get(Context context) { | |
return ((HasActivitySubcomponentBuilders) context.getApplicationContext()); | |
} | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
appComponent = DaggerAppComponent.create(); | |
appComponent.inject(this); | |
} | |
@Override | |
public ActivityComponentBuilder getActivityComponentBuilder(Class<? extends Activity> activityClass) { | |
return activityComponentBuilders.get(activityClass); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment