package com.naz.sdkdemo.adaapter;

import android.annotation.SuppressLint;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.naz.sdkdemo.R;
import com.naz.sdkdemo.bean.ScanInfo;
import com.naz.sdkdemo.bean.TrademarkInfo;

import java.util.List;

public class FullApplyTrademarkScanAdapter extends BaseQuickAdapter<ScanInfo, BaseViewHolder> {
   public FullApplyTrademarkScanAdapter(@Nullable List<ScanInfo> data) {
      super(R.layout.item_scan_code, data);
   }

   @Override
   protected void convert(@NonNull BaseViewHolder holder, ScanInfo info) {
      holder.setText(R.id.tv_name, info.material_code_show);
      holder.setText(R.id.tv_count, "数量："+info.qty);
      holder.getView(R.id.delete).setOnClickListener(new View.OnClickListener() {
         @SuppressLint("NotifyDataSetChanged")
         @Override
         public void onClick(View v) {
            getData().remove(info);
            notifyDataSetChanged();
         }
      });
   }
}
