[3.3.0][魔方] 移除之前在调试面板上的魔方调试入口,迁移到运营面板上;添加[魔方指令测试]开关,打开后用户点击魔方按键只显示Toast不给工控机下发指令
This commit is contained in:
@@ -15,7 +15,9 @@ import com.mogo.eagle.core.function.api.devatools.mofang.IMoGoMoFangProvider.OnM
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListener {
|
||||
|
||||
@@ -31,6 +33,18 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
|
||||
private val linkedLog by lazy { MoFangLinkedLog().also { executor.setLinkedLog(it) } }
|
||||
|
||||
private val isTest by lazy { AtomicBoolean(false) }
|
||||
|
||||
private val toast by lazy { AtomicReference<Toast>() }
|
||||
|
||||
override fun enableTest(enable: Boolean) {
|
||||
isTest.set(enable)
|
||||
}
|
||||
|
||||
override fun isEnableTest(): Boolean {
|
||||
return isTest.get()
|
||||
}
|
||||
|
||||
override fun init(app: Application) {
|
||||
try {
|
||||
linkedLog.record(mapOf("init" to "start"))
|
||||
@@ -135,6 +149,13 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
}
|
||||
|
||||
override fun onBluetoothKeyBoardCombineClicked(vararg keyCodes: Int) {
|
||||
if (isTest.get()) {
|
||||
toast.get()?.cancel()
|
||||
Toast.makeText(Utils.getApp(), "组合键[${keyCodes.joinToString(",") { KeyEvent.keyCodeToString(it) }}]触发了\n[正式使用时,请关闭运营面板上的\"魔方指令\"测试开关]", Toast.LENGTH_SHORT).also {
|
||||
toast.set(it)
|
||||
}.show()
|
||||
return
|
||||
}
|
||||
try {
|
||||
linkedLog.record(mapOf("command" to "combine_clicked: ${keyCodes.joinToString(",") { KeyEvent.keyCodeToString(it) } }"))
|
||||
executor.handleCombineClick(*keyCodes)
|
||||
@@ -146,6 +167,13 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
}
|
||||
|
||||
override fun onBluetoothKeyBoardLongClicked(keyCode: Int) {
|
||||
if (isTest.get()) {
|
||||
toast.get()?.cancel()
|
||||
Toast.makeText(Utils.getApp(), "长按键[${KeyEvent.keyCodeToString(keyCode)}]触发了\n[正式使用时,请关闭运营面板上的\"魔方指令\"测试开关]", Toast.LENGTH_SHORT).also {
|
||||
toast.set(it)
|
||||
}.show()
|
||||
return
|
||||
}
|
||||
try {
|
||||
linkedLog.record(mapOf("command" to "long_clicked: ${ KeyEvent.keyCodeToString(keyCode) }"))
|
||||
executor.handleLongClick(keyCode)
|
||||
@@ -159,6 +187,13 @@ internal class MoGoMoFangProviderImpl: IMoGoMoFangProvider, OnMoFangDeviceListen
|
||||
}
|
||||
|
||||
override fun onBluetoothKeyboardClicked(keyCode: Int) {
|
||||
if (isTest.get()) {
|
||||
toast.get()?.cancel()
|
||||
Toast.makeText(Utils.getApp(), "单击键[${KeyEvent.keyCodeToString(keyCode)}]触发了\n[正式使用时,请关闭运营面板上的\"魔方指令\"测试开关]", Toast.LENGTH_SHORT).also {
|
||||
toast.set(it)
|
||||
}.show()
|
||||
return
|
||||
}
|
||||
try {
|
||||
linkedLog.record(mapOf("command" to "clicked: ${ KeyEvent.keyCodeToString(keyCode) }"))
|
||||
executor.handleSingleClick(keyCode)
|
||||
|
||||
@@ -324,15 +324,15 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
/**
|
||||
* 蘑方点击事件
|
||||
*/
|
||||
tbMojie.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if (isChecked) {
|
||||
buttonView.setCompoundDrawables(null, null, iconDown, null)
|
||||
tbOpenMfView.visibility = View.VISIBLE
|
||||
} else {
|
||||
buttonView.setCompoundDrawables(null, null, iconRight, null)
|
||||
tbOpenMfView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
// tbMojie.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
// if (isChecked) {
|
||||
// buttonView.setCompoundDrawables(null, null, iconDown, null)
|
||||
// tbOpenMfView.visibility = View.VISIBLE
|
||||
// } else {
|
||||
// buttonView.setCompoundDrawables(null, null, iconRight, null)
|
||||
// tbOpenMfView.visibility = View.GONE
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* APP升级点击事件
|
||||
@@ -349,13 +349,13 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 蘑方控制 默认关闭
|
||||
*/
|
||||
tbOpenMfView.isChecked = HmiBuildConfig.isShowMfToastView
|
||||
tbOpenMfView.setOnCheckedChangeListener { _, isChecked ->
|
||||
HmiBuildConfig.isShowMfToastView = isChecked
|
||||
}
|
||||
// /**
|
||||
// * 蘑方控制 默认关闭
|
||||
// */
|
||||
// tbOpenMfView.isChecked = HmiBuildConfig.isShowMfToastView
|
||||
// tbOpenMfView.setOnCheckedChangeListener { _, isChecked ->
|
||||
// HmiBuildConfig.isShowMfToastView = isChecked
|
||||
// }
|
||||
|
||||
/**
|
||||
* 版本信息
|
||||
|
||||
@@ -286,8 +286,9 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
btnSpeedSet.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
mfStatusLayout.setClickEnabled(false)
|
||||
/**
|
||||
* 魔方sop运营相关配置
|
||||
*/
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
val mf = CallerDevaToolsManager.mofang()
|
||||
if (mf != null) {
|
||||
@@ -318,6 +319,15 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mfTest.isEnabled = true
|
||||
mfTest.isChecked = mf?.isEnableTest() ?: false
|
||||
mfTest.setOnCheckedChangeListener { _, isChecked ->
|
||||
mf?.enableTest(isChecked)
|
||||
}
|
||||
} else {
|
||||
mfStatusLayout.setClickEnabled(false)
|
||||
mfTest.isEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -290,32 +290,6 @@
|
||||
android:textOn="关闭obu预警融合"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<!-- 蘑方控制 start -->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbMojie"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:drawableEnd="@drawable/icon_right"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:textOff="蘑方控制"
|
||||
android:textOn="蘑方控制"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/tbOpenMfView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="蘑方按键Toast"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:scaleY="1"
|
||||
android:scaleX="1" />
|
||||
<!-- 蘑方控制 end -->
|
||||
|
||||
<!-- APP升级数据 start -->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbAppUpgrade"
|
||||
|
||||
@@ -336,15 +336,33 @@
|
||||
android:layout_marginStart="10dp"
|
||||
/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.setting.StateViewLayout
|
||||
android:id="@+id/mfStatusLayout"
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvSpeedThresholdTitle"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:padding="5dip"
|
||||
android:background="@drawable/bg_mf_sop_operator"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvSpeedThresholdTitle"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
android:layout_marginEnd="15dp" >
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.setting.StateViewLayout
|
||||
android:id="@+id/mfStatusLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/mfTest"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="魔方指令测试"
|
||||
android:paddingTop="25dp"
|
||||
android:layout_marginTop="5dip"
|
||||
android:paddingBottom="25dp" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user