From dded7fe1d51cb3da855d02201ca150c9b7fd0495 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 15 九月 2020 10:41:52 +0800
Subject: [PATCH] 修复一键分享功能中,整改建议 没有显示的问题
---
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemActivity.kt | 5 +
app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt | 2
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt | 5 +
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt | 89 ++++++++++++++++-------------
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt | 1
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailViewModel.kt | 21 ++++---
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemPreViewActivity.kt | 2
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceViewModel.kt | 3
gradle.properties | 4 +
9 files changed, 77 insertions(+), 55 deletions(-)
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt
index 9e0f1a3..46f614c 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt
@@ -130,7 +130,7 @@
return View.OnClickListener {
val t = imageViewList.size - pathTempList.size
val picNum = if (t >= 0) t else 0
- PhotoUtil.pickPhoto(this, TAKE_PHOTO, picNum)
+ PhotoUtil.pickPhoto2(this, TAKE_PHOTO, picNum)
}
}
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt
index a089439..8eeb114 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt
@@ -653,6 +653,7 @@
} else {
it.problemcount + 1
}
+ // fixme: 2020/9/1 姝ゅ鍘熸湰鐨勯�昏緫鏄柊澧炰竴涓棶棰樺悗锛屽悓姝ユ洿鏂板贰鏌ヤ俊鎭腑鐨勯棶棰樻暟锛岄敊璇紝搴旇灏嗘鏇存柊鎿嶄綔鐩存帴鐢辨柊澧為棶棰樻帴鍙g粺涓�瀹屾垚
viewModel.updateInspection(it)
}
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailViewModel.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailViewModel.kt
index 4db8edd..fc26e00 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailViewModel.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailViewModel.kt
@@ -117,21 +117,24 @@
}
}
- updateSubTask()
- updateInspection(inspection.value)
-
- //鏇存柊鐣岄潰
- subTask.value = subTask.value
+ updateSubTask {
+ //鏇存柊鐣岄潰
+ subTask.value = subTask.value
+ }
}
/**
* 鏇存柊瀛愪换鍔�
*/
- fun updateSubTask() {
+ fun updateSubTask(s: () -> Unit) {
subTask.value?.let {
inspectionRepository.updateSubTask(it, object : ResultCallBack<String> {
override fun onSuccess(result: String?) {
-
+ result?.let {
+ updateInspection(inspection.value){
+ s()
+ }
+ }
}
override fun onFailure() {
@@ -145,11 +148,11 @@
/**
* 鏇存柊宸℃煡淇℃伅
*/
- fun updateInspection(inspection: Inspection?) {
+ fun updateInspection(inspection: Inspection?, s: () -> Unit = {}) {
inspection?.let {
inspectionRepository.updateInspection(it, object : ResultCallBack<ResponseBody> {
override fun onSuccess(result: ResponseBody?) {
-
+ result?.let { s() }
}
override fun onFailure() {
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt
index 147f1b7..105a3cc 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt
@@ -135,10 +135,15 @@
viewModel.suggestionList.observe(this, Observer {
it.let {
sp_take_evidence_select_suggestion.adapter = ArrayAdapter(this, R.layout.item_spinner_drop_down, it)
+ onSuggestionLoaded()
}
})
}
+ open fun onSuggestionLoaded() {
+
+ }
+
protected fun updateUIByProblemType(visible: Int) {
sp_take_evidence_select_location.visibility = visible
et_take_evidence_location.visibility = visible
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceViewModel.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceViewModel.kt
index 247146e..9042490 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceViewModel.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceViewModel.kt
@@ -38,7 +38,7 @@
//鎵�鏈夋暟鎹姞杞藉畬鎴愰�氱煡
val loadingOver = MutableLiveData<Boolean>()
//璁板綍鍚勪釜鏁版嵁鍔犺浇鏄惁瀹屾垚鐨勭姸鎬�
- private val loadingStatus = BooleanArray(3)
+ private val loadingStatus = BooleanArray(2)
/**
* 鑾峰彇鍦烘櫙闂鍙�変綅缃紙鐩墠鍙湁宸ュ湴锛屼絾鎵�鏈夊満鏅兘浣跨敤锛�
@@ -111,7 +111,6 @@
advices.add("鏆傛棤寤鸿")
suggestionList.value = advices
- onLoaded(2)
}
}
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..82d8415 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
@@ -71,6 +71,36 @@
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() {
super.initObserver()
viewModel.loadingOver.observe(this, Observer {
@@ -84,7 +114,6 @@
if (pt.guid == problemTypeId) {
problemType = entry.key
originProblemName = pt.name
- setSelectListener()
return@breaking
}
}
@@ -93,6 +122,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 +154,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 +238,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
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemActivity.kt
index bc8c569..f904911 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemActivity.kt
@@ -50,6 +50,9 @@
intent.putExtra(ShareProblemPreViewActivity.ARG_MERGE_INFO, infoList)
startActivity(intent)
}
+ btn_fail.setOnClickListener {
+ onBackPressed()
+ }
}
override fun getTab(): TabLayout = tab
@@ -59,7 +62,7 @@
override fun getTitles(): List<String> {
val list = mutableListOf<String>()
for (i in problemVoList?.indices ?: 0..0) {
- list.add("闂$i")
+ list.add("闂${i+1}")
}
return list
}
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemPreViewActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemPreViewActivity.kt
index 7e67cad..d346ee7 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemPreViewActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemPreViewActivity.kt
@@ -87,7 +87,7 @@
}
}
util.mergeImage(problemImageList).let {
- val text = vo.problems ?: "" + if (vo.advise!=null) "," + vo.advise else ""
+ val text = (vo.problems ?: "") + if (vo.advise!=null) "锛�" + vo.advise else ""
resultBitmap = if (it != null) {
val b = util.mergeVerticalText(it, text, PROBLEM_DESCRIBE, R.mipmap.ic_problem_describe, resources)
// val b = util.mergeVerticalText(it, text)
diff --git a/gradle.properties b/gradle.properties
index e2443a5..99f1e35 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,4 +17,6 @@
# org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.parallel=true
-org.gradle.configureondemand=true
\ No newline at end of file
+org.gradle.configureondemand=true
+
+android.injected.testOnly=false
\ No newline at end of file
--
Gitblit v1.9.3