package com.cheng.blzb.ui.base

import android.annotation.SuppressLint
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.KeyEvent
import com.cheng.blzb.R

open class BaseDialog @JvmOverloads constructor(
    context: Context,
    styleRes: Int = R.style.BaseStyleDialog,
    private val isNoReturn: Boolean = false
) : Dialog(context, styleRes) {

    @SuppressLint("GestureBackNavigation")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if (isNoReturn) {
            setOnKeyListener { _, keyCode, _ ->
                var isShield = false
                if (keyCode == KeyEvent.KEYCODE_BACK) {
                    isShield = true
                }
                isShield
            }
        }
    }


}