Skip to content

Instantly share code, notes, and snippets.

@shahbazahmed1269
Created June 10, 2017 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shahbazahmed1269/55a9c634f46d6a1f99dbd8494ed4ffb5 to your computer and use it in GitHub Desktop.
Save shahbazahmed1269/55a9c634f46d6a1f99dbd8494ed4ffb5 to your computer and use it in GitHub Desktop.
Part of my 2nd blog post on architecture components and MVVM
@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