-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageModule.java
More file actions
44 lines (33 loc) · 1.06 KB
/
ImageModule.java
File metadata and controls
44 lines (33 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.tom.meeter;
import static com.tom.meeter.infrastructure.common.Globals.getServerPath;
import static com.tom.meeter.infrastructure.common.InfrastructureHelper.logMethod;
import android.app.Application;
import androidx.annotation.NonNull;
import com.tom.meeter.context.image.ImageDownloader;
import com.tom.meeter.context.image.service.ImageService;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import retrofit2.Retrofit;
@Module
public class ImageModule {
private static final String TAG = ImageModule.class.getCanonicalName();
public ImageModule() {
logMethod(TAG, this);
}
@Singleton
@NonNull
@Provides
public ImageService provideImageService(Application app) {
return new Retrofit.Builder()
.baseUrl(getServerPath(app))
.build()
.create(ImageService.class);
}
@Singleton
@NonNull
@Provides
public ImageDownloader provideImageDownloader(ImageService imageService) {
return new ImageDownloader(imageService);
}
}