package com.zj365.mime.act

import android.text.Html
import com.alibaba.android.arouter.facade.annotation.Route
import com.blankj.utilcode.util.ArrayUtils
import com.xty.base.act.BaseVmAct
import com.xty.common.MMkvHelper
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.getImageUrl
import com.xty.common.setImage
import com.xty.common.util.CommonToastUtils
import com.zj365.mime.R
import com.zj365.mime.databinding.ActAboutBinding
import com.zj365.mime.vm.AboutVm

/**
 * 关于我们
 */
@Route(path = ARouterUrl.ABOUT)
class AboutAct: BaseVmAct<AboutVm>() {
    val binding by lazy { ActAboutBinding.inflate(layoutInflater) }
    var openLogFlag = 0

    override fun setLayout()=binding.root
    override fun initData() {
        super.initData()
        isDarkBar=true
    }

    override fun initView() {
        super.initView()

        statusBar(binding.title.mView)
        binding.title.mIvBack.setOnClickListener { finish() }
        binding.title.mTvTitle.text = getString(R.string.about)

        binding.mVersion.text="版本号:  V${packageManager.getPackageInfo(this.packageName,0).versionName}"

        binding.tvUserPrivate.setOnClickListener {
            bundle.clear()
            bundle.putString("title", "用户协议")
            bundle.putBoolean("isAgree", false)
            bundle.putString("url","https://dc.zhongjian365.com/agreement.html")
            RouteManager.goAct(ARouterUrl.AGREEMNT_READ_WEB_ACT, bundle)
        }

        binding.tvPrivate.setOnClickListener {
            bundle.clear()
            bundle.putString("title", "隐私政策")
            bundle.putBoolean("isAgree", false)
            bundle.putString("url","https://dc.zhongjian365.com/privacy.html")
            RouteManager.goAct(ARouterUrl.AGREEMNT_READ_WEB_ACT, bundle)
        }
     //   mViewModel.getAbout()

        binding.mVersion.setOnClickListener {
            openLogFlag++
            if (openLogFlag > 10){//此处只为了留个后门看日志信息
                CommonToastUtils.showToast("调试日志开启....")
                MMkvHelper.put("openLog", true)
            }
        }
    }

    override fun liveObserver() {
        mViewModel.prevLive.observe(this){
            if (!ArrayUtils.isEmpty(it.data)){
                it.data[0].let {

                }
            }

        }
    }
}