| | |
| | | package cn.flightfeather.thirdappmodule.module.inspection |
| | | |
| | | import android.arch.lifecycle.Observer |
| | | import android.arch.lifecycle.ViewModelProviders |
| | | import android.os.Bundle |
| | | import android.view.View |
| | | import android.widget.TextView |
| | | import cn.flightfeather.thirdappmodule.R |
| | | import cn.flightfeather.thirdappmodule.bean.entity.Scense |
| | | import cn.flightfeather.thirdappmodule.databinding.SceneHistoryViewModel |
| | | 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 |
| | | |
| | | lateinit var viewModel: MenuSceneHistoryViewModel |
| | | lateinit var viewModel: SceneHistoryViewModel |
| | | |
| | | override fun onCreate(savedInstanceState: Bundle?) { |
| | | super.onCreate(savedInstanceState) |
| | | |
| | | viewModel = ViewModelProviders.of(this).get(SceneDetailViewModel::class.java) |
| | | viewModel = ViewModelProviders.of(this).get(SceneHistoryViewModel::class.java) |
| | | |
| | | scene = intent.getSerializableExtra("scene") as Scense? |
| | | |
| | |
| | | initObserver() |
| | | initListener() |
| | | |
| | | viewModel.getSceneStatus { |
| | | scene?.let { viewModel.getSceneDetail(it) } |
| | | scene?.let { |
| | | viewModel.fetchChangeInfoList(it.guid) |
| | | viewModel.fetchProblemRecurrence(it.guid) |
| | | viewModel.fetchInspectionKeyPoint(it.guid) |
| | | } |
| | | } |
| | | |
| | | private fun initUI() { |
| | | view_waiting.visibility = View.VISIBLE |
| | | scene?.let { |
| | | tv_status.text = StringBuilder(it.type + getString(R.string.scene_status)) |
| | | } |
| | | // 默认先将三块内容隐藏 |
| | | cl_risk_warn.visibility = View.GONE |
| | | cl_inspection_key_point.visibility = View.GONE |
| | | cl_temp_inspection.visibility = View.GONE |
| | | tv_change_rate.visibility = View.GONE |
| | | tv_change_efficiency.visibility = View.GONE |
| | | tv_problem_recurrence.visibility = View.GONE |
| | | } |
| | | |
| | | private fun initObserver() { |
| | | |
| | | // 风险提示 |
| | | viewModel.changeInfoTxt.observe(this, Observer { |
| | | it?.let { |
| | | tv_change_rate.text = it |
| | | tv_change_rate.visibility = View.VISIBLE |
| | | cl_risk_warn.visibility = View.VISIBLE |
| | | } |
| | | }) |
| | | viewModel.changeEfficiencyTxt.observe(this, Observer { |
| | | it?.let { |
| | | tv_change_efficiency.text = it |
| | | tv_change_efficiency.visibility = View.VISIBLE |
| | | cl_risk_warn.visibility = View.VISIBLE |
| | | } |
| | | }) |
| | | viewModel.problemRecurrenceTxt.observe(this, Observer { |
| | | it?.let { |
| | | tv_problem_recurrence.text = it |
| | | tv_problem_recurrence.visibility = View.VISIBLE |
| | | cl_risk_warn.visibility = View.VISIBLE |
| | | } |
| | | }) |
| | | // 巡查要点 |
| | | viewModel.inspectionKeyPointTxt.observe(this, Observer { |
| | | it?.let { |
| | | tv_key_point.text = it |
| | | cl_inspection_key_point.visibility = View.VISIBLE |
| | | } |
| | | }) |
| | | // 应急巡查 |
| | | viewModel.tempInspectionTxt.observe(this, Observer { |
| | | it?.let { |
| | | tv_temp_inspection.text = it |
| | | cl_temp_inspection.visibility = View.VISIBLE |
| | | } |
| | | }) |
| | | } |
| | | |
| | | private fun initListener() { |
| | | |
| | | |
| | | |
| | | fab_close.setOnClickListener { |
| | | this.finish() |
| | | } |