package com.sd.cavphmi.ui

import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import com.sd.cavphmi.intfaces.OnConCan

class ExitAppDialog : DialogFragment() {

    var onConCan: OnConCan? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        isCancelable=false
    }


    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
        return AlertDialog.Builder(requireContext())
//                dialog.setIcon(android.R.drawable.ic_dialog_info)
            .setTitle("提示")
            .setMessage("确定退出应用")
            .setPositiveButton(
                "确定"
            ) { dialog1: DialogInterface?, which: Int ->
                onConCan?.onCon()
            }
            .setNegativeButton("取消") { dialog, _ ->
                onConCan?.onCan()
            }.create()
    }
}