package com.zj365.dc.activity

import android.text.Html
import android.view.View
import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.act.BaseVmAct
import com.xty.base.vm.BaseVm
import com.xty.common.Dateutils
import com.xty.common.arouter.ARouterUrl
import com.xty.common.util.ImageGetterUtils
import com.xty.network.model.MessageBean
import com.xty.network.model.MessageTypeDataBean
import com.zj365.dc.databinding.ActMessageDetailNewBinding

@Route(path = ARouterUrl.MESSAGE_DETAIL_NEW)
class MessageDetailNewAct: BaseVmAct<BaseVm>() {
    val binding by lazy { ActMessageDetailNewBinding.inflate(layoutInflater) }

    var msgBean : MessageTypeDataBean.MessageTypeBean? = null


    override fun liveObserver() {
    }

    override fun setLayout() = binding.root

    override fun initView() {
        super.initView()
        statusBar(binding.title.mView)
        binding.title.mTvTitle.text= "消息详情"
        binding.title.mIvBack.setOnClickListener {
            finish()
        }
    }

    override fun initData() {
        super.initData()
        intent.extras?.let {
            if(it.containsKey("bean")){
                msgBean=it.getSerializable("bean") as MessageTypeDataBean.MessageTypeBean
                msgBean?.let {
                    binding.tvMsgTitle.text = it.notifyTitle
                    binding.tvMsgTime.text = Dateutils.formatTime(it.notifyCreateTime,Dateutils.YYYY_MM_DD_HH_MM)
                    binding.tvMsgContent.text = Html.fromHtml(it.notifyContent,ImageGetterUtils.MyImageGetter(this,binding.tvMsgContent),null)

                }


            }
        }

    }
}