// Path: 2016-06-15_hot_and_cold/app/src/main/java/com/gdgand/rxjava/rxjavasample/hotandcold/SampleApplication.java
// public class SampleApplication extends Application {
// 	private ApplicationComponent applicationComponent;
// 
// 	@Override
// 	public void onCreate() {
// 		super.onCreate();
// 		applicationComponent = createComponent();
// 	}
// 
// 	private ApplicationComponent createComponent() {
// 		return DaggerApplicationComponent.builder()
// 			.applicationModule(new ApplicationModule(this))
// 			.dataModule(new DataModule())
// 			.build();
// 	}
// 
// 	public ApplicationComponent getApplicationComponent() {
// 		return applicationComponent;
// 	}
// 
// }
// 
// Path: 2016-06-15_hot_and_cold/app/src/main/java/com/gdgand/rxjava/rxjavasample/hotandcold/di/module/ActivityModule.java
// @Module
// public class ActivityModule {
// 
// 	private Activity activity;
// 
// 	public ActivityModule(Activity activity) {
// 		this.activity = activity;
// 	}
// 
// 	@Provides
// 	@PerActivity
// 	public Activity activity() {
// 		return activity;
// 	}
// 
// 	@Provides
// 	@PerActivity
// 	public ProgressIndicatorProvider progressIndicatorProvider(Activity activity) {
// 		return new ProgressIndicatorProvider(activity);
// 	}
// }


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.gdgand.rxjava.rxjavasample.hotandcold.R;
import com.gdgand.rxjava.rxjavasample.hotandcold.SampleApplication;
import com.gdgand.rxjava.rxjavasample.hotandcold.di.component.DaggerActivityComponent;
import com.gdgand.rxjava.rxjavasample.hotandcold.di.module.ActivityModule;
import rx.android.schedulers.AndroidSchedulers;
import rx.subscriptions.CompositeSubscription;
import javax.inject.Inject;
			}
		});

		onInject();

		subscriptions = new CompositeSubscription();

		subscriptions.add(viewModel.getPosts()
			.observeOn(AndroidSchedulers.mainThread())
			.subscribe(adapter::setDatas, this::showError));

		subscriptions.add(viewModel.getCounts()
			.observeOn(AndroidSchedulers.mainThread())
			.subscribe(pair -> {
				textViewResult.setText(String.format("앨범 %d개, 앨범아닌건 %d개", pair.first, pair.second));
			}, this::showError));

		viewModel.refresh();
	}

	@Override
	protected void onDestroy() {
		subscriptions.unsubscribe();
		super.onDestroy();
	}

	void onInject() {
		DaggerActivityComponent
			.builder()
			.applicationComponent(((SampleApplication)getApplication()).getApplicationComponent())
// Path: 2016-06-15_hot_and_cold/app/src/main/java/com/gdgand/rxjava/rxjavasample/hotandcold/SampleApplication.java
// public class SampleApplication extends Application {
// 	private ApplicationComponent applicationComponent;
// 
// 	@Override
// 	public void onCreate() {
// 		super.onCreate();
// 		applicationComponent = createComponent();
// 	}
// 
// 	private ApplicationComponent createComponent() {
// 		return DaggerApplicationComponent.builder()
// 			.applicationModule(new ApplicationModule(this))
// 			.dataModule(new DataModule())
// 			.build();
// 	}
// 
// 	public ApplicationComponent getApplicationComponent() {
// 		return applicationComponent;
// 	}
// 
// }
// 
// Path: 2016-06-15_hot_and_cold/app/src/main/java/com/gdgand/rxjava/rxjavasample/hotandcold/di/module/ActivityModule.java
// @Module
// public class ActivityModule {
// 
// 	private Activity activity;
// 
// 	public ActivityModule(Activity activity) {
// 		this.activity = activity;
// 	}
// 
// 	@Provides
// 	@PerActivity
// 	public Activity activity() {
// 		return activity;
// 	}
// 
// 	@Provides
// 	@PerActivity
// 	public ProgressIndicatorProvider progressIndicatorProvider(Activity activity) {
// 		return new ProgressIndicatorProvider(activity);
// 	}
// }


// Path: 2016-06-15_hot_and_cold/app/src/main/java/com/gdgand/rxjava/rxjavasample/hotandcold/presentation/mvvm/imgur/MvvmActivity.java
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.gdgand.rxjava.rxjavasample.hotandcold.R;
import com.gdgand.rxjava.rxjavasample.hotandcold.SampleApplication;
import com.gdgand.rxjava.rxjavasample.hotandcold.di.component.DaggerActivityComponent;
import com.gdgand.rxjava.rxjavasample.hotandcold.di.module.ActivityModule;
import rx.android.schedulers.AndroidSchedulers;
import rx.subscriptions.CompositeSubscription;
import javax.inject.Inject;

			}
		});

		onInject();

		subscriptions = new CompositeSubscription();

		subscriptions.add(viewModel.getPosts()
			.observeOn(AndroidSchedulers.mainThread())
			.subscribe(adapter::setDatas, this::showError));

		subscriptions.add(viewModel.getCounts()
			.observeOn(AndroidSchedulers.mainThread())
			.subscribe(pair -> {
				textViewResult.setText(String.format("앨범 %d개, 앨범아닌건 %d개", pair.first, pair.second));
			}, this::showError));

		viewModel.refresh();
	}

	@Override
	protected void onDestroy() {
		subscriptions.unsubscribe();
		super.onDestroy();
	}

	void onInject() {
		DaggerActivityComponent
			.builder()
			.applicationComponent(((SampleApplication)getApplication()).getApplicationComponent())
			.activityModule(new ActivityModule(this))