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 InsertArticleWrapperActivity : 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(ArticleFragment().with(bundleOf(KEY_ARTICLE_TYPE to ArticleType.MINE_ARTICLE)))
        fragments?.add(ArticleFragment().with(bundleOf(KEY_ARTICLE_TYPE to ArticleType.COLLECTION_ARTICLE)))
    }

    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_ARTICLE_TYPE = "ArticleType"

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

    enum class ArticleType {
        MINE_ARTICLE,
        COLLECTION_ARTICLE
    }
}