package com.ux.video.file.filerecovery.result

import android.graphics.Color
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.graphics.drawable.toDrawable
import androidx.fragment.app.DialogFragment
import com.ux.video.file.filerecovery.databinding.DialogExitBinding
import com.ux.video.file.filerecovery.databinding.DialogPermissionBinding


class ExitDialogFragment(val onClickExit: () -> Unit) : DialogFragment() {

    private lateinit var binding: DialogExitBinding
    override fun onStart() {
        super.onStart()
        dialog?.window?.apply {
            setLayout(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT
            )
            setBackgroundDrawable(Color.TRANSPARENT.toDrawable())
        }
    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = DialogExitBinding.inflate(inflater)
        binding.run {
            cancel.setOnClickListener { dismiss() }
            exit.setOnClickListener {
                onClickExit()
                dismiss()
            }
        }
        return binding.root
    }
}
