From e102578ebfc95c27aeb13dce13fb82af53a2bead Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 25 二月 2021 17:07:23 +0800
Subject: [PATCH] 1. 新增夜间施工查询界面 2. 新增夜间施工管理统计界面
---
app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt | 44 +++++++++++++++++++++++++++++++++++---------
1 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt
index f6e86cb..82a55a5 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspection/MenuCameraActivity.kt
@@ -51,10 +51,13 @@
//褰撳墠閫夋嫨鐨勬媿鐓х被鍨�
private var currentType = MediaFileType.RoutineRecord
+ private var currentTypeName = currentType.des
lateinit var viewModel: MenuCameraViewModel
private val viewList = mutableListOf<View>()
+
+ private val listMap = mutableMapOf<MediaFileType, RecyclerView>()
var subTask: Subtask? = null
var inspection: Inspection? = null
@@ -92,7 +95,9 @@
val oldFile = File(it)
val cal = Calendar.getInstance().apply { time = subTask?.executionstarttime }
scene?.run {
- val path = "FlightFeather/Photo/" + districtname + "/"+ cal.get(Calendar.YEAR) + "骞�" + (cal.get(Calendar.MONTH) + 1) + "鏈�/"+ (cal.get(Calendar.MONTH) + 1) + "鏈�" + cal.get(Calendar.DAY_OF_MONTH) + "鏃�/"+ name + "/浠绘剰鎷嶇収/"
+ val path = "FlightFeather/Photo/" + districtname + "/" + cal.get(Calendar.YEAR) + "骞�" + (cal.get(Calendar.MONTH) + 1) + "鏈�/" +
+ (cal.get(Calendar.MONTH) + 1) + "鏈�" + cal.get(Calendar.DAY_OF_MONTH) + "鏃�/" + name + "/浠绘剰鎷嶇収/" + currentTypeName + "/"
+
val fileName = UUIDGenerator.generateUUID(4) + ".jpg"
val newFile = File(Environment.getExternalStorageDirectory(), path + fileName)
if (!newFile.parentFile.exists()) {
@@ -152,6 +157,7 @@
addOnItemTouchListener(RecyclerItemClickListener(this@MenuCameraActivity, this, object : RecyclerItemClickListener.OnItemClickListener {
override fun onItemClick(view: View?, position: Int) {
currentType = type
+ currentTypeName = title.text.toString()
//鎷嶇収
if (dataList[position].guid == null) {
PhotoUtil.pickPhoto2(this@MenuCameraActivity, TAKE_PHOTO, 9)
@@ -181,6 +187,10 @@
}
}))
+
+ if (!listMap.containsKey(type)) {
+ listMap[type] = this
+ }
}
viewList.add(view)
@@ -230,21 +240,37 @@
}
private fun addPhoto(mediaFile: Mediafile) {
- getDataSet(currentType).run {
- first.value?.add(mediaFile)
- second.adapter?.run {
- notifyDataSetChanged()
+ if (listMap.containsKey(currentType)) {
+ viewModel.fileList.value?.forEach {
+ if (it.type == currentType) {
+ it.dataList.add(mediaFile)//绗竴涓暟鎹负鎷嶇収鎸夐挳
+ listMap[currentType]?.adapter?.notifyDataSetChanged()
+ }
}
}
+// getDataSet(currentType).run {
+// first.value?.add(mediaFile)
+// second.adapter?.run {
+// notifyDataSetChanged()
+// }
+// }
}
private fun deletePhoto(pos: Int) {
- getDataSet(currentType).run {
- first.value?.removeAt(pos + 1)//绗竴涓暟鎹负鎷嶇収鎸夐挳
- second.adapter?.run {
- notifyDataSetChanged()
+ if (listMap.containsKey(currentType)) {
+ viewModel.fileList.value?.forEach {
+ if (it.type == currentType) {
+ it.dataList.removeAt(pos + 1)//绗竴涓暟鎹负鎷嶇収鎸夐挳
+ listMap[currentType]?.adapter?.notifyDataSetChanged()
+ }
}
}
+// getDataSet(currentType).run {
+// first.value?.removeAt(pos + 1)//绗竴涓暟鎹负鎷嶇収鎸夐挳
+// second.adapter?.run {
+// notifyDataSetChanged()
+// }
+// }
}
private fun getDataSet(type: MediaFileType) = when (type) {
--
Gitblit v1.9.3