package com.gh.gamecenter

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.help.HelpContainerFragment

class QaActivity : ToolBarActivity() {

    companion object {
        /**
         * qaId 存在则是QA页面
         * qaCollectionId 存在则是QA合集页面
         * 两个都存在则默认时QA合集页面
         */
        fun getIntent(
            context: Context,
            navigationTitle: String,
            qaId: String? = null,
            qaCollectionId: String? = null
        ): Intent {
            val args = Bundle()
            args.putString(EntranceConsts.KEY_QA_ID, qaId)
            args.putString(EntranceConsts.KEY_QA_COLLECTION_ID, qaCollectionId)
            args.putString(EntranceConsts.KEY_NAVIGATION_TITLE, navigationTitle)
            return getTargetIntent(context, QaActivity::class.java, HelpContainerFragment::class.java, args)
        }
    }

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

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

    override fun isAutoResetViewBackgroundEnabled() = true

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