diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/adapter/TopicListAdapter.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/adapter/TopicListAdapter.kt index 7d1c810990..dc7ffabf0b 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/adapter/TopicListAdapter.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/adapter/TopicListAdapter.kt @@ -15,10 +15,10 @@ import com.zhjt.mogo_core_function_devatools.R */ class TopicListAdapter: RecyclerView.Adapter() { - private var data:List? = null + private var data:MutableList? = null private var topicClickListener: TopicClickListener? = null - fun setData( data: List?){ + fun setData( data: MutableList?){ this.data = data } @@ -39,13 +39,37 @@ class TopicListAdapter: RecyclerView.Adapter() holder.topic_check_box.isChecked = topicList[position].topicStatus holder.topic_check_box.tag = topicList holder.topic_check_box.isClickable = topicList[position].topicCanClick - holder.topic_check_box.setOnCheckedChangeListener { _, b -> - topicList[position].topicStatus = b - topicClickListener?.onClick(topicList[position].topicName,b) + holder.topic_check_box.setOnCheckedChangeListener { _, isChecked -> + topicList[position].topicStatus = isChecked + topicClickListener?.onClick(topicList[position].topicName,isChecked) + if(isChecked){ + //滚动到置顶 + moveItem(topicList[position],position,0) + }else{ + var lastNotCan = 0 //最后一个不能选择的 + for( i in 0 until itemCount){ + var topicEntity = data?.get(i) + if (topicEntity != null) { + if(!topicEntity.topicCanClick){ + lastNotCan = i + } + } + } + moveItem(topicList[position],position,lastNotCan) + } } } } + private fun moveItem(topicEntity: TopicEntity,removePos: Int,insertedPos: Int){ + data?.remove(topicEntity) + notifyItemRemoved(removePos) + notifyItemRangeChanged(removePos, itemCount - removePos) + data?.add(insertedPos, topicEntity) + notifyItemInserted(insertedPos) + notifyItemRangeChanged(insertedPos, itemCount) + } + override fun getItemCount() = data?.size ?: 0 class TopicListHolder(itemView: View) : RecyclerView.ViewHolder(itemView){ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt index f77c252142..f00e5f8ee2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt @@ -17,7 +17,9 @@ import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.module.service.routeoverlay.RouteStrategy +import kotlinx.android.synthetic.main.view_debug_setting.view.* import kotlinx.android.synthetic.main.view_sop_setting.view.* +import kotlinx.android.synthetic.main.view_sop_setting.view.tbRouteDynamicEffect /** * SOP设置窗口 @@ -134,6 +136,13 @@ class SOPSettingView @JvmOverloads constructor( } } + + //是否开启异常上报 + tbIPCReport.isChecked = FunctionBuildConfig.isReportWarning + tbIPCReport.setOnCheckedChangeListener { _, isChecked -> + FunctionBuildConfig.isReportWarning = isChecked + } + //变道绕障的目标障碍物速度阈值 tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s" ivSpeedReduce.setOnClickListener { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml index 5644c7fbec..f574e97e7d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml @@ -121,12 +121,25 @@ app:layout_constraintTop_toBottomOf="@id/tbRainMode" /> + + > exten } @Override - public void onWindowFocusChanged(boolean hasFocus) { - super.onWindowFocusChanged(hasFocus); + protected void onRestart() { + super.onRestart(); BarUtils.hideStatusBarAndSticky(this.getWindow()); }