diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt index f44ee28a01..c89509c59e 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -599,38 +599,39 @@ class MoGoAutopilotProvider : // 包信息列表,获取响应且reqType=2时有效 for(bagsInfoRespEntity in bagManagerEntity.bagsInfoResp){ - // 包描述信息 - val bagDescription = BagManagerOuterClass.BagDescription - .newBuilder() - - bagsInfoRespEntity.description?.let { - bagDescription.description = it.description - bagDescription.hasAudio = it.hasAudio - bagDescription.audioUrl = it.audioUrl - bagDescription.setReportBI(it.reportBI) - } - - val bagsInfoResp = BagManagerOuterClass.BagInfo - .newBuilder() - .setKey(bagsInfoRespEntity.key) - .setTotalSize(bagsInfoRespEntity.totalSize) - .setTimestamp(bagsInfoRespEntity.timestamp) - .setBagPath(bagsInfoRespEntity.bagPath) - .setMergeStat(bagsInfoRespEntity.mergeStat) - .setUploadStat(bagsInfoRespEntity.uploadStat) - .setDescription(bagDescription.build()) - - // 子包信息 - for(subBagEntity in bagsInfoRespEntity.subBags){ - val subBag = BagManagerOuterClass.SubBag + if(bagsInfoRespEntity.itemType == 0){ + // 包描述信息 + val bagDescription = BagManagerOuterClass.BagDescription .newBuilder() - .setKey(subBagEntity.key) - .setHost(subBagEntity.host) - .setSize(subBagEntity.size) - .build() - bagsInfoResp.addSubBags(subBag) + bagsInfoRespEntity.description?.let { + bagDescription.description = it.description + bagDescription.hasAudio = it.hasAudio + bagDescription.audioUrl = it.audioUrl + bagDescription.setReportBI(it.reportBI) + } + + val bagsInfoResp = BagManagerOuterClass.BagInfo + .newBuilder() + .setKey(bagsInfoRespEntity.key) + .setTotalSize(bagsInfoRespEntity.totalSize) + .setTimestamp(bagsInfoRespEntity.timestamp) + .setBagPath(bagsInfoRespEntity.bagPath) + .setMergeStat(bagsInfoRespEntity.mergeStat) + .setUploadStat(bagsInfoRespEntity.uploadStat) + .setDescription(bagDescription.build()) + + // 子包信息 + for(subBagEntity in bagsInfoRespEntity.subBags){ + val subBag = BagManagerOuterClass.SubBag + .newBuilder() + .setKey(subBagEntity.key) + .setHost(subBagEntity.host) + .setSize(subBagEntity.size) + .build() + bagsInfoResp.addSubBags(subBag) + } + bagManager.addBagsInfoResp(bagsInfoResp) } - bagManager.addBagsInfoResp(bagsInfoResp) } //反馈上传cos桶结果,获取响应且reqType=3时有效 diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseManagerView.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseManagerView.kt index ffca422d84..79e5aaa59e 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseManagerView.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseManagerView.kt @@ -6,7 +6,6 @@ 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 @@ -75,11 +74,13 @@ internal class BadCaseManagerView @JvmOverloads constructor( if(bagManagerEntity.bagsInfoResp.size>0){ selectedBagSize = 0 for(selectBagInfo in bagManagerEntity.bagsInfoResp){ - selectBagInfo.selectStatus = true - selectedBagSize += selectBagInfo.totalSize - bagManagerList.add(selectBagInfo) + if(selectBagInfo.itemType == 0){ + selectBagInfo.selectStatus = true + selectedBagSize += selectBagInfo.totalSize + bagManagerList.add(selectBagInfo) + selectedBagNum++ + } } - selectedBagNum = bagManagerEntity.bagsInfoResp.size //显示选择包的个数和大小 tvSelectedBagSize.text = "已选${selectedBagNum}个包,共${selectedBagSize/(1000*1024*1024)}G" tvSelectedBagSize.visibility = View.VISIBLE @@ -109,12 +110,14 @@ internal class BadCaseManagerView @JvmOverloads constructor( CallerAutoPilotManager.sendBagManagerCmd(bagManagerEntity) bagUploadDialog = BagUploadDialog(context) - bagUploadDialog?.setListener { //删除选择 + bagUploadDialog?.setListener { //删除选择,取消上传 bagManagerList.clear() if (bagManagerEntity.bagsInfoResp.size > 0) { for (cancelBagInfo in bagManagerEntity.bagsInfoResp) { - cancelBagInfo.selectStatus = false - bagManagerList.remove(cancelBagInfo) + if(cancelBagInfo.itemType == 0){ + cancelBagInfo.selectStatus = false + bagManagerList.remove(cancelBagInfo) + } } selectedBagNum = 0 selectedBagSize = 0 @@ -122,9 +125,8 @@ internal class BadCaseManagerView @JvmOverloads constructor( bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp) } } - bagUploadDialog?.setAllUpload(selectedBagNum,selectedBagSize) bagUploadDialog?.show() - + bagUploadDialog?.setAllUpload(selectedBagNum,selectedBagSize) }else{ ToastUtils.showShort("请先选择要上传的Bag包") } @@ -211,56 +213,78 @@ internal class BadCaseManagerView @JvmOverloads constructor( // DownloadManager.getInstance().download("CarPad/mogopadlog/X20202111230C01YYW/2023-01-30/Audio_1675049657187_BadCase.wav", // "/mnt/sdcard/mogo/","test13.wav") - val descriptionEntityOne = BagDescriptionEntity("包信息描述1",false, - "CarPad/mogopadlog/X20202111230C01YYW/2023-01-30/Audio_1675049657187_BadCase.wav",false) - val bagInfoEntityOne = BagInfoEntity() - bagInfoEntityOne.key = 12341 - bagInfoEntityOne.totalSize = 1*1024*1024*1000 - bagInfoEntityOne.timestamp = System.currentTimeMillis().toString() - bagInfoEntityOne.bagPath = "" - bagInfoEntityOne.mergeStat = false - bagInfoEntityOne.uploadStat = false - bagInfoEntityOne.description = descriptionEntityOne - - val descriptionEntityTwo = BagDescriptionEntity("包信息描述2",true, - "CarPad/mogopadlog/X20202111230C01YYW/2023-01-30/Audio_1675049657187_BadCase.wav",true) - val bagInfoEntityTwo = BagInfoEntity() - bagInfoEntityTwo.key = 12342 - bagInfoEntityTwo.totalSize = 2*1024*1024*1000 - bagInfoEntityTwo.timestamp = System.currentTimeMillis().toString() - bagInfoEntityTwo.bagPath = "" - bagInfoEntityTwo.mergeStat = false - bagInfoEntityTwo.uploadStat = false - bagInfoEntityTwo.description = descriptionEntityTwo - - val descriptionEntityThree = BagDescriptionEntity("包信息描述3",true, - "CarPad/mogopadlog/X20202111230C01YYW/2023-01-30/Audio_1675049657187_BadCase.wav",true) - val bagInfoEntityThree = BagInfoEntity() - bagInfoEntityThree.key = 12343 - bagInfoEntityThree.totalSize = 1*1024*1024*1000 - bagInfoEntityThree.timestamp = System.currentTimeMillis().toString() - bagInfoEntityThree.bagPath = "" - bagInfoEntityThree.mergeStat = false - bagInfoEntityThree.uploadStat = false - bagInfoEntityThree.description = descriptionEntityThree - - val descriptionEntityFour = BagDescriptionEntity("包信息描述1",true, - "CarPad/mogopadlog/X20202111230C01YYW/2023-01-30/Audio_1675049657187_BadCase.wav",true) - val bagInfoEntityFour = BagInfoEntity() - bagInfoEntityFour.key = 12344 - bagInfoEntityFour.totalSize = 10*1024*1024*1000L - bagInfoEntityFour.timestamp = System.currentTimeMillis().toString() - bagInfoEntityFour.bagPath = "" - bagInfoEntityFour.mergeStat = false - bagInfoEntityFour.uploadStat = false - bagInfoEntityFour.description = descriptionEntityFour - - bagManagerEntity.bagsInfoResp.add(bagInfoEntityOne) - bagManagerEntity.bagsInfoResp.add(bagInfoEntityTwo) - bagManagerEntity.bagsInfoResp.add(bagInfoEntityThree) - bagManagerEntity.bagsInfoResp.add(bagInfoEntityFour) - - bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp) +// val descriptionEntityOne = BagDescriptionEntity("包信息描述1",false, +// "CarPad/mogopadlog/X20202111230C01YYW/2023-01-30/Audio_1675049657187_BadCase.wav",false) +// val bagInfoEntityOne = BagInfoEntity() +// bagInfoEntityOne.key = 12341 +// bagInfoEntityOne.totalSize = 1*1024*1024*1000 +// bagInfoEntityOne.timestamp = "20230208125414" +// bagInfoEntityOne.bagPath = "" +// bagInfoEntityOne.mergeStat = false +// bagInfoEntityOne.uploadStat = false +// bagInfoEntityOne.description = descriptionEntityOne +// +// val descriptionEntityTwo = BagDescriptionEntity("包信息描述2",true, +// "CarPad/mogopadlog/X20202111230C01YYW/2023-01-30/Audio_1675049657187_BadCase.wav",true) +// val bagInfoEntityTwo = BagInfoEntity() +// bagInfoEntityTwo.key = 12342 +// bagInfoEntityTwo.totalSize = 2*1024*1024*1000 +// bagInfoEntityTwo.timestamp = "20230208125414" +// bagInfoEntityTwo.bagPath = "" +// bagInfoEntityTwo.mergeStat = false +// bagInfoEntityTwo.uploadStat = false +// bagInfoEntityTwo.description = descriptionEntityTwo +// +// val descriptionEntityThree = BagDescriptionEntity("包信息描述3",true, +// "CarPad/mogopadlog/X20202111230C01YYW/2023-01-30/Audio_1675049657187_BadCase.wav",true) +// val bagInfoEntityThree = BagInfoEntity() +// bagInfoEntityThree.key = 12343 +// bagInfoEntityThree.totalSize = 1*1027*1000 +// bagInfoEntityThree.timestamp = "20230208125414" +// bagInfoEntityThree.bagPath = "" +// bagInfoEntityThree.mergeStat = false +// bagInfoEntityThree.uploadStat = false +// bagInfoEntityThree.description = descriptionEntityThree +// +// val descriptionEntityFour = BagDescriptionEntity("包信息描述4",true, +// "CarPad/mogopadlog/X20202111230C01YYW/2023-01-30/Audio_1675049657187_BadCase.wav",true) +// val bagInfoEntityFour = BagInfoEntity() +// bagInfoEntityFour.key = 12344 +// bagInfoEntityFour.totalSize = 10*1024*1024*1000L +// bagInfoEntityFour.timestamp = "20230208125414" +// bagInfoEntityFour.bagPath = "" +// bagInfoEntityFour.mergeStat = false +// bagInfoEntityFour.uploadStat = false +// bagInfoEntityFour.description = descriptionEntityFour +// +// val list: MutableList = ArrayList() +// list.add(bagInfoEntityOne) +// list.add(bagInfoEntityTwo) +// list.add(bagInfoEntityThree) +// list.add(bagInfoEntityFour) +// for(entity in list){ +// entity.timestamp?.let { +// val month = it.substring(4,6) +// val day = it.substring(6,8) +// val time = "${month}月${day}日" +// var containTime = false +// for(bag in bagManagerEntity.bagsInfoResp){ +// if(bag.timeStr == time){ +// containTime = true +// } +// } +// if(!containTime || bagManagerEntity.bagsInfoResp.size ==0){ +// //增加时间的 +// val bagInfoEntity = BagInfoEntity() +// bagInfoEntity.itemType = 1 +// bagInfoEntity.timeStr = time +// bagManagerEntity.bagsInfoResp.add(bagInfoEntity) +// } +// bagManagerEntity.bagsInfoResp.add(entity) +// } +// } +// +// bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp) } @@ -300,20 +324,40 @@ internal class BadCaseManagerView @JvmOverloads constructor( if(bagManager.bagsInfoRespCount>0){ 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.description = descriptionEntity - for(subBag in it.subBagsList){ - val subBagEntity = SubBagEntity(subBag.key,subBag.host,subBag.size) - bagInfoEntity.subBags.add(subBagEntity) + it.timestamp?.let { time -> + 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.description = descriptionEntity + for(subBag in it.subBagsList){ + val subBagEntity = SubBagEntity(subBag.key,subBag.host,subBag.size) + bagInfoEntity.subBags.add(subBagEntity) + } + + val month = time.substring(4,6) + val day = time.substring(6,8) + val time = "${month}月${day}日" + var containTime = false + for(bag in bagManagerEntity.bagsInfoResp){ + if(bag.timeStr == time){ + containTime = true + } + } + if(!containTime || bagManagerEntity.bagsInfoResp.size ==0){ + //增加时间的 + val bagInfoEntity = BagInfoEntity() + bagInfoEntity.itemType = 1 + bagInfoEntity.timeStr = time + bagManagerEntity.bagsInfoResp.add(bagInfoEntity) + } + + bagManagerEntity.bagsInfoResp.add(bagInfoEntity) } - bagManagerEntity.bagsInfoResp.add(bagInfoEntity) } } //更新List diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BagUploadDialog.java b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BagUploadDialog.java index 52045bd0c4..95154416e3 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BagUploadDialog.java +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BagUploadDialog.java @@ -1,5 +1,6 @@ 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; @@ -11,6 +12,8 @@ import androidx.annotation.NonNull; import com.zhjt.mogo_core_function_devatools.R; +import java.text.DecimalFormat; + /** * @author XuXinChao * @description Bag包上传进度展示弹窗 @@ -23,12 +26,13 @@ public class BagUploadDialog extends Dialog { private TextView tvUploadDetail;//上传详情 private ProgressBar viewUploadProgress;//上传进度条 - private int totalNum; - private Long totalSize; - private int remainNum; - private Long remainSize; + 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); @@ -82,17 +86,26 @@ public class BagUploadDialog extends Dialog { uploadListener = listener; } - public void setAllUpload(int totalNum,Long totalSize){ + @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)"); } - public void updateRemainUpload(int remainNum,Long remainSize){ + @SuppressLint("SetTextI18n") + public void updateRemainUpload(int remainNum, Long remainSize){ this.remainNum = remainNum; this.remainSize = remainSize; //更新进度条和进度文字 - tvUploadDetail.setText("共计"+totalNum+"个包 ("+(totalSize/(1000*1024*1024L))+"G) 已上传"+(totalNum-remainNum)+"个包 (" - +((totalSize-remainSize)/(1000*1024*1024L))+"G) 剩余"+remainNum+"个包 ("+ (remainSize/(1000*1024*1024L))+"G)"); + 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); } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/SpaceWarningDialog.java b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/SpaceWarningDialog.java index 68fb89106d..0b1656014a 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/SpaceWarningDialog.java +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/SpaceWarningDialog.java @@ -1,7 +1,7 @@ package com.zhjt.mogo_core_function_devatools.badcase.biz; +import android.app.Activity; import android.app.Dialog; -import android.content.Context; import android.os.Bundle; import android.view.WindowManager; import android.widget.TextView; @@ -20,9 +20,11 @@ public class SpaceWarningDialog extends Dialog { private TextView tvCleanDisk;//清理磁盘 private TextView tvCancel;//取消 + private Activity mActivity; - public SpaceWarningDialog(@NonNull Context context) { - super(context, R.style.bad_case_dialog); + public SpaceWarningDialog(@NonNull Activity activity) { + super(activity, R.style.bad_case_dialog); + mActivity = activity; } @Override @@ -47,7 +49,9 @@ public class SpaceWarningDialog extends Dialog { //清理磁盘 tvCleanDisk.setOnClickListener(v -> { //跳转录包管理页面 - CallerDevaToolsManager.INSTANCE.showBadCaseManagerView(getContext()); + if(mActivity!=null){ + CallerDevaToolsManager.INSTANCE.showBadCaseManagerView(mActivity); + } dismiss(); }); //取消 diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/adapter/BagManagerListAdapter.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/adapter/BagManagerListAdapter.kt index ae037f522d..a5bc9e11d0 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/adapter/BagManagerListAdapter.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/adapter/BagManagerListAdapter.kt @@ -9,119 +9,140 @@ import android.widget.CheckBox import android.widget.EditText import android.widget.ImageView import android.widget.TextView -import androidx.core.widget.addTextChangedListener import androidx.recyclerview.widget.RecyclerView import com.mogo.eagle.core.data.badcase.BagDescriptionEntity import com.mogo.eagle.core.data.badcase.BagInfoEntity -import com.mogo.eagle.core.utilcode.util.TimeUtils import com.zhjt.mogo_core_function_devatools.R -import kotlinx.coroutines.NonDisposableHandle -import kotlinx.coroutines.NonDisposableHandle.parent +import java.text.DecimalFormat /** * @author XuXinChao * @description Bag包管理列表适配器 * @since: 2022/12/19 */ -class BagManagerListAdapter: RecyclerView.Adapter() { +class BagManagerListAdapter: RecyclerView.Adapter() { private var data:List ?= null private var bagClickListener: BagClickListener ?= null + private val format = DecimalFormat("0.0") fun setData(data: List?){ this.data = data notifyDataSetChanged() } - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BagManagerListHolder { - val view = LayoutInflater.from(parent.context) - .inflate(R.layout.item_bag_manager, parent, false) - return BagManagerListHolder(view) + 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: BagManagerListHolder, position: Int) { - data?.let { - val bagInfoEntity = it[position] -// if(bagInfoEntity.description?.description.isNullOrEmpty()){ -// holder.cbBagSelect.text = bagInfoEntity.key.toString() -// }else{ -// holder.cbBagSelect.text = bagInfoEntity.description?.description -// } - holder.cbBagSelect.setOnCheckedChangeListener(null) - holder.cbBagSelect.isChecked = bagInfoEntity.selectStatus - holder.cbBagSelect.tag = bagInfoEntity - holder.cbBagSelect.setOnCheckedChangeListener { _, isChecked -> - bagClickListener?.onClick(bagInfoEntity,isChecked) + 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) + } - holder.etBagNameEdit.addTextChangedListener(object:TextWatcher{ - override fun beforeTextChanged( - s: CharSequence?, - start: Int, - count: Int, - after: Int - ) { + holder.etBagNameEdit.addTextChangedListener(object:TextWatcher{ + override fun beforeTextChanged( + s: CharSequence?, + start: Int, + count: Int, + after: Int + ) { - } + } - override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { - } + } - override fun afterTextChanged(s: Editable?) { - bagInfoEntity.description?.let { desc-> - val descriptionStr = s.toString() - if(desc.description != descriptionStr){ - desc.description = descriptionStr - bagClickListener?.editDescription(bagInfoEntity.key,desc) + override fun afterTextChanged(s: Editable?) { + bagInfoEntity.description?.let { desc-> + val descriptionStr = s.toString() + if(desc.description != descriptionStr){ + desc.description = descriptionStr + bagClickListener?.editDescription(bagInfoEntity.key,desc) + } + } + } + + }) + + 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) } } - } - }) - 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(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}" } } - 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 - } - - holder.tvBagSize.text = "${bagInfoEntity.totalSize/(1000*1024*1024)}G" - holder.tvBagTime.text = - it[position].timestamp?.let { it1 -> TimeUtils.millis2String(it1.toLong(),TimeUtils.getHourMinSecondFormat()) } - - } } 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) diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_bag_audio.png b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_bag_audio.png new file mode 100644 index 0000000000..2959045ff3 Binary files /dev/null and b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable-xhdpi/icon_bag_audio.png differ diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/icon_bag_edit.png b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/icon_bag_edit.png new file mode 100644 index 0000000000..09ffe565d7 Binary files /dev/null and b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/icon_bag_edit.png differ diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/dialog_bag_upload.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/dialog_bag_upload.xml index ac59ac7c64..0f76ebdba2 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/dialog_bag_upload.xml +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/dialog_bag_upload.xml @@ -73,10 +73,10 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" - android:layout_marginTop="275px" + android:layout_marginTop="270px" style="?android:attr/progressBarStyleHorizontal" android:max="100" - android:progress="40" + android:progress="0" android:progressDrawable="@drawable/progress_bar_drawable" /> @@ -87,7 +87,7 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" - android:layout_marginTop="378px" + android:layout_marginTop="370px" android:textColor="#FF06D1ED" android:textSize="43px" android:gravity="center" diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml index feb1231767..eb969081db 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml @@ -26,9 +26,9 @@ app:layout_constraintLeft_toRightOf="@id/cbBagSelect" app:layout_constraintRight_toLeftOf="@id/tvBagTime" android:layout_marginStart="15dp" - android:layout_marginEnd="20dp" + android:layout_marginEnd="30dp" android:background="@null" - android:drawableEnd="@drawable/icon_dev_status_un_fold" + android:drawableEnd="@drawable/icon_bag_edit" android:textColor="#FFFFFFFF" android:textSize="32dp" android:maxLines="1" @@ -57,9 +57,9 @@ app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintRight_toLeftOf="@id/tvBagReportStatus" - android:src="@drawable/icon_dev_status_un_fold" + android:src="@drawable/icon_bag_audio" android:visibility="invisible" - android:layout_marginEnd="20dp" + android:layout_marginEnd="30dp" /> + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/layout_badcase_manager.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/layout_badcase_manager.xml index 78c13df55d..3db62e3e3f 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/layout_badcase_manager.xml +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/layout_badcase_manager.xml @@ -174,8 +174,8 @@ app:layout_constraintRight_toRightOf="@id/pbSpacePercent" app:layout_constraintTop_toBottomOf="@id/tvSelectAll" app:layout_constraintBottom_toTopOf="@id/tvUploadCloud" - android:layout_marginTop="20dp" - android:layout_marginBottom="20dp" + android:layout_marginTop="30dp" + android:layout_marginBottom="30dp" /> \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index ff7c2dbe2a..f8dd7bd27d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -1,6 +1,7 @@ package com.mogo.eagle.core.function.hmi.ui import android.animation.Animator +import android.app.Activity import android.content.* import android.graphics.* import android.graphics.drawable.* @@ -401,13 +402,12 @@ class MoGoHmiFragment : MvpFragment(), super.onBagManagerResult(bagManager) //判断磁盘是否已满,展示预警弹窗 UiThreadHandler.post{ - bagManager.spaceInfoRespCount if(bagManager.spaceInfoRespCount>0){ for(spaceInfo in bagManager.spaceInfoRespList){ for(bagSpaceInfo in spaceInfo.bagDirsSpaceInfoList){ if(bagSpaceInfo.free == 0L){ //磁盘空间已满 - val spaceWarningDialog = SpaceWarningDialog(requireContext()) + val spaceWarningDialog = SpaceWarningDialog(context as Activity) spaceWarningDialog.show() } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/debug_icon_bag_manager.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/debug_icon_bag_manager.png new file mode 100644 index 0000000000..8dc2dff73f Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/debug_icon_bag_manager.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml index 9b31c7183f..a821ce24f2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml @@ -185,7 +185,8 @@ android:layout_width="150dp" android:layout_height="150dp" android:layout_centerHorizontal="true" - android:background="@drawable/debug_icon_sop" /> + android:background="@drawable/debug_icon_bag_manager" + /> =ArrayList()// 子包信息 var selectStatus: Boolean = false //Bag包勾选状态,默认为未勾选 + var itemType: Int = 0 //0是正常Bag包,1为时间Title + var timeStr: String = "" } \ No newline at end of file