Created
December 25, 2016 07:47
-
-
Save janishar/0d3466801f069a70def4ea11a3812331 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
@Module | |
public class ApplicationModule { | |
private final Application mApplication; | |
public ApplicationModule(Application app) { | |
mApplication = app; | |
} | |
@Provides | |
@ApplicationContext | |
Context provideContext() { | |
return mApplication; | |
} | |
@Provides | |
Application provideApplication() { | |
return mApplication; | |
} | |
@Provides | |
@DatabaseInfo | |
String provideDatabaseName() { | |
return "demo-dagger.db"; | |
} | |
@Provides | |
@DatabaseInfo | |
Integer provideDatabaseVersion() { | |
return 2; | |
} | |
@Provides | |
SharedPreferences provideSharedPrefs() { | |
return mApplication.getSharedPreferences("demo-prefs", Context.MODE_PRIVATE); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment