package com.yzx.escreen.widget

import android.app.Dialog
import android.content.Context
import android.view.Window
import com.yzx.escreen.utils.hideNavigationBar

class BaseDialog(context: Context, themeResId: Int, res: Int) : Dialog(context, themeResId) {
    private var res: Int = 0
    private var leaveId:Int = 0
    var showed = false

    init {
        hideNavigationBar()
        requestWindowFeature(Window.FEATURE_NO_TITLE)
        setContentView(res)
        this.res = res
        setCanceledOnTouchOutside(false)
        setCancelable(false)
    }

    fun  setLeaveId(id:Int){
        leaveId = id
    }

    fun  getLeaveId():Int{
        return leaveId
    }

    override fun onWindowFocusChanged(hasFocus: Boolean) {
        super.onWindowFocusChanged(hasFocus)
        hideNavigationBar()
    }

    override fun show() {
        hideNavigationBar()
        super.show()
    }
}