package com.swiftcleaner.chovey.view.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.swiftcleaner.chovey.R;
import com.swiftcleaner.chovey.model.bean.CleanFileBean;
import com.swiftcleaner.chovey.model.bean.SimilarBean;

import java.util.List;

/**
 * 作者：马海钊
 * 时间：2024/12/18 14:05
 * 功能：
 */
public class ItemSimilarPhotosAdapter extends BaseAdapter {
    private Context context;
    private List<SimilarBean> childItems;

    public ItemSimilarPhotosAdapter(Context context, List<SimilarBean> childItems) {
        this.context = context;
        this.childItems = childItems;
    }

    @Override
    public int getCount() {
        return childItems.size();
    }

    @Override
    public Object getItem(int position) {
        return childItems.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        ViewHolder holder;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_screen_shot_list, parent, false);
            holder = new ViewHolder();
            holder.childItemText = view.findViewById(R.id.item_screen_shot_number);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        if (childItems!=null){
//            Glide.with(context).load(R.mipmap.l_tu).error(R.mipmap.err_img).into(holder.img);
//            holder.childItemText.setText(""+childItems.get(position).getSize());
        }

        return view;
    }
    private static class ViewHolder {
        TextView childItemText;
        CheckBox checkBox;
        ImageView img;
    }

}
