package com.gh.gamecenter.forum.moderator

import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.view.View
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.updateStatusBarColor
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.entity.ApplyModeratorStatusEntity

/**
 * 版主申请
 */
class ApplyModeratorActivity : ToolBarActivity() {
    companion object {
        fun getIntent(context: Context, bbsId: String, status: ApplyModeratorStatusEntity): Intent {
            val bundle = Bundle()
            bundle.putString(EntranceConsts.KEY_BBS_ID, bbsId)
            bundle.putParcelable("status", status)
            return getTargetIntent(
                context,
                ApplyModeratorActivity::class.java,
                ApplyModeratorFragment::class.java,
                bundle
            )
        }
    }

    override fun getLayoutId(): Int {
        return R.layout.activity_apply_moderator
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        hideToolbar(true)
        setStatusBarTransparent()
    }

    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)
    }

    private fun setStatusBarTransparent() {
        DisplayUtils.transparentStatusBar(this)
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            window.decorView.systemUiVisibility =
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
        }
    }
}