package fsir.tqqe;

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

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

import com.bumptech.glide.Glide;
import com.test.basd.supercleanermax.R;

import java.util.List;

public class Lfhy extends RecyclerView.Adapter<Lfhy.GalleryViewHolder> {
    private Context context;


    private int index = 0;

    public void setPos(int index) {
        this.index = index;
    }

    private List<Rdrk> list;

    public Lfhy(Context context, List<Rdrk> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public GalleryViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.bheqoc, parent, false);
        return new GalleryViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull GalleryViewHolder holder, int position) {
        if (position < list.size()) {
            Rdrk bean = list.get(position);
            Glide.with(holder.itemView.getContext()).load(bean.getSrc()).into((ImageView) holder.itemView);
        }
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public static class GalleryViewHolder extends RecyclerView.ViewHolder {

        public GalleryViewHolder(@NonNull View itemView) {
            super(itemView);
        }
    }
}