package com.gh.gamecenter.forum.home.follow

import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.forum.home.follow.fragment.AllFollowedFragment

class AllFollowedActivity : BaseActivity() {
    override fun getLayoutId(): Int = com.gh.gamecenter.common.R.layout.activity_all_followed

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        DisplayUtils.setLightStatusBar(this, true)
        setStatusBarColor(Color.TRANSPARENT)
        val containerFragment = supportFragmentManager.findFragmentByTag(AllFollowedFragment::class.java.name)
            ?: AllFollowedFragment().with(intent.extras)
        // 若 placeholder 外层为 RelativeLayout 的话，会出现莫名的偏移
        supportFragmentManager.beginTransaction()
            .replace(com.gh.gamecenter.selector.R.id.layout_activity_content, containerFragment, AllFollowedFragment::class.java.name)
            .commitAllowingStateLoss()
    }

    companion object {

        fun getIntent(context: Context): Intent = Intent(context, AllFollowedActivity::class.java)
    }
}