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.R
import com.gh.gamecenter.common.utils.updateStatusBarColor

class InsertAnswerWrapperActivity : BaseActivity_TabLayout() {

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

    override fun getLayoutId(): Int = R.layout.activity_tablayout_no_title_viewpager

    override fun initFragmentList(fragments: MutableList<Fragment>?) {
        fragments?.add(AnswerFragment().with(bundleOf(KEY_ANSWER_TYPE to AnswerType.MINE_ANSWER)))
        fragments?.add(AnswerFragment().with(bundleOf(KEY_ANSWER_TYPE to AnswerType.COLLECTION_ANSWER)))
    }

    override fun initTabTitleList(tabTitleList: MutableList<String>?) {
        tabTitleList?.add("我的回答")
        tabTitleList?.add("收藏回答")
    }

    override fun isAutoResetViewBackgroundEnabled(): Boolean = true

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

    companion object {
        const val KEY_ANSWER_TYPE = "AnswerType"

        fun getIntent(context: Context): Intent {
            return Intent(context, InsertAnswerWrapperActivity::class.java)
        }
    }

    enum class AnswerType {
        MINE_ANSWER,
        COLLECTION_ANSWER
    }
}