Merge branch 'dev_arch_opt_3.0' into dev_robosweeper-d_app-module_221230_1.1.0
# Conflicts: # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java # app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java # app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java
This commit is contained in:
@@ -158,6 +158,10 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
BadCaseManager.showBadCaseConfigWindow(ctx)
|
||||
}
|
||||
|
||||
override fun showBadCaseManagerView(context: Context) {
|
||||
BadCaseManager.showBadCaseManagerWindow(context)
|
||||
}
|
||||
|
||||
override fun downLoadPackage(downloadKey: String, downloadUrl: String) {
|
||||
upgradeManager.downLoadPackage(mContext!!, downloadKey, downloadUrl)
|
||||
}
|
||||
@@ -239,4 +243,8 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
}
|
||||
|
||||
override fun apmEnvProvider(): IApmEnvProvider = apmEnvProvider
|
||||
|
||||
override fun queryObuUpgrade(obuVersionName: String) {
|
||||
bindingCarManager.queryObuUpgrade(obuVersionName)
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,16 @@ package com.zhjt.mogo_core_function_devatools.apm
|
||||
|
||||
import android.os.Process
|
||||
import android.text.TextUtils
|
||||
import android.util.*
|
||||
import android.widget.Toast
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_INIT_ENV_RESTART
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_INIT
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
|
||||
import com.mogo.eagle.core.function.api.devatools.apm.*
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.zhjt.mogo_core_function_devatools.apm.config.*
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
|
||||
import kotlinx.coroutines.*
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
@@ -53,7 +57,6 @@ object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
return
|
||||
}
|
||||
launch {
|
||||
Log.d(TAG, "onEnvChanged[1]:[buildType: $buildType, netType:$netType, dockerVersion:$dockerVersion]")
|
||||
var buildTypeChanged = false
|
||||
if (ApmEnvConfig.getBuildType() != buildType) {
|
||||
buildTypeChanged = true
|
||||
@@ -80,10 +83,9 @@ object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
isEnvValid = buildType == "0" || (buildType == "1" && netType == DebugConfig.NET_MODE_RELEASE.toString() && dockerVersion.endsWith("release", true))
|
||||
}
|
||||
val appRelaunched = ApmEnvConfig.isAppRelaunched()
|
||||
Log.d(TAG, "onEnvChanged[2]: buildTypeChanged: $buildTypeChanged, netTypeChanged: $netTypeChanged, dockerVersionChanged:$dockerVersionChanged], isAppLaunched:$appRelaunched")
|
||||
if ((!isEnvValid || (buildTypeChanged || netTypeChanged || dockerVersionChanged)) && !appRelaunched) {
|
||||
ApmEnvConfig.setAppRelaunched(true)
|
||||
restartApp()
|
||||
restartApp("buildType:$buildType,netType:$netType,dockerVersion:$dockerVersion")
|
||||
return@launch
|
||||
}
|
||||
if (isFirstDockerVersionSet) {
|
||||
@@ -108,9 +110,16 @@ object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
}
|
||||
}
|
||||
|
||||
private fun restartApp() {
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
|
||||
linkCode = CHAIN_LINK_INIT,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_INIT_ENV_RESTART,
|
||||
paramIndexes = [0],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
private fun restartApp(envStr:String) {
|
||||
launch(Dispatchers.Main) {
|
||||
Log.d(TAG, "restartApp ---")
|
||||
Toast.makeText(Utils.getApp(), "发现系统环境不一致,正在重启...", Toast.LENGTH_SHORT).show()
|
||||
delay(50)
|
||||
Utils.getApp().startActivity(Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName))
|
||||
|
||||
@@ -101,6 +101,22 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示BadCase录包管理页面
|
||||
*/
|
||||
fun showBadCaseManagerWindow(context: Context){
|
||||
val badCaseManagerView = BadCaseManagerView(context)
|
||||
badCaseManagerView.setOnClickListener(object: BadCaseManagerView.ClickListener{
|
||||
override fun onClose() {
|
||||
hideFloat?.invoke()
|
||||
hideFloat = null
|
||||
}
|
||||
})
|
||||
context.enqueuePop(badCaseManagerView,AutoSizeUtils.dp2px(context,960f), WindowManager.LayoutParams.MATCH_PARENT, key = "BadCaseManagerView").also {
|
||||
hideFloat = it
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 主动采集BadCase
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.RecordTemplateA
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
|
||||
import kotlinx.android.synthetic.main.layout_badcase_config.view.*
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import java.lang.Exception
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,521 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Handler
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import bag_manager.BagManagerOuterClass
|
||||
import com.mogo.eagle.core.data.badcase.BagDescriptionEntity
|
||||
import com.mogo.eagle.core.data.badcase.BagInfoEntity
|
||||
import com.mogo.eagle.core.data.badcase.BagManagerEntity
|
||||
import com.mogo.eagle.core.data.badcase.SubBagEntity
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.zhidao.loglib.download.DownloadManager
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.BagManagerListAdapter
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig.bagManagerList
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.record.Audition
|
||||
import kotlinx.android.synthetic.main.layout_badcase_manager.view.*
|
||||
import java.util.*
|
||||
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description BadCase录包管理页面
|
||||
* @since: 2022/12/15
|
||||
*/
|
||||
class BadCaseManagerView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotRecordListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "BadCaseManagerView"
|
||||
}
|
||||
|
||||
private var bagManagerListAdapter: BagManagerListAdapter ?= null
|
||||
private var bagManagerEntity: BagManagerEntity = BagManagerEntity()
|
||||
private var clickListener: ClickListener? = null
|
||||
private var bagUploadDialog: BagUploadDialog ?= null
|
||||
|
||||
private var spaceTotal: Long = 0 //总空间
|
||||
private var spaceUsed: Long = 0 //已用空间
|
||||
private var spaceFree: Long = 0 //可用空间
|
||||
|
||||
private var selectedBagNum = 0 //选中Bag包的数量
|
||||
private var selectedBagSize: Long = 0 //选中Bag包的大小
|
||||
|
||||
private val audioSavePath = "/mnt/sdcard/mogo/"
|
||||
|
||||
private var isNameModify = false
|
||||
|
||||
private val deleteDataList: ArrayList<BagInfoEntity> = ArrayList()
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_badcase_manager, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView(){
|
||||
background = ColorDrawable(Color.parseColor("#F0151D41"))
|
||||
clLayout.setOnClickListener {
|
||||
}
|
||||
//关闭BadCase管理窗口
|
||||
ivManagerClose.setOnClickListener {
|
||||
clickListener?.onClose()
|
||||
}
|
||||
//一键全选
|
||||
tvSelectAll.setOnClickListener {
|
||||
if(bagManagerEntity.bagsInfoResp.size>0){
|
||||
selectedBagSize = 0
|
||||
selectedBagNum = 0
|
||||
bagManagerList.clear()
|
||||
for(selectBagInfo in bagManagerEntity.bagsInfoResp){
|
||||
if(selectBagInfo.itemType == 0){
|
||||
selectBagInfo.selectStatus = true
|
||||
selectedBagSize += selectBagInfo.totalSize
|
||||
bagManagerList.add(selectBagInfo)
|
||||
selectedBagNum++
|
||||
}
|
||||
}
|
||||
//显示选择包的个数和大小
|
||||
tvSelectedBagSize.text = "已选${selectedBagNum}个包,共${selectedBagSize/(1000*1024*1024)}G"
|
||||
tvSelectedBagSize.visibility = View.VISIBLE
|
||||
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
|
||||
}
|
||||
}
|
||||
//取消选中
|
||||
tvCancelSelect.setOnClickListener {
|
||||
if(bagManagerEntity.bagsInfoResp.size>0){
|
||||
for(cancelBagInfo in bagManagerEntity.bagsInfoResp){
|
||||
cancelBagInfo.selectStatus = false
|
||||
bagManagerList.remove(cancelBagInfo)
|
||||
}
|
||||
selectedBagNum = 0
|
||||
selectedBagSize = 0
|
||||
tvSelectedBagSize.visibility = View.GONE
|
||||
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//上传Cos桶
|
||||
tvUploadCloud.setOnClickListener {
|
||||
if(bagManagerList.size>0){
|
||||
bagManagerEntity.reqType = 3
|
||||
bagManagerEntity.keyReq = bagManagerList[0].key
|
||||
Log.i("sendBagManagerCmd","bagManagerEntity.keyReq="+bagManagerEntity.keyReq)
|
||||
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
|
||||
|
||||
bagUploadDialog = BagUploadDialog(context)
|
||||
bagUploadDialog?.setListener { //删除选择,取消上传
|
||||
bagManagerList.clear()
|
||||
if (bagManagerEntity.bagsInfoResp.size > 0) {
|
||||
for (cancelBagInfo in bagManagerEntity.bagsInfoResp) {
|
||||
if(cancelBagInfo.itemType == 0){
|
||||
cancelBagInfo.selectStatus = false
|
||||
bagManagerList.remove(cancelBagInfo)
|
||||
}
|
||||
}
|
||||
selectedBagNum = 0
|
||||
selectedBagSize = 0
|
||||
tvSelectedBagSize.visibility = View.GONE
|
||||
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
|
||||
}
|
||||
}
|
||||
bagUploadDialog?.show()
|
||||
bagUploadDialog?.setAllUpload(selectedBagNum,selectedBagSize)
|
||||
}else{
|
||||
ToastUtils.showShort("请先选择要上传的Bag包")
|
||||
}
|
||||
|
||||
}
|
||||
//删除Bag包
|
||||
tvDeleteSelect.setOnClickListener {
|
||||
if(bagManagerList.size>0){
|
||||
bagManagerEntity.reqType = 4
|
||||
bagManagerEntity.keyReq = bagManagerList[0].key
|
||||
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
|
||||
}else{
|
||||
ToastUtils.showShort("请先选择要删除的Bag包")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bagManagerListAdapter = BagManagerListAdapter()
|
||||
bagManagerListAdapter?.setListener(object :BagManagerListAdapter.BagClickListener{
|
||||
override fun onClick(bagInfoEntity: BagInfoEntity, isChecked: Boolean) {
|
||||
if(isChecked){
|
||||
bagInfoEntity.selectStatus = true
|
||||
bagManagerList.add(bagInfoEntity)
|
||||
selectedBagNum++
|
||||
selectedBagSize += bagInfoEntity.totalSize
|
||||
tvSelectedBagSize.text = "已选${selectedBagNum}个包,共${selectedBagSize/(1000*1024*1024)}G"
|
||||
tvSelectedBagSize.visibility = View.VISIBLE
|
||||
}else{
|
||||
bagInfoEntity.selectStatus = false
|
||||
bagManagerList.remove(bagInfoEntity)
|
||||
selectedBagNum--
|
||||
selectedBagSize -= bagInfoEntity.totalSize
|
||||
if(selectedBagNum == 0){
|
||||
tvSelectedBagSize.visibility = View.GONE
|
||||
}else{
|
||||
tvSelectedBagSize.text = "已选${selectedBagNum}个包,共${selectedBagSize/(1000*1024*1024)}G"
|
||||
tvSelectedBagSize.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun uploadBI(bagInfoEntity: BagInfoEntity) {
|
||||
//展示上报弹窗
|
||||
val initiativeBadCaseWindow = InitiativeBadCaseWindow(context as Activity)
|
||||
initiativeBadCaseWindow.setClickListener(object: InitiativeBadCaseWindow.ClickListener{
|
||||
override fun closeWindow() {
|
||||
initiativeBadCaseWindow.hideFloatWindow()
|
||||
}
|
||||
})
|
||||
initiativeBadCaseWindow.showReportBIWindow(bagInfoEntity)
|
||||
}
|
||||
|
||||
override fun editDescription(key: Long, description: BagDescriptionEntity) {
|
||||
//编辑Bag包描述信息
|
||||
isNameModify = true
|
||||
bagManagerEntity.reqType = 5
|
||||
bagManagerEntity.keyReq = key
|
||||
bagManagerEntity.descReq = description
|
||||
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
|
||||
}
|
||||
|
||||
override fun bagAudio(key: Long, audioUrl: String) {
|
||||
DownloadManager.getInstance().init(context)
|
||||
val downUrl = audioUrl.replace("http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/","")
|
||||
DownloadManager.getInstance().download(downUrl,
|
||||
audioSavePath,"${key}.wav")
|
||||
//延迟播放
|
||||
Handler().postDelayed({
|
||||
//音频文件播放
|
||||
Audition.getInstance().playOrStop("${audioSavePath}${key}.wav")
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
})
|
||||
val linearLayoutManager = LinearLayoutManager(context)
|
||||
rvBagList.layoutManager = linearLayoutManager
|
||||
rvBagList.adapter = bagManagerListAdapter
|
||||
|
||||
//音频文件播放
|
||||
// Audition.getInstance().playOrStop("/mnt/sdcard/mogo/test.wav")
|
||||
//
|
||||
// 音频下载
|
||||
// DownloadManager.getInstance().init(context)
|
||||
// DownloadManager.getInstance().download("CarPad/mogopadlog/X20202111230C01YYW/2023-01-30/Audio_1675049657187_BadCase.wav",
|
||||
// "/mnt/sdcard/mogo/","test13.wav")
|
||||
|
||||
}
|
||||
|
||||
fun setOnClickListener(clickListener: ClickListener) {
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
|
||||
interface ClickListener {
|
||||
fun onClose()
|
||||
}
|
||||
|
||||
override fun onBagManagerResult(bagManager: BagManagerOuterClass.BagManager) {
|
||||
super.onBagManagerResult(bagManager)
|
||||
UiThreadHandler.post {
|
||||
Log.i(TAG,"onBagManagerResult Start")
|
||||
Log.i(TAG,"keyReq="+bagManager.keyReq)
|
||||
Log.i(TAG,"reqType="+bagManager.reqType)
|
||||
Log.i(TAG,"uploadCosResp stat="+bagManager.uploadCosResp.stat)
|
||||
Log.i(TAG,"descReq description="+bagManager.descReq.description
|
||||
+" audioUrl="+bagManager.descReq.audioUrl
|
||||
+" reportBI="+bagManager.descReq.reportBI
|
||||
+" hasAudio="+bagManager.descReq.hasAudio)
|
||||
for(logBag in bagManager.bagsInfoRespList){
|
||||
Log.i(TAG,"bagPath="+logBag.bagPath)
|
||||
Log.i(TAG,"timestamp="+logBag.timestamp)
|
||||
Log.i(TAG,"description="+logBag.description)
|
||||
Log.i(TAG,"key="+logBag.key)
|
||||
Log.i(TAG,"mergeStat="+logBag.mergeStat)
|
||||
Log.i(TAG,"totalSize="+logBag.totalSize)
|
||||
Log.i(TAG,"uploadStat="+logBag.uploadStat)
|
||||
}
|
||||
Log.i(TAG,"onBagManagerResult End")
|
||||
|
||||
//获取空间使用信息
|
||||
if(bagManager.reqType == 1){
|
||||
//遍历各个主机的硬盘空间信息
|
||||
if(bagManager.spaceInfoRespCount>0){
|
||||
spaceTotal = 0
|
||||
spaceUsed = 0
|
||||
spaceFree = 0
|
||||
for(spaceInfo in bagManager.spaceInfoRespList){
|
||||
spaceInfo.diskSpaceInfo?.let {
|
||||
spaceTotal += it.total
|
||||
spaceUsed += it.used
|
||||
spaceFree += it.free
|
||||
}
|
||||
}
|
||||
//展示空间使用情况
|
||||
//已使用空间
|
||||
tvUsedSpaceContent.text = "${(spaceUsed/(1000*1024*1024L))}G"
|
||||
//可使用空间
|
||||
tvFreeSpaceContent.text = "${(spaceFree/(1000*1024*1024L))}G"
|
||||
//进度条展示空间
|
||||
pbSpacePercent.progress = (spaceUsed*100/spaceTotal).toInt()
|
||||
}
|
||||
}
|
||||
//遍历所有bag
|
||||
else if(bagManager.reqType == 2){
|
||||
clBagHaveDataLayout.visibility = View.VISIBLE
|
||||
clBagNoDataLayout.visibility = View.GONE
|
||||
if(bagManager.bagsInfoRespCount>0){
|
||||
bagManagerEntity.bagsInfoResp.clear()
|
||||
val originBagInfoList = ArrayList<BagInfoEntity>()
|
||||
for(bagInfo in bagManager.bagsInfoRespList){
|
||||
bagInfo?.let {
|
||||
val descriptionEntity = BagDescriptionEntity(it.description.description,it.description.hasAudio,it.description.audioUrl,it.description.reportBI)
|
||||
val bagInfoEntity = BagInfoEntity()
|
||||
bagInfoEntity.key = it.key
|
||||
bagInfoEntity.totalSize = it.totalSize
|
||||
bagInfoEntity.timestamp = it.timestamp
|
||||
bagInfoEntity.bagPath = it.bagPath
|
||||
bagInfoEntity.mergeStat = it.mergeStat
|
||||
bagInfoEntity.uploadStat = it.uploadStat
|
||||
bagInfoEntity.itemType = 0
|
||||
bagInfoEntity.description = descriptionEntity
|
||||
for(subBag in it.subBagsList){
|
||||
val subBagEntity = SubBagEntity(subBag.key,subBag.host,subBag.size)
|
||||
bagInfoEntity.subBags.add(subBagEntity)
|
||||
}
|
||||
originBagInfoList.add(bagInfoEntity)
|
||||
//对数组按照时间顺序进行倒序排序
|
||||
originBagInfoList.sortWith(Comparator { o1, o2 ->
|
||||
o2.timestamp.compareTo(o1.timestamp)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
for(originBagInfo in originBagInfoList){
|
||||
originBagInfo.let {
|
||||
it.timestamp.let { time ->
|
||||
val month = time.substring(4,6)
|
||||
val day = time.substring(6,8)
|
||||
val timeStr = "${month}月${day}日"
|
||||
var containTime = false
|
||||
for(bag in bagManagerEntity.bagsInfoResp){
|
||||
if(bag.timeStr == timeStr){
|
||||
containTime = true
|
||||
}
|
||||
}
|
||||
if(!containTime || bagManagerEntity.bagsInfoResp.size ==0){
|
||||
//增加时间的
|
||||
val bagInfoTimeEntity = BagInfoEntity()
|
||||
bagInfoTimeEntity.itemType = 1
|
||||
bagInfoTimeEntity.timeStr = timeStr
|
||||
bagInfoTimeEntity.timestamp = time.substring(0,8)
|
||||
bagManagerEntity.bagsInfoResp.add(bagInfoTimeEntity)
|
||||
}
|
||||
var containKey = false
|
||||
for(bagInfoContain in bagManagerEntity.bagsInfoResp){
|
||||
if(bagInfoContain.key == it.key){
|
||||
containKey = true
|
||||
}
|
||||
}
|
||||
if(!containKey){
|
||||
bagManagerEntity.bagsInfoResp.add(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//更新List
|
||||
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
|
||||
}
|
||||
|
||||
// 开启定时查询速度
|
||||
Timer().schedule(timerTaskRefresh, Date(), 60*1000)
|
||||
}
|
||||
//上传Cos
|
||||
else if(bagManager.reqType == 3){
|
||||
//此处应循环上传Cos
|
||||
val uploadIterator = bagManagerEntity.bagsInfoResp.iterator()
|
||||
while(uploadIterator.hasNext()){
|
||||
val uploadBagInfo = uploadIterator.next()
|
||||
if(uploadBagInfo.key == bagManager.uploadCosResp.key && bagManager.uploadCosResp.stat!=1){
|
||||
bagManagerList.remove(uploadBagInfo)
|
||||
if(bagManagerList.size>0){
|
||||
var remainSize = 0L
|
||||
for(bagInfo in bagManagerList){
|
||||
remainSize += bagInfo.totalSize
|
||||
}
|
||||
bagUploadDialog?.updateRemainUpload(bagManagerList.size,remainSize)
|
||||
//执行下一个上传Bag命令
|
||||
bagManagerEntity.reqType = 3
|
||||
bagManagerEntity.keyReq = bagManagerList[0].key
|
||||
Log.i("sendBagManagerCmd","bagManagerEntity.keyReq="+bagManagerEntity.keyReq)
|
||||
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
|
||||
}
|
||||
}
|
||||
}
|
||||
//上传Cos执行完成
|
||||
if(bagManagerList.size == 0 && selectedBagNum != 0){
|
||||
ToastUtils.showShort("上传命令完成")
|
||||
bagUploadDialog?.uploadCompleted()
|
||||
tvCancelSelect.performClick()
|
||||
}
|
||||
|
||||
when (bagManager.uploadCosResp.stat) {
|
||||
0 -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶成功")
|
||||
}
|
||||
1 -> {
|
||||
//执行中
|
||||
}
|
||||
2 -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶执行python失败")
|
||||
}
|
||||
3 -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶拷贝过程失败")
|
||||
}
|
||||
4 -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶合并过程失败")
|
||||
}
|
||||
5 -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶上传过程失败")
|
||||
}
|
||||
else -> {
|
||||
ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶 ${bagManager.uploadCosResp.message}")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//删除Bag
|
||||
else if(bagManager.reqType == 4){
|
||||
//收到此回调就删除对应key的Bag
|
||||
val iterator = bagManagerEntity.bagsInfoResp.iterator()
|
||||
while(iterator.hasNext()){
|
||||
val deleteBagInfo = iterator.next()
|
||||
if(deleteBagInfo.key == bagManager.keyReq){
|
||||
iterator.remove()
|
||||
bagManagerList.remove(deleteBagInfo)
|
||||
//更新列表
|
||||
// bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
|
||||
}
|
||||
}
|
||||
//遍历列表,如当天Bag全部删除,同时把日期标题也删除更新列表
|
||||
deleteDataList.clear()
|
||||
val titleIterator = bagManagerEntity.bagsInfoResp.iterator()
|
||||
while(titleIterator.hasNext()){
|
||||
val titleBagInfo = titleIterator.next()
|
||||
if(titleBagInfo.itemType == 1){
|
||||
val bagIterator = bagManagerEntity.bagsInfoResp.iterator()
|
||||
var hasBag = false
|
||||
var bagBagInfo: BagInfoEntity ?= null
|
||||
while(bagIterator.hasNext()){
|
||||
bagBagInfo = bagIterator.next()
|
||||
if(bagBagInfo.itemType == 0){
|
||||
bagBagInfo.timestamp.let {
|
||||
if(it.contains(titleBagInfo.timestamp)){
|
||||
hasBag = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!hasBag){
|
||||
// bagIterator.remove()
|
||||
titleBagInfo.let { deleteDataList.add(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(deleteDataList.isNotEmpty()){
|
||||
val deleteIterator = bagManagerEntity.bagsInfoResp.iterator()
|
||||
while(deleteIterator.hasNext()){
|
||||
val deleteInfo = deleteIterator.next()
|
||||
if(deleteDataList.contains(deleteInfo)){
|
||||
deleteIterator.remove()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(bagManagerList.size == 0){
|
||||
tvCancelSelect.performClick()
|
||||
}
|
||||
|
||||
if(bagManagerList.size>0){
|
||||
//继续执行删除命令
|
||||
bagManagerEntity.reqType = 4
|
||||
bagManagerEntity.keyReq = bagManagerList[0].key
|
||||
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
|
||||
}
|
||||
|
||||
//更新列表
|
||||
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
|
||||
}
|
||||
//修改bag附加信息
|
||||
else if(bagManager.reqType == 5){
|
||||
//更新Bag包上报状态
|
||||
for(bagInfo in bagManagerEntity.bagsInfoResp){
|
||||
if(bagInfo.key == bagManager.keyReq){
|
||||
bagInfo.description?.let {
|
||||
it.reportBI = bagManager.descReq.reportBI
|
||||
it.description = bagManager.descReq.description
|
||||
it.hasAudio = bagManager.descReq.hasAudio
|
||||
it.audioUrl = bagManager.descReq.audioUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isNameModify){
|
||||
//更新List
|
||||
bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp)
|
||||
}
|
||||
isNameModify = false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerAutopilotRecordListenerManager.addListener(TAG, this)
|
||||
bagManagerEntity.reqType = 2
|
||||
//遍历所有bag
|
||||
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerAutopilotRecordListenerManager.removeListener(TAG)
|
||||
try {
|
||||
timerTaskRefresh.cancel()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private val timerTaskRefresh = object : TimerTask() {
|
||||
override fun run() {
|
||||
UiThreadHandler.post {
|
||||
//获取空间使用信息,每隔1分钟获取一次
|
||||
bagManagerEntity.reqType = 1
|
||||
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.zhjt.mogo_core_function_devatools.R;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description Bag包上传进度展示弹窗
|
||||
* @since: 2022/2/1
|
||||
*/
|
||||
public class BagUploadDialog extends Dialog {
|
||||
|
||||
private TextView tvCancelUpload;//取消上传
|
||||
private TextView tvCancel;//取消
|
||||
private TextView tvUploadDetail;//上传详情
|
||||
private ProgressBar viewUploadProgress;//上传进度条
|
||||
|
||||
private int totalNum = 0;
|
||||
private Long totalSize = 0L;
|
||||
private int remainNum = 0;
|
||||
private Long remainSize = 0L;
|
||||
|
||||
private BagUploadListener uploadListener;
|
||||
private DecimalFormat format = new DecimalFormat("0.0");
|
||||
|
||||
public BagUploadDialog(@NonNull Context context) {
|
||||
super(context, R.style.bad_case_dialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.dialog_bag_upload);
|
||||
WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.height = 688;
|
||||
params.width = 1110;
|
||||
getWindow().setAttributes(params);//向WindowManager设置属性
|
||||
setCanceledOnTouchOutside(false);
|
||||
init();
|
||||
initEvent();
|
||||
}
|
||||
|
||||
private void init(){
|
||||
tvCancelUpload = findViewById(R.id.tvCancelUpload);
|
||||
tvCancel = findViewById(R.id.tvCancel);
|
||||
tvUploadDetail = findViewById(R.id.tvUploadDetail);
|
||||
viewUploadProgress = findViewById(R.id.viewUploadProgress);
|
||||
}
|
||||
|
||||
private void initEvent(){
|
||||
//取消上传
|
||||
tvCancelUpload.setOnClickListener(v -> {
|
||||
if(uploadListener!=null){
|
||||
uploadListener.cancelUpload();
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
//取消
|
||||
tvCancel.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
|
||||
public void setListener(BagUploadListener listener){
|
||||
uploadListener = listener;
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void setAllUpload(int totalNum, Long totalSize){
|
||||
this.totalNum = totalNum;
|
||||
this.totalSize = totalSize;
|
||||
//更新进度条和进度文字
|
||||
String totalStr = format.format((totalSize/(1000*1024*1024.0)));
|
||||
tvUploadDetail.setText("共计"+totalNum+"个包 ("+totalStr+"G) 已上传"+(0)+"个包 ("
|
||||
+0+"G) 剩余"+totalNum+"个包 ("+ totalStr+"G)");
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void updateRemainUpload(int remainNum, Long remainSize){
|
||||
this.remainNum = remainNum;
|
||||
this.remainSize = remainSize;
|
||||
//更新进度条和进度文字
|
||||
String updateTotalStr = format.format((totalSize/(1000*1024*1024.0)));
|
||||
String updateUploadStr = format.format(((totalSize-remainSize)/(1000*1024*1024.0)));
|
||||
String updateRemainStr = format.format((remainSize/(1000*1024*1024.0)));
|
||||
tvUploadDetail.setText("共计"+totalNum+"个包 ("+updateTotalStr+"G) 已上传"+(totalNum-remainNum)+"个包 ("
|
||||
+updateUploadStr+"G) 剩余"+remainNum+"个包 ("+ updateRemainStr +"G)");
|
||||
viewUploadProgress.setProgress((totalNum-remainNum)*100/totalNum);
|
||||
}
|
||||
|
||||
public void uploadCompleted(){
|
||||
dismiss();
|
||||
}
|
||||
|
||||
interface BagUploadListener{
|
||||
//取消上传
|
||||
void cancelUpload();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import bag_manager.BagManagerOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
@@ -116,4 +117,8 @@ public class CaseListDialog extends Dialog implements IMoGoAutopilotRecordListen
|
||||
caseListAdapter.notifyDataSetChanged();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBagManagerResult(@NonNull BagManagerOuterClass.BagManager bagManager) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import bag_manager.BagManagerOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
@@ -203,4 +204,8 @@ public class CaseTopicListDialog extends Dialog implements IMoGoAutopilotRecordL
|
||||
@Override
|
||||
public void onAutopilotRecordResult(@NonNull RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBagManagerResult(@NonNull BagManagerOuterClass.BagManager bagManager) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.badcase.BagDescriptionEntity
|
||||
import com.mogo.eagle.core.data.badcase.BagInfoEntity
|
||||
import com.mogo.eagle.core.data.badcase.BagManagerEntity
|
||||
import com.mogo.eagle.core.data.badcase.RecordCaseEntity
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
@@ -36,8 +39,10 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.record.RecordManager
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.io.File
|
||||
import java.lang.StringBuilder
|
||||
import java.util.*
|
||||
|
||||
|
||||
@@ -77,17 +82,17 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
private lateinit var tvInitiativeCancel: TextView
|
||||
|
||||
private var audioStatus = false
|
||||
private var audioFileName: String? = null //录音文件名称
|
||||
private var audioFileName:String?=null //录音文件名称
|
||||
|
||||
private var uploadReason: StringBuilder = StringBuilder() //上报原因,标签
|
||||
|
||||
@Volatile
|
||||
private var recordKey: String? = null //录制bag包key
|
||||
|
||||
private var recordKey: String?=null //录制bag包key
|
||||
@Volatile
|
||||
private var recordFileName: String? = null //录制文件包名
|
||||
private var longitude: Double? = null
|
||||
private var latitude: Double? = null
|
||||
private var recordFileName: String?=null //录制文件包名
|
||||
private var longitude: Double?=null
|
||||
private var latitude: Double?=null
|
||||
|
||||
private var bagManagerEntity: BagManagerEntity = BagManagerEntity()
|
||||
|
||||
private var mInViewX = 0f
|
||||
private var mInViewY = 0f
|
||||
@@ -107,9 +112,8 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun initFloatWindow() {
|
||||
mFloatLayout =
|
||||
LayoutInflater.from(mActivity).inflate(R.layout.view_initiative_bad_case, null) as View
|
||||
private fun initFloatWindow(){
|
||||
mFloatLayout = LayoutInflater.from(mActivity).inflate(R.layout.view_initiative_bad_case, null) as View
|
||||
mFloatLayout.setOnTouchListener(this)
|
||||
|
||||
tvInitiativeNum = mFloatLayout.findViewById(R.id.tvInitiativeNum)
|
||||
@@ -128,17 +132,16 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
|
||||
tvInitiativeReport = mFloatLayout.findViewById(R.id.tvInitiativeReport)
|
||||
tvInitiativeCancel = mFloatLayout.findViewById(R.id.tvInitiativeCancel)
|
||||
if (BadCaseConfig.windowNum < 1) {
|
||||
if(BadCaseConfig.windowNum<1){
|
||||
BadCaseConfig.windowNum = 1
|
||||
}
|
||||
tvInitiativeNum.text = BadCaseConfig.windowNum.toString()
|
||||
BadCaseConfig.windowNum++
|
||||
tvInitiativeTime.text =
|
||||
"时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
|
||||
tvInitiativeTime.text = "时间:${millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat())}"
|
||||
tvInitiativeIdentity.text = "身份:${BadCaseConfig.identity}"
|
||||
|
||||
//采集结果回调监听
|
||||
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(), this)
|
||||
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(),this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(this.hashCode().toString(), this)
|
||||
viewAudioButton.setOnClickListener {
|
||||
@@ -147,37 +150,37 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
}
|
||||
|
||||
tvInitiativeReport.setOnClickListener {
|
||||
if (!rbOne.isChecked && !rbTwo.isChecked && !rbThree.isChecked &&
|
||||
!rbFour.isChecked && !rbFive.isChecked && !rbSix.isChecked
|
||||
) {
|
||||
if(!rbOne.isChecked && !rbTwo.isChecked && !rbThree.isChecked &&
|
||||
!rbFour.isChecked && !rbFive.isChecked && !rbSix.isChecked){
|
||||
TipToast.shortTip("请选择至少一个Case")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (rbOne.isChecked) {
|
||||
uploadReason.clear()
|
||||
if(rbOne.isChecked){
|
||||
uploadReason.append("严重画龙 ")
|
||||
}
|
||||
if (rbTwo.isChecked) {
|
||||
if(rbTwo.isChecked){
|
||||
uploadReason.append("速度过慢 ")
|
||||
}
|
||||
if (rbThree.isChecked) {
|
||||
if(rbThree.isChecked){
|
||||
uploadReason.append("感知、定位、地图等其他 ")
|
||||
}
|
||||
if (rbFour.isChecked) {
|
||||
if(rbFour.isChecked){
|
||||
uploadReason.append("速度过快 ")
|
||||
}
|
||||
if (rbFive.isChecked) {
|
||||
if(rbFive.isChecked){
|
||||
uploadReason.append("存在碰撞风险 ")
|
||||
}
|
||||
if (rbSix.isChecked) {
|
||||
if(rbSix.isChecked){
|
||||
uploadReason.append("点刹、顿挫")
|
||||
}
|
||||
if (audioStatus) {
|
||||
if(audioStatus){
|
||||
audioStatus = !audioStatus
|
||||
setAudio(audioStatus)
|
||||
Handler().postDelayed({
|
||||
uploadAudio()
|
||||
}, 1000)
|
||||
} else {
|
||||
uploadAudio()
|
||||
},1000)
|
||||
}else{
|
||||
uploadAudio()
|
||||
}
|
||||
}
|
||||
@@ -200,10 +203,10 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
}
|
||||
}
|
||||
|
||||
var countDownTimer: CountDownTimer? = null
|
||||
var countDownTimer: CountDownTimer?=null
|
||||
|
||||
private fun setAudio(status: Boolean) {
|
||||
if (status) {
|
||||
private fun setAudio(status: Boolean){
|
||||
if(status){
|
||||
//开始录音
|
||||
audioFileName = "Audio_${System.currentTimeMillis()}_BadCase"
|
||||
RecordManager.getInstance().start(audioFileName)
|
||||
@@ -211,11 +214,11 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
viewAudioButton.setImageResource(R.drawable.icon_bad_case_audio_select)
|
||||
tvAudioCountDown.visibility = View.VISIBLE
|
||||
//开始倒计时
|
||||
if (countDownTimer == null) {
|
||||
if(countDownTimer==null){
|
||||
countDownTimer = object : CountDownTimer(60000, 1000) {
|
||||
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
tvAudioCountDown.text = "${millisUntilFinished / 1000}S"
|
||||
tvAudioCountDown.text = "${millisUntilFinished/1000}S"
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
@@ -228,7 +231,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
}
|
||||
countDownTimer?.start()
|
||||
}
|
||||
} else {
|
||||
}else{
|
||||
//结束倒计时
|
||||
countDownTimer?.cancel()
|
||||
countDownTimer?.onFinish()
|
||||
@@ -238,13 +241,11 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
|
||||
}
|
||||
|
||||
private fun uploadAudio() {
|
||||
private fun uploadAudio(){
|
||||
val singlePath = "/mnt/sdcard/mogo/DataCollection/${audioFileName}.wav"
|
||||
val file = File(singlePath)
|
||||
if (file.exists()) {
|
||||
LogInfoManagerFactory.createAudioUpload(mActivity.applicationContext,
|
||||
"Audio",
|
||||
singlePath,
|
||||
if(file.exists()){
|
||||
LogInfoManagerFactory.createAudioUpload(mActivity.applicationContext,"Audio",singlePath,
|
||||
object : OnUploadListener {
|
||||
override fun onUploadSuccess(filePath: String, downloadUrl: String) {
|
||||
CallerLogger.d("$M_DEVA$TAG", "语音文件上传成功:downloadUrl=$downloadUrl")
|
||||
@@ -260,7 +261,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
removeUploadListener(singlePath)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
}else{
|
||||
//上传到服务器
|
||||
upload(null)
|
||||
}
|
||||
@@ -270,7 +271,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
* 将语音文件上传Cos监听移除
|
||||
* @param filePath 文件路径
|
||||
*/
|
||||
private fun removeUploadListener(filePath: String) {
|
||||
private fun removeUploadListener(filePath: String){
|
||||
val pkgInfo: List<String> = filePath.substring(
|
||||
filePath.lastIndexOf("/") + 1,
|
||||
filePath.lastIndexOf(".")
|
||||
@@ -283,21 +284,21 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
* 将记录上传到服务器
|
||||
* @param downloadUrl 语音文件下载地址
|
||||
*/
|
||||
private fun upload(downloadUrl: String?) {
|
||||
GlobalScope.launch {
|
||||
private fun upload(downloadUrl: String?){
|
||||
GlobalScope.launch{
|
||||
val uploadResult = presenter.upload(mutableMapOf<String, String>().also { itx ->
|
||||
itx["carLicense"] = AppConfigInfo.plateNumber ?: "" //车牌号
|
||||
itx["filename"] = recordFileName ?: "" //bag包文件地址
|
||||
itx["carLicense"] = AppConfigInfo.plateNumber?:"" //车牌号
|
||||
itx["filename"] = recordFileName?:"" //bag包文件地址
|
||||
itx["filesize"] = "0" //bag包文件大小
|
||||
itx["key"] = recordKey ?: "" //key
|
||||
itx["reason"] = uploadReason.toString() ?: "" //采集原因
|
||||
itx["key"] = recordKey?:"" //key
|
||||
itx["reason"] = uploadReason.toString() //采集原因
|
||||
itx["duration"] = BadCaseConfig.totalDuration.toString() //采集时长,固定为20S
|
||||
itx["startTime"] = System.currentTimeMillis().toString() //上报时间(时间戳格式)
|
||||
itx["channel"] = "1" //渠道
|
||||
itx["carSn"] = MoGoAiCloudClientConfig.getInstance().sn //SN
|
||||
itx["userRole"] = BadCaseConfig.identity //采集者角色
|
||||
itx["audioUrl"] = downloadUrl ?: "" //音频COS地址
|
||||
itx["mapVersion"] = BadCaseConfig.dockerVersion ?: "" //工控机版本
|
||||
itx["audioUrl"] = downloadUrl?:"" //音频COS地址
|
||||
itx["mapVersion"] = BadCaseConfig.dockerVersion ?:"" //工控机版本
|
||||
itx["eyeVersion"] = AppUtils.getAppVersionName() //鹰眼版本
|
||||
itx["coordinate"] = "latitude:${latitude};longitude:${longitude}" //坐标
|
||||
|
||||
@@ -306,6 +307,15 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
TipToast.shortTip("上报失败")
|
||||
} else {
|
||||
TipToast.shortTip("上报成功")
|
||||
//将上报BI的结果同步给工控机记录保存
|
||||
recordKey?.let {
|
||||
val hasAudio = downloadUrl != null
|
||||
val descReqEntity = BagDescriptionEntity(uploadReason.toString(),hasAudio,downloadUrl.toString(),true)
|
||||
bagManagerEntity.reqType = 5
|
||||
bagManagerEntity.keyReq = it.toLong()
|
||||
bagManagerEntity.descReq = descReqEntity
|
||||
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
|
||||
}
|
||||
BadCaseConfig.windowNum--
|
||||
clickListener?.closeWindow()
|
||||
}
|
||||
@@ -346,19 +356,28 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-950
|
||||
mWindowManager!!.addView(mFloatLayout, mWindowParams)
|
||||
//开启录包
|
||||
if (recordCaseEntity != null) {
|
||||
CallerAutoPilotControlManager.recordPackage(
|
||||
recordCaseEntity.caseId,
|
||||
Random(SystemClock.elapsedRealtime()).nextInt(),
|
||||
BadCaseConfig.totalDuration,
|
||||
BadCaseConfig.previousDuration,
|
||||
recordCaseEntity.topicList
|
||||
)
|
||||
} else {
|
||||
CallerAutoPilotControlManager.recordPackage(
|
||||
BadCaseConfig.type, Random(SystemClock.elapsedRealtime()).nextInt(),
|
||||
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration
|
||||
)
|
||||
if(recordCaseEntity!=null){
|
||||
CallerAutoPilotControlManager.recordPackage(recordCaseEntity.caseId,Random(SystemClock.elapsedRealtime()).nextInt(),
|
||||
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration,recordCaseEntity.topicList)
|
||||
}else{
|
||||
CallerAutoPilotControlManager.recordPackage(BadCaseConfig.type,Random(SystemClock.elapsedRealtime()).nextInt(),
|
||||
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun showReportBIWindow(bagInfoEntity: BagInfoEntity){
|
||||
if (mFloatLayout.parent == null) {
|
||||
val metrics = DisplayMetrics()
|
||||
// 默认固定位置,靠屏幕右边缘的中间
|
||||
mWindowManager!!.defaultDisplay.getMetrics(metrics)
|
||||
mWindowParams!!.x = metrics.widthPixels
|
||||
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-950
|
||||
mWindowManager!!.addView(mFloatLayout, mWindowParams)
|
||||
//已经录包无需再次启动录包,只要将录包信息同步到弹窗
|
||||
bagInfoEntity.let {
|
||||
recordKey = it.key.toString()
|
||||
recordFileName = it.bagPath
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -373,13 +392,12 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
|
||||
override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) {
|
||||
CallerLogger.d("${M_DEVA}${TAG}", "-- 收到工控机录制任务回调 -- $recordPanel")
|
||||
|
||||
ThreadUtils.runOnUiThread {
|
||||
if (recordKey == null) {
|
||||
if(recordKey==null){
|
||||
recordKey = recordPanel.key.toString()
|
||||
BadCaseConfig.recordKeyList.add(recordPanel.key)
|
||||
}
|
||||
if (recordFileName == null) {
|
||||
if(recordFileName==null){
|
||||
recordFileName = recordPanel.filename
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import android.graphics.Color
|
||||
import android.graphics.PixelFormat
|
||||
import android.os.CountDownTimer
|
||||
import android.os.Handler
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.*
|
||||
import android.widget.CheckBox
|
||||
@@ -15,10 +17,13 @@ import android.widget.TextView
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.badcase.BagDescriptionEntity
|
||||
import com.mogo.eagle.core.data.badcase.BagManagerEntity
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
@@ -28,12 +33,13 @@ import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String
|
||||
import com.zhidao.loglib.call.LogInfoManagerFactory
|
||||
import com.zhidao.loglib.upload.OnUploadListener
|
||||
import com.zhidao.loglib.upload.UploadManager
|
||||
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.record.RecordManager
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import com.zhidao.loglib.upload.UploadManager
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import java.io.File
|
||||
@@ -56,14 +62,16 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
private lateinit var mFloatLayout: View
|
||||
|
||||
private var audioStatus = false
|
||||
private var audioFileName: String? = null //录音文件名称
|
||||
private var audioFileName:String?=null //录音文件名称
|
||||
|
||||
private var bagManagerEntity: BagManagerEntity = BagManagerEntity()
|
||||
|
||||
private var uploadReason: String = String() //上报原因,标签
|
||||
private var recordKey: String? = null //录制bag包key
|
||||
private var recordFileName: String? = null //录制文件包名
|
||||
private var boxBean: MsgBoxBean? = null
|
||||
private var longitude: Double? = null
|
||||
private var latitude: Double? = null
|
||||
private var recordKey: String?=null //录制bag包key
|
||||
private var recordFileName: String?=null //录制文件包名
|
||||
private var boxBean: MsgBoxBean ?= null
|
||||
private var longitude: Double?=null
|
||||
private var latitude: Double?=null
|
||||
|
||||
private var mInViewX = 0f
|
||||
private var mInViewY = 0f
|
||||
@@ -73,7 +81,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
private var mInScreenY = 0f
|
||||
|
||||
private var clickListener: ClickListener? = null
|
||||
var countDownTimer: CountDownTimer? = null
|
||||
var countDownTimer: CountDownTimer?=null
|
||||
|
||||
private lateinit var tvPassiveNum: TextView
|
||||
private lateinit var tvPassiveTime: TextView
|
||||
@@ -96,9 +104,8 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun initFloatWindow() {
|
||||
mFloatLayout =
|
||||
LayoutInflater.from(mActivity).inflate(R.layout.view_passive_bad_case, null) as View
|
||||
private fun initFloatWindow(){
|
||||
mFloatLayout = LayoutInflater.from(mActivity).inflate(R.layout.view_passive_bad_case, null) as View
|
||||
mFloatLayout.setOnTouchListener(this)
|
||||
tvPassiveNum = mFloatLayout.findViewById(R.id.tvPassiveNum)
|
||||
tvPassiveTime = mFloatLayout.findViewById(R.id.tvPassiveTime)
|
||||
@@ -108,13 +115,12 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
tvPassiveReport = mFloatLayout.findViewById(R.id.tvPassiveReport)
|
||||
tvPassiveCancel = mFloatLayout.findViewById(R.id.tvPassiveCancel)
|
||||
flReasonLayout = mFloatLayout.findViewById(R.id.flReasonLayout)
|
||||
if (BadCaseConfig.windowNum < 1) {
|
||||
if(BadCaseConfig.windowNum<1){
|
||||
BadCaseConfig.windowNum = 1
|
||||
}
|
||||
tvPassiveNum.text = BadCaseConfig.windowNum.toString()
|
||||
BadCaseConfig.windowNum++
|
||||
tvPassiveTime.text =
|
||||
"时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
|
||||
tvPassiveTime.text = "时间:${millis2String(System.currentTimeMillis(),TimeUtils.getHourMinSecondFormat())}"
|
||||
tvPassiveIdentity.text = "身份:${BadCaseConfig.identity}"
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
|
||||
@@ -124,17 +130,17 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
}
|
||||
|
||||
tvPassiveReport.setOnClickListener {
|
||||
if (uploadReason.isEmpty()) {
|
||||
if(uploadReason.isEmpty()){
|
||||
TipToast.shortTip("请选择至少一个Case")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (audioStatus) {
|
||||
if(audioStatus){
|
||||
audioStatus = !audioStatus
|
||||
setAudio(audioStatus)
|
||||
Handler().postDelayed({
|
||||
uploadAudio()
|
||||
}, 1000)
|
||||
} else {
|
||||
},1000)
|
||||
}else{
|
||||
uploadAudio()
|
||||
}
|
||||
//删除记录
|
||||
@@ -162,8 +168,8 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
}
|
||||
}
|
||||
|
||||
private fun setAudio(status: Boolean) {
|
||||
if (status) {
|
||||
private fun setAudio(status: Boolean){
|
||||
if(status){
|
||||
//开始录音
|
||||
audioFileName = "Audio_${System.currentTimeMillis()}_BadCase"
|
||||
RecordManager.getInstance().start(audioFileName)
|
||||
@@ -171,11 +177,11 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
viewAudioButton.setImageResource(R.drawable.icon_bad_case_audio_select)
|
||||
tvAudioCountDown.visibility = View.VISIBLE
|
||||
//开始倒计时
|
||||
if (countDownTimer == null) {
|
||||
if(countDownTimer==null){
|
||||
countDownTimer = object : CountDownTimer(60000, 1000) {
|
||||
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
tvAudioCountDown.text = "${millisUntilFinished / 1000}S"
|
||||
tvAudioCountDown.text = "${millisUntilFinished/1000}S"
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
@@ -188,7 +194,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
}
|
||||
countDownTimer?.start()
|
||||
}
|
||||
} else {
|
||||
}else{
|
||||
//结束倒计时
|
||||
countDownTimer?.cancel()
|
||||
countDownTimer?.onFinish()
|
||||
@@ -198,13 +204,11 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
|
||||
}
|
||||
|
||||
private fun uploadAudio() {
|
||||
private fun uploadAudio(){
|
||||
val singlePath = "/mnt/sdcard/mogo/DataCollection/${audioFileName}.wav"
|
||||
val file = File(singlePath)
|
||||
if (file.exists()) {
|
||||
LogInfoManagerFactory.createAudioUpload(mActivity.applicationContext,
|
||||
"Audio",
|
||||
singlePath,
|
||||
if(file.exists()){
|
||||
LogInfoManagerFactory.createAudioUpload(mActivity.applicationContext,"Audio",singlePath,
|
||||
object : OnUploadListener {
|
||||
override fun onUploadSuccess(filePath: String, downloadUrl: String) {
|
||||
CallerLogger.d("$M_DEVA$TAG", "语音文件上传成功:downloadUrl=$downloadUrl")
|
||||
@@ -220,7 +224,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
removeUploadListener(singlePath)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
}else{
|
||||
//上传到服务器
|
||||
upload(null)
|
||||
}
|
||||
@@ -230,7 +234,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
* 将语音文件上传Cos监听移除
|
||||
* @param filePath 文件路径
|
||||
*/
|
||||
private fun removeUploadListener(filePath: String) {
|
||||
private fun removeUploadListener(filePath: String){
|
||||
val pkgInfo: List<String> = filePath.substring(
|
||||
filePath.lastIndexOf("/") + 1,
|
||||
filePath.lastIndexOf(".")
|
||||
@@ -243,21 +247,21 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
* 将记录上传到服务器
|
||||
* @param downloadUrl 语音文件下载地址
|
||||
*/
|
||||
private fun upload(downloadUrl: String?) {
|
||||
GlobalScope.launch {
|
||||
private fun upload(downloadUrl: String?){
|
||||
GlobalScope.launch{
|
||||
val uploadResult = presenter.upload(mutableMapOf<String, String>().also { itx ->
|
||||
itx["carLicense"] = AppConfigInfo.plateNumber ?: "" //车牌号
|
||||
itx["filename"] = recordFileName ?: "" //bag包文件地址
|
||||
itx["carLicense"] = AppConfigInfo.plateNumber?:"" //车牌号
|
||||
itx["filename"] = recordFileName?:"" //bag包文件地址
|
||||
itx["filesize"] = "0" //bag包文件大小
|
||||
itx["key"] = recordKey ?: "" //key
|
||||
itx["key"] = recordKey?:"" //key
|
||||
itx["reason"] = uploadReason //采集原因
|
||||
itx["duration"] = BadCaseConfig.totalDuration.toString() //采集时长,固定为20S
|
||||
itx["startTime"] = System.currentTimeMillis().toString() //上报时间(时间戳格式)
|
||||
itx["channel"] = "0" //渠道
|
||||
itx["carSn"] = MoGoAiCloudClientConfig.getInstance().sn //SN
|
||||
itx["userRole"] = BadCaseConfig.identity //采集者角色
|
||||
itx["audioUrl"] = downloadUrl ?: "" //音频COS地址
|
||||
itx["mapVersion"] = BadCaseConfig.dockerVersion ?: "" //工控机版本
|
||||
itx["audioUrl"] = downloadUrl?:"" //音频COS地址
|
||||
itx["mapVersion"] = BadCaseConfig.dockerVersion ?:"" //工控机版本
|
||||
itx["eyeVersion"] = AppUtils.getAppVersionName() //鹰眼版本
|
||||
itx["coordinate"] = "latitude:${latitude};longitude:${longitude}" //坐标
|
||||
|
||||
@@ -266,6 +270,15 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
TipToast.shortTip("上报失败")
|
||||
} else {
|
||||
TipToast.shortTip("上报成功")
|
||||
//将上报BI的结果同步给工控机记录保存
|
||||
recordKey?.let {
|
||||
val hasAudio = downloadUrl != null
|
||||
val descReqEntity = BagDescriptionEntity(uploadReason,hasAudio,downloadUrl.toString(),true)
|
||||
bagManagerEntity.reqType = 5
|
||||
bagManagerEntity.keyReq = it.toLong()
|
||||
bagManagerEntity.descReq = descReqEntity
|
||||
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
|
||||
}
|
||||
BadCaseConfig.windowNum--
|
||||
clickListener?.closeWindow()
|
||||
}
|
||||
@@ -309,33 +322,28 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
// 默认固定位置,靠屏幕右边缘的中间
|
||||
mWindowManager!!.defaultDisplay.getMetrics(metrics)
|
||||
mWindowParams!!.x = metrics.widthPixels
|
||||
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight() - 950
|
||||
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-950
|
||||
mWindowManager!!.addView(mFloatLayout, mWindowParams)
|
||||
}
|
||||
|
||||
GlobalScope.launch {
|
||||
GlobalScope.launch{
|
||||
presenter.loadBadCases(true).also {
|
||||
ThreadUtils.runOnUiThread {
|
||||
it.iterator().forEach {
|
||||
val checkBox = CheckBox(mActivity)
|
||||
checkBox.setTextColor(Color.WHITE)
|
||||
val lp = FlexboxLayout.LayoutParams(
|
||||
FlexboxLayout.LayoutParams.WRAP_CONTENT,
|
||||
FlexboxLayout.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
checkBox.buttonDrawable =
|
||||
mActivity.resources.getDrawable(R.drawable.badcase_radio_button_style)
|
||||
checkBox.setPadding(
|
||||
val lp = FlexboxLayout.LayoutParams(FlexboxLayout.LayoutParams.WRAP_CONTENT,
|
||||
FlexboxLayout.LayoutParams.WRAP_CONTENT)
|
||||
checkBox.buttonDrawable = mActivity.resources.getDrawable(R.drawable.badcase_radio_button_style)
|
||||
checkBox.setPadding(SizeUtils.dp2px(10f),
|
||||
SizeUtils.dp2px(10f),
|
||||
SizeUtils.dp2px(10f),
|
||||
SizeUtils.dp2px(10f),
|
||||
SizeUtils.dp2px(10f)
|
||||
)
|
||||
checkBox.textSize = AutoSizeUtils.dp2px(mActivity, 18f).toFloat()
|
||||
SizeUtils.dp2px(10f))
|
||||
checkBox.textSize = AutoSizeUtils.dp2px(mActivity,18f).toFloat()
|
||||
checkBox.text = it.reason
|
||||
checkBox.isChecked = it.isChecked
|
||||
checkBox.setOnCheckedChangeListener(this@PassiveBadCaseWindow)
|
||||
flReasonLayout.addView(checkBox, lp)
|
||||
flReasonLayout.addView(checkBox,lp)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,13 +353,13 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
|
||||
override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
|
||||
buttonView?.text?.let {
|
||||
if (isChecked) {
|
||||
if (!uploadReason.contains(it)) {
|
||||
if(isChecked){
|
||||
if(!uploadReason.contains(it)){
|
||||
uploadReason += it
|
||||
}
|
||||
} else {
|
||||
if (uploadReason.contains(it)) {
|
||||
uploadReason = uploadReason.replace(it.toString(), "")
|
||||
}else{
|
||||
if(uploadReason.contains(it)){
|
||||
uploadReason = uploadReason.replace(it.toString(),"")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +373,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
|
||||
}
|
||||
|
||||
fun setRecord(msgBoxBean: MsgBoxBean) {
|
||||
fun setRecord(msgBoxBean: MsgBoxBean){
|
||||
boxBean = msgBoxBean
|
||||
val recordBagMsg = (msgBoxBean.bean as RecordBagMsg)
|
||||
recordKey = recordBagMsg.key.toString()
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
||||
import com.zhjt.mogo_core_function_devatools.R;
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description BadCase车端磁盘空间已满预警弹窗
|
||||
* @since: 2022/2/1
|
||||
*/
|
||||
public class SpaceWarningDialog extends Dialog {
|
||||
|
||||
private TextView tvCleanDisk;//清理磁盘
|
||||
private TextView tvCancel;//取消
|
||||
private Activity mActivity;
|
||||
|
||||
private ClickListener clickListener;
|
||||
|
||||
public SpaceWarningDialog(@NonNull Activity activity) {
|
||||
super(activity, R.style.bad_case_dialog);
|
||||
mActivity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.dialog_space_warning);
|
||||
WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.height = 688;
|
||||
params.width = 1110;
|
||||
getWindow().setAttributes(params);//向WindowManager设置属性
|
||||
setCanceledOnTouchOutside(false);
|
||||
init();
|
||||
initEvent();
|
||||
}
|
||||
|
||||
private void init(){
|
||||
tvCleanDisk = findViewById(R.id.tvCleanDisk);
|
||||
tvCancel = findViewById(R.id.tvCancel);
|
||||
}
|
||||
|
||||
private void initEvent(){
|
||||
//清理磁盘
|
||||
tvCleanDisk.setOnClickListener(v -> {
|
||||
//跳转录包管理页面
|
||||
// if(mActivity!=null){
|
||||
// CallerDevaToolsManager.INSTANCE.showBadCaseManagerView(mActivity);
|
||||
// }
|
||||
if(clickListener!=null){
|
||||
clickListener.showBadCaseManagerView();
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
//取消
|
||||
tvCancel.setOnClickListener(v -> {
|
||||
//取消弹窗
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
public void setClickListener(ClickListener clickListener){
|
||||
this.clickListener = clickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
|
||||
public interface ClickListener{
|
||||
void showBadCaseManagerView();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz.adapter
|
||||
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.CheckBox
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.badcase.BagDescriptionEntity
|
||||
import com.mogo.eagle.core.data.badcase.BagInfoEntity
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
import java.text.DecimalFormat
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description Bag包管理列表适配器
|
||||
* @since: 2022/12/19
|
||||
*/
|
||||
class BagManagerListAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
private var data:List<BagInfoEntity> ?= null
|
||||
private var bagClickListener: BagClickListener ?= null
|
||||
private val format = DecimalFormat("0.00")
|
||||
|
||||
fun setData(data: List<BagInfoEntity>?){
|
||||
this.data = data
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
if(viewType == 1){
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_bag_time_title,parent,false)
|
||||
return BagTimeTitleHolder(view)
|
||||
}else{
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_bag_manager, parent, false)
|
||||
return BagManagerListHolder(view)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
when(holder){
|
||||
is BagTimeTitleHolder ->{
|
||||
data?.let {
|
||||
holder.tvBagTimeTitle.text = it[position].timeStr
|
||||
}
|
||||
}
|
||||
is BagManagerListHolder->{
|
||||
data?.let {
|
||||
val bagInfoEntity = it[position]
|
||||
holder.cbBagSelect.setOnCheckedChangeListener(null)
|
||||
holder.cbBagSelect.isChecked = bagInfoEntity.selectStatus
|
||||
holder.cbBagSelect.tag = bagInfoEntity
|
||||
holder.cbBagSelect.setOnCheckedChangeListener { _, isChecked ->
|
||||
bagClickListener?.onClick(bagInfoEntity,isChecked)
|
||||
}
|
||||
|
||||
val textWatcher: TextWatcher = object : TextWatcher {
|
||||
override fun beforeTextChanged(
|
||||
charSequence: CharSequence,
|
||||
i: Int,
|
||||
i1: Int,
|
||||
i2: Int
|
||||
) {
|
||||
}
|
||||
|
||||
override fun onTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {}
|
||||
override fun afterTextChanged(editable: Editable) {
|
||||
bagInfoEntity.description?.let { desc->
|
||||
val descriptionStr = editable.toString()
|
||||
if(desc.description != descriptionStr){
|
||||
desc.description = descriptionStr
|
||||
bagClickListener?.editDescription(bagInfoEntity.key,desc)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
holder.etBagNameEdit.onFocusChangeListener =
|
||||
View.OnFocusChangeListener { p0, hasFocus ->
|
||||
val edit = p0 as EditText
|
||||
if(hasFocus){
|
||||
edit.addTextChangedListener(textWatcher)
|
||||
}else{
|
||||
edit.removeTextChangedListener(textWatcher)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bagInfoEntity.description?.let { des->
|
||||
if(des.reportBI){
|
||||
//已上报
|
||||
holder.tvBagReportStatus.text = "已上报"
|
||||
holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_reported_button_bg)
|
||||
}else{
|
||||
//未上报
|
||||
holder.tvBagReportStatus.text = "上报"
|
||||
holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_report_button_bg)
|
||||
holder.tvBagReportStatus.setOnClickListener {
|
||||
bagClickListener?.uploadBI(bagInfoEntity)
|
||||
}
|
||||
}
|
||||
if(des.description.isEmpty()){
|
||||
holder.etBagNameEdit.setText(bagInfoEntity.key.toString())
|
||||
}else{
|
||||
holder.etBagNameEdit.setText(des.description)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(bagInfoEntity.description?.hasAudio == true){
|
||||
holder.ivBagAudio.visibility = View.VISIBLE
|
||||
holder.ivBagAudio.setOnClickListener {
|
||||
bagInfoEntity.description?.let { description->
|
||||
bagClickListener?.bagAudio(bagInfoEntity.key,description.audioUrl)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
holder.ivBagAudio.visibility = View.INVISIBLE
|
||||
}
|
||||
//大小
|
||||
val bagSize = format.format(bagInfoEntity.totalSize/(1000*1024*1024.0))
|
||||
holder.tvBagSize.text = "${bagSize}G"
|
||||
|
||||
//时间
|
||||
bagInfoEntity.timestamp?.let { time->
|
||||
val hour = time.substring(8,10)
|
||||
val min = time.substring(10,12)
|
||||
val second = time.substring(12,14)
|
||||
holder.tvBagTime.text = "${hour}:${min}:${second}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = data?.size ?: 0
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return data!![position].itemType
|
||||
}
|
||||
|
||||
class BagTimeTitleHolder(itemView: View): RecyclerView.ViewHolder(itemView){
|
||||
var tvBagTimeTitle: TextView = itemView.findViewById(R.id.tvBagTimeTitle)
|
||||
}
|
||||
|
||||
class BagManagerListHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
|
||||
var cbBagSelect: CheckBox = itemView.findViewById(R.id.cbBagSelect)
|
||||
var etBagNameEdit: EditText = itemView.findViewById(R.id.etBagNameEdit)
|
||||
var tvBagReportStatus: TextView = itemView.findViewById(R.id.tvBagReportStatus)
|
||||
var ivBagAudio: ImageView = itemView.findViewById(R.id.ivBagAudio)
|
||||
var tvBagTime: TextView = itemView.findViewById(R.id.tvBagTime)
|
||||
var tvBagSize: TextView = itemView.findViewById(R.id.tvBagSize)
|
||||
}
|
||||
|
||||
fun setListener(listener: BagClickListener){
|
||||
bagClickListener = listener
|
||||
}
|
||||
|
||||
interface BagClickListener{
|
||||
//选择Bag包
|
||||
fun onClick(bagInfoEntity: BagInfoEntity,isChecked: Boolean)
|
||||
//上报BI平台
|
||||
fun uploadBI(bagInfoEntity: BagInfoEntity)
|
||||
//编辑Bag包描述信息
|
||||
fun editDescription(key: Long,description: BagDescriptionEntity)
|
||||
//听录音
|
||||
fun bagAudio(key: Long,audioUrl: String)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.consts
|
||||
|
||||
import com.mogo.eagle.core.data.badcase.BagInfoEntity
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description 录包配置参数
|
||||
@@ -32,5 +34,8 @@ object BadCaseConfig {
|
||||
//自定义Topic清单列表
|
||||
@JvmField
|
||||
var customTopicList: ArrayList<String> = ArrayList()
|
||||
//Bag包管理列表
|
||||
@JvmField
|
||||
var bagManagerList: ArrayList<BagInfoEntity> = ArrayList()
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.record;
|
||||
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.text.TextUtils;
|
||||
|
||||
//播放试听
|
||||
public class Audition implements MediaPlayer.OnPreparedListener, MediaPlayer.OnCompletionListener{
|
||||
private static volatile Audition INSTANCE;
|
||||
public MediaPlayer mediaPlayer;
|
||||
private String oldPath;
|
||||
private OnAuditionListener listener;
|
||||
|
||||
public interface OnAuditionListener {
|
||||
void onAuditionCompletion();
|
||||
|
||||
}
|
||||
|
||||
public void registerOnAuditionListener(OnAuditionListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void unregisterOnAuditionListener() {
|
||||
this.listener = null;
|
||||
}
|
||||
|
||||
private Audition() {
|
||||
}
|
||||
|
||||
public static Audition getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (Audition.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new Audition();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPlaying() {
|
||||
return mediaPlayer != null && mediaPlayer.isPlaying();
|
||||
}
|
||||
|
||||
private void play(String path) {
|
||||
oldPath = path;
|
||||
if (mediaPlayer != null) {
|
||||
mediaPlayer.release();
|
||||
mediaPlayer = null;
|
||||
}
|
||||
if (mediaPlayer == null) {
|
||||
mediaPlayer = new MediaPlayer();
|
||||
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||
mediaPlayer.setOnPreparedListener(this);
|
||||
mediaPlayer.setOnCompletionListener(this);
|
||||
}
|
||||
try {
|
||||
mediaPlayer.setDataSource(path);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mediaPlayer.prepareAsync();
|
||||
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
oldPath = null;
|
||||
if (mediaPlayer != null) {
|
||||
mediaPlayer.stop();
|
||||
mediaPlayer.reset();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean playOrStop(String path) {
|
||||
if (!TextUtils.equals(oldPath, path)) {
|
||||
play(path);
|
||||
return true;
|
||||
} else {
|
||||
stop();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
stop();
|
||||
mediaPlayer = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepared(MediaPlayer mp) {
|
||||
mp.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompletion(MediaPlayer mp) {
|
||||
oldPath = null;
|
||||
if (listener != null) {
|
||||
listener.onAuditionCompletion();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,14 @@ import com.mogo.eagle.core.data.app.AppConfigInfo.role
|
||||
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.obu.MogoObuConst
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isDriver
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isPassenger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.zhjt.mogo_core_function_devatools.upgrade.IPCUpgradeManager.Companion.ipcUpgradeManager
|
||||
@@ -59,9 +62,6 @@ class BindingCarManager : IMoGoAutopilotCarConfigListener {
|
||||
if (carConfigResp != null && !TextUtils.isEmpty(carConfigResp.macAddress)) {
|
||||
Log.d("Upgrade", "MoGoHandAdasMsgManager address = " + carConfigResp.macAddress)
|
||||
getBindingCarInfo(carConfigResp.macAddress, MoGoAiCloudClientConfig.getInstance().sn)
|
||||
|
||||
//obu的升级,只需要司机屏连接
|
||||
queryObuUpgrade(carConfigResp.macAddress)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,14 +164,18 @@ class BindingCarManager : IMoGoAutopilotCarConfigListener {
|
||||
fun queryAppUpgrade() {
|
||||
UpgradeAppNetWorkManager.getInstance()
|
||||
.getAppUpgradeInfo(mContext, mAddress, role.toString() + "")
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机屏 处理obu升级即可,乘客屏不需要处理
|
||||
*
|
||||
* obu的升级,只需要司机屏连接
|
||||
*/
|
||||
private fun queryObuUpgrade(macAddress: String) {
|
||||
ObuUpgradeAppNetWorkManager.getInstance().getObuUpgradeInfo(mContext, macAddress)
|
||||
fun queryObuUpgrade(obuVersionName: String) {
|
||||
if (screenType == 1) {
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}","queryObuUpgrade isConnected = ${CallerObuApiManager.isConnected()} --- mAddress = $mAddress")
|
||||
ObuUpgradeAppNetWorkManager.getInstance().getObuUpgradeInfo(mContext, mAddress, obuVersionName)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,8 +56,6 @@ class BindingCarNetWorkManager private constructor() {
|
||||
widevineIDWithMd5: String?,
|
||||
screenType: Int
|
||||
) {
|
||||
// String macAddress1 = "48:b0:2d:4d:33:40";
|
||||
// String sn = "X2020220417KA94QIN";
|
||||
val request = BindingCarRequest(
|
||||
macAddress,
|
||||
widevineIDWithMd5,
|
||||
@@ -152,29 +150,39 @@ class BindingCarNetWorkManager private constructor() {
|
||||
}
|
||||
|
||||
private fun updateCarVrIconRes(brandId: String?) {
|
||||
d(SceneConstant.M_BINDING + TAG, "CarModelChange : ${DebugConfig.isCarModelChange()}")
|
||||
if(!DebugConfig.isCarModelChange()){
|
||||
return
|
||||
}
|
||||
if (brandId == null || brandId.isEmpty()) {
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_BINDING + TAG, "getDefaultId() : ${getDefaultId()} ---- brandId = $brandId")
|
||||
if (getDefaultId() == brandId) {
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_BINDING + TAG, "updateCarVrIconRes : $brandId")
|
||||
when (brandId) {
|
||||
"1" -> {
|
||||
"1" -> { //东风
|
||||
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.chuzuche)
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.chuzuche
|
||||
}
|
||||
"2" -> {
|
||||
"2" -> { //红旗
|
||||
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.hq_h9)
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.hq_h9
|
||||
}
|
||||
"3" -> {
|
||||
"3" -> { //金旅
|
||||
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.xiaobache)
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaobache
|
||||
}
|
||||
"4" -> { //开沃
|
||||
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.xiaobache)
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaobache
|
||||
}
|
||||
"5" -> { //福田
|
||||
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.huanwei)
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.huanwei
|
||||
}
|
||||
else -> {
|
||||
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.chuzuche)
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.chuzuche
|
||||
@@ -186,6 +194,8 @@ class BindingCarNetWorkManager private constructor() {
|
||||
return when (HdMapBuildConfig.currentCarVrIconRes) {
|
||||
R.raw.chuzuche -> "1"
|
||||
R.raw.xiaobache -> "3"
|
||||
R.raw.xiaobache -> "4"
|
||||
R.raw.huanwei -> "5"
|
||||
else -> "1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class SceneManager {
|
||||
sceneModuleTAG.map[TAXI] = SceneModule(true, M_TAXI)
|
||||
sceneModuleTAG.map[TAXI_P] = SceneModule(true, M_TAXI_P)
|
||||
sceneModuleTAG.map[SWEEPER] = SceneModule(true, M_SWEEPER)
|
||||
sceneModuleTAG.map[OTHER] = SceneModule(false, M_OTHER)
|
||||
sceneModuleTAG.map[OTHER] = SceneModule(true, M_OTHER)
|
||||
|
||||
sceneLogTAG.map[TAXI] = SceneTAG(false)
|
||||
sceneLogTAG.map[BUS] = SceneTAG(false)
|
||||
|
||||
@@ -3,17 +3,17 @@ package com.zhjt.mogo_core_function_devatools.upgrade;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BINDING;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.constants.HostConst;
|
||||
import com.mogo.eagle.core.data.bindingcar.UpgradeAppInfo;
|
||||
import com.mogo.eagle.core.data.obu.MogoObuConst;
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
@@ -50,15 +50,15 @@ public class ObuUpgradeAppNetWorkManager {
|
||||
|
||||
/**
|
||||
* 获取obu升级信息,obu升级服务端使用app升级接口,根据screenType区分类型
|
||||
* mac :工控机mac地址
|
||||
* mac :工控机mac地址,
|
||||
* screenType : 类型
|
||||
*/
|
||||
public void getObuUpgradeInfo(Context context, String mac) {
|
||||
public void getObuUpgradeInfo(Context context, String mac, String versionName) {
|
||||
// String sn = "X20202203105S688HZ";
|
||||
// String mac = "48:b0:2d:3a:bc:78";
|
||||
// String mac1 = "48:b0:2d:4d:33:40";
|
||||
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String obuVersionName = String.valueOf(AppUtils.getAppVersionCode()); // TODO 获取obu的版本号, string和int 服务端处理
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo mac = " + mac + "---sn = " + sn + "---obuVersionName =" + obuVersionName);
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo mac = " + mac + " ---sn = " + sn + " ---versionName = " + versionName);
|
||||
UpgradeAppRequest request = new UpgradeAppRequest(sn, mac, "7");
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mUpgradeApiService.getUpgradeInfo(requestBody)
|
||||
@@ -72,10 +72,9 @@ public class ObuUpgradeAppNetWorkManager {
|
||||
@Override
|
||||
public void onNext(@NonNull UpgradeAppInfo info) {
|
||||
if (info != null && info.result != null) {
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo url = " + info.result.getAppUrl() + "----name = " + info.result.getVersionName() + "--obuVersionName =" + obuVersionName + "--info.result = " + info.result);
|
||||
if (!String.valueOf(info.result.getVersionName()).equals(obuVersionName)) {
|
||||
//下载 TAG和文件名 TODO
|
||||
CallerDevaToolsManager.INSTANCE.downLoadPackage("OBU", info.result.getAppUrl());
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo appFileName = " + info.result.getAppFileName() + " ----url = " + info.result.getAppUrl() + " ----name = " + info.result.getVersionName() + " --obuVersionName =" + versionName + " ---info.result = " + info.result);
|
||||
if (!String.valueOf(info.result.getVersionName()).equals(versionName)) { //判断是否下载,当文件名称不一致的时候,就下载
|
||||
CallerDevaToolsManager.INSTANCE.downLoadPackage(info.result.getAppFileName(), info.result.getAppUrl());
|
||||
}
|
||||
} else {
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getObuUpgradeInfo onNext info == null");
|
||||
@@ -84,7 +83,7 @@ public class ObuUpgradeAppNetWorkManager {
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
CallerLogger.INSTANCE.e(M_BINDING + TAG, "getObuUpgradeInfo e = " + e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,14 +4,17 @@ import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import androidx.core.app.NotificationCompat
|
||||
import com.elegant.utils.UiThreadHandler
|
||||
import com.mogo.eagle.core.data.obu.MogoObuConst
|
||||
import com.mogo.eagle.core.function.api.devatools.IMogoDevaToolsUpgradeListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.updateStatusBarDownloadView
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
|
||||
import com.mogo.eagle.core.utilcode.breakpoint.Config
|
||||
import com.mogo.eagle.core.utilcode.breakpoint.bean.ThreadBean
|
||||
import com.mogo.eagle.core.utilcode.breakpoint.callback.IDownload
|
||||
import com.mogo.eagle.core.utilcode.breakpoint.utils.DownloadUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ZipUtils
|
||||
@@ -29,12 +32,18 @@ class UpgradeManager : IDownload {
|
||||
}
|
||||
|
||||
private var map: Map<String, String>? = null
|
||||
private var mDownloadFileName: String? = null
|
||||
|
||||
fun downLoadPackage(context: Context, downloadKey: String,downloadUrl: String) {
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", "UpgradeManager downLoadPackage = " + downloadUrl?.contains(".zip") + "----downloadKey = $downloadKey ---downloadUrl = $downloadUrl")
|
||||
if (downloadUrl?.contains(".zip")) {
|
||||
mDownloadFileName = downloadKey
|
||||
}
|
||||
|
||||
DownloadUtils.downLoad(
|
||||
context,
|
||||
downloadUrl,
|
||||
Config.downLoadPath,
|
||||
if (downloadUrl?.contains(".zip")) Config.downLoadObuPath else Config.downLoadPath,
|
||||
downloadKey,
|
||||
5,
|
||||
this
|
||||
@@ -81,7 +90,7 @@ class UpgradeManager : IDownload {
|
||||
}
|
||||
|
||||
override fun onFinished(downloadUrl: String?, threadBean: ThreadBean?) {
|
||||
if (downloadUrl != null) {
|
||||
if (downloadUrl != null) { //TODO 需要判断是否是apk文件
|
||||
AppUtils.installApp(Config.downLoadPath + downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1))
|
||||
}
|
||||
if (downloadUrl != null) {
|
||||
@@ -119,7 +128,7 @@ class UpgradeManager : IDownload {
|
||||
}
|
||||
|
||||
/**
|
||||
* 鹰眼app下载监听
|
||||
* 鹰眼app下载监听 liyz
|
||||
*/
|
||||
fun updateUpgradeProgress(context: Context) {
|
||||
val builder = NotificationCompat.Builder(context)
|
||||
@@ -148,7 +157,8 @@ class UpgradeManager : IDownload {
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
override fun onError(url: String?, errorMsg: String?) {}
|
||||
override fun onError(url: String?, errorMsg: String?) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -162,23 +172,37 @@ class UpgradeManager : IDownload {
|
||||
override fun onStart(url: String?) {}
|
||||
override fun onPause(url: String?) {}
|
||||
override fun onProgress(url: String?, length: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onFinished(url: String?) {
|
||||
//下载完成,解压文件 TODO
|
||||
//下载完成,解压文件
|
||||
try {
|
||||
val files = ZipUtils.unzipFile("", "")
|
||||
//传给obu升级
|
||||
|
||||
val files = ZipUtils.unzipFile(Config.downLoadObuPath + mDownloadFileName, Config.downLoadUnzipObuPath)
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", " onFinished file = ${Config.downLoadObuPath + mDownloadFileName} -----files = $files ")
|
||||
//1传给obu升级,升级成功,2需要删除相应文件夹
|
||||
var md5Path = ""
|
||||
var tarPath = ""
|
||||
for (f in files) {
|
||||
if (f.path.contains(".md5")) {
|
||||
md5Path = f.path
|
||||
}
|
||||
if (f.path.contains(".gz")) {
|
||||
tarPath = f.path
|
||||
}
|
||||
}
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${MogoObuConst.TAG_UPGRADE_OBU}", "updateObuUpgradeStatus ---md5Path = $md5Path -----tarPath = $tarPath ")
|
||||
CallerObuApiManager.uploadObuPack(arrayOf(md5Path, tarPath))
|
||||
} catch (e: IOException) {
|
||||
//解压失败
|
||||
|
||||
//解压失败,删除文件夹
|
||||
CallerObuApiManager.deleteObuFile()
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(url: String?, errorMsg: String?) {}
|
||||
override fun onError(url: String?, errorMsg: String?) {
|
||||
//下载失败,删除文件夹
|
||||
CallerObuApiManager.deleteObuFile()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:startColor="#BB791C"
|
||||
android:endColor="#BB791C"
|
||||
android:angle="0"
|
||||
/>
|
||||
<corners android:radius="13px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:startColor="#566195"
|
||||
android:endColor="#566195"
|
||||
android:angle="0"
|
||||
/>
|
||||
<corners android:radius="13px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:startColor="#3B4577"
|
||||
android:endColor="#3B4577"
|
||||
android:angle="0"
|
||||
/>
|
||||
<corners android:radius="13px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:startColor="#3B4577"
|
||||
android:endColor="#3B4577"
|
||||
android:angle="0"
|
||||
/>
|
||||
<corners android:radius="16px" />
|
||||
</shape>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 926 B |
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<!-- solid指定形状的填充色,只有android:color一个属性 -->
|
||||
<gradient
|
||||
android:startColor="#3B4577"
|
||||
android:endColor="#7CF6FF"
|
||||
/>
|
||||
<!-- padding设置内容区域离边界的间距 -->
|
||||
<!-- corners设置圆角,只适用于rectangle -->
|
||||
<!-- <corners android:bottomRightRadius="20dp"-->
|
||||
<!-- android:topRightRadius="20dp"/>-->
|
||||
|
||||
<corners android:radius="30px"
|
||||
/>
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners
|
||||
android:radius="30px"
|
||||
/>
|
||||
<solid android:color="#3B4577"/>
|
||||
|
||||
<stroke
|
||||
android:color="#7CF6FF"
|
||||
android:width="1.5px"
|
||||
/>
|
||||
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@android:id/secondaryProgress">
|
||||
<scale android:scaleWidth="100%">
|
||||
<shape>
|
||||
<corners android:topRightRadius="30px"
|
||||
android:bottomRightRadius="30px"/>
|
||||
<solid android:color="#7CF6FF"/>
|
||||
</shape>
|
||||
</scale>
|
||||
</item>
|
||||
|
||||
<item android:id="@android:id/progress">
|
||||
<scale android:scaleWidth="100%"
|
||||
android:drawable="@drawable/progress_bar_ct" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:startColor="#029DFF"
|
||||
android:endColor="#0056FF"
|
||||
android:angle="0"
|
||||
/>
|
||||
<corners android:radius="13px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 设置背景色 -->
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="0dp" />
|
||||
<gradient
|
||||
android:startColor="#33A682"
|
||||
android:endColor="#4ADD80"
|
||||
/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 设置进度条颜色 -->
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="0dp" />
|
||||
<gradient
|
||||
android:startColor="#FFD900"
|
||||
android:endColor="#FFAB00"
|
||||
/>
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 设置背景色 -->
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="21px" />
|
||||
|
||||
<gradient
|
||||
android:startColor="#3B4577"
|
||||
android:endColor="#D71B0E"
|
||||
/>
|
||||
<stroke
|
||||
android:color="#FF807C"
|
||||
android:width="1.5px"
|
||||
/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 设置进度条颜色 -->
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners
|
||||
android:bottomLeftRadius="21px"
|
||||
android:bottomRightRadius="21px"
|
||||
android:topLeftRadius="21px"
|
||||
android:topRightRadius="21px"
|
||||
/>
|
||||
<gradient
|
||||
android:startColor="#06D1ED"
|
||||
android:endColor="#06D1ED"
|
||||
android:type="radial"
|
||||
/>
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:startColor="#33A682"
|
||||
android:endColor="#4ADD80"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:startColor="#029DFF"
|
||||
android:endColor="#0056FF"
|
||||
android:angle="0"
|
||||
/>
|
||||
<corners android:radius="16px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:startColor="#FFD900"
|
||||
android:endColor="#FFAB00"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="1110px"
|
||||
android:layout_height="688px">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvUploadTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:text="cos桶上传中"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="56px"
|
||||
android:layout_marginTop="95px"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewVerticalLine"
|
||||
android:layout_width="2px"
|
||||
android:layout_height="160px"
|
||||
android:background="#66B8BFE8"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewHorizontalLine"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2px"
|
||||
android:background="#66B8BFE8"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/viewVerticalLine"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCancelUpload"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewHorizontalLine"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="@id/viewVerticalLine"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:text="取消上传"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="52px"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewHorizontalLine"
|
||||
app:layout_constraintLeft_toRightOf="@id/viewVerticalLine"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:text="取消"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="52px"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/viewUploadProgress"
|
||||
android:layout_width="791px"
|
||||
android:layout_height="42px"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="270px"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:progressDrawable="@drawable/progress_bar_drawable"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvUploadDetail"
|
||||
android:layout_width="814px"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="370px"
|
||||
android:textColor="#FF06D1ED"
|
||||
android:textSize="43px"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="1110px"
|
||||
android:layout_height="688px">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvWarningTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:text="当前工控机磁盘空间已满"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="56px"
|
||||
android:layout_marginTop="95px"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewVerticalLine"
|
||||
android:layout_width="2px"
|
||||
android:layout_height="160px"
|
||||
android:background="#66B8BFE8"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewHorizontalLine"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2px"
|
||||
android:background="#66B8BFE8"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/viewVerticalLine"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCleanDisk"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewHorizontalLine"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="@id/viewVerticalLine"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:text="清理磁盘"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="52px"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewHorizontalLine"
|
||||
app:layout_constraintLeft_toRightOf="@id/viewVerticalLine"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:text="取消"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="52px"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/viewProgress"
|
||||
android:layout_width="791px"
|
||||
android:layout_height="42px"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="275px"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:progressDrawable="@drawable/space_warning_progress_bg"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_marginTop="18dp"
|
||||
android:layout_marginBottom="18dp"
|
||||
>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbBagSelect"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:button="@drawable/badcase_radio_button_style"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etBagNameEdit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/cbBagSelect"
|
||||
app:layout_constraintRight_toLeftOf="@id/tvBagTime"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:background="@null"
|
||||
android:drawableEnd="@drawable/icon_bag_edit"
|
||||
android:drawablePadding="@dimen/dp_10"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="32dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBagReportStatus"
|
||||
android:layout_width="162dp"
|
||||
android:layout_height="68dp"
|
||||
android:background="@drawable/bag_reported_button_bg"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:text="已上报"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="28dp"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivBagAudio"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/tvBagReportStatus"
|
||||
android:src="@drawable/icon_bag_audio"
|
||||
android:visibility="invisible"
|
||||
android:layout_marginEnd="30dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBagTime"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="26dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/ivBagAudio"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:gravity="start"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBagSize"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#75FFFFFF"
|
||||
android:textSize="26dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tvBagTime"
|
||||
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBagTimeTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="38px"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,228 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="960dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F0151D41"
|
||||
android:id="@+id/clLayout"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivManagerClose"
|
||||
android:layout_width="107dp"
|
||||
android:layout_height="107dp"
|
||||
android:layout_marginTop="66dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:src="@drawable/icon_close_nor"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewManagerTitleLine"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="92dp"
|
||||
android:background="#2966EC"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvManagerTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="任务管理"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="42dp"
|
||||
app:layout_constraintTop_toTopOf="@id/viewManagerTitleLine"
|
||||
app:layout_constraintBottom_toBottomOf="@id/viewManagerTitleLine"
|
||||
app:layout_constraintLeft_toLeftOf="@id/viewManagerTitleLine"
|
||||
android:layout_marginStart="50dp"
|
||||
/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clBagHaveDataLayout"
|
||||
android:layout_width="785dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewManagerTitleLine"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="@id/viewManagerTitleLine"
|
||||
android:visibility="gone"
|
||||
>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pbSpacePercent"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="785dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_marginTop="100dp"
|
||||
android:progressDrawable="@drawable/space_percent_bg"
|
||||
android:max="100"
|
||||
android:progress="10"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewUsedSpace"
|
||||
android:layout_width="23dp"
|
||||
android:layout_height="23dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/pbSpacePercent"
|
||||
app:layout_constraintLeft_toLeftOf="@id/pbSpacePercent"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/used_space_bg"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvUsedSpaceContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="32dp"
|
||||
app:layout_constraintTop_toTopOf="@id/viewUsedSpace"
|
||||
app:layout_constraintBottom_toBottomOf="@id/viewUsedSpace"
|
||||
app:layout_constraintLeft_toRightOf="@id/viewUsedSpace"
|
||||
android:layout_marginStart="10dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFreeSpaceContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="32dp"
|
||||
app:layout_constraintRight_toRightOf="@id/pbSpacePercent"
|
||||
app:layout_constraintTop_toTopOf="@id/viewUsedSpace"
|
||||
app:layout_constraintBottom_toBottomOf="@id/viewUsedSpace"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewFreeSpace"
|
||||
android:layout_width="23dp"
|
||||
android:layout_height="23dp"
|
||||
android:background="@drawable/unused_space_bg"
|
||||
app:layout_constraintTop_toTopOf="@id/viewUsedSpace"
|
||||
app:layout_constraintBottom_toBottomOf="@id/viewUsedSpace"
|
||||
app:layout_constraintRight_toLeftOf="@id/tvFreeSpaceContent"
|
||||
android:layout_marginEnd="10dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSelectAll"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="80dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewUsedSpace"
|
||||
android:layout_marginTop="50dp"
|
||||
android:background="@drawable/select_all_button_bg"
|
||||
android:text="一键全选"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="36dp"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCancelSelect"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="80dp"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSelectAll"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSelectAll"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvSelectAll"
|
||||
android:layout_marginStart="30dp"
|
||||
android:background="@drawable/cancel_select_button_bg"
|
||||
android:text="取消"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="36dp"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSelectedBagSize"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSelectAll"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSelectAll"
|
||||
app:layout_constraintRight_toRightOf="@id/pbSpacePercent"
|
||||
android:textColor="#FF00AFFF"
|
||||
android:textSize="34dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvUploadCloud"
|
||||
android:layout_width="330dp"
|
||||
android:layout_height="120dp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/pbSpacePercent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="120dp"
|
||||
android:background="@drawable/upload_cloud_button_bg"
|
||||
android:text="上云"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="42dp"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDeleteSelect"
|
||||
android:layout_width="330dp"
|
||||
android:layout_height="120dp"
|
||||
app:layout_constraintTop_toTopOf="@id/tvUploadCloud"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvUploadCloud"
|
||||
app:layout_constraintRight_toRightOf="@id/pbSpacePercent"
|
||||
android:background="@drawable/delete_button_bg"
|
||||
android:text="删除"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="42dp"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvBagList"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/pbSpacePercent"
|
||||
app:layout_constraintRight_toRightOf="@id/pbSpacePercent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSelectAll"
|
||||
app:layout_constraintBottom_toTopOf="@id/tvUploadCloud"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clBagNoDataLayout"
|
||||
android:layout_width="785dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewManagerTitleLine"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="@id/viewManagerTitleLine"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivBagNoData"
|
||||
android:layout_width="@dimen/dp_317"
|
||||
android:layout_height="@dimen/dp_290"
|
||||
android:src="@drawable/icon_bag_no_data"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_400"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="暂无数据"
|
||||
android:textColor="#FFCAD6FF"
|
||||
android:textSize="@dimen/dp_44"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ivBagNoData"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user