Created
August 19, 2018 15:43
-
-
Save ibrahimsn98/1278fa8d5d7d64e1f37a806921edd79b to your computer and use it in GitHub Desktop.
android-mvvm-with-dagger-2
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
@Singleton | |
@Module(includes = ViewModelModule.class) | |
public class ApplicationModule { | |
private static final String BASE_URL = "https://api.github.com/"; | |
@Singleton | |
@Provides | |
static Retrofit provideRetrofit() { | |
return new Retrofit.Builder().baseUrl(BASE_URL) | |
.addCallAdapterFactory(RxJava2CallAdapterFactory.create()) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.build(); | |
} | |
@Singleton | |
@Provides | |
static RepoService provideRetrofitService(Retrofit retrofit) { | |
return retrofit.create(RepoService.class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment