package com.ux.video.file.filerecovery.recovery.ui.recoveryphoto

import android.graphics.Color
import android.os.Bundle
import android.view.Gravity
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.DialogDeleteSuccessBinding
import com.ux.video.file.filerecovery.utils.ExtendFunctions.dpToPx

class DeleteSuccessDialog(): DialogFragment() {
    private lateinit var binding: DialogDeleteSuccessBinding
    override fun onStart() {
        super.onStart()
        dialog?.setCanceledOnTouchOutside(false)
        isCancelable = false
        dialog?.window?.apply {
            setLayout(
                ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT
            )
            setBackgroundDrawable(Color.TRANSPARENT.toDrawable())
            val params = attributes
            params.gravity = Gravity.TOP or Gravity.CENTER_HORIZONTAL
            params.y = 100.dpToPx(context)
            attributes = params
        }
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {

        binding = DialogDeleteSuccessBinding.inflate(inflater)
        return binding.root
    }
}