package com.gh.gamecenter.forum.home

import android.os.Bundle
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.GridLayoutManager.SpanSizeLookup
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.constant.EntranceConsts.IS_DETAIL_PAGE
import com.gh.gamecenter.video.detail.HomeVideoFragment

/**
 * 社区首页
 */
class CommunityActivity : BaseActivity() {

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

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val extras = intent.extras
        extras?.putBoolean(IS_DETAIL_PAGE, true)
        val fragment =
            supportFragmentManager.findFragmentByTag(CommunityHomeFragment::class.java.name) as? CommunityHomeFragment
                ?: CommunityHomeFragment().with(extras)

        supportFragmentManager.beginTransaction()
            .replace(com.gh.gamecenter.selector.R.id.layout_activity_content, fragment, CommunityHomeFragment::class.java.name)
            .commitNowAllowingStateLoss()

    }
}