package com.xty.server.act

import android.text.TextUtils
import android.util.DisplayMetrics
import android.widget.LinearLayout
import android.widget.LinearLayout.*
import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.act.IBaseAct
import com.xty.common.R
import com.xty.common.arouter.ARouterUrl
import com.xty.common.getImageUrl
import com.xty.common.setBigImage
import com.xty.network.model.ExpertBean
import com.xty.server.databinding.ActExpertChiefBinding


/**
 * 专家首席
 */
@Route(path = ARouterUrl.EXPERT_CHIEF)
class ExpertProAct: IBaseAct() {
    val binding by lazy{ActExpertChiefBinding.inflate(layoutInflater)}
    override fun setLayout()=binding.root
    override fun initData() {
        super.initData()
        isDarkBar=true

        intent.extras?.let {
            val url=it.getString("url")
            val titleName = it.getString("titleName")
            if (!TextUtils.isEmpty(titleName)){
                binding.title.mTvTitle.text = titleName
            }else {
                binding.title.mTvTitle.text = getString(R.string.expert_info)
            }
//            binding.proPhoto.apply {
//                setImageUser(context,getImageUrl(bean.profilePhotoUrl))}
            binding.infoPhoto.apply {
                val displayMetrics = DisplayMetrics()
                windowManager.defaultDisplay.getMetrics(displayMetrics)
                val screenWidth: Int = displayMetrics.widthPixels
                val layoutParams = layoutParams as LinearLayout.LayoutParams
                layoutParams.width = screenWidth // 设置宽度为200像素

                setLayoutParams(layoutParams)
                url?.let {
                    setBigImage(context,getImageUrl(url))}
            }

        }
    }

    override fun initView() {
        super.initView()
        statusBar(binding.title.mView)
//        binding.title.mTvTitle.text=getString(R.string.expert_info)
        binding.title.mIvBack.setOnClickListener { finish() }
    }
}