| | |
| | | package cn.flightfeather.thirdappmodule.module.inspection |
| | | |
| | | import android.annotation.SuppressLint |
| | | import android.arch.lifecycle.Observer |
| | | import android.arch.lifecycle.ViewModelProviders |
| | | import android.os.Bundle |
| | | import android.support.v7.widget.LinearLayoutManager |
| | | import android.view.LayoutInflater |
| | | import android.view.View |
| | | import cn.flightfeather.thirdappmodule.R |
| | | import cn.flightfeather.thirdappmodule.adapter.AllRecyclerViewAdapter |
| | | import cn.flightfeather.thirdappmodule.bean.entity.Scense |
| | | import cn.flightfeather.thirdappmodule.bean.vo.RankVo |
| | | import cn.flightfeather.thirdappmodule.bean.vo.SceneConstructionSite |
| | | import cn.flightfeather.thirdappmodule.bean.vo.TaskFrequencyVo |
| | | import cn.flightfeather.thirdappmodule.module.base.BaseActivity |
| | | import cn.flightfeather.thirdappmodule.module.task.SceneDetailViewModel |
| | | import cn.flightfeather.thirdappmodule.util.CommonUtils |
| | | import cn.flightfeather.thirdappmodule.util.Constant |
| | | import kotlinx.android.synthetic.main.dialog_scene_subinfo.* |
| | | import kotlinx.android.synthetic.main.fragment_analysis_over_view.* |
| | | |
| | | /** |
| | | * 场景施工阶段管理界面 |
| | | * Date: 2025/10/27 |
| | | */ |
| | | class MenuSceneInfoActivity : BaseActivity() { |
| | | |
| | | private var scene: Scense? = null |
| | | private var statusAdapter: AllRecyclerViewAdapter<String>? = null |
| | | |
| | | override fun getLayoutId(): Int = R.layout.dialog_scene_subinfo |
| | | |
| | |
| | | initUI() |
| | | initObserver() |
| | | initListener() |
| | | |
| | | viewModel.getSceneStatus { |
| | | scene?.let { viewModel.getSceneDetail(it) } |
| | | } |
| | | } |
| | | |
| | | private fun initUI() { |
| | |
| | | } |
| | | |
| | | private fun initObserver() { |
| | | viewModel.aName.observe(this, Observer { |
| | | viewModel.subScene.observe(this, Observer { |
| | | view_waiting.visibility = View.GONE |
| | | |
| | | if (it == null) { |
| | | group_no_data.visibility = View.VISIBLE |
| | | group_s_info.visibility = View.GONE |
| | | } else { |
| | | group_no_data.visibility = View.GONE |
| | | group_s_info.visibility = View.VISIBLE |
| | | tv_s_account_c.text = it |
| | | val status = when (scene?.typeid.toString()) { |
| | | Constant.SCENE_TYPE_SITE -> { |
| | | (it as SceneConstructionSite?)?.siExtension1 |
| | | } |
| | | else -> "" |
| | | } |
| | | var index = viewModel.sceneStatus.indexOf(status) |
| | | if (index == -1) index = 0 |
| | | statusAdapter?.run { |
| | | setSelected(true, index) |
| | | notifyItemChanged(index) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | private fun initListener() { |
| | | tv_create_account.setOnClickListener { |
| | | view_waiting.visibility = View.VISIBLE |
| | | sceneId?.let { viewModel.createAccount(it) } |
| | | statusAdapter = object : AllRecyclerViewAdapter<String>(viewModel.sceneStatus, android.R.layout.simple_list_item_single_choice, this) { |
| | | @SuppressLint("NotifyDataSetChanged") |
| | | override fun bindView(holder: MyViewHolder?, obj: String?, isSelected: Boolean, position: Int) { |
| | | holder?.setText(R.id.text1, obj) |
| | | ?.setOnItemClickListener { |
| | | setAllFalse() |
| | | setSelected(true, position) |
| | | notifyDataSetChanged() |
| | | (viewModel.subScene.value as SceneConstructionSite?)?.siExtension1 = obj |
| | | } |
| | | } |
| | | } |
| | | val lm = LinearLayoutManager(this) |
| | | lm.orientation = LinearLayoutManager.VERTICAL |
| | | rv_status!!.layoutManager = lm |
| | | rv_status!!.adapter = statusAdapter |
| | | |
| | | |
| | | fab_close.setOnClickListener { |
| | | this.finish() |
| | | } |
| | | fab_submit.setOnClickListener { |
| | | viewModel |
| | | } |
| | | } |
| | | } |