package com.doumee.keyCabinet.ui.face.adapter; import android.content.Context; import android.view.View; import com.doumee.keyCabinet.databinding.ErrRcvItemBinding; import com.doumee.lib_coremodel.util.SpUtil; import com.doumee.lib_coremodel.view.recyclerview.adapter.BindingAdapter; import com.doumee.lib_coremodel.view.recyclerview.adapter.BindingHolder; public class ErrRcvAdapter extends BindingAdapter { public static interface OnItemClick{ void onItemClick(SpUtil.SPBean item); } private OnItemClick onItemClick; public ErrRcvAdapter(Context context, int layoutId, OnItemClick onItemClick) { super(context, layoutId); this.onItemClick = onItemClick; } @Override public void bindViewDatas(BindingHolder holder, SpUtil.SPBean item, int position) { holder.getBinding().setData(item); item.setPos(position); holder.getBinding().clRoot.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if(onItemClick!=null){ onItemClick.onItemClick(item); } return true; } }); } }