// Path: app/src/main/java/me/pkliang/gankmaku/base/view/IDataAdapter.java
// public interface IDataAdapter<DATA> {
// 
//   void notifyDataChanged(DATA data, boolean isRefresh);
// 
//   DATA getData();
// 
//   boolean isEmpty();
// }
// 
// Path: domain/src/main/java/me/pkliang/gankmaku/domain/entity/Response.java
// public class Response {
// 
//   private List<Entry> results;
//   private boolean error;
// 
//   public Response setResults(List<Entry> results) {
//     this.results = results;
//     return this;
//   }
// 
//   public void setError(boolean error) {
//     this.error = error;
//   }
// 
//   public List<Entry> getResults() {
//     return results;
//   }
// 
//   public boolean isError() {
//     return error;
//   }
// }


import android.support.v7.widget.RecyclerView;
import me.pkliang.gankmaku.base.view.IDataAdapter;
import me.pkliang.gankmaku.domain.entity.Response;
package me.pkliang.gankmaku.base;


/**
 * Created by Omistaja on 8/11/2015.
 */
public abstract class BaseAdapter<V extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<V>
    implements IDataAdapter<Response> {

  protected Response mResponse;

  protected BaseAdapter(Response mResponse) {
    this.mResponse = mResponse;
  }

  @Override public int getItemCount() {
    return mResponse.getResults().size();
  }

  @Override public void notifyDataChanged(Response response, boolean isRefresh) {
    if (isRefresh) mResponse.getResults().clear();
    mResponse.getResults().addAll(response.getResults());
    mResponse.setError(response.isError());
// Path: app/src/main/java/me/pkliang/gankmaku/base/view/IDataAdapter.java
// public interface IDataAdapter<DATA> {
// 
//   void notifyDataChanged(DATA data, boolean isRefresh);
// 
//   DATA getData();
// 
//   boolean isEmpty();
// }
// 
// Path: domain/src/main/java/me/pkliang/gankmaku/domain/entity/Response.java
// public class Response {
// 
//   private List<Entry> results;
//   private boolean error;
// 
//   public Response setResults(List<Entry> results) {
//     this.results = results;
//     return this;
//   }
// 
//   public void setError(boolean error) {
//     this.error = error;
//   }
// 
//   public List<Entry> getResults() {
//     return results;
//   }
// 
//   public boolean isError() {
//     return error;
//   }
// }


// Path: app/src/main/java/me/pkliang/gankmaku/base/BaseAdapter.java
import android.support.v7.widget.RecyclerView;
import me.pkliang.gankmaku.base.view.IDataAdapter;
import me.pkliang.gankmaku.domain.entity.Response;

package me.pkliang.gankmaku.base;


/**
 * Created by Omistaja on 8/11/2015.
 */
public abstract class BaseAdapter<V extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<V>
    implements IDataAdapter<Response> {

  protected Response mResponse;

  protected BaseAdapter(Response mResponse) {
    this.mResponse = mResponse;
  }

  @Override public int getItemCount() {
    return mResponse.getResults().size();
  }

  @Override public void notifyDataChanged(Response response, boolean isRefresh) {
    if (isRefresh) mResponse.getResults().clear();
    mResponse.getResults().addAll(response.getResults());
    mResponse.setError(response.isError());
    notifyDataSetChanged();