[6.2.4]查看录包快照
This commit is contained in:
@@ -50,6 +50,7 @@ class BadCaseManagerView @JvmOverloads constructor(
|
||||
private var bagManagerEntity: BagManagerEntity = BagManagerEntity()
|
||||
private var clickListener: ClickListener? = null
|
||||
private var bagUploadDialog: BagUploadDialog ?= null
|
||||
private var recordScreenDialog: RecordScreenDialog ?= null
|
||||
|
||||
private var spaceTotal: Long = 0 //总空间
|
||||
private var spaceUsed: Long = 0 //已用空间
|
||||
@@ -212,6 +213,15 @@ class BadCaseManagerView @JvmOverloads constructor(
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
override fun lookMapScreen(key: Long) {
|
||||
//打开高精地图截图对话框
|
||||
if(recordScreenDialog == null){
|
||||
recordScreenDialog = RecordScreenDialog(context)
|
||||
}
|
||||
recordScreenDialog?.show()
|
||||
recordScreenDialog?.showScreenImage(key)
|
||||
}
|
||||
|
||||
})
|
||||
val linearLayoutManager = LinearLayoutManager(context)
|
||||
rvBagList.layoutManager = linearLayoutManager
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.app.Activity
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.PixelFormat
|
||||
import android.os.Bundle
|
||||
import android.os.CountDownTimer
|
||||
import android.os.Environment
|
||||
import android.os.Handler
|
||||
import android.os.SystemClock
|
||||
import android.util.DisplayMetrics
|
||||
@@ -62,6 +62,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.record.RecordManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.BadCaseNetManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.store.BadCaseReasonStore
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.util.RecordBitmapUtils
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.json.JSONArray
|
||||
@@ -641,7 +642,18 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
* 高精地图截图回调
|
||||
*/
|
||||
override fun onMapScreen(bitmap: Bitmap) {
|
||||
|
||||
//图片保存本地
|
||||
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
|
||||
if (!File(fileDir).exists()) {
|
||||
File(fileDir).mkdirs()
|
||||
}
|
||||
RecordBitmapUtils.bitmap2Path(bitmap,path)
|
||||
//遍历是否有非当日的文件并删除
|
||||
RecordBitmapUtils.deleteExpiredFile(currentDay)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.app.Activity
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.PixelFormat
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.os.Handler
|
||||
import android.util.DisplayMetrics
|
||||
import android.util.Log
|
||||
@@ -56,6 +57,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.BadCaseAnalyticsManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.BadReasonListAdapter
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.BadCaseNetManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.repository.store.BadCaseReasonStore
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.util.RecordBitmapUtils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONException
|
||||
@@ -611,7 +613,18 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
* 高精地图截图回调
|
||||
*/
|
||||
override fun onMapScreen(bitmap: Bitmap) {
|
||||
super.onMapScreen(bitmap)
|
||||
//图片保存本地
|
||||
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
|
||||
if (!File(fileDir).exists()) {
|
||||
File(fileDir).mkdirs()
|
||||
}
|
||||
RecordBitmapUtils.bitmap2Path(bitmap,path)
|
||||
//遍历是否有非当日的文件并删除
|
||||
RecordBitmapUtils.deleteExpiredFile(currentDay)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,14 +51,16 @@ public class RecordScreenDialog extends Dialog {
|
||||
}
|
||||
|
||||
private void initEvent(){
|
||||
String imagePath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator+
|
||||
"MapScreen" + File.separator+ millis2String(System.currentTimeMillis(),getMdFormat()) + File.separator+"test.png";
|
||||
Uri imageUri = Uri.parse(imagePath);
|
||||
|
||||
ivScreen.setImageURI(imageUri);
|
||||
|
||||
//关闭当前弹窗
|
||||
ivScreenClose.setOnClickListener(view -> dismiss());
|
||||
}
|
||||
|
||||
public void showScreenImage(Long recordKey){
|
||||
String imagePath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator+
|
||||
"MapScreen" + File.separator+ millis2String(System.currentTimeMillis(),getMdFormat()) + File.separator+recordKey+".png";
|
||||
Uri imageUri = Uri.parse(imagePath);
|
||||
|
||||
ivScreen.setImageURI(imageUri);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -113,6 +113,11 @@ class BagManagerListAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
}
|
||||
}
|
||||
|
||||
holder.ivMapScreen.setOnClickListener {
|
||||
bagInfoEntity.description?.let {
|
||||
bagClickListener?.lookMapScreen(bagInfoEntity.key)
|
||||
}
|
||||
}
|
||||
|
||||
if(bagInfoEntity.description?.hasAudio == true){
|
||||
holder.ivBagAudio.visibility = View.VISIBLE
|
||||
@@ -161,6 +166,7 @@ class BagManagerListAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
var ivBagAudio: ImageView = itemView.findViewById(R.id.ivBagAudio)
|
||||
var tvBagTime: TextView = itemView.findViewById(R.id.tvBagTime)
|
||||
var tvBagSize: TextView = itemView.findViewById(R.id.tvBagSize)
|
||||
var ivMapScreen: ImageView = itemView.findViewById(R.id.ivMapScreen)
|
||||
}
|
||||
|
||||
fun setListener(listener: BagClickListener){
|
||||
@@ -176,6 +182,8 @@ class BagManagerListAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
fun editDescription(key: Long,description: BagDescriptionEntity)
|
||||
//听录音
|
||||
fun bagAudio(key: Long,audioUrl: String)
|
||||
//查看高精地图截图
|
||||
fun lookMapScreen(key: Long)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.util
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.os.Environment
|
||||
import android.util.Log
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.biz.InitiativeBadCaseWindow
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.OutputStream
|
||||
|
||||
object RecordBitmapUtils {
|
||||
|
||||
/**
|
||||
* 将Bitmap保存到本地
|
||||
*/
|
||||
fun bitmap2Path(bitmap: Bitmap, path: String?): String? {
|
||||
try {
|
||||
val os: OutputStream = FileOutputStream(path)
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, os)
|
||||
os.flush()
|
||||
os.close()
|
||||
} catch (e: java.lang.Exception) {
|
||||
Log.e(InitiativeBadCaseWindow.TAG, "bitmap2Path Exception", e)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除过期文件
|
||||
*/
|
||||
fun deleteExpiredFile(currentDay: String){
|
||||
val checkFileName = Environment.getExternalStorageDirectory().absolutePath + File.separator+ "MapScreen"
|
||||
val checkFileFolder = File(checkFileName)
|
||||
if(checkFileFolder.exists()){
|
||||
checkFileFolder.listFiles()?.forEach {dir->
|
||||
if(dir.name != currentDay && dir.isDirectory){
|
||||
dir.listFiles()?.forEach { file->
|
||||
file.delete()
|
||||
}
|
||||
dir.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 在指定Bitmap中绘制文字
|
||||
*/
|
||||
fun drawTextOnBitmap(bitmap: Bitmap, text: String?, x: Int, y: Int): Bitmap? {
|
||||
val mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true)
|
||||
val canvas = Canvas(mutableBitmap)
|
||||
val paint = Paint()
|
||||
paint.color = Color.RED
|
||||
paint.textSize = 100f
|
||||
paint.isAntiAlias = true
|
||||
canvas.drawText(text!!, x.toFloat(), y.toFloat(), paint)
|
||||
return mutableBitmap
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,6 +62,17 @@
|
||||
android:layout_marginEnd="30dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivMapScreen"
|
||||
android:layout_width="@dimen/dp_44"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
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:layout_marginEnd="20dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBagTime"
|
||||
android:layout_width="110dp"
|
||||
@@ -69,8 +80,8 @@
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="26dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/ivBagAudio"
|
||||
android:layout_marginEnd="30dp"
|
||||
app:layout_constraintRight_toLeftOf="@id/ivMapScreen"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="start"
|
||||
/>
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ message BagDescription{
|
||||
optional bool hasAudio = 2; // 此bag是否具有录音文件
|
||||
optional string audioUrl = 3; // bag附加录音文件的文件名
|
||||
optional bool reportBI = 4; //上报BI状态
|
||||
optional bool isPassive = 5; // 是否是被动录包,true代表是被动录包,false代表是主动录包
|
||||
optional bool recordFail = 6; //录包是否失败,fasle代表录包成功,true代表录包失败
|
||||
}
|
||||
|
||||
// 各主机上报的包信息
|
||||
|
||||
@@ -127,6 +127,7 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
|
||||
mMapView.setOnMapViewVisualAngleChangeListener(this)
|
||||
mMapView.setOnRoadInfoListener(this, 1)
|
||||
mMapView.setOnRoadSideFenceRegionListener(this,5000)
|
||||
mMapView.registerScreenListener(this)
|
||||
registerLogListener(this, mMapView.getEventController())
|
||||
d(M_MAP + TAG, "initListeners - setOnMapStyleListener - view $mMapView")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user