package xn.xxp.home.notice;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;

import androidx.appcompat.app.AppCompatActivity;

import com.blankj.utilcode.util.TimeUtils;
import com.bumptech.glide.Glide;

import java.text.SimpleDateFormat;
import java.util.Locale;

import core.util.EscapeUnescape;
import http.vo.response.LaboratoryVo;
import xn.xxp.app.LabApp;
import xn.xxp.databinding.ActivityNoticeMsgSystemBinding;

public class NoticeMsgSystemActivity extends AppCompatActivity {
    ActivityNoticeMsgSystemBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityNoticeMsgSystemBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        binding.nowDate.setText(TimeUtils.getNowString(new SimpleDateFormat("MM月dd日 EEEE ", Locale.getDefault())));
        binding.backLayout.setOnClickListener(v -> finish());
        LaboratoryVo laboratoryVo = LabApp.laboratory;
        if (null != laboratoryVo) {
            Glide.with(this).load(laboratoryVo.rectangleLogo).into(binding.logo);
            binding.subName.setText(laboratoryVo.subName);
        }
        binding.webView.setBackgroundColor(0); // 设置背景色
        binding.webView.getBackground().setAlpha(0); // 设置填充透明度 范围：0-255
        Intent getIntent = getIntent();
        if (null != getIntent && getIntent.hasExtra("content")) {
            String content = getIntent.getStringExtra("content");
            if (null != content && !TextUtils.isEmpty(content)) {
                binding.webView.loadDataWithBaseURL(null, EscapeUnescape.unescape(content), "text/html", "utf-8", null);
                return;
            }
        }
        finish();
    }
}