use of com.byoutline.kickmaterial.dagger.GlobalModule in project kickmaterial by byoutline.
the class DaggerRules method getActivityRule.
public static <ACTIVITY extends Activity> ActivityTestRule<ACTIVITY> getActivityRule(final AppComponentProvider mainComponentProv, Class<ACTIVITY> clazz) {
final Handler mainHandler = new Handler(Looper.getMainLooper());
return new DaggerActivityTestRule<>(clazz, (application, activity) -> {
final KickMaterialApp app = (KickMaterialApp) application;
final AppComponent appComponent = mainComponentProv.getComponent(app);
final GlobalComponent globalComponent = DaggerGlobalComponent.builder().globalModule(new GlobalModule(app, appComponent.getBus(), appComponent.getAccessTokenProvider())).build();
mainHandler.post(() -> app.setComponents(globalComponent, appComponent));
});
}
Aggregations