Skip to content

Instantly share code, notes, and snippets.

@JorgeCastilloPrz
Created December 7, 2014 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JorgeCastilloPrz/9cb01c518be2fde5b301 to your computer and use it in GitHub Desktop.
Save JorgeCastilloPrz/9cb01c518be2fde5b301 to your computer and use it in GitHub Desktop.
Dagger AppModule
/**
* A module for more generic or external dependencies wich doesnt require a {@link android.content.Context} or
* {@link android.app.Application} to create.
*/
@Module(
library = true
)
public class AppModule {
@Provides
@Singleton
public NotificationIdController provideNotificationIdController() {
return new NotificationIdController();
}
@Provides
@Singleton
public Bus provideBus() {
return new Bus(ThreadEnforcer.MAIN);
}
@Provides
@Singleton
public RestClient provideRestClient() {
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint(ConnectionHelper.BASE_URL)
.setLogLevel(RestAdapter.LogLevel.FULL)
.build();
return restAdapter.create(RestClient.class);
}
@Provides
@Singleton
public DialogController provideDialogController() {
return new DialogController();
}
@Provides
@Singleton
public UserController provideUserController() {
return new UserController();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment