Skip to content

Instantly share code, notes, and snippets.

@danilosilvadev
Created March 30, 2017 15:12
Show Gist options
  • Save danilosilvadev/84319ba84227013b5f100b1e089a7097 to your computer and use it in GitHub Desktop.
Save danilosilvadev/84319ba84227013b5f100b1e089a7097 to your computer and use it in GitHub Desktop.
//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