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/base/BaseTakePicActivity.kt | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt
index 989accf..9c15188 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseTakePicActivity.kt
@@ -12,6 +12,7 @@
import cn.flightfeather.thirdapp.util.UUIDGenerator
import cn.flightfeather.thirdapp.util.file.FileUtil
import cn.flightfeather.thirdapp.util.photo.PhotoUtil
+import com.bumptech.glide.Glide
import com.lcw.library.imagepicker.ImagePicker
import org.jetbrains.anko.toast
import java.io.File
@@ -31,8 +32,8 @@
const val EXTRA_SELECT_IMAGES = ImagePicker.EXTRA_SELECT_IMAGES
}
- //鎷嶆憚鐨勫緟涓婁紶鐨勫浘鐗囨枃浠跺垪琛�
- val pathTempList = mutableListOf<File>()
+ //鎷嶆憚鐨勫緟涓婁紶鐨勫浘鐗囨枃浠跺垪琛�, true: 浠h〃闇�瑕佷笂浼狅紱false: 浠h〃涓嶉渶瑕佷笂浼�
+ val pathTempList = mutableListOf<Pair<File, Boolean>>()
// fixme: 2019/8/2 鐢变簬鍘熶唬鐮佷腑澶ч儴鍒嗗浘鐗囨媿鎽勫浐瀹氭浜嗘渶澶�3寮狅紝鎵�浠ユ病鏈変娇鐢ㄥ垪琛ㄧ粨鏋勶紝鑰屾槸鎵嬪姩璁剧疆浜�3涓狪mageView锛屾澶勬殏鏃跺欢鐢紝涓嶅仛淇敼
var imageViewList = mutableListOf<ImageView>()
@@ -56,8 +57,8 @@
//鏌ョ湅涓存椂鎷嶆憚鍥剧墖鍙互鍒犻櫎
data?.getIntExtra("position", -1)?.let {
if (it > -1) {
- if (pathTempList[it].exists()) {
- pathTempList[it].delete()
+ if (pathTempList[it].first.exists()) {
+ pathTempList[it].first.delete()
}
pathTempList.removeAt(it)
refreshImageView()
@@ -74,7 +75,7 @@
}
try {
FileUtil.copyFile(oldFile, newFile)
- pathTempList.add(newFile)
+ pathTempList.add(Pair(newFile, true))
} catch (e: IOException) {
e.printStackTrace()
application.toast("澶嶅埗鏂囦欢澶辫触")
@@ -91,15 +92,20 @@
when {
i < picSize -> {
imageViewList[i].setOnClickListener(viewPhotoClickListener(i))
- // fixme: 2019/8/2 姝ゅ缁檌mageVIew璁剧疆鍥剧墖鍦ㄥ師浠g爜涓槸鑷畾涔変簡涓�涓狝syncTask锛屼箣鍚庡彲浠ョ敤Glide绛夌涓夋柟妗嗘灦鏇夸唬
- SetImageTask(pathTempList[i], imageViewList[i]).execute()
+ imageViewList[i].scaleType = ImageView.ScaleType.CENTER_CROP
+ Glide.with(this)
+ .load(pathTempList[i].first)
+ .placeholder(R.drawable.icon_add_photo_waite)
+ .into(imageViewList[i])
}
i == picSize -> imageViewList[i].run {
setOnClickListener(takePhotoClickListener(i))
+ scaleType = ImageView.ScaleType.FIT_CENTER
setImageResource(R.drawable.icon_add_photo)
}
else -> imageViewList[i].run {
setOnClickListener(null)
+ scaleType = ImageView.ScaleType.FIT_CENTER
setImageResource(R.drawable.icon_add_photo_blank)
}
}
@@ -109,11 +115,15 @@
//鏈夊浘鐗囨椂锛屾煡鐪嬪浘鐗囩殑鐐瑰嚮浜嬩欢(temp)
fun viewPhotoClickListener(position: Int): View.OnClickListener {
return View.OnClickListener {
+ val fileList = mutableListOf<File>()
+ pathTempList.forEach {
+ fileList.add(it.first)
+ }
val intent = Intent(this, PhotoViewerActivity::class.java)
intent.putExtra("position", position)
intent.putExtra("type", PhotoViewerActivity.EVIDENCE_PHOTO_TEMP)
intent.putExtra("deletable", picDeletable)
- intent.putExtra(PhotoViewerActivity.PARA_FILES, pathTempList as Serializable)
+ intent.putExtra(PhotoViewerActivity.PARA_FILES, fileList as Serializable)
startActivityForResult(intent, VIEW_PHOTO)
}
}
--
Gitblit v1.9.3