package com.sheep.gamegroup.view.adapter;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
import com.sheep.gamegroup.model.entity.Article;
import com.sheep.gamegroup.util.Jump2View;
import com.sheep.gamegroup.util.ViewUtil;
import com.sheep.jiuyan.samllsheep.R;

import java.util.List;

/**
 * Created by realicing on 2018/11/5.
 * realicing@sina.com
 */
public class AdpGcGameAppArticleRecommend extends RecyclerViewAdapter<Article> {

    private Activity activity;

    public AdpGcGameAppArticleRecommend(Context context, List<Article> datas) {
        super(context, R.layout.item_article_recommend, datas);
        activity = (Activity) context;
    }

    @Override
    public void convert(ViewHolder viewHolder, final Article item, int position) {
        TextView item_article_recommend_title = viewHolder.itemView.findViewById(R.id.item_article_recommend_title);
        ImageView item_article_recommend_icon = viewHolder.itemView.findViewById(R.id.item_article_recommend_icon);
        TextView item_article_recommend_content = viewHolder.itemView.findViewById(R.id.item_article_recommend_content);

        ViewUtil.setText(item_article_recommend_title, item.getTitle());
        ViewUtil.setText(item_article_recommend_content, item.getContent());
        ViewUtil.setGameImage(item_article_recommend_icon, item.getPictures());

        viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Jump2View.getInstance().goFindItem(activity, item);
            }
        });
    }

}
