package com.yidian.shenghuoquan.newscontent.ui

import android.os.Bundle
import android.util.Log
import com.yidian.common.XRouterPathConstants
import com.yidian.common.XRouterPathConstants.Companion.PROTOCOL
import com.yidian.common.base.BaseActivity
import com.yidian.shenghuoquan.newscontent.databinding.ActivityProtocolBinding
import com.yidian.xarc.xbrid.XBridManager
import com.yidian.xarc.xbrid.XWebView


class ProtocolActivity: BaseActivity<ActivityProtocolBinding>() {
    override fun createViewBinding(): ActivityProtocolBinding {
        return ActivityProtocolBinding.inflate(layoutInflater)
    }

    override fun getXPageName(): String {
        return PROTOCOL
    }

    companion object{
        const val ProtocolUrlKey = "protocol_url"
    }

    private lateinit var webView: XWebView


    override fun init(savedInstanceState: Bundle?) {
        super.init(savedInstanceState)
        if(intent.getSerializableExtra(XRouterPathConstants.ParamsKey) !=null){
            val paramsMap = intent.getSerializableExtra(XRouterPathConstants.ParamsKey) as HashMap<*, *>
            val protocolUrl = paramsMap[ProtocolUrlKey] as String
            Log.e("zhb-yd", "protocolUrl:$protocolUrl")
            webView = XBridManager.getWebView(this, "testidenfier", viewBind.wvProtocol)
            webView.loadUrl(protocolUrl)
        }
    }
}