package com.dlc.eboard.ui.leave

import android.os.Bundle
import com.dlc.eboard.R
import com.dlc.eboard.databinding.ActivityLeaveBinding
import com.dlc.eboard.ui.common.BaseCountDownActivity
import com.dlc.eboard.ui.widget.NavViewCompat
import com.dlc.eboard.ui.widget.TitleBar
import com.rc.httpcore.vo.response.SignInCheckResp

/**
 * 离开
 *
 * @author ReiChin_
 */
open class LeaveActivity :
    BaseCountDownActivity<ActivityLeaveBinding>() {

    override fun createViewBinding() = ActivityLeaveBinding.inflate(layoutInflater)

    override val mTitleBar: TitleBar by lazy { viewBinding.titleBar }
    override val mNavView: NavViewCompat by lazy { viewBinding.navView }

    override fun initViews(savedInstanceState: Bundle?) {
        super.initViews(savedInstanceState)
        showDefaultFragment()
    }

    protected open fun showDefaultFragment() {
        val student: SignInCheckResp? = intent.getParcelableExtra("data")
        val transaction = supportFragmentManager.beginTransaction()
        transaction.add(
            R.id.container,
            LeaveFaceMatchingFragment.newInstance(student),
            LeaveFaceMatchingFragment.TAG
        )
        transaction.commitAllowingStateLoss()
    }

    override fun enabledBackCountDown() = true

}