package com.xty.base.weight

import android.content.Context
import android.view.View
import com.xty.base.databinding.DialogTipBinding
import com.xty.base.dialog.BaseDialog
import com.xty.common.SizeUtil

class TipDialog (context: Context,  var title:String, var isleftshow : Boolean ?= true,var left:String?= "拒绝", var right:String?= "同意", var confirm:()->Unit): BaseDialog(context) {
    val binding by lazy{DialogTipBinding.inflate(layoutInflater)}
    override fun setLayout()=binding.root
    override fun initView() {
        super.initView()
        setDialogPadding(SizeUtil.dp2px(context,40f),0, SizeUtil.dp2px(context,40f),0)
        binding.mTitle.text=title
        binding.mTvConfirm.setOnClickListener {
            dismiss()
        }
        if (isleftshow != true){
            binding.mTvCancel.visibility= View.GONE
        }
        binding.mTvCancel.setOnClickListener {
            confirm.invoke()
            dismiss()
        }
        binding.mTvConfirm.text = right
        binding.mTvCancel.text = left
    }
}