Created
June 10, 2017 05:52
-
-
Save shahbazahmed1269/55a9c634f46d6a1f99dbd8494ed4ffb5 to your computer and use it in GitHub Desktop.
Part of my 2nd blog post on architecture components and MVVM
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 AppModule { | |
public static final String BASE_URL = "https://api.github.com/"; | |
@Provides | |
@Singleton | |
GithubApiService provideGithubApiService() { | |
return new Retrofit.Builder() | |
.addConverterFactory(GsonConverterFactory.create()) | |
.baseUrl(BASE_URL) | |
.build() | |
.create(GithubApiService.class); | |
} | |
@Provides | |
@Singleton | |
IssueRepository provideIssueRepository(IssueRepositoryImpl repository) { | |
return repository; | |
} | |
@Provides | |
ViewModel provideListIssuesViewModel(ListIssuesViewModel viewModel) { | |
return viewModel; | |
} | |
@Provides | |
ViewModelProvider.Factory provideListIssuesViewModelFactory( | |
ViewModelFactory factory | |
) { | |
return factory; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment