// Path: dagger_app/src/main/java/my/liewjuntung/daggerviperusage/app/ViperUsageApplication.java
// public class ViperUsageApplication extends Application implements HasActivityInjector {
//     private static final String TAG = ViperUsageApplication.class.getSimpleName();
// 
//     @Inject
//     DispatchingAndroidInjector<Activity> androidInjector;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         DaggerAppComponent
//                 .builder()
//                 .application(this)
//                 .build()
//                 .inject(this);
//     }
// 
//     @Override
//     public AndroidInjector<Activity> activityInjector() {
//         return androidInjector;
//     }
// }
// 
// Path: dagger_app/src/main/java/my/liewjuntung/daggerviperusage/dagger/api/ApiModule.java
// @Module
// public class ApiModule {
//     @Singleton
//     @Provides
//     public OkHttpClient providesOkHttpClient() {
//         HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
//         loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
// 
//         return new OkHttpClient.Builder()
//                 .connectTimeout(5000, TimeUnit.MILLISECONDS)
//                 .readTimeout(5000, TimeUnit.MILLISECONDS)
//                 .writeTimeout(5000, TimeUnit.MILLISECONDS)
//                 .addInterceptor(loggingInterceptor)
//                 .build();
//     }
// 
//     @Singleton
//     @Provides
//     public Retrofit.Builder providesRetrofitBuilder(OkHttpClient client) {
//         return new Retrofit.Builder()
//                 .addConverterFactory(GsonConverterFactory.create())
//                 .client(client)
//                 .addCallAdapterFactory(RxJava2CallAdapterFactory.create());
//     }
// 
//     @Singleton
//     @Provides
//     @Named("instagram")
//     public Retrofit providesInstagramRetrofit(Retrofit.Builder builder) {
//         return builder
//                 .baseUrl("https://www.instagram.com/")
//                 .build();
//     }
// 
//     @Singleton
//     @Provides
//     public IServices providesIService(@Named("instagram") Retrofit retrofit) {
//         return retrofit.create(IServices.class);
//     }
// }


import android.app.Application;
import javax.inject.Singleton;
import dagger.BindsInstance;
import dagger.Component;
import dagger.android.AndroidInjectionModule;
import my.liewjuntung.daggerviperusage.app.ViperUsageApplication;
import my.liewjuntung.daggerviperusage.dagger.api.ApiModule;
package my.liewjuntung.daggerviperusage.dagger;




/**
 * Created by pandawarrior on 24/10/2017.
 */
@Singleton
@Component(modules = {AndroidInjectionModule.class, AppModule.class, ActivityBuilder.class, ApiModule.class})
public interface AppComponent {

    @Component.Builder interface Builder {
        AppComponent build();
        @BindsInstance
// Path: dagger_app/src/main/java/my/liewjuntung/daggerviperusage/app/ViperUsageApplication.java
// public class ViperUsageApplication extends Application implements HasActivityInjector {
//     private static final String TAG = ViperUsageApplication.class.getSimpleName();
// 
//     @Inject
//     DispatchingAndroidInjector<Activity> androidInjector;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         DaggerAppComponent
//                 .builder()
//                 .application(this)
//                 .build()
//                 .inject(this);
//     }
// 
//     @Override
//     public AndroidInjector<Activity> activityInjector() {
//         return androidInjector;
//     }
// }
// 
// Path: dagger_app/src/main/java/my/liewjuntung/daggerviperusage/dagger/api/ApiModule.java
// @Module
// public class ApiModule {
//     @Singleton
//     @Provides
//     public OkHttpClient providesOkHttpClient() {
//         HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
//         loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
// 
//         return new OkHttpClient.Builder()
//                 .connectTimeout(5000, TimeUnit.MILLISECONDS)
//                 .readTimeout(5000, TimeUnit.MILLISECONDS)
//                 .writeTimeout(5000, TimeUnit.MILLISECONDS)
//                 .addInterceptor(loggingInterceptor)
//                 .build();
//     }
// 
//     @Singleton
//     @Provides
//     public Retrofit.Builder providesRetrofitBuilder(OkHttpClient client) {
//         return new Retrofit.Builder()
//                 .addConverterFactory(GsonConverterFactory.create())
//                 .client(client)
//                 .addCallAdapterFactory(RxJava2CallAdapterFactory.create());
//     }
// 
//     @Singleton
//     @Provides
//     @Named("instagram")
//     public Retrofit providesInstagramRetrofit(Retrofit.Builder builder) {
//         return builder
//                 .baseUrl("https://www.instagram.com/")
//                 .build();
//     }
// 
//     @Singleton
//     @Provides
//     public IServices providesIService(@Named("instagram") Retrofit retrofit) {
//         return retrofit.create(IServices.class);
//     }
// }


// Path: dagger_app/src/main/java/my/liewjuntung/daggerviperusage/dagger/AppComponent.java
import android.app.Application;
import javax.inject.Singleton;
import dagger.BindsInstance;
import dagger.Component;
import dagger.android.AndroidInjectionModule;
import my.liewjuntung.daggerviperusage.app.ViperUsageApplication;
import my.liewjuntung.daggerviperusage.dagger.api.ApiModule;

package my.liewjuntung.daggerviperusage.dagger;




/**
 * Created by pandawarrior on 24/10/2017.
 */
@Singleton
@Component(modules = {AndroidInjectionModule.class, AppModule.class, ActivityBuilder.class, ApiModule.class})
public interface AppComponent {

    @Component.Builder interface Builder {
        AppComponent build();
        @BindsInstance
        Builder application(Application application);