package com.gh.gamecenter.catalog

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.gh.base.DownloadToolbarActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.updateStatusBarColor
import com.gh.gamecenter.entity.CatalogEntity

class NewCatalogListActivity : DownloadToolbarActivity() {

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

    override fun showDownloadMenu(): Boolean {
        return true
    }

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

    override fun isAutoResetViewBackgroundEnabled() = true

    companion object {
        fun getIntent(
            context: Context,
            primaryCatalogId: String, // 一级分类 id
            primaryCatalogName: String, // 一级分类名
            catalogTitle: String,
            catalog: CatalogEntity,
            initTitle: String
        ): Intent {
            val bundle = Bundle()
            bundle.putParcelable(EntranceConsts.KEY_DATA, catalog)
            bundle.putString(EntranceConsts.KEY_PRIMARY_CATALOG_ID, primaryCatalogId)
            bundle.putString(EntranceConsts.KEY_PRIMARY_CATALOG_NAME, primaryCatalogName)
            bundle.putString(EntranceConsts.KEY_NAME, catalog.name)
            bundle.putString(EntranceConsts.KEY_CATALOG_TITLE, catalogTitle)
            bundle.putString(EntranceConsts.KEY_CATALOG_INIT_TITLE, initTitle)
            return getTargetIntent(
                context,
                NewCatalogListActivity::class.java,
                NewCatalogListFragment::class.java,
                bundle
            )
        }
    }

}