BaseActivity

import android.app.Activity

import android.content.Context

import android.os.Bundle

import android.view.LayoutInflater

import androidx.appcompat.app.AppCompatActivity

import androidx.viewbinding.ViewBinding



abstract class BaseActivity : AppCompatActivity() {



    protected lateinit var mContext: Context

    protected lateinit var mActivity: Activity



    protected abstract val binding: ViewBinding

    override fun onCreate(savedInstanceState: Bundle?) {

        super.onCreate(savedInstanceState)

        mContext = this

        mActivity = this



        setContentView(binding.root)

    }



    inline fun <T : ViewBinding> AppCompatActivity.viewBinding(crossinline bindingListener: (LayoutInflater) -> T) =

        lazy(LazyThreadSafetyMode.SYNCHRONIZED) {

            val invoke = bindingListener.invoke(layoutInflater)

//            setContentView(invoke.root)

            invoke

        }



}