| | |
| | | |
| | | private val viewList = mutableListOf<View>() |
| | | |
| | | private val listMap = mutableMapOf<MediaFileType, RecyclerView>() |
| | | |
| | | var subTask: Subtask? = null |
| | | var inspection: Inspection? = null |
| | | var scene: Scense? = null |
| | |
| | | } |
| | | |
| | | })) |
| | | |
| | | if (!listMap.containsKey(type)) { |
| | | listMap[type] = this |
| | | } |
| | | } |
| | | |
| | | viewList.add(view) |
| | |
| | | } |
| | | |
| | | 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) { |