From 17eb1d06e104bc1cd93498fe3a3eaecf14c9d734 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 12 十一月 2020 13:57:35 +0800
Subject: [PATCH] 1. 修复现场整改时,问题状态是‘问题审核通过’而不是“整改未审核”的问题; 2. 修改任意拍照界面的多图片展示方式为Glide,减少内存溢出的可能性; 3. 新增图片类型枚举类,罗列原有的图片类型,并新增“铭牌”和“监测设备”; 4. 修复导航功能可能导致空指针的问题; 5. 任意拍界面新增按分类拍摄功能; 6. 修复现场整改界面打开崩溃问题;
---
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraViewModel.kt | 40 ++++++++++++++++++++++++++++------------
1 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraViewModel.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraViewModel.kt
index eae0b61..8d93bcd 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraViewModel.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraViewModel.kt
@@ -3,6 +3,7 @@
import android.arch.lifecycle.MutableLiveData
import cn.flightfeather.thirdapp.bean.Mediafile
import cn.flightfeather.thirdapp.common.net.ResultCallBack
+import cn.flightfeather.thirdapp.model.enumreation.MediaFileType
import cn.flightfeather.thirdapp.module.base.BaseViewModel
import cn.flightfeather.thirdapp.repository.InspectionRepository
import cn.flightfeather.thirdapp.repository.ProblemRepository
@@ -16,27 +17,42 @@
private val inspectionRepository = InspectionRepository()
private val problemRepository = ProblemRepository()
- val mediaFileList = MutableLiveData<ArrayList<Mediafile>>().apply { value = ArrayList() }
+ //甯歌璁板綍鍥剧墖
+ val routineRecordList = MutableLiveData<ArrayList<Mediafile>>().apply { value = ArrayList() }
+ //閾墝鍥剧墖
+ val nameplateList = MutableLiveData<ArrayList<Mediafile>>().apply { value = ArrayList() }
+ //鐩戞祴璁惧鍥剧墖
+ val monitorDeviceList = MutableLiveData<ArrayList<Mediafile>>().apply { value = ArrayList() }
+
+ private val dataSet = listOf(
+ Pair(MediaFileType.RoutineRecord, routineRecordList),
+ Pair(MediaFileType.Nameplate, nameplateList),
+ Pair(MediaFileType.MonitorDevice, monitorDeviceList)
+ )
+
/**
* 鑾峰彇浠绘剰鎷嶇収鍥剧墖
*/
fun getMediaFile(inspectionId: String) {
- inspectionRepository.getMediaFile(inspectionId, BUSINESS_TYPE_CAMERA, object : ResultCallBack<ArrayList<Mediafile>> {
- override fun onSuccess(result: ArrayList<Mediafile>?) {
- result?.let {
- mediaFileList.value?.run {
- clear()
- addAll(it)
+ dataSet.forEach {p ->
+ inspectionRepository.getMediaFile(inspectionId, p.first.value, object : ResultCallBack<ArrayList<Mediafile>> {
+ override fun onSuccess(result: ArrayList<Mediafile>?) {
+ result?.let {
+ p.second.value?.run {
+ clear()
+ add(0, Mediafile())//鍦ㄥ垪琛ㄥご娣诲姞鍥剧墖鎷嶆憚鎸夐挳
+ addAll(it)
+ }
+ p.second.value = p.second.value
}
- mediaFileList.value = mediaFileList.value
}
- }
- override fun onFailure() {
+ override fun onFailure() {
- }
+ }
- })
+ })
+ }
}
/**
--
Gitblit v1.9.3