Slide 32
Slide 32 text
MainModule.java
@Module public class MainModule {
private static final int CACHE_SIZE_10_MB = 10 * 1024 * 1024;
private static final int TIMEOUT = 20;
@Provides public Presenter providesPresenter(Repository repository) {
return new Presenter(repository);
}
@Provides @Reusable public Repository repository(Cache cache, Api api) {
return new Repository(cache, api);
}
@Provides @Singleton public Cache providesCache() {
return new Cache(CACHE_SIZE_10_MB);
}
@Provides @Reusable public Api providesApi() {
return new Api(TIMEOUT);
}
}