package com.convenient.android.common.base.view

import android.annotation.SuppressLint
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.convenient.android.common.extension.removeAllFragments
import com.gyf.immersionbar.ImmersionBar


/**
 * @classname BaseActivity
 * @author LiuXiaoLong
 * @date 2022-07-27
 * @description
 */
open class BaseActivity : AppCompatActivity() {

    //沉浸式状体栏
    @SuppressLint("StaticFieldLeak")
    var mImmersionBar: ImmersionBar? = null

    //标志符号：判断当前activity是否显示
    var isCurrentFront = false

    val handler: BaseActivityHandler by lazy { BaseActivityHandler(this) }

    override fun onCreate(savedInstanceState: Bundle?) {
        lifecycle.addObserver(BaseActivityLifecycleEvents(this))
        super.onCreate(savedInstanceState)
    }

    override fun onStop() {
        super.onStop()
        if (isFinishing) removeAllFragments()
    }
}