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.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(com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface)
    }

    override fun getLayoutId(): Int = com.gh.gamecenter.common.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(com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface)
    }

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