Skip to content

Instantly share code, notes, and snippets.

@PierceZ
Created February 11, 2017 21:37
Show Gist options
  • Save PierceZ/dcaf2875106a5a2559c1d362f3b9664c to your computer and use it in GitHub Desktop.
Save PierceZ/dcaf2875106a5a2559c1d362f3b9664c to your computer and use it in GitHub Desktop.
An example of using Dagger to make a bus of subjects.
@Module
public class BusModule {
public static final String PROVIDER_TOP_SUBJECT = "PROVIDER_TOP_SUBJECT";
public static final String PROVIDER_BOTTOM_SUBJECT = "PROVIDER_BOTTOM_SUBJECT";
@Provides
@Singleton
@Named(PROVIDER_TOP_SUBJECT)
static PublishSubject<String> provideTopSubject() {
return PublishSubject.create();
}
@Provides
@Singleton
@Named(PROVIDER_BOTTOM_SUBJECT)
static PublishSubject<String> provideBottomSubject() {
return PublishSubject.create();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment