// Path: core-common/src/main/java/com/christianbahl/appkit/core/common/view/CBMvpView.java
// public interface CBMvpView<M> extends MvpLceView<List<M>> {
// 
// }
// 
// Path: core/src/main/java/com/christianbahl/appkit/core/fragment/CBFragmentMvpListRecyclerViewPtr.java
// public abstract class CBFragmentMvpListRecyclerViewPtr<M, V extends CBMvpView<M>, P extends MvpPresenter<V>, A extends RecyclerView.Adapter>
//     extends CBFragmentMvpRecyclerViewPtr<List<M>, V, P, A> implements CBMvpView<M> {
// 
// }
// 
// Path: sample-core/src/main/java/com/christianbahl/appkit/samplecore/fragment_recyclerview/FragmentRecyclerViewAdapter.java
// public class FragmentRecyclerViewAdapter extends CBAdapterRecyclerView<String> {
// 
//   public FragmentRecyclerViewAdapter(Context context) {
//     super(context);
//   }
// 
//   @Override
//   public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position, int viewType) {
//     ((StringViewHolder) viewHolder).bindView(items.get(position));
//   }
// 
//   @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//     return new StringViewHolder(inflater.inflate(R.layout.row_text, parent, false));
//   }
// 
//   class StringViewHolder extends RecyclerView.ViewHolder {
// 
//     private TextView text;
// 
//     public StringViewHolder(View v) {
//       super(v);
// 
//       text = (TextView) v.findViewById(R.id.text);
//     }
// 
//     public void bindView(String data) {
//       text.setText(data);
//     }
//   }
// }
// 
// Path: sample-core/src/main/java/com/christianbahl/appkit/samplecore/fragment_recyclerview_list/FragmentRecyclerViewListPresenter.java
// public class FragmentRecyclerViewListPresenter extends MvpBasePresenter<CBMvpView<String>> {
// 
//   public void loadData(boolean contentPresent) {
//     if (isViewAttached()) {
//       getView().showLoading(contentPresent);
//     }
// 
//     if (new Random().nextInt(10) % 3 == 0) {
//       if (isViewAttached()) {
//         getView().showError(new NullPointerException("No Data found!"), contentPresent);
//       }
//     } else {
//       if (isViewAttached()) {
//         getView().setData(getItems());
//         getView().showContent();
//       }
//     }
//   }
// 
//   private List<String> getItems() {
//     List<String> items = new ArrayList<>();
// 
//     for (int i = 1; i <= 30; i++) {
//       items.add("Item " + i);
//     }
// 
//     return items;
//   }
// }


import android.support.annotation.NonNull;
import android.widget.Toast;
import com.christianbahl.appkit.core.common.view.CBMvpView;
import com.christianbahl.appkit.core.fragment.CBFragmentMvpListRecyclerViewPtr;
import com.christianbahl.appkit.samplecore.fragment_recyclerview.FragmentRecyclerViewAdapter;
import com.christianbahl.appkit.samplecore.fragment_recyclerview_list.FragmentRecyclerViewListPresenter;
import java.util.List;
package com.christianbahl.appkit.samplecore.fragment_recyclerview_list_ptr;


/**
 * @author Christian Bahl
 */
public class FragmentRecyclerViewListPtrFragment extends
    CBFragmentMvpListRecyclerViewPtr<String, CBMvpView<String>, FragmentRecyclerViewListPresenter, FragmentRecyclerViewAdapter> {

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

  @NonNull @Override protected FragmentRecyclerViewAdapter createAdapter() {
    return new FragmentRecyclerViewAdapter(getActivity());
  }

  @NonNull @Override public FragmentRecyclerViewListPresenter createPresenter() {
    return new FragmentRecyclerViewListPresenter();
  }

  @Override public void setData(List<String> data) {
    Toast.makeText(getActivity(), "Data loaded", Toast.LENGTH_LONG).show();
    adapter.setItems(data);
    adapter.notifyDataSetChanged();
  }

  @Override public void loadData(boolean pullToRefresh) {
// Path: core-common/src/main/java/com/christianbahl/appkit/core/common/view/CBMvpView.java
// public interface CBMvpView<M> extends MvpLceView<List<M>> {
// 
// }
// 
// Path: core/src/main/java/com/christianbahl/appkit/core/fragment/CBFragmentMvpListRecyclerViewPtr.java
// public abstract class CBFragmentMvpListRecyclerViewPtr<M, V extends CBMvpView<M>, P extends MvpPresenter<V>, A extends RecyclerView.Adapter>
//     extends CBFragmentMvpRecyclerViewPtr<List<M>, V, P, A> implements CBMvpView<M> {
// 
// }
// 
// Path: sample-core/src/main/java/com/christianbahl/appkit/samplecore/fragment_recyclerview/FragmentRecyclerViewAdapter.java
// public class FragmentRecyclerViewAdapter extends CBAdapterRecyclerView<String> {
// 
//   public FragmentRecyclerViewAdapter(Context context) {
//     super(context);
//   }
// 
//   @Override
//   public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position, int viewType) {
//     ((StringViewHolder) viewHolder).bindView(items.get(position));
//   }
// 
//   @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//     return new StringViewHolder(inflater.inflate(R.layout.row_text, parent, false));
//   }
// 
//   class StringViewHolder extends RecyclerView.ViewHolder {
// 
//     private TextView text;
// 
//     public StringViewHolder(View v) {
//       super(v);
// 
//       text = (TextView) v.findViewById(R.id.text);
//     }
// 
//     public void bindView(String data) {
//       text.setText(data);
//     }
//   }
// }
// 
// Path: sample-core/src/main/java/com/christianbahl/appkit/samplecore/fragment_recyclerview_list/FragmentRecyclerViewListPresenter.java
// public class FragmentRecyclerViewListPresenter extends MvpBasePresenter<CBMvpView<String>> {
// 
//   public void loadData(boolean contentPresent) {
//     if (isViewAttached()) {
//       getView().showLoading(contentPresent);
//     }
// 
//     if (new Random().nextInt(10) % 3 == 0) {
//       if (isViewAttached()) {
//         getView().showError(new NullPointerException("No Data found!"), contentPresent);
//       }
//     } else {
//       if (isViewAttached()) {
//         getView().setData(getItems());
//         getView().showContent();
//       }
//     }
//   }
// 
//   private List<String> getItems() {
//     List<String> items = new ArrayList<>();
// 
//     for (int i = 1; i <= 30; i++) {
//       items.add("Item " + i);
//     }
// 
//     return items;
//   }
// }


// Path: sample-core/src/main/java/com/christianbahl/appkit/samplecore/fragment_recyclerview_list_ptr/FragmentRecyclerViewListPtrFragment.java
import android.support.annotation.NonNull;
import android.widget.Toast;
import com.christianbahl.appkit.core.common.view.CBMvpView;
import com.christianbahl.appkit.core.fragment.CBFragmentMvpListRecyclerViewPtr;
import com.christianbahl.appkit.samplecore.fragment_recyclerview.FragmentRecyclerViewAdapter;
import com.christianbahl.appkit.samplecore.fragment_recyclerview_list.FragmentRecyclerViewListPresenter;
import java.util.List;

package com.christianbahl.appkit.samplecore.fragment_recyclerview_list_ptr;


/**
 * @author Christian Bahl
 */
public class FragmentRecyclerViewListPtrFragment extends
    CBFragmentMvpListRecyclerViewPtr<String, CBMvpView<String>, FragmentRecyclerViewListPresenter, FragmentRecyclerViewAdapter> {

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

  @NonNull @Override protected FragmentRecyclerViewAdapter createAdapter() {
    return new FragmentRecyclerViewAdapter(getActivity());
  }

  @NonNull @Override public FragmentRecyclerViewListPresenter createPresenter() {
    return new FragmentRecyclerViewListPresenter();
  }

  @Override public void setData(List<String> data) {
    Toast.makeText(getActivity(), "Data loaded", Toast.LENGTH_LONG).show();
    adapter.setItems(data);
    adapter.notifyDataSetChanged();
  }

  @Override public void loadData(boolean pullToRefresh) {
    presenter.loadData(pullToRefresh);