package io.github.droidkaigi.confsched2017.view.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import javax.inject.Inject;

import io.github.droidkaigi.confsched2017.databinding.FragmentContributorsBinding;
import io.github.droidkaigi.confsched2017.viewmodel.ContributorsViewModel;

public class ContributorsFragment extends BaseFragment {

    public static final String TAG = ContributorsFragment.class.getSimpleName();

    @Inject
    ContributorsViewModel viewModel;

    private FragmentContributorsBinding binding;

    public static ContributorsFragment newInstance() {
        return new ContributorsFragment();
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        getComponent().inject(this);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        binding = FragmentContributorsBinding.inflate(inflater, container, false);
        binding.setViewModel(viewModel);

        initView();
        return binding.getRoot();
    }

    private void initView() {
        //
    }
}

@@ -150,24 +150,49 @@
 n.Nullable;%0A
+import android.util.Log;%0A
 import andro
@@ -273,16 +273,40 @@
 Group;%0A%0A
+import java.util.List;%0A%0A
 import j
@@ -409,16 +409,77 @@
 inding;%0A
+import io.github.droidkaigi.confsched2017.model.Contributor;%0A
 import i
@@ -544,16 +544,171 @@
 ewModel;
+%0Aimport io.reactivex.android.schedulers.AndroidSchedulers;%0Aimport io.reactivex.disposables.CompositeDisposable;%0Aimport io.reactivex.disposables.Disposable;
 %0A%0Apublic
@@ -891,16 +891,74 @@
 Model;%0A%0A
+    @Inject%0A    CompositeDisposable compositeDisposable;%0A%0A
     priv
@@ -1235,24 +1235,505 @@
 is);%0A    %7D%0A%0A
+    @Override%0A    public void onCreate(@Nullable Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        Disposable disposable = viewModel.getContributors()%0A                .observeOn(AndroidSchedulers.mainThread())%0A                .subscribe(%0A                        this::renderContributors,%0A                        throwable -%3E Log.e(TAG, %22Failed to find contributors.%22, throwable)%0A                );%0A        compositeDisposable.add(disposable);%0A    %7D%0A%0A
     @Nullabl
@@ -2046,44 +2046,268 @@
     
-private void initView() %7B%0A        //
+@Override%0A    public void onStop() %7B%0A        super.onStop();%0A        compositeDisposable.dispose();%0A    %7D%0A%0A    private void initView() %7B%0A        //%0A    %7D%0A%0A    private void renderContributors(List%3CContributor%3E contributors) %7B%0A        // TODO render contributors
 %0A   

Integrate ViewModel to ContributorsFragment