Created
March 30, 2017 15:12
-
-
Save danilosilvadev/84319ba84227013b5f100b1e089a7097 to your computer and use it in GitHub Desktop.
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 | |
@Provides | |
@PerActivity | |
public Retrofit provideRetrofit(Gson gson, OkHttpClient okHttpClient) { | |
Retrofit retrofit = new Retrofit.Builder() | |
.addConverterFactory(GsonConverterFactory.create(gson)) | |
.baseUrl(BASE_URL) | |
.client(okHttpClient) | |
//converts Retrofit response into Observable | |
.addCallAdapterFactory(RxJavaCallAdapterFactory.create()) | |
.build(); | |
return retrofit; | |
} | |
//COMPONENT | |
@PerActivity | |
@Component(modules = {PresenterModule.class, UserLoginModule.class, ResponseModule.class, RetrofitModule.class}) | |
public interface MainComponent { | |
void injectIntoMainActivity(MainActivity mainActivity); | |
//void injectIntoMainPresenter(MainPresenter mainPresenter); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment