package com.zxhyis.tools.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import com.zxhyis.tools.logic.ActivityCollector


abstract class TopActivity<T : ViewBinding> : AppCompatActivity() {

    lateinit var vb: T

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        ActivityCollector.addActivity(this)
        vb = getViewBinding1()
        setContentView(vb.root)
        init()
    }

    abstract fun getViewBinding1(): T

    abstract fun init()


    override fun onDestroy() {
        super.onDestroy()
        ActivityCollector.removeActivity(this)
    }

}

