Created
June 18, 2018 11:24
-
-
Save mohak1712/46419c92b0784cfffee39b2573565857 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ApplicationModule { | |
private Application mApplication; | |
public ApplicationModule(Application application) { | |
mApplication = application; | |
} | |
@Provides | |
Application provideApplication() { | |
return mApplication; | |
} | |
@Provides | |
@ApplicationContext | |
Context provideContext() { | |
return mApplication; | |
} | |
@Provides | |
@Singleton | |
public Retrofit getRetrofit(OkHttpClient client) { | |
return new Retrofit.Builder() | |
.addConverterFactory(GsonConverterFactory.create()) | |
.client(client) | |
.addCallAdapterFactory(RxJava2CallAdapterFactory.create()) | |
.baseUrl(BuildConfig.BASE_URL) | |
.build(); | |
} | |
@Provides | |
@Singleton | |
OkHttpClient getOkHttpClient() { | |
return new WeatherOkhttp().getWeatherOkhttpClient(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment