package com.audio.record.screen.test.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.WindowCompat
import androidx.viewbinding.ViewBinding
import com.audio.record.screen.test.tool.Common
import com.audio.record.screen.test.tool.Common.setStatusBarTextColor


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

    protected lateinit var binding: T

    abstract fun initBinding(): T


    //true 深色  false 浅色 null 不全屏
    abstract fun getFullColor(): Boolean?
    open fun onSetViewBefore(){}
    abstract fun onCreateInit()
    abstract fun onInitPadding():Boolean
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = initBinding()
        getFullColor()?.let {
            if(onInitPadding()){
                binding.root.setPadding(0,Common.dpToPx(40,this),0,0)
            }
            setStatusBarTextColor(this,it)
        }
        onSetViewBefore()
        setContentView(binding.root)
        onCreateInit()
    }

}