package com.gh.gamecenter.energy.view

import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.core.utils.DisplayUtils

class EnergyCenterActivity : ToolBarActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        hideToolbar(true)
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            val color = window.navigationBarColor
            DisplayUtils.transparentStatusAndNavigation(this)
            window.navigationBarColor = color
        } else {
            DisplayUtils.transparentStatusAndNavigation(this)
        }
    }

    override fun provideNormalIntent(): Intent {
        return getTargetIntent(this, EnergyCenterActivity::class.java, EnergyCenterFragment::class.java)
    }

    companion object {
        fun getIntent(context: Context?): Intent? {
            return getIntent(context, 0)
        }

        fun getIntent(context: Context?, initTabIndex: Int): Intent? {
            val bundle = Bundle()
            bundle.putInt(EntranceConsts.KEY_TAB_INDEX, if (initTabIndex == 0 || initTabIndex == 1) initTabIndex else 0)
            return getTargetIntent(context, EnergyCenterActivity::class.java, EnergyCenterFragment::class.java, bundle)
        }
    }
}