package com.zj365.mime.weight

import android.content.Context
import android.view.View
import com.xty.base.dialog.BaseDialog
import com.xty.common.SizeUtil
import com.zj365.mime.databinding.DialogTipToastBinding

class TipDialog (context: Context, var isShowCancel:Boolean=false, var title:String,  var confirm:()->Unit,): BaseDialog(context) {
    val binding by lazy{ DialogTipToastBinding.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 {
            confirm.invoke()
            dismiss()
        }
//        if(!isCenter){
//            binding.mTitle.gravity=Gravity.LEFT
//        }
        if(isShowCancel){
            binding.mTvCancel.visibility= View.GONE
        }
        binding.mTvCancel.setOnClickListener {
            dismiss()
        }
    }
}