[6.2.4]Bag包上传后,不可再查看截图,按钮置灰,上传成功后,删除当前Bag包截图

This commit is contained in:
xuxinchao
2023-12-06 18:37:55 +08:00
parent 6d3989f47d
commit 7e65e5f476
9 changed files with 55 additions and 19 deletions

View File

@@ -119,6 +119,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
private var recordFileName: String?=null //录制文件包名
private var receiveTime: String?= null
private var uploadStamp: String = System.currentTimeMillis().toString()
private var screenSavePath: String ?= null //截图保存路径
private var bagManagerEntity: BagManagerEntity = BagManagerEntity()
@@ -241,7 +242,6 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
clickListener?.closeWindow()
}
mWindowParams = WindowManager.LayoutParams()
mWindowManager = mActivity.windowManager
mWindowParams?.let {
@@ -460,6 +460,10 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
bagManagerEntity.descReq = descReqEntity
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
}
//删除截图
screenSavePath?.let {
RecordBitmapUtils.deleteReportedImage(it)
}
val loc = getChassisLocationWGS84()
BadCaseAnalyticsManager.bagRecordUpload(recordKey.toString(),recordFileName?:"",uploadStamp,
"100",AppConfigInfo.plateNumber,BadCaseConfig.totalDuration.toString(),MoGoAiCloudClientConfig.getInstance().sn,
@@ -677,7 +681,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
}else{
RecordBitmapUtils.bitmap2Path(bitmap,path)
}
screenSavePath = path
//遍历是否有非当日的文件并删除
RecordBitmapUtils.deleteExpiredFile(currentDay)
}

View File

@@ -99,6 +99,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
private lateinit var rvPassiveList : RecyclerView
private var badReasonListAdapter: BadReasonListAdapter?= null
private var screenSavePath: String ?= null //截图保存路径
private var mInViewX = 0f
private var mInViewY = 0f
@@ -457,6 +458,10 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
bagManagerEntity.descReq = descReqEntity
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
}
//删除截图
screenSavePath?.let {
RecordBitmapUtils.deleteReportedImage(it)
}
//被动上报埋点统计
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
BadCaseAnalyticsManager.bagRecordUpload(recordKey?:"",recordFileName?:"",receiveTime?:System.currentTimeMillis().toString(),
@@ -644,6 +649,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
}else{
RecordBitmapUtils.bitmap2Path(bitmap,path)
}
screenSavePath = path
//遍历是否有非当日的文件并删除
RecordBitmapUtils.deleteExpiredFile(currentDay)
}

View File

@@ -14,8 +14,10 @@ import com.mogo.eagle.core.data.deva.badcase.BagDescriptionEntity
import com.mogo.eagle.core.data.deva.badcase.BagInfoEntity
import com.mogo.eagle.core.utilcode.util.FileUtils.millis2String
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.mogo_core_function_devatools.R
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import com.zhjt.mogo_core_function_devatools.badcase.util.RecordBitmapUtils
import java.text.DecimalFormat
@@ -101,12 +103,18 @@ class BagManagerListAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
holder.tvBagReportStatus.text = "录包失败"
holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_reported_button_bg)
holder.tvBagReportStatus.isClickable = false
//已上报的Bag不支持再查看,图标置为灰色,并且不可点击
holder.ivMapScreen.alpha = 0.5f
holder.ivMapScreen.isClickable = false
}else{
if(des.reportBI){
//已上报
holder.tvBagReportStatus.text = "已上报"
holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_reported_button_bg)
holder.tvBagReportStatus.isClickable = false
//已上报的Bag不支持再查看,图标置为灰色,并且不可点击
holder.ivMapScreen.alpha = 0.5f
holder.ivMapScreen.isClickable = false
}else{
//未上报
holder.tvBagReportStatus.text = "上报"
@@ -115,6 +123,16 @@ class BagManagerListAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
holder.tvBagReportStatus.setOnClickListener {
bagClickListener?.uploadBI(bagInfoEntity)
}
holder.ivMapScreen.setOnClickListener {
bagInfoEntity.description?.let {
//查找是否有截图文件
if(RecordBitmapUtils.checkHasImage(bagInfoEntity.key)){
bagClickListener?.lookMapScreen(bagInfoEntity.key)
}else{
ToastUtils.showShort("该截图录制失败或已删除")
}
}
}
}
}
if(des.description.isEmpty()){
@@ -124,12 +142,6 @@ class BagManagerListAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
}
}
holder.ivMapScreen.setOnClickListener {
bagInfoEntity.description?.let {
bagClickListener?.lookMapScreen(bagInfoEntity.key)
}
}
//录包来源:自动 or 人工
if(BadCaseConfig.bagResourceList.contains(bagInfoEntity.key)){
//在该列表中找到Bag包的Key则代表该Bag为人工录包
@@ -175,14 +187,6 @@ class BagManagerListAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
}
}
//只有当天的Bag才显示查看截图按钮
bagInfoEntity.timestamp.let {day ->
val currentDay = millis2String(System.currentTimeMillis(), TimeUtils.getMdFormatTwo())
if(day.contains(currentDay)){
holder.ivMapScreen.visibility = View.VISIBLE
}
}
}
}
}

View File

@@ -10,6 +10,8 @@ import com.mogo.eagle.core.data.deva.report.ReportEntity
import com.mogo.eagle.core.data.msgbox.FMInfoMsg
import com.mogo.eagle.core.data.msgbox.MsgFmData
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.utilcode.util.FileUtils.millis2String
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.zhjt.mogo_core_function_devatools.badcase.biz.InitiativeBadCaseWindow
import java.io.File
import java.io.FileOutputStream
@@ -33,7 +35,7 @@ object RecordBitmapUtils {
}
/**
* 删除过期文件
* 删除过期文件
*/
fun deleteExpiredFile(currentDay: String){
val checkFileName = Environment.getExternalStorageDirectory().absolutePath + File.separator+ "MapScreen"
@@ -50,6 +52,27 @@ object RecordBitmapUtils {
}
}
fun deleteReportedImage(path: String){
val screenFile = File(path)
if(screenFile.exists()){
screenFile.delete()
}
}
fun checkHasImage(recordKey: Long): Boolean{
var checkResult = false
val currentDay = millis2String(System.currentTimeMillis(), TimeUtils.getMdFormat())
val fileDir: String = Environment.getExternalStorageDirectory().absolutePath + File.separator+
"MapScreen" + File.separator+ currentDay + File.separator
val fileName = "$recordKey.png"
val path = fileDir + fileName
val file = File(path)
if(file.exists()){
checkResult = true
}
return checkResult
}
/**
* 在指定Bitmap中绘制文字
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 926 B

View File

@@ -100,9 +100,8 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@id/ivBagAudio"
android:src="@drawable/icon_bad_case_audio_select"
android:src="@drawable/icon_bag_look_screen"
android:layout_marginEnd="@dimen/dp_25"
android:visibility="invisible"
/>
<ImageView