package com.gh.gamecenter

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.gh.base.DownloadToolbarActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.updateStatusBarColor
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.game.GameFragment

class BlockActivity : DownloadToolbarActivity() {

    companion object {
        fun getIntent(context: Context, blockData: SubjectRecommendEntity, entrance: String): Intent {
            val args = Bundle()
            args.putParcelable(EntranceConsts.KEY_BLOCK_DATA, blockData)
            args.putString(EntranceConsts.KEY_ENTRANCE, entrance)
            return getTargetIntent(context, BlockActivity::class.java, GameFragment::class.java, args)
        }
    }

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

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

    override fun showDownloadMenu(): Boolean {
        return true
    }

    override fun getActivityNameInChinese(): String {
        return "板块"
    }

    override fun getBusinessId(): Pair<String, String> {
        return Pair(
            targetFragment?.arguments?.getParcelable<SubjectRecommendEntity>(EntranceConsts.KEY_BLOCK_DATA)?.link ?: "",
            ""
        )
    }

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