package com.gh.gamecenter.discovery

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.updateStatusBarColor
import com.gh.gamecenter.feature.exposure.ExposureEvent

/**
 * 猜你喜欢-发现页
 */
class DiscoveryActivity : ToolBarActivity() {

    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 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, entrance: String, exposureEvent: ExposureEvent? = null): Intent {
            val bundle = Bundle()
            bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
            exposureEvent?.let {
                bundle.putParcelableArrayList(
                    EntranceConsts.KEY_EXPOSURE_SOURCE_LIST,
                    ArrayList(exposureEvent.source)
                )
            }
            return getTargetIntent(context, DiscoveryActivity::class.java, DiscoveryFragment::class.java, bundle)
        }
    }
}