package com.example.beijing_daxing.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import androidx.databinding.DataBindingUtil;

import com.example.beijing_daxing.R;
import com.example.beijing_daxing.adapter.PersonPenaltyAdapter;
import com.example.beijing_daxing.been.PmRecordPenalty;
import com.example.beijing_daxing.databinding.DialogPersonPenaltyBinding;

import java.util.List;

public class PersonPenaltyDialog extends Dialog {
    private Context context;
    private DialogPersonPenaltyBinding binding;
    private PersonPenaltyAdapter adapter;
    private List<PmRecordPenalty> list;

    public void setList(List<PmRecordPenalty> list) {
        this.list = list;
        adapter.setList(list);
        adapter.notifyDataSetChanged();

    }

    public PersonPenaltyDialog(Context context) {
        super(context, R.style.dialog);
        this.context = context;
        adapter = new PersonPenaltyAdapter(context, null);
        binding =
                DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.dialog_person_penalty, null, false);
        setContentView(binding.getRoot());

        binding.setAdapter(adapter);
        binding.dialogDismiss.setOnClickListener(v -> dismiss());
    }



}
