// Path: app/src/main/java/com/yunq/gankio/data/entity/Girl.java
// public class Girl extends Soul {
// 
//     @Column("used")
//     public boolean used;
//     @Column("type")
//     public String type;
//     @Column("url")
//     public String url;
//     @Column("who")
//     public String who;
//     @Column("desc")
//     public String desc;
//     @Column("createdAt")
//     public Date createdAt;
//     @Column("publishedAt")
//     public Date publishedAt;
//     @Column("updatedAt")
//     public Date updatedAt;
// 
// }
// 
// Path: app/src/main/java/com/yunq/gankio/ui/widget/RatioImageView.java
// public class RatioImageView extends ImageView {
// 
//     private int originalWidth;
// 
//     private int originalHeight;
// 
//     public RatioImageView(Context context) {
//         super(context);
//     }
// 
//     public RatioImageView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//     }
// 
//     public RatioImageView(Context context, AttributeSet attrs, int defStyleAttr) {
//         super(context, attrs, defStyleAttr);
//     }
// 
//     public void setOriginalSize(int originalWidth, int originalHeight) {
//         this.originalWidth = originalWidth;
//         this.originalHeight = originalHeight;
//     }
// 
//     @Override
//     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//         if (originalHeight > 0 && originalWidth > 0) {
//             float radio = (float) originalWidth / (float) originalHeight;
// 
//             int width = MeasureSpec.getSize(widthMeasureSpec);
//             int height = MeasureSpec.getSize(heightMeasureSpec);
// 
//             if (width > 0) {
//                 height = (int) ((float) width / radio);
//             }
// 
//             setMeasuredDimension(width, height);
//         } else {
//             super.onMeasure(widthMeasureSpec, heightMeasureSpec);
//         }
// 
//     }
// }


import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.yunq.gankio.R;
import com.yunq.gankio.data.entity.Girl;
import com.yunq.gankio.ui.widget.RatioImageView;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
package com.yunq.gankio.ui.adapter;





/**
 * Created by admin on 16/1/5.
 */
public class MainListAdapter extends RecyclerView.Adapter<MainListAdapter.ViewHolder> {

    private List<Girl> mListData;

    private Context mContext;

    private IClickItem mIClickItem;

    public MainListAdapter(Context context) {
        mContext = context;
        mListData = new ArrayList<>();
    }

    public void setIClickItem(IClickItem iClickItem) {
        mIClickItem = iClickItem;
    }

    public void updateWithClear(List<Girl> data) {
        mListData.clear();
        mListData.addAll(data);
        notifyDataSetChanged();
    }

    public void update(List<Girl> data) {
        mListData.addAll(data);
        notifyDataSetChanged();
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.index_item, null);
        ViewHolder holder = new ViewHolder(view);
        return holder;
    }

    @Override
// Path: app/src/main/java/com/yunq/gankio/data/entity/Girl.java
// public class Girl extends Soul {
// 
//     @Column("used")
//     public boolean used;
//     @Column("type")
//     public String type;
//     @Column("url")
//     public String url;
//     @Column("who")
//     public String who;
//     @Column("desc")
//     public String desc;
//     @Column("createdAt")
//     public Date createdAt;
//     @Column("publishedAt")
//     public Date publishedAt;
//     @Column("updatedAt")
//     public Date updatedAt;
// 
// }
// 
// Path: app/src/main/java/com/yunq/gankio/ui/widget/RatioImageView.java
// public class RatioImageView extends ImageView {
// 
//     private int originalWidth;
// 
//     private int originalHeight;
// 
//     public RatioImageView(Context context) {
//         super(context);
//     }
// 
//     public RatioImageView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//     }
// 
//     public RatioImageView(Context context, AttributeSet attrs, int defStyleAttr) {
//         super(context, attrs, defStyleAttr);
//     }
// 
//     public void setOriginalSize(int originalWidth, int originalHeight) {
//         this.originalWidth = originalWidth;
//         this.originalHeight = originalHeight;
//     }
// 
//     @Override
//     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//         if (originalHeight > 0 && originalWidth > 0) {
//             float radio = (float) originalWidth / (float) originalHeight;
// 
//             int width = MeasureSpec.getSize(widthMeasureSpec);
//             int height = MeasureSpec.getSize(heightMeasureSpec);
// 
//             if (width > 0) {
//                 height = (int) ((float) width / radio);
//             }
// 
//             setMeasuredDimension(width, height);
//         } else {
//             super.onMeasure(widthMeasureSpec, heightMeasureSpec);
//         }
// 
//     }
// }


// Path: app/src/main/java/com/yunq/gankio/ui/adapter/MainListAdapter.java
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.yunq.gankio.R;
import com.yunq.gankio.data.entity.Girl;
import com.yunq.gankio.ui.widget.RatioImageView;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;

package com.yunq.gankio.ui.adapter;





/**
 * Created by admin on 16/1/5.
 */
public class MainListAdapter extends RecyclerView.Adapter<MainListAdapter.ViewHolder> {

    private List<Girl> mListData;

    private Context mContext;

    private IClickItem mIClickItem;

    public MainListAdapter(Context context) {
        mContext = context;
        mListData = new ArrayList<>();
    }

    public void setIClickItem(IClickItem iClickItem) {
        mIClickItem = iClickItem;
    }

    public void updateWithClear(List<Girl> data) {
        mListData.clear();
        mListData.addAll(data);
        notifyDataSetChanged();
    }

    public void update(List<Girl> data) {
        mListData.addAll(data);
        notifyDataSetChanged();
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.index_item, null);
        ViewHolder holder = new ViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, final int position) {