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 AdpGcGameAppActivityRecommend extends RecyclerViewAdapter<Article> {

    private Activity activity;

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

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

        ViewUtil.setImage(item_activity_recommend_iv, item.getPictures(), activity.getResources().getDimensionPixelSize(R.dimen.content_padding_5));
        ViewUtil.setText(item_activity_recommend_content, item.getContent());

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

}
