| | |
| | | import cn.flightfeather.thirdappmodule.module.base.BaseTakePicActivity |
| | | import cn.flightfeather.thirdappmodule.util.DateFormatter |
| | | import cn.flightfeather.thirdappmodule.util.Domain |
| | | import cn.flightfeather.thirdappmodule.util.SystemServiceUtils |
| | | import cn.flightfeather.thirdappmodule.util.UUIDGenerator |
| | | import cn.flightfeather.thirdappmodule.util.file.FileUtil |
| | | import cn.flightfeather.thirdappmodule.util.file.FileUtils |
| | | import com.flightfeather.taizhang.common.utils.download.UpDownloadUtil |
| | | import io.reactivex.Observable |
| | | import kotlinx.android.synthetic.main.dialog_take_evidence.* |
| | | import org.greenrobot.eventbus.EventBus |
| | | import org.greenrobot.eventbus.Subscribe |
| | |
| | | import java.io.File |
| | | import java.io.IOException |
| | | import java.util.* |
| | | import kotlin.collections.ArrayList |
| | | |
| | | /** |
| | | * @author riku |
| | | * Date: 2019/8/1 |
| | | * 问题拍照取证 |
| | | */ |
| | | open class MenuEvidenceActivity : BaseTakePicActivity() { |
| | | |
| | | override fun getLayoutId(): Int = R.layout.dialog_take_evidence |
| | |
| | | var scene: Scense? = null |
| | | var lat = 0.0 |
| | | var lng = 0.0 |
| | | var picUrls: ArrayList<String>? = null |
| | | |
| | | protected var submitTime = 0L//提交时间,防止连续提交,多次记录 |
| | | |
| | |
| | | getExtra() |
| | | initUI() |
| | | initObserver() |
| | | |
| | | viewModel.getLocationList() |
| | | loadOnlinePic() |
| | | subTask?.let { t -> |
| | | scene?.let { s -> |
| | | viewModel.getLocationList(s.typeid.toInt()) |
| | | viewModel.getProblemType(t.typeno, t.citycode, t.districtcode, s.typeid) |
| | | } |
| | | } |
| | |
| | | scene = intent.getSerializableExtra("scene") as Scense? |
| | | lat = intent.getDoubleExtra("lat", 0.0) |
| | | lng = intent.getDoubleExtra("lng", 0.0) |
| | | picUrls = intent.getStringArrayListExtra("picUrls") |
| | | } |
| | | |
| | | private fun initUI() { |
| | | // 问题类型初始化 |
| | | 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) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 具体问题初始化 |
| | | sp_take_evidence_select_problem.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { |
| | | override fun onNothingSelected(parent: AdapterView<*>?) = Unit |
| | | override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 提交问题按钮初始化 |
| | | fab_take_evidence_ok.setOnClickListener { |
| | | val now = Date() |
| | | if (now.time - submitTime >= 1000) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 取消提交问题按钮初始化 |
| | | fab_take_evidence_close.setOnClickListener { |
| | | finish() |
| | | } |
| | | |
| | | // 备注栏一键复制具体问题功能 |
| | | listOf(Pair(btn_copy_problem_des, et_take_evidence_problem_des)).forEach { |
| | | it.first.isSelected = false |
| | | it.first.setOnClickListener {v -> |
| | | if (v.isSelected) { |
| | | // 清空备注栏文本 |
| | | it.second.setText("") |
| | | v.isSelected = !v.isSelected |
| | | } else { |
| | | // 复制当前选择的具体问题 |
| | | val p = sp_take_evidence_select_problem.selectedItem |
| | | if (p is Problemtype) { |
| | | it.second.setText(p.name) |
| | | v.isSelected = !v.isSelected |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | private fun loadOnlinePic() { |
| | | picUrls?.forEach { |
| | | UpDownloadUtil.download(this, it, FileUtils.getFileName(it), {path -> |
| | | pathTempList.add(Pair(File(path), true)) |
| | | refreshImageView() |
| | | }, { |
| | | toast("问题图片下载失败") |
| | | }) |
| | | } |
| | | } |
| | | |
| | | protected fun updateUIByProblemType(visible: Int) { |
| | | sp_take_evidence_select_location.visibility = visible |
| | | et_take_evidence_location.visibility = visible |