package com.guadou.ewalletrunalone

import android.content.Intent
import android.os.Bundle
import android.view.View
import com.guadou.lib_baselib.base.activity.BaseVMActivity
import com.guadou.lib_baselib.base.vm.EmptyViewModel
import com.guadou.lib_baselib.utils.CommUtils
import com.guadou.lib_baselib.utils.StatusBarUtils

/**
 * 独立运行模块的兼职Fragment的页面载体
 */
class EWalletMainActivity : BaseVMActivity<EmptyViewModel>() {

    private lateinit var mGroupTabWallet: View
    private val mWalletFragment by lazy { EWalletMainFragment() }

    companion object {
        fun startInstance() {
            val context = CommUtils.getContext()
            val intent = Intent(context, EWalletMainActivity::class.java)
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            context.startActivity(intent)
        }
    }

    override fun getLayoutIdRes(): Int = R.layout.activity_wallet_main

    override fun init(savedInstanceState: Bundle?) {
        StatusBarUtils.immersive(this)
        setStatusBarBlackText()

        initView()
        initFragment()
    }

    private fun initFragment() {
        supportFragmentManager.beginTransaction()
            .add(R.id.main_fragment_container, mWalletFragment)
            .commitAllowingStateLoss()
    }

    private fun initView() {
        mGroupTabWallet = findViewById(R.id.group_tab_wallet)
        mGroupTabWallet.isSelected = true
    }

    override fun startObserve() {

    }
}