package com.danding.yang800.Adapter;


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.danding.yang800.Entity.SortListInfo;
import com.danding.yang800.R;
import com.zhy.autolayout.utils.AutoUtils;

public class DocumentAdapter extends MyBaseAdapter<SortListInfo> {

    public DocumentAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Info info = null;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.document_item, null);
            info = new Info();
            info.document_itemIv= (ImageView) convertView.findViewById(R.id.document_itemIv);

            convertView.setTag(info);
            AutoUtils.autoSize(convertView);
        } else {
            info = (Info) convertView.getTag();
        }
        Glide.with(context).load(getItem(position).getUrl()).error(R.drawable.huisebeijing).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(info.document_itemIv);
        return convertView;
    }

    class Info {
        ImageView document_itemIv;
    }

}
