| | |
| | | import android.os.Environment |
| | | import android.view.View |
| | | import android.widget.AdapterView |
| | | import cn.flightfeather.thirdapp.bean.Domainitem |
| | | import cn.flightfeather.thirdapp.bean.Mediafile |
| | | import cn.flightfeather.thirdapp.bean.Problemtype |
| | | import cn.flightfeather.thirdapp.bean.entity.Domainitem |
| | | import cn.flightfeather.thirdapp.bean.entity.Mediafile |
| | | import cn.flightfeather.thirdapp.bean.entity.Problemtype |
| | | import cn.flightfeather.thirdapp.bean.vo.ProblemlistVo |
| | | import cn.flightfeather.thirdapp.module.base.VIEW_PHOTO |
| | | import kotlinx.android.synthetic.main.dialog_take_evidence.* |
| | |
| | | VIEW_PHOTO -> { |
| | | //查看临时拍摄图片可以删除 |
| | | data?.getIntExtra("position", -1)?.let { |
| | | if (it > -1) { |
| | | viewModel.mediaFileList.value?.get(it)?.let {m -> |
| | | val size = viewModel.mediaFileList.value?.size ?: 0 |
| | | if (it > -1 && it < size) { |
| | | viewModel.mediaFileList.value?.get(it)?.let { m -> |
| | | deleteMediaFileList.add(m) |
| | | } |
| | | } else { |
| | | toast("要删除的图片不存在") |
| | | } |
| | | } |
| | | } |
| | |
| | | override fun getExtra() { |
| | | super.getExtra() |
| | | problemVo = intent.getSerializableExtra("problemlistVo") as ProblemlistVo |
| | | } |
| | | |
| | | override fun onSuggestionLoaded() { |
| | | super.onSuggestionLoaded() |
| | | if (problemVo != null && viewModel.suggestionList.value?.isNotEmpty() == true) { |
| | | //整改建议 |
| | | var advice = problemVo!!.advise |
| | | var getSuggestion = false |
| | | for (i in viewModel.suggestionList.value?.indices ?: 0..0) { |
| | | val s = viewModel.suggestionList.value?.get(i) |
| | | if (s != null && advice.contains(s)) { |
| | | advice = advice.replace(s, "") |
| | | sp_take_evidence_select_suggestion.setSelection(i) |
| | | getSuggestion = true |
| | | break |
| | | } |
| | | } |
| | | //整改建议备注 |
| | | if (getSuggestion) { |
| | | var suggestionRemark = advice.removeRange(0, 1)//删除第一个字符,括号“(” |
| | | suggestionRemark = suggestionRemark.dropLast(1)//删除最后一个字符,括号“)” |
| | | et_take_evidence_suggestion.setText(suggestionRemark) |
| | | } |
| | | } |
| | | sp_take_evidence_select_problem_type.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { |
| | | override fun onNothingSelected(parent: AdapterView<*>?) = Unit |
| | | override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { |
| | | onProblemTypeSelected(position) |
| | | } |
| | | } |
| | | } |
| | | |
| | | override fun initObserver() { |
| | |
| | | locationRemark = locationRemark.dropLast(1)//删除最后一个字符,括号“)” |
| | | } |
| | | et_take_evidence_location.setText(locationRemark) |
| | | |
| | | //整改建议 |
| | | var advice = problemVo!!.advise |
| | | var suggestion = "" |
| | | for (i in viewModel.suggestionList.value?.indices ?: 0..0) { |
| | | val s = viewModel.suggestionList.value?.get(i) |
| | | if (s != null && advice.contains(s)) { |
| | | advice = advice.replace(s, "") |
| | | sp_take_evidence_select_suggestion.setSelection(i) |
| | | break |
| | | } |
| | | } |
| | | //整改建议备注 |
| | | var suggestionRemark = advice.removeRange(0, 1)//删除第一个字符,括号“(” |
| | | suggestionRemark = suggestionRemark.dropLast(1)//删除最后一个字符,括号“)” |
| | | et_take_evidence_suggestion.setText(suggestionRemark) |
| | | } |
| | | }) |
| | | |