package com.gh.gamecenter.personalhome

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.core.utils.DisplayUtils

class UserHomeActivity : ToolBarActivity() {

    override fun provideNormalIntent(): Intent {
        return getTargetIntent(this, UserHomeActivity::class.java, UserHomeFragment::class.java)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        hideToolbar(true)
        DisplayUtils.setStatusBarColor(this, R.color.transparent, false)
    }

    companion object {
        @JvmStatic
        fun getIntent(context: Context, userId: String, entrance: String?, path: String?): Intent {
            val bundle = Bundle()
            bundle.putString(EntranceConsts.KEY_USER_ID, userId)
            bundle.putString(EntranceConsts.KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
            bundle.putString(EntranceConsts.KEY_PATH, path)
            return getTargetIntent(context, UserHomeActivity::class.java, UserHomeFragment::class.java, bundle)
        }
    }

    override fun getBusinessId(): Pair<String, String> {
        return Pair(targetFragment.arguments?.getString(EntranceConsts.KEY_USER_ID) ?: "", "")
    }

    override fun isAutoResetViewBackgroundEnabled(): Boolean = true

}