package com.lc.myapplication.security.locks.dialog

import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.DialogFragment
import com.lc.myapplication.security.locks.databinding.MsgDialogBinding


class MsgDialog(private var message: String) : DialogFragment() {

    private lateinit var vb: MsgDialogBinding
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        vb = MsgDialogBinding.inflate(layoutInflater)
        dialog?.run {
            setCanceledOnTouchOutside(true)
            window?.run {
                setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
                setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
            }

        }
        vb.msg.text = message
        initCLick()
        return vb.root
    }


    private fun initCLick() {
        vb.tvOk.setOnClickListener {
            dismiss()
        }

    }




}