package com.dlc.exam.ui.certificate

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import com.bumptech.glide.Glide
import com.dlc.exam.R
import com.dlc.exam.databinding.DialogCertificatePhotoBinding

/**
 * info
 *
 * @author ReiChin_
 */
class CertificatePhotoDialog(context: Context, private val imgUrl: String) :
    Dialog(context, R.style.AlertDialogStyle) {

    private val viewBinding: DialogCertificatePhotoBinding by lazy {
        DialogCertificatePhotoBinding.inflate(LayoutInflater.from(context))
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(viewBinding.root)

        viewBinding.close.setOnClickListener { dismiss() }

        Glide.with(context)
            .load(imgUrl)
            .placeholder(R.mipmap.img_bg_jzz)
            .error(R.mipmap.img_error)
            .into(viewBinding.photo)
    }

}