From a5d862051462a5fcc2717b405896a6d424002e54 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 22 十二月 2020 15:43:06 +0800
Subject: [PATCH] 1. 调整了数控实体的存储位置; 2. 新增数据表“媒体文件类型别名表”; 3. 修改任意拍模块,将图片分类改为根据场景类型动态生成,同时新增修改分类别名功能; 4. 优化子任务选择界面的任务排序方式,按照“待开始”、“执行中”、“未执行”的顺序进行排序;
---
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt | 109 ++++++++++++++++++++++++++++++++----------------------
1 files changed, 64 insertions(+), 45 deletions(-)
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt
index b8e0011..2767749 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt
@@ -6,9 +6,9 @@
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.*
@@ -37,6 +37,13 @@
tv_dialog_take_evidence_title.text = "闂淇敼"
+ 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) {
+
+ }
+ }
+
fab_take_evidence_ok.setOnClickListener {
val now = Date()
if (now.time - submitTime >= 1000) {
@@ -56,10 +63,13 @@
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("瑕佸垹闄ょ殑鍥剧墖涓嶅瓨鍦�")
}
}
}
@@ -69,6 +79,36 @@
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() {
@@ -84,7 +124,6 @@
if (pt.guid == problemTypeId) {
problemType = entry.key
originProblemName = pt.name
- setSelectListener()
return@breaking
}
}
@@ -93,6 +132,7 @@
for (i in viewModel.problemFatherType.value?.indices ?: 0..0) {
if (viewModel.problemFatherType.value?.get(i) == problemType) {
sp_take_evidence_select_problem_type.setSelection(i)
+ onProblemTypeSelected(i)
break
}
}
@@ -124,22 +164,6 @@
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)
}
})
@@ -224,31 +248,26 @@
viewModel.deleteMediaFile(deleteMediaFileList)
}
- private fun setSelectListener() {
- 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) {
- val problemType = viewModel.problemFatherType.value?.get(position)
- viewModel.refreshProblems(problemType)
+ private fun onProblemTypeSelected(position: Int) {
+ val problemType = viewModel.problemFatherType.value?.get(position)
+ viewModel.refreshProblems(problemType)
- viewModel.problemFatherType.value?.let {
- if (it[position] == "鎬佸害") {
- updateUIByProblemType(View.GONE)
- } else {
- updateUIByProblemType(View.VISIBLE)
- }
- }
-
- val problemNameList = viewModel.problemMap[problemType] ?: arrayListOf()
- for (i in problemNameList.indices) {
- if (problemNameList[i].name == originProblemName) {
- sp_take_evidence_select_problem.setSelection(i)
- break
- }
- }
-
- viewModel.problemType.value?.get(0)?.guid?.let { viewModel.getSuggestionList(it) }
+ viewModel.problemFatherType.value?.let {
+ if (it[position] == "鎬佸害") {
+ updateUIByProblemType(View.GONE)
+ } else {
+ updateUIByProblemType(View.VISIBLE)
}
}
+
+ val problemNameList = viewModel.problemMap[problemType] ?: arrayListOf()
+ for (i in problemNameList.indices) {
+ if (problemNameList[i].name == originProblemName) {
+ sp_take_evidence_select_problem.setSelection(i)
+ break
+ }
+ }
+
+ viewModel.problemType.value?.get(0)?.guid?.let { viewModel.getSuggestionList(it) }
}
}
\ No newline at end of file
--
Gitblit v1.9.3