Created
December 7, 2014 14:05
-
-
Save JorgeCastilloPrz/9cb01c518be2fde5b301 to your computer and use it in GitHub Desktop.
Dagger AppModule
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
/** | |
* 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