package com.fxy.main.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.Toast;

import com.chad.library.adapter.base.BaseViewHolder;
import com.fxy.baselibrary.util.StringUtils;
import com.fxy.R;
import com.fxy.main.bean.JobEntry;

import java.util.List;

/**
 * 项目名称：FingerShipWork
 * 类描述：
 * 创建人：ww
 * 创建时间：2018/3/16 17:42
 * 修改人：COMP-021-2002
 * 修改时间：2018/3/16 17:42
 * 修改备注：
 */

public class HomeFragmentAdapter extends BaseAdapter<JobEntry> {

    public HomeFragmentAdapter(int layoutResId, @Nullable List<JobEntry> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, JobEntry jobEntry) {
        ImageView homeImaItemHeader = (ImageView) holder.getView(R.id.home_ima_item_header);//.bindView.findViewById(R.id.home_ima_item_header);
        if (StringUtils.isEmpty(jobEntry.getHeaderUrl())) {
            Toast.makeText(mContext, mContext.getString(R.string.nopictrue), Toast.LENGTH_SHORT).show();
        } else {
//            Glide.with(mContext).load(jobEntry.getHeaderUrl()).into(homeImaItemHeader);
        }

        holder.setText(R.id.home_tv_item_title, StringUtils.isEmpty(jobEntry.getTitle()) ? mContext.getString(R.string.unkown_task) : jobEntry.getTitle())
                .setText(R.id.home_tv_item_time, StringUtils.isEmpty(jobEntry.getTime()) ? mContext.getString(R.string.uncertain_task_time) : jobEntry.getTime());
    }
}