package com.develop.common.dialog

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.develop.base.mvvm.FullScreenTransparentDialog
import com.develop.common.databinding.DialogCommonBinding


class CommonDialog(
) : FullScreenTransparentDialog() {
    private lateinit var binding: DialogCommonBinding

    var msg = ""
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        binding = DialogCommonBinding.inflate(
            inflater, container, false
        )
        binding.tvMsg.text = msg
        binding.tvOk.setOnClickListener {
            removeSelf()
        }
        if (!hasOKBtn) {
            binding.tvOk.visibility = View.INVISIBLE
            binding.tvProgress.visibility = View.VISIBLE
        } else {
            binding.tvOk.visibility = View.VISIBLE
            binding.tvProgress.visibility = View.GONE
        }
        return binding.root
    }

    var hasOKBtn: Boolean = true

    fun updateProgress(progress: String) {
        binding.tvProgress.text = progress
    }
}