riku
2020-09-15 dded7fe1d51cb3da855d02201ca150c9b7fd0495
修复一键分享功能中,整改建议 没有显示的问题
已修改9个文件
132 ■■■■■ 文件已修改
app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailViewModel.kt 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceActivity.kt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuEvidenceViewModel.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuProblemUpdateActivity.kt 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemActivity.kt 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/ShareProblemPreViewActivity.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
gradle.properties 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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)
        }
    }
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/InspectionDetailActivity.kt
@@ -653,6 +653,7 @@
                } else {
                    it.problemcount + 1
                }
                // fixme: 2020/9/1 此处原本的逻辑是新增一个问题后,同步更新巡查信息中的问题数,错误,应该将此更新操作直接由新增问题接口统一完成
                viewModel.updateInspection(it)
            }
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() {
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
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)
                }
            }
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) }
    }
}
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
    }
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)
gradle.properties
@@ -17,4 +17,6 @@
# org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.configureondemand=true
android.injected.testOnly=false