package com.wd.workoffice.ui.adapter;


import android.content.Intent;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.load.ImageHeaderParser;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.app.Config;
import com.wd.workoffice.bean.mesBean.ImageBean;
import com.wd.workoffice.ui.activity.mes.ImageActivity;
import com.wd.workoffice.util.GlideUtils;
import com.wd.workoffice.util.WorkUtils;

import java.util.List;

import static flexible.xd.android_base.utils.ActivityUtils.startActivity;

/**
 * Created by flexible on 2018/8/13.
 */

public class ImgAdapter extends BaseQuickAdapter<ImageBean, BaseViewHolder> {

    public ImgAdapter(int layoutResId, List data) {
        super(layoutResId, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, ImageBean item) {
        ImageView ivImg = helper.getView(R.id.iv_img);
        GlideUtils.getRequest().load("http://124.129.27.194:81/" + item.getPath()).into(ivImg);
        helper.addOnClickListener(R.id.iv_img);
        ivImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(helper.getConvertView().getContext(), ImageActivity.class);
                intent.putExtra("url", "http://124.129.27.194:81/" + item.getPath());
                startActivity(intent);
            }
        });
    }
}

