package com.flightfeather.ducha.module.inspection
|
|
import android.arch.lifecycle.Observer
|
import android.os.Bundle
|
import android.view.View
|
import cn.flightfeather.thirdappmodule.CommonApplication
|
import cn.flightfeather.thirdappmodule.adapter.IconsPageAdapter
|
import cn.flightfeather.thirdappmodule.module.inspection.InspectionDetailActivity
|
import cn.flightfeather.thirdappmodule.util.Domain
|
import com.flightfeather.ducha.R
|
|
/**
|
* @author riku
|
* Date: 2021/8/2
|
*/
|
class DCInspectionDetailActivity : InspectionDetailActivity() {
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
super.onCreate(savedInstanceState)
|
|
viewModel.subTask.removeObservers(this)
|
viewModel.subTask.observe(this, Observer {
|
it?.let {
|
updateUIBySubTask(it)
|
taskStatus = it.status
|
onDataLoaded(1)
|
if (it.stAssessorguid != null
|
&& it.stAssessorguid.contains(CommonApplication.getInstance().currentUser.guid)) {
|
if (menuList.size >= 4) {
|
menuList[3].alpha = 1F
|
menuList[3].setOnClickListener(this)
|
}
|
} else {
|
if (menuList.size >= 4) {
|
menuList[3].alpha = 0.2F
|
menuList[3].setOnClickListener(null)
|
}
|
}
|
}
|
})
|
}
|
|
// override fun initIconViewPager() {
|
// super.initIconViewPager()
|
// val iconPage1 = View.inflate(this, R.layout.dc_page_patrol_icons_first, null)
|
//
|
// menuList.apply{
|
// clear()
|
//
|
// add(iconPage1.findViewById(R.id.ln_patrol_take_evidence))
|
// add(iconPage1.findViewById(R.id.ln_patrol_problem_list))
|
// add(iconPage1.findViewById(R.id.ln_patrol_camera))
|
// add(iconPage1.findViewById(R.id.ln_patrol_check))
|
// add(iconPage1.findViewById(R.id.ln_patrol_navi))
|
// add(iconPage1.findViewById(R.id.ln_patrol_chose_latlng))
|
// add(iconPage1.findViewById(R.id.ln_patrol_edit))
|
// }
|
//
|
// vp_patrol_icons.adapter = IconsPageAdapter(ArrayList<View>().apply {
|
// add(iconPage1)
|
// })
|
// }
|
|
override fun refreshMenuStatus(status: String) {
|
menuList.let {m ->
|
when (status) {
|
Domain.TASK_STATUS_WAITING -> {
|
for (i in m.indices) {
|
if (i <= 3) {
|
m[i].alpha = 0.2F
|
m[i].setOnClickListener(showNeedStartTaskListener())
|
} else {
|
m[i].alpha = 1F
|
m[i].setOnClickListener(this)
|
}
|
}
|
}
|
Domain.TASK_STATUS_RUNNING -> {
|
m.forEach {
|
it.alpha = 1F
|
it.setOnClickListener(this)
|
}
|
}
|
Domain.TASK_STATUS_FINISHED -> {
|
for (i in m.indices) {
|
// if (i == 1) {
|
// m[i].alpha = 0.2F
|
// m[i].isClickable = false
|
// } else {
|
m[i].alpha = 1F
|
m[i].setOnClickListener(this)
|
// }
|
}
|
}
|
}
|
if (viewModel.userTypeId == Domain.USER_COMPTENT.toByte()) {
|
for (i in m.indices) {
|
when (i) {
|
1, in 3..4, in 7..11 -> {
|
m[i].alpha = 0.2F
|
m[i].isClickable = false
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|