diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt index 5a14e847d5..893c53223d 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/BadCaseManager.kt @@ -248,6 +248,8 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis ) } bag录制失败" ) + //录包失败时,保存录包失败状态 + BadCaseConfig.bagRecordFailList.add(recordPanel.key) } return } 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 9017d57097..71cb1c78dc 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 @@ -8,6 +8,8 @@ import android.os.Handler import android.util.AttributeSet import android.view.LayoutInflater import android.view.View +import android.view.inputmethod.InputMethodManager +import android.widget.EditText import androidx.constraintlayout.widget.ConstraintLayout import androidx.recyclerview.widget.LinearLayoutManager import bag_manager.BagManagerOuterClass @@ -222,6 +224,11 @@ class BadCaseManagerView @JvmOverloads constructor( recordScreenDialog?.showScreenImage(key) } + override fun startEdit(editText: EditText) { + val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager? + imm?.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT) + } + }) val linearLayoutManager = LinearLayoutManager(context) rvBagList.layoutManager = linearLayoutManager diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt index 5bf02d4ae2..e25cb093a9 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/InitiativeBadCaseWindow.kt @@ -568,6 +568,8 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList //开始录制 if(recordPanel.stat == 300){ BadCaseConfig.recordKeyList.add(recordPanel.key) + //保存录包状态 + BadCaseConfig.bagResourceList.add(recordPanel.key) //开启高精地图截图 CallerMapUIServiceManager.getMapUIController()?.getMapScreenShot() } 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 9490029f08..67d912e1e8 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 @@ -12,9 +12,13 @@ import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import com.mogo.eagle.core.data.deva.badcase.BagDescriptionEntity import com.mogo.eagle.core.data.deva.badcase.BagInfoEntity +import com.mogo.eagle.core.utilcode.util.FileUtils.millis2String +import com.mogo.eagle.core.utilcode.util.TimeUtils import com.zhjt.mogo_core_function_devatools.R +import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig import java.text.DecimalFormat + /** * @author XuXinChao * @description Bag包管理列表适配器 @@ -32,14 +36,14 @@ class BagManagerListAdapter: RecyclerView.Adapter() { } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - if(viewType == 1){ + return if(viewType == 1){ val view = LayoutInflater.from(parent.context) .inflate(R.layout.item_bag_time_title,parent,false) - return BagTimeTitleHolder(view) + BagTimeTitleHolder(view) }else{ val view = LayoutInflater.from(parent.context) .inflate(R.layout.item_bag_manager, parent, false) - return BagManagerListHolder(view) + BagManagerListHolder(view) } } @@ -92,18 +96,25 @@ class BagManagerListAdapter: RecyclerView.Adapter() { bagInfoEntity.description?.let { des-> - if(des.reportBI){ - //已上报 - holder.tvBagReportStatus.text = "已上报" + if(BadCaseConfig.bagRecordFailList.contains(bagInfoEntity.key)){ + //如果在录包失败列表中找到该Bag包,则该包为录包失败状态 + holder.tvBagReportStatus.text = "录包失败" holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_reported_button_bg) holder.tvBagReportStatus.isClickable = false }else{ - //未上报 - holder.tvBagReportStatus.text = "上报" - holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_report_button_bg) - holder.tvBagReportStatus.isClickable = true - holder.tvBagReportStatus.setOnClickListener { - bagClickListener?.uploadBI(bagInfoEntity) + if(des.reportBI){ + //已上报 + holder.tvBagReportStatus.text = "已上报" + holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_reported_button_bg) + holder.tvBagReportStatus.isClickable = false + }else{ + //未上报 + holder.tvBagReportStatus.text = "上报" + holder.tvBagReportStatus.setBackgroundResource(R.drawable.bag_report_button_bg) + holder.tvBagReportStatus.isClickable = true + holder.tvBagReportStatus.setOnClickListener { + bagClickListener?.uploadBI(bagInfoEntity) + } } } if(des.description.isEmpty()){ @@ -119,6 +130,25 @@ class BagManagerListAdapter: RecyclerView.Adapter() { } } + //录包来源:自动 or 人工 + if(BadCaseConfig.bagResourceList.contains(bagInfoEntity.key)){ + //在该列表中找到Bag包的Key则代表该Bag为人工录包 + holder.tvBagResource.text = "人工" + holder.tvBagResource.setBackgroundResource(R.drawable.bag_artificial_button_bg) + }else{ + //自动录包 + holder.tvBagResource.text = "自动" + holder.tvBagResource.setBackgroundResource(R.drawable.bag_auto_button_bg) + } + + //编辑文字按钮 + holder.ivEditReason.setOnClickListener { + holder.etBagNameEdit.requestFocus() + holder.etBagNameEdit.performClick() + //调起软键盘 + bagClickListener?.startEdit(holder.etBagNameEdit) + } + if(bagInfoEntity.description?.hasAudio == true){ holder.ivBagAudio.visibility = View.VISIBLE holder.ivBagAudio.setOnClickListener { @@ -144,6 +174,15 @@ class BagManagerListAdapter: RecyclerView.Adapter() { e.printStackTrace() } } + + //只有当天的Bag才显示查看截图按钮 + bagInfoEntity.timestamp.let {day -> + val currentDay = millis2String(System.currentTimeMillis(), TimeUtils.getMdFormatTwo()) + if(day.contains(currentDay)){ + holder.ivMapScreen.visibility = View.VISIBLE + } + } + } } } @@ -167,6 +206,8 @@ class BagManagerListAdapter: RecyclerView.Adapter() { var tvBagTime: TextView = itemView.findViewById(R.id.tvBagTime) var tvBagSize: TextView = itemView.findViewById(R.id.tvBagSize) var ivMapScreen: ImageView = itemView.findViewById(R.id.ivMapScreen) + var tvBagResource: TextView = itemView.findViewById(R.id.tvBagResource) + var ivEditReason: ImageView = itemView.findViewById(R.id.ivEditReason) } fun setListener(listener: BagClickListener){ @@ -184,6 +225,8 @@ class BagManagerListAdapter: RecyclerView.Adapter() { fun bagAudio(key: Long,audioUrl: String) //查看高精地图截图 fun lookMapScreen(key: Long) + //点击按钮调起编辑Bag包信息 + fun startEdit(editText: EditText) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/consts/BadCaseConfig.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/consts/BadCaseConfig.kt index 29b7741383..b6ee0d1047 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/consts/BadCaseConfig.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/consts/BadCaseConfig.kt @@ -37,5 +37,11 @@ object BadCaseConfig { //Bag包管理列表 @JvmField var bagManagerList: ArrayList = ArrayList() + //Bag包来源,将主动录包的Key保存在该列表中,不在该列表中的在录包管理页面的Bag包视为被动录包 + @JvmField + var bagResourceList: ArrayList = ArrayList() + //Bag包录包失败状态列表,当Bag录制失败时保存在该列表,当Bag包在该列表中不存在时即视为录包成功 + @JvmField + var bagRecordFailList: ArrayList = ArrayList() } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bag_artificial_button_bg.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bag_artificial_button_bg.xml new file mode 100644 index 0000000000..03f1407ad1 --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bag_artificial_button_bg.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bag_auto_button_bg.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bag_auto_button_bg.xml new file mode 100644 index 0000000000..fdc5ea6d1e --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/drawable/bag_auto_button_bg.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file 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 3177571e65..3d02585ffa 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 @@ -17,25 +17,56 @@ app:layout_constraintStart_toStartOf="parent" /> - + + + + + + + - \ No newline at end of file diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/TimeUtils.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/TimeUtils.java index e837752e57..3edf2d84c8 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/TimeUtils.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/TimeUtils.java @@ -51,6 +51,10 @@ public final class TimeUtils { return getSafeDateFormat("yyyy-MM-dd"); } + public static SimpleDateFormat getMdFormatTwo(){ + return getSafeDateFormat("yyyyMMdd"); + } + public static SimpleDateFormat getHourMinSecondFormat(){ return getSafeDateFormat("HH:mm:ss"); }