package com.develop.food.base.widgets

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.develop.base.databinding.DialogCommonBinding
import com.develop.food.base.ui.FullScreenTransparentDialog

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

    var msg = ""
    var title = ""
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        binding = DialogCommonBinding.inflate(
            inflater, container, false
        )
        binding.tvMsg.text = msg
        binding.tvFinish.text = title
        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
    }
}