[6.7.0][工具箱] feat: 增加工具箱里item 漫游;

This commit is contained in:
aibingbing
2024-09-23 14:37:33 +08:00
parent cd7cf712cc
commit f5450fcfd3
6 changed files with 153 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.och.IToolKitItemClickListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.bone.toolkit.custom.ToolDriverRomaView
import com.mogo.eagle.core.function.hmi.bone.toolkit.custom.ToolRestartSystemView
import com.mogo.eagle.core.function.hmi.bone.toolkit.custom.ToolStopServiceView
import com.mogo.eagle.core.function.hmi.ui.setting.SopView
@@ -34,7 +35,8 @@ object ToolKitDataManager : IToolKitItemClickListener {
KILL_APP, //杀死 APP
RESTART_SYSTEM, //重启系统
STOP_SERVICE, //停止服务
AI_REPORT //AI数据采集
AI_REPORT, //AI数据采集
ROMA, //漫游
}
private val listeners by lazy { ConcurrentHashMap<String, IToolKitItemClickListener>() }
@@ -98,6 +100,15 @@ object ToolKitDataManager : IToolKitItemClickListener {
ToolTypeEnum.AI_REPORT.name,
getDefaultItemView(ctx, "上报", R.drawable.icon_toolkit_item_ai_report)
)
// 按照目前RomaTaxiView添加限制bus业务司机端taxi业务司机端 展示漫游按钮
if (AppIdentityModeUtils.isBusDriver(FunctionBuildConfig.appIdentityMode)
|| AppIdentityModeUtils.isTaxiDriver(FunctionBuildConfig.appIdentityMode)
) {
it += ToolKitBean(
ToolTypeEnum.ROMA.name,
getRoamItemView(ctx)
)
}
}
addListener(TAG, this)
}
@@ -133,6 +144,13 @@ object ToolKitDataManager : IToolKitItemClickListener {
return ToolRestartSystemView(context)
}
/**
* 漫游 自定义view
*/
private fun getRoamItemView(context: Context): View {
return ToolDriverRomaView(context)
}
override fun onItemClick(toolTag: String, ctx: Context?) {
//ToastUtils.showShort(toolTag)
when (toolTag) {

View File

@@ -0,0 +1,95 @@
package com.mogo.eagle.core.function.hmi.bone.toolkit.custom
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.function.api.map.roma.IMoGoRomaListener
import com.mogo.eagle.core.function.call.map.CallerMapIdentifyManager.romaTrigger
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ClickUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import kotlinx.android.synthetic.main.view_tool_driver_roma.view.ivRomaView
class ToolDriverRomaView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoRomaListener {
companion object {
private const val TAG = "ToolDriverRomaView"
}
@Volatile
private var romaMode = false
@Volatile
private var click = true
init {
LayoutInflater.from(context).inflate(R.layout.view_tool_driver_roma, this, true)
val a = context.obtainStyledAttributes(
attrs,
R.styleable.RomaView,
defStyleAttr,
0
)
setOnClickListener {
if (ClickUtils.isClickTooFrequent(this, 2500)) {
ToastUtils.showShort("不要频繁点击哦~")
return@setOnClickListener
}
if (!click) {
return@setOnClickListener
}
if (!MogoStatusManager.getInstance().isSocketOnLine) {
ToastUtils.showShort("长链状态异常,请检查链接后开启漫游")
return@setOnClickListener
}
click = false
romaMode = !romaMode
//司机屏不控制乘客屏漫游,独自漫游
romaTrigger(romaMode)
}
}
override fun romaViewStatus(status: Boolean) {
ThreadUtils.runOnUiThread {
if (status) {
this.visibility = View.VISIBLE
} else {
this.visibility = View.GONE
}
}
}
override fun romaStatus(status: Boolean) {
ThreadUtils.runOnUiThread {
click = true
if (status) {
romaMode = true
ivRomaView.setBackgroundResource(R.drawable.icon_toolkit_item_roma_selected)
} else {
romaMode = false
ivRomaView.setBackgroundResource(R.drawable.tool_driver_roma_select_bg)
}
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMapRomaListener.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMapRomaListener.removeListener(TAG)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/icon_toolkit_item_roma_selected" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/icon_toolkit_item_roma_selected" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/icon_toolkit_item_roma_selected" android:state_selected="true" />
<item android:drawable="@drawable/icon_toolkit_item_roma_selected" android:state_focused="true" />
<item android:drawable="@drawable/icon_toolkit_item_roma_default" />
</selector>

View File

@@ -0,0 +1,31 @@
<?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:id="@+id/cl_roma_bg"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/ivRomaView"
android:layout_width="@dimen/dp_160"
android:layout_height="@dimen/dp_160"
android:src="@drawable/tool_driver_roma_select_bg"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_1"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:text="漫游模式"
android:textColor="@color/color_FFFFFF"
android:textSize="@dimen/sp_38"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivRomaView" />
</androidx.constraintlayout.widget.ConstraintLayout>