package pxds.dlpf.buoz.fico

import android.content.Context
import android.text.format.Formatter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import com.test.basd.supercleanermax.R
import com.test.basd.supercleanermax.databinding.XdhdyjBinding
import pxds.lmmd.zmwf.Khko.string
import pxds.vazp.FileBean
import java.text.SimpleDateFormat
import java.util.Date

object Faim {

    fun Context.showFileDetailDialog(fileBean: FileBean) {
        val binding = XdhdyjBinding.inflate(LayoutInflater.from(this))
        val dialog = AlertDialog.Builder(this).setView(binding.root).create()

        dialog.setContentView(binding.root)
        dialog.setCanceledOnTouchOutside(true)
        dialog.show()

        val lp = dialog.window?.attributes
        lp?.width = resources.getDimensionPixelOffset(R.dimen.މނޓޗޕ)
        lp?.height = ViewGroup.LayoutParams.WRAP_CONTENT
        dialog.window?.attributes = lp
        dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)

        binding.ivrxehl.text = fileBean.name
        val dateFormat = SimpleDateFormat(R.string.ޢޣޣސސ_D.string())

        val date = Date(fileBean.time)

        val time = dateFormat.format(date)
        binding.smokwld.text = R.string.ޥލޚދޞ_D.string((time).toString())
        val size = Formatter.formatFileSize(this, fileBean.size)
        binding.wkrduju.text = R.string.ޗބޤޡޑ_D.string((size).toString())
        binding.qgddmae.text = R.string.ބޞޝތޤ_D.string((fileBean.path).toString())
    }
}