| | |
| | | package cn.flightfeather.thirdappmodule.module.inspection |
| | | |
| | | import android.arch.lifecycle.Observer |
| | | import android.arch.lifecycle.ViewModelProviders |
| | | import android.os.Bundle |
| | | import android.support.v4.content.ContextCompat |
| | | import android.view.View |
| | | import android.widget.TextView |
| | | import cn.flightfeather.thirdappmodule.R |
| | | import cn.flightfeather.thirdappmodule.bean.entity.Scense |
| | | import cn.flightfeather.thirdappmodule.module.base.BaseActivity |
| | | import cn.flightfeather.thirdappmodule.module.task.SceneDetailViewModel |
| | | import kotlinx.android.synthetic.main.dialog_scene_history.* |
| | | import kotlinx.android.synthetic.main.fragment_analysis_over_view.* |
| | | |
| | | /** |
| | | * 场景历史情况提示界面 |
| | | * Date: 2025/10/27 |
| | | */ |
| | | class MenuSceneHistoryActivity : BaseActivity() { |
| | | inner class HistoryItemView(val title: String, val show: Boolean, val parentView: View, val titleView: TextView) |
| | | |
| | | // 传入的场景对象 |
| | | private var scene: Scense? = null |
| | | |
| | | override fun getLayoutId(): Int = R.layout.dialog_scene_history |
| | |
| | | override fun onCreate(savedInstanceState: Bundle?) { |
| | | super.onCreate(savedInstanceState) |
| | | |
| | | viewModel = ViewModelProviders.of(this).get(SceneDetailViewModel::class.java) |
| | | viewModel = ViewModelProviders.of(this).get(MenuSceneHistoryViewModel::class.java) |
| | | |
| | | scene = intent.getSerializableExtra("scene") as Scense? |
| | | |
| | |
| | | initObserver() |
| | | initListener() |
| | | |
| | | viewModel.getSceneStatus { |
| | | scene?.let { viewModel.getSceneDetail(it) } |
| | | } |
| | | // viewModel.getSceneStatus { |
| | | // scene?.let { viewModel.getSceneDetail(it) } |
| | | // } |
| | | } |
| | | |
| | | private fun initUI() { |
| | | view_waiting.visibility = View.VISIBLE |
| | | // 统计项目 |
| | | val itemList = listOf( |
| | | HistoryItemView("现场评分", true, cl_1, tv_title_1), |
| | | HistoryItemView("典型工地", true, cl_2, tv_title_2), |
| | | HistoryItemView("重点区域", true, cl_3, tv_title_3), |
| | | HistoryItemView("联合执法", true, cl_4, tv_title_4), |
| | | HistoryItemView("整改效率", true, cl_5, tv_title_5), |
| | | HistoryItemView("问题复发", true, cl_6, tv_title_6), |
| | | HistoryItemView("施工阶段", true, cl_7, tv_title_7), |
| | | HistoryItemView("监测数据", true, cl_8, tv_title_8), |
| | | HistoryItemView("应急巡查", false, cl_9, tv_title_9) |
| | | ) |
| | | |
| | | // 显示 加载图标 |
| | | view_waiting.visibility = View.GONE |
| | | |
| | | // 根据配置显示对应的项目,并自动匹配序号 |
| | | var index = 1 |
| | | itemList.forEach { item -> |
| | | if (item.show) { |
| | | val title = "${index}. ${item.title}" |
| | | item.parentView.visibility = View.VISIBLE |
| | | item.titleView.text = title |
| | | index++ |
| | | } else { |
| | | item.parentView.visibility = View.GONE |
| | | } |
| | | } |
| | | |
| | | // 显示 场景名称 |
| | | scene?.let { |
| | | tv_status.text = StringBuilder(it.type + getString(R.string.scene_status)) |
| | | tv_title.text = it.name |
| | | } |
| | | } |
| | | |
| | | private fun initObserver() { |
| | | // 历史评估情况 |
| | | viewModel.evaluationList.observe(this, Observer { |
| | | |
| | | }) |
| | | |
| | | // 典型场景情况 |
| | | viewModel.typicalScene.observe(this, Observer { |
| | | |
| | | }) |
| | | tv_title_2.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color)) |
| | | // 重点区域(在国控点、市控点周边) |
| | | viewModel.keyArea.observe(this, Observer { |
| | | |
| | | }) |
| | | tv_title_3.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color)) |
| | | // 联合执法 |
| | | viewModel.jointLawEnforcement.observe(this, Observer { |
| | | |
| | | }) |
| | | tv_title_4.setTextColor(ContextCompat.getColor(this, R.color.main_color_3)) |
| | | tv_summary_4.setTextColor(ContextCompat.getColor(this, R.color.main_color_3)) |
| | | // 整改效率 |
| | | viewModel.changeRate.observe(this, Observer { |
| | | |
| | | }) |
| | | tv_title_5.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color)) |
| | | // 问题复发 |
| | | viewModel.problemRecurrence.observe(this, Observer { |
| | | |
| | | }) |
| | | tv_title_6.setTextColor(ContextCompat.getColor(this, R.color.red_btn_bg_color)) |
| | | // 施工阶段 |
| | | viewModel.constructionPhase.observe(this, Observer { |
| | | |
| | | }) |
| | | tv_title_7.setTextColor(ContextCompat.getColor(this, R.color.main_color_2)) |
| | | // 在线监测数据 |
| | | viewModel.monitorData.observe(this, Observer { |
| | | |
| | | }) |
| | | tv_title_8.setTextColor(ContextCompat.getColor(this, R.color.main_color_3)) |
| | | tv_summary_8.setTextColor(ContextCompat.getColor(this, R.color.main_color_3)) |
| | | // 应急巡查 |
| | | viewModel.emergencyInspection.observe(this, Observer { |
| | | |
| | | }) |
| | | tv_title_9.setTextColor(ContextCompat.getColor(this, R.color.main_color_3)) |
| | | } |
| | | |
| | | private fun initListener() { |
| | | |
| | | |
| | | |
| | | fab_close.setOnClickListener { |
| | | this.finish() |
| | | } |