package com.convenient.android.common.base.viewbinding

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding
import com.convenient.android.common.base.view.BaseDialogFragment

/**
 * @classname: BaseBindingDialogFragment
 * @author: LiuXiaoLong
 * @date: 2022-07-27 PM
 * description:
 */
abstract class BaseBindingDialogFragment<VB : ViewBinding>(private val inflate: (LayoutInflater, ViewGroup?, Boolean) -> VB) : BaseDialogFragment() {

    private var _binding: VB? = null
    val binding: VB? get() = _binding

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        _binding = inflate(inflater, container, false)
        return binding?.root
    }

    override fun onDestroyView() {
        super.onDestroyView()
        _binding = null
    }
}