package com.gh.gamecenter.qa.editor

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.core.os.bundleOf
import androidx.fragment.app.Fragment
import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.R
import com.gh.gamecenter.collection.GamesCollectionFragment
import com.gh.gamecenter.common.utils.updateStatusBarColor
import com.gh.gamecenter.login.user.UserManager

class InsertGameCollectionWrapperActivity : BaseActivity_TabLayout() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        updateStatusBarColor(R.color.background_white, R.color.background_white)
    }

    override fun getLayoutId(): Int = R.layout.activity_tablayout_no_title_viewpager

    override fun initFragmentList(fragments: MutableList<Fragment>?) {
        fragments?.add(
            GamesCollectionFragment().with(
                bundleOf(
                    EntranceConsts.KEY_USER_ID to UserManager.getInstance().userId,
                    EntranceConsts.KEY_TYPE to GamesCollectionFragment.TYPE_USER,
                    EntranceConsts.KEY_INSERT_GAME_COLLECTION to true
                )
            )
        )
        fragments?.add(
            GamesCollectionFragment().with(
                bundleOf(
                    EntranceConsts.KEY_USER_ID to UserManager.getInstance().userId,
                    EntranceConsts.KEY_TYPE to GamesCollectionFragment.TYPE_COLLECT,
                    EntranceConsts.KEY_INSERT_GAME_COLLECTION to true
                )
            )
        )
    }

    override fun initTabTitleList(tabTitleList: MutableList<String>?) {
        tabTitleList?.add("我的游戏单")
        tabTitleList?.add("收藏游戏单")
    }


    override fun isAutoResetViewBackgroundEnabled(): Boolean = true

    override fun onDarkModeChanged() {
        super.onDarkModeChanged()
        updateStatusBarColor(R.color.background_white, R.color.background_white)
    }

    companion object {
        fun getIntent(context: Context): Intent {
            return Intent(context, InsertGameCollectionWrapperActivity::class.java)
        }
    }
}