package com.bonait.bnframework.common.linktab.good;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

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

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.linktab.LinkMode;
import com.bonait.bnframework.common.view.MyLayoutManager;
import com.bonait.bnframework.modules.home.adapter.AttributeSetAdapter;
import com.bonait.bnframework.modules.home.adapter.liaochang_adapter;
import com.bonait.bnframework.modules.home.adapter.newgood_adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import java.util.List;


public class GoodRightAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    public List<LinkMode> Fdata;
    private final LayoutInflater mLayoutInflater;
    private Context context;
    public GoodRightAdapter(Context context, @Nullable List<LinkMode> data) {
//        super(layoutResId, data);
        Fdata=data;
        mLayoutInflater = LayoutInflater.from(context);
        this.context = context;
    }

//    @Override
//    protected void convert(BaseViewHolder holder, LinkMode item) {
//        RecyclerView view= holder.getView(R.id.recycler_view);
//
//        MyLayoutManager layout = new MyLayoutManager();
//        layout.setAutoMeasureEnabled(true);
//        view.setLayoutManager(layout);
//        newgood_adapter adapter = new newgood_adapter(getContext(), item.content);
//        view.setAdapter(adapter);
//    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = mLayoutInflater.inflate(R.layout.item_right_lc, parent, false);
        return new MyLCViewHolder1(inflate);

    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, @SuppressLint("RecyclerView") int position) {
        MyLCViewHolder1 myLCViewHolder1 = (MyLCViewHolder1)holder;
        MyLayoutManager layout = new MyLayoutManager();
        layout.setAutoMeasureEnabled(true);
        myLCViewHolder1.recyclerView.setLayoutManager(layout);
        newgood_adapter adapter = new newgood_adapter(position,context, Fdata.get(position).content);
        myLCViewHolder1.recyclerView.setAdapter(adapter);
    }

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

    public static class MyLCViewHolder1 extends RecyclerView.ViewHolder{
        RecyclerView recyclerView;
        public MyLCViewHolder1(@NonNull View itemView) {
            super(itemView);
            recyclerView= itemView.findViewById(R.id.recycler_view);
        }
    }
}