| | |
| | | import cn.flightfeather.thirdappmodule.bean.entity.Scense |
| | | import cn.flightfeather.thirdappmodule.bean.entity.Subtask |
| | | import cn.flightfeather.thirdappmodule.model.enumreation.MediaFileType |
| | | import cn.flightfeather.thirdappmodule.model.enumreation.MediaFileType_Backup |
| | | import cn.flightfeather.thirdappmodule.module.base.BaseActivity |
| | | import cn.flightfeather.thirdappmodule.module.base.BaseTakePicActivity |
| | | import cn.flightfeather.thirdappmodule.module.base.TAKE_PHOTO |
| | |
| | | |
| | | const val BUSINESS_TYPE_CAMERA = 5 |
| | | |
| | | /** |
| | | * @author riku |
| | | * Date: 2019/8/1 |
| | | * 任意拍照 |
| | | */ |
| | | class MenuCameraActivity : BaseActivity() { |
| | | override fun getLayoutId(): Int = R.layout.dialog_camera_3 |
| | | |
| | | //页面支持的拍摄图片类型 |
| | | private val typeList = listOf(MediaFileType.RoutineRecord, MediaFileType.Nameplate, MediaFileType.MonitorDevice) |
| | | private val typeList = listOf<MediaFileType>() |
| | | |
| | | //当前选择的拍照类型 |
| | | private var currentType = MediaFileType.RoutineRecord |
| | | private var currentType = MediaFileType(MediaFileType_Backup.RoutineRecord.value, MediaFileType_Backup.RoutineRecord.des) |
| | | private var currentTypeName = currentType.des |
| | | |
| | | lateinit var viewModel: MenuCameraViewModel |
| | |
| | | currentTypeName = title.text.toString() |
| | | //拍照 |
| | | if (dataList[position].guid == null) { |
| | | PhotoUtil.pickPhoto2(this@MenuCameraActivity, TAKE_PHOTO, 9) |
| | | PhotoUtil.pickPhoto(this@MenuCameraActivity, TAKE_PHOTO, 9) |
| | | } |
| | | //查看图片 |
| | | else { |
| | |
| | | private fun initObserver() { |
| | | viewModel.fileList.observe(this, Observer { |
| | | it?.forEach { m -> |
| | | initRecyclerView(m.dataList, m.type ?: MediaFileType.Others, m.alias) |
| | | initRecyclerView(m.dataList, m.type ?: MediaFileType.defaultType, m.alias) |
| | | } |
| | | val menus = it?.map { m-> |
| | | m.type?.des ?: "" |
| | | } |
| | | if (viewList.isNotEmpty()) { |
| | | banner.dataList = viewList |
| | | menus?.let { m->banner.menus = m } |
| | | } |
| | | }) |
| | | // typeList.forEach { |
| | |
| | | mediaFile.description = fileName |
| | | mediaFile.savetime = Date() |
| | | mediaFile.ischanged = false |
| | | val exetension1 = scene?.citycode + "/" + scene?.districtcode + "/" + DateFormatter.dateFormat2.format(calendar.time) + "/" + scene?.guid + "/" |
| | | mediaFile.extension1 = exetension1 |
| | | val extension1 = scene?.citycode + "/" + scene?.districtcode + "/" + DateFormatter.dateFormat2.format(calendar.time) + "/" + scene?.guid + "/" |
| | | mediaFile.extension1 = extension1 |
| | | mediaFile.remark = "未上传" |
| | | |
| | | viewModel.putMediaFile(mediaFile) |
| | |
| | | // notifyDataSetChanged() |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | private fun getDataSet(type: MediaFileType) = when (type) { |
| | | MediaFileType.RoutineRecord -> Pair(viewModel.routineRecordList, rv_photo_list_1) |
| | | MediaFileType.Nameplate -> Pair(viewModel.nameplateList, rv_photo_list_2) |
| | | MediaFileType.MonitorDevice -> Pair(viewModel.monitorDeviceList, rv_photo_list_3) |
| | | else -> Pair(viewModel.routineRecordList, rv_photo_list_1) |
| | | } |
| | | } |