Merge remote-tracking branch 'origin/release_robotaxi-d-app-module_2120_221017_2.12.0.1'
# Conflicts: # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java # core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt # libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java
@@ -383,6 +383,16 @@ class MoGoAutopilotProvider :
|
||||
return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration)
|
||||
}
|
||||
|
||||
override fun recordPackage(
|
||||
type: Int,
|
||||
id: Int,
|
||||
duration: Int,
|
||||
bduration: Int,
|
||||
topics: List<String>
|
||||
): Boolean {
|
||||
return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration, topics)
|
||||
}
|
||||
|
||||
override fun stopRecord(type: Int, id: Int): Boolean {
|
||||
return AdasManager.getInstance().stopRecordPackage(id, type)
|
||||
}
|
||||
@@ -501,17 +511,43 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据采集录制模式配置列表
|
||||
* 绕障类功能开关
|
||||
* isEnable = true 开启
|
||||
* isEnable = false 关闭
|
||||
* @return boolean
|
||||
*/
|
||||
override fun getBadCaseConfig() {
|
||||
AdasManager.getInstance().sendRecordDataConfigReq()
|
||||
override fun sendDetouring(isEnable: Boolean): Boolean {
|
||||
return if(isEnable){
|
||||
AdasManager.getInstance().sendDetouring(1)
|
||||
}else{
|
||||
AdasManager.getInstance().sendDetouring(0)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 变道绕障的目标障碍物速度阈值
|
||||
* @param speed 速度阈值 m/s
|
||||
* @return boolean
|
||||
*/
|
||||
override fun sendDetouringSpeed(speed: Double): Boolean {
|
||||
return AdasManager.getInstance().sendDetouringSpeed(speed)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据采集录制模式配置列表
|
||||
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
|
||||
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
|
||||
* @param topicsNeedToCache
|
||||
* @return boolean
|
||||
*/
|
||||
override fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List<String>): Boolean{
|
||||
return AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache)
|
||||
}
|
||||
|
||||
/**
|
||||
* 向左变道
|
||||
*/
|
||||
override fun sendOperatorChangeLaneLeft() {
|
||||
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorChangeLaneLeft -------> ")
|
||||
AdasManager.getInstance().sendOperatorCmdChangeLaneLeft()
|
||||
}
|
||||
|
||||
@@ -519,7 +555,6 @@ class MoGoAutopilotProvider :
|
||||
* 向右变道
|
||||
*/
|
||||
override fun sendOperatorChangeLaneRight() {
|
||||
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorChangeLaneRight -------> ")
|
||||
AdasManager.getInstance().sendOperatorCmdChangeLaneRight()
|
||||
}
|
||||
|
||||
@@ -527,7 +562,6 @@ class MoGoAutopilotProvider :
|
||||
* 发送设置加速度 acc>0加速 acc<0减速 acc=0复位
|
||||
*/
|
||||
override fun sendOperatorSetAcceleratedSpeed(cc: Double) {
|
||||
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorSetAcceleratedSpeed cc $cc ")
|
||||
AdasManager.getInstance().sendOperatorCmdSetAcceleratedSpeed(cc)
|
||||
}
|
||||
|
||||
@@ -535,10 +569,26 @@ class MoGoAutopilotProvider :
|
||||
* 鸣笛 value 1: honk 2: stop honking
|
||||
*/
|
||||
override fun sendOperatorSetHorn(value: Double) {
|
||||
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorSetHorn value $value ")
|
||||
AdasManager.getInstance().sendOperatorCmdSetHorn(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发生行程相关
|
||||
* type=1或2的时 需要参数 lineName
|
||||
* type=3或4的时 需要参数 lineName departureStopName arrivalStopName isLastStop
|
||||
* type=5时 不需要任何参数
|
||||
*
|
||||
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
|
||||
* @param lineName 路线名
|
||||
* @param departureStopName 出站站点名
|
||||
* @param arrivalStopName 下一站到达站点名
|
||||
* @param isLastStop 是否最终站
|
||||
* @return boolean
|
||||
*/
|
||||
override fun sendTripInfo(type: Int, lineName: String, departureStopName: String,arrivalStopName: String, isLastStop: Boolean) {
|
||||
AdasManager.getInstance().sendTripInfoReq(type, lineName, departureStopName,arrivalStopName, isLastStop)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送工控机所有节点重启命令
|
||||
*/
|
||||
|
||||
@@ -46,13 +46,17 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningAction
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotRotting
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotTrajectory
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPointCloudListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordConfig
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager.invokeAutopilotStatistics
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerStartAutopilotFailedListenerManager.invokeStartAutopilotFailed
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhidao.support.adas.high.OnAdasListener
|
||||
import com.zhidao.support.adas.high.bean.AutopilotAbility
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatistics
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
|
||||
@@ -412,7 +416,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
header: MessagePad.Header?,
|
||||
config: MessagePad.RecordDataConfig?
|
||||
) {
|
||||
|
||||
if(config!=null){
|
||||
invokeAutopilotRecordConfig(config)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -436,9 +442,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
}
|
||||
|
||||
|
||||
override fun onError(status: ProtocolStatus, bytes: ByteArray) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可以启动自动驾驶
|
||||
@@ -447,4 +450,36 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
override fun onAutopilotAbility(ability: AutopilotAbility?) {
|
||||
invokeAutopilotAbility(ability)
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动自动驾驶失败回调
|
||||
* 根据MAP 系统监控状态返回过滤
|
||||
* message.getMsg() 获取详细错误说明
|
||||
* message.getCode() 可用于判断属于什么类型
|
||||
*
|
||||
* @param message 数据
|
||||
*/
|
||||
override fun onStartAutopilotFailed(message: MogoReportMsg.MogoReportMessage?) {
|
||||
invokeStartAutopilotFailed(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动自动驾驶状态统计
|
||||
* 触发机制:下发启动自动驾驶命令,根据MAP返回状态判断成功或失败
|
||||
* 统计四种状态:成功 失败 取消 超时
|
||||
*
|
||||
* @param statistics 统计数据
|
||||
*/
|
||||
override fun onAutopilotStatistics(statistics: AutopilotStatistics?) {
|
||||
invokeAutopilotStatistics(statistics);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据解析失败、数据异常回调
|
||||
* @param status 错误原因
|
||||
* @param bytes 原始数据
|
||||
*/
|
||||
override fun onError(status: ProtocolStatus, bytes: ByteArray) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.mogo.eagle.core.function.appupgrade.network;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BINDING;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.bindingcar.UpgradeAppInfo;
|
||||
@@ -56,8 +57,7 @@ public class UpgradeAppNetWorkManager {
|
||||
// String mac = "48:b0:2d:3a:bc:78";
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
int versionCode = AppUtils.getAppVersionCode();
|
||||
CallerLogger.INSTANCE.d(TAG, "getAppUpgradeInfo mac = " + mac + "---type = " + screenType + "---sn = " + sn + "---versionCode =" + versionCode);
|
||||
Log.d(TAG, "mac = " + mac + "---type = " + screenType + "---sn = " + sn + "---versionCode =" + versionCode);
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "getAppUpgradeInfo mac = " + mac + "---type = " + screenType + "---sn = " + sn + "---versionCode =" + versionCode);
|
||||
UpgradeAppRequest request = new UpgradeAppRequest(sn, mac, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mUpgradeApiService.getUpgradeInfo(requestBody)
|
||||
@@ -71,14 +71,12 @@ public class UpgradeAppNetWorkManager {
|
||||
@Override
|
||||
public void onNext(@NonNull UpgradeAppInfo info) {
|
||||
if (info != null && info.result != null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "UpgradeAppInfo url = " + info.result.getAppUrl() + "----code = " + info.result.getVersionCode());
|
||||
Log.d(TAG, "UpgradeAppInfo url = " + info.result.getAppUrl() + "----code = " + info.result.getVersionCode() + "--versionCode =" + versionCode + "--info.result = " + info.result);
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "UpgradeAppInfo url = " + info.result.getAppUrl() + "----code = " + info.result.getVersionCode() + "--versionCode =" + versionCode + "--info.result = " + info.result);
|
||||
if (info.result.getVersionCode() > versionCode) {
|
||||
CallerHmiManager.INSTANCE.showUpgradeDialog(info.result.getAppUrl().substring(info.result.getAppUrl().lastIndexOf("/")+1), info.result.getAppUrl(), info.result.getInstallTitle(), info.result.getInstallContent(), info.result.getInstallType());
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "onNext info == null");
|
||||
CallerLogger.INSTANCE.d(TAG, "UpgradeAppInfo onNext info == null");
|
||||
CallerLogger.INSTANCE.d(M_BINDING + TAG, "UpgradeAppInfo onNext info == null");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ public interface BindingcarApiService {
|
||||
* @return {@link BindingcarInfo}
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@POST("pad/selectPadByMac")
|
||||
Observable<BindingcarInfo> getBindingcarInfo(@Header("access_token") String access_token, @Body RequestBody requestBody);
|
||||
@POST("eagleEye-mis/cmdbapi/pad/selectPadByMac")
|
||||
Observable<BindingcarInfo> getBindingcarInfo(/*@Header("access_token") String access_token,*/ @Body RequestBody requestBody);
|
||||
|
||||
/**
|
||||
* 绑定和修改绑定车机
|
||||
@@ -31,7 +31,7 @@ public interface BindingcarApiService {
|
||||
* @return {@link ModifyBindingcarInfo}
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@POST("pad/updatePadByMac")
|
||||
Observable<ModifyBindingcarInfo> modifyBindingcarInfo(@Header("access_token") String access_token, @Body RequestBody requestBody);
|
||||
@POST("eagleEye-mis/cmdbapi/pad/updatePadByMac")
|
||||
Observable<ModifyBindingcarInfo> modifyBindingcarInfo(/*@Header("access_token") String access_token,*/ @Body RequestBody requestBody);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.util.Log;
|
||||
import com.mogo.commons.constants.SharedPrefsConstants;
|
||||
import com.mogo.eagle.core.data.bindingcar.BindingcarInfo;
|
||||
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo;
|
||||
import com.mogo.eagle.core.function.BindHostConst;
|
||||
import com.mogo.eagle.core.function.api.bindingcar.BindingcarCallBack;
|
||||
import com.mogo.eagle.core.function.bindingcar.R;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
@@ -34,11 +35,10 @@ import okhttp3.RequestBody;
|
||||
public class BindingcarNetWorkManager {
|
||||
private static volatile BindingcarNetWorkManager requestNoticeManager;
|
||||
private final BindingcarApiService mBindingcarApiService;
|
||||
private String token = "c4a2f30cebf64972bcd11577e1c07f86"; //中台做了接口适配,需要这个token
|
||||
private static final String TAG = "BindingcarNetWorkManager";
|
||||
private static final String TAG = "BindingcarNetManager";
|
||||
|
||||
private BindingcarNetWorkManager() {
|
||||
mBindingcarApiService = MoGoRetrofitFactory.getInstance(HostConst.BINDING_SN_HOST)
|
||||
mBindingcarApiService = MoGoRetrofitFactory.getInstance(BindHostConst.getBaseUrl())
|
||||
.create(BindingcarApiService.class);
|
||||
}
|
||||
|
||||
@@ -60,11 +60,13 @@ public class BindingcarNetWorkManager {
|
||||
* @param macAddress mac地址
|
||||
*/
|
||||
public void getBindingcarInfo(Context context, String macAddress, String widevineIDWithMd5, int screenType) {
|
||||
// String macAddress = "48:b0:2d:3a:bc:78";
|
||||
// String macAddress1 = "48:b0:2d:3a:bc:78";
|
||||
// String macAddress1 = "48:b0:2d:4d:b9:63";
|
||||
// String sn = "X20202203105S688HZ";
|
||||
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, widevineIDWithMd5, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mBindingcarApiService.getBindingcarInfo(token, requestBody)
|
||||
mBindingcarApiService.getBindingcarInfo(requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BindingcarInfo>() {
|
||||
@@ -76,6 +78,7 @@ public class BindingcarNetWorkManager {
|
||||
public void onNext(@NonNull BindingcarInfo info) {
|
||||
if (info != null && info.getData() != null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "getBindingcarInfo onNext info.getData() =" + info.getData().toString());
|
||||
Log.d(TAG, "getBindingcarInfo onNext info.getData() =" + info.getData().toString());
|
||||
if (info.getData().getCompare().equals("0")) {
|
||||
CallerHmiManager.INSTANCE.showBindingcarDialog();
|
||||
} else if (info.getData().getCompare().equals("3")) {
|
||||
@@ -84,10 +87,12 @@ public class BindingcarNetWorkManager {
|
||||
TipToast.shortTip("当前工控机没有入库");
|
||||
}
|
||||
|
||||
//根据车辆类型切换不同的车辆模型
|
||||
//根据车辆类型切换不同的车辆模型,只针对红旗做处理
|
||||
// if (info.getData().getVendor().equals("一汽红旗")) { //TODO
|
||||
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.xiaobache);
|
||||
// } else if (info.getData().getVendor().equals("东风")) {
|
||||
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.hq_h9);
|
||||
// }
|
||||
|
||||
// else if (info.getData().getVendor().equals("东风汽车集团")) {
|
||||
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.chuzuche);
|
||||
// } else if (info.getData().getVendor().equals("金旅星辰")) {
|
||||
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.xiaobache);
|
||||
@@ -118,7 +123,7 @@ public class BindingcarNetWorkManager {
|
||||
public void modifyBindingcar(String macAddress, String widevineIDWithMd5, BindingcarCallBack callBack, int screenType) {
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, widevineIDWithMd5, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mBindingcarApiService.modifyBindingcarInfo(token, requestBody)
|
||||
mBindingcarApiService.modifyBindingcarInfo(requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<ModifyBindingcarInfo>() {
|
||||
@@ -130,6 +135,7 @@ public class BindingcarNetWorkManager {
|
||||
public void onNext(@NonNull ModifyBindingcarInfo info) {
|
||||
if (info != null) {
|
||||
callBack.callBackResult(info);
|
||||
Log.d(TAG, "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
|
||||
CallerLogger.INSTANCE.d(TAG, "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogo
|
||||
|
||||
override fun speak(context: Context, content: String, listener: IMoGoVoiceCallback) {
|
||||
listeners += WeakReference(listener)
|
||||
AIAssist.getInstance(context).speakTTSVoice(content, this)
|
||||
AIAssist.getInstance(context).speakTTSVoiceWithLevel(content,AIAssist.LEVEL3 ,this)
|
||||
}
|
||||
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
|
||||
@@ -35,8 +35,9 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
}
|
||||
|
||||
override fun initBiz() {
|
||||
bizConfigCenter.init(mContext!!)
|
||||
traceManager.init(mContext!!)
|
||||
bizConfigCenter.init(mContext!!)
|
||||
FuncConfigImpl.init()
|
||||
MogoLogCatchManager.init(mContext!!)
|
||||
}
|
||||
|
||||
|
||||
@@ -107,13 +107,24 @@ internal object BadCaseManager : LifecycleEventObserver {
|
||||
if(ClickUtils.isFastClick()){
|
||||
if(NetworkUtils.isConnected()){
|
||||
if(BadCaseConfig.dockerVersion!=null){
|
||||
val initiativeBadCaseWindow = InitiativeBadCaseWindow(activity)
|
||||
initiativeBadCaseWindow.setClickListener(object: InitiativeBadCaseWindow.ClickListener{
|
||||
override fun closeWindow() {
|
||||
initiativeBadCaseWindow.hideFloatWindow()
|
||||
}
|
||||
})
|
||||
initiativeBadCaseWindow.showFloatWindow()
|
||||
//兼容老MAP版本
|
||||
if(BadCaseConfig.dockerVersion!!.contains("2.3.0")
|
||||
|| BadCaseConfig.dockerVersion!!.contains("2.4.0")
|
||||
|| BadCaseConfig.dockerVersion!!.contains("2.5.0")
|
||||
|| BadCaseConfig.dockerVersion!!.contains("2.6.0")
|
||||
|| BadCaseConfig.dockerVersion!!.contains("2.8.0")){
|
||||
val initiativeBadCaseWindow = InitiativeBadCaseWindow(activity)
|
||||
initiativeBadCaseWindow.setClickListener(object: InitiativeBadCaseWindow.ClickListener{
|
||||
override fun closeWindow() {
|
||||
initiativeBadCaseWindow.hideFloatWindow()
|
||||
}
|
||||
|
||||
})
|
||||
initiativeBadCaseWindow.showFloatWindow(null)
|
||||
}else{
|
||||
val caseListDialog = CaseListDialog(activity)
|
||||
caseListDialog.show()
|
||||
}
|
||||
}else{
|
||||
ToastUtils.showShort("工控机连接状态异常")
|
||||
}
|
||||
|
||||
@@ -1,35 +1,37 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.RadioButton
|
||||
import android.widget.RadioGroup
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.mogo.eagle.core.data.badcase.RecordTypeEntity
|
||||
import com.mogo.eagle.core.data.badcase.TopicEntity
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.SizeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.RecordTemplateAdapter
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
|
||||
import kotlinx.android.synthetic.main.layout_badcase_config.view.*
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import java.lang.Exception
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description BadCase上报信息配置页面
|
||||
* @since: 2022/7/5
|
||||
*/
|
||||
internal class BadCaseConfigView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotRecordListener {
|
||||
|
||||
companion object {
|
||||
@@ -37,18 +39,21 @@ defStyleAttr: Int = 0
|
||||
}
|
||||
|
||||
private var clickListener: ClickListener? = null
|
||||
private var recordTemplateAdapter: RecordTemplateAdapter? = null
|
||||
private var mIdentity = BadCaseConfig.identity
|
||||
private var mPreviousDuration = BadCaseConfig.previousDuration
|
||||
private var mBackDuration = BadCaseConfig.backDuration
|
||||
private var mType = 1
|
||||
private var recordTypesList = ArrayList<RecordTypeEntity>()
|
||||
private var caseTopicListDialog: CaseTopicListDialog? = null
|
||||
|
||||
init{
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_badcase_config, this, true)
|
||||
background = ColorDrawable(Color.parseColor("#F0151D41"))
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView(){
|
||||
private fun initView() {
|
||||
//关闭BadCase配置窗口
|
||||
ivConfigClose.setOnClickListener {
|
||||
clickListener?.onClose()
|
||||
@@ -75,41 +80,42 @@ defStyleAttr: Int = 0
|
||||
//保存配置按钮
|
||||
tvConfigSave.setOnClickListener {
|
||||
//判断、保存录制时间信息
|
||||
val preTimeStr=etInitiativePreTime.text.toString()
|
||||
val afterTimeStr=etInitiativeAfterTime.text.toString()
|
||||
val preTimeStr = etInitiativePreTime.text.toString()
|
||||
val afterTimeStr = etInitiativeAfterTime.text.toString()
|
||||
|
||||
try {
|
||||
if(preTimeStr.isEmpty()){
|
||||
if (preTimeStr.isEmpty()) {
|
||||
mPreviousDuration = BadCaseConfig.previousDuration
|
||||
}else{
|
||||
} else {
|
||||
mPreviousDuration = preTimeStr.toInt()
|
||||
}
|
||||
if(afterTimeStr.isEmpty()){
|
||||
if (afterTimeStr.isEmpty()) {
|
||||
mBackDuration = BadCaseConfig.backDuration
|
||||
}else{
|
||||
} else {
|
||||
mBackDuration = afterTimeStr.toInt()
|
||||
}
|
||||
|
||||
if(mPreviousDuration<0 || mPreviousDuration>30){
|
||||
if (mPreviousDuration < 0 || mPreviousDuration > 30) {
|
||||
ToastUtils.showLong("前溯采集时长最长30S")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if(mBackDuration<0 || mBackDuration>300){
|
||||
if (mBackDuration < 0 || mBackDuration > 300) {
|
||||
ToastUtils.showLong("采集总时长最长300S")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if((mPreviousDuration+mBackDuration)<5){
|
||||
if ((mPreviousDuration + mBackDuration) < 5) {
|
||||
ToastUtils.showLong("采集总时长最短5S")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if((mPreviousDuration+mBackDuration)>300){
|
||||
if ((mPreviousDuration + mBackDuration) > 300) {
|
||||
ToastUtils.showLong("采集总时长最长300S")
|
||||
return@setOnClickListener
|
||||
}
|
||||
BadCaseConfig.previousDuration = mPreviousDuration
|
||||
BadCaseConfig.backDuration = mBackDuration
|
||||
BadCaseConfig.totalDuration = BadCaseConfig.previousDuration + BadCaseConfig.backDuration
|
||||
}catch (e: Exception){
|
||||
BadCaseConfig.totalDuration =
|
||||
BadCaseConfig.previousDuration + BadCaseConfig.backDuration
|
||||
} catch (e: Exception) {
|
||||
ToastUtils.showLong("输入时间格式不合法,请重新输入")
|
||||
etInitiativePreTime.text = null
|
||||
etInitiativeAfterTime.text = null
|
||||
@@ -126,14 +132,14 @@ defStyleAttr: Int = 0
|
||||
}
|
||||
|
||||
//现场恢复
|
||||
when(BadCaseConfig.identity){
|
||||
"安全员"->{
|
||||
when (BadCaseConfig.identity) {
|
||||
"安全员" -> {
|
||||
rbSafetyOfficer.isChecked = true
|
||||
}
|
||||
"QA、研发"->{
|
||||
"QA、研发" -> {
|
||||
rbDeveloper.isChecked = true
|
||||
}
|
||||
"产品、运营、演示"->{
|
||||
"产品、运营、演示" -> {
|
||||
rbProduct.isChecked = true
|
||||
}
|
||||
}
|
||||
@@ -141,128 +147,75 @@ defStyleAttr: Int = 0
|
||||
etInitiativePreTime.hint = "${BadCaseConfig.previousDuration}S"
|
||||
etInitiativeAfterTime.hint = "${BadCaseConfig.backDuration}S"
|
||||
|
||||
// val test1 = TestBean(1,"人工接管自动录制")
|
||||
// val test2 = TestBean(2,"地图采集")
|
||||
// val test3 = TestBean(3,"画龙问题排查")
|
||||
// val test4 = TestBean(4,"误识别问题排查")
|
||||
// val test5 = TestBean(5,"lidar+planning")
|
||||
// val test6 = TestBean(6,"camera+planning")
|
||||
// val test7 = TestBean(7,"bus lidar+planning")
|
||||
// val test8 = TestBean(8,"bus camera+planning")
|
||||
// val test99 = TestBean(99,"ai data")
|
||||
//
|
||||
// val list = ArrayList<TestBean>()
|
||||
// list.add(test1)
|
||||
// list.add(test2)
|
||||
// list.add(test3)
|
||||
// list.add(test4)
|
||||
// list.add(test5)
|
||||
// list.add(test6)
|
||||
// list.add(test7)
|
||||
// list.add(test8)
|
||||
// list.add(test99)
|
||||
// list.iterator().forEach {
|
||||
// if(it.id!=99){
|
||||
// val radioButton = RadioButton(context)
|
||||
// val lp = RadioGroup.LayoutParams(
|
||||
// RadioGroup.LayoutParams.WRAP_CONTENT,
|
||||
// RadioGroup.LayoutParams.WRAP_CONTENT
|
||||
// )
|
||||
// //设置RadioButton边距 (int left, int top, int right, int bottom)
|
||||
// lp.setMargins(
|
||||
// SizeUtils.dp2px(0f),
|
||||
// SizeUtils.dp2px(8f),
|
||||
// SizeUtils.dp2px(10f),
|
||||
// SizeUtils.dp2px(8f)
|
||||
// )
|
||||
// //设置RadioButton背景
|
||||
// radioButton.setTextColor(Color.WHITE)
|
||||
//
|
||||
// radioButton.buttonDrawable = resources.getDrawable(R.drawable.badcase_radio_button_style)
|
||||
// //设置文字距离四周的距离
|
||||
// radioButton.setPadding(
|
||||
// SizeUtils.dp2px(12f),
|
||||
// SizeUtils.dp2px(5f),
|
||||
// SizeUtils.dp2px(10f),
|
||||
// SizeUtils.dp2px(5f)
|
||||
// )
|
||||
// radioButton.textSize = SizeUtils.sp2px(9f).toFloat()
|
||||
// radioButton.id = it.id
|
||||
// radioButton.isChecked = it.id == BadCaseConfig.type
|
||||
// //设置文字
|
||||
// radioButton.text = it.src
|
||||
// //将radioButton添加到radioGroup中
|
||||
// rgRecordConfig.addView(radioButton, lp)
|
||||
// rgRecordConfig.setOnCheckedChangeListener { _, checkedId ->
|
||||
// mType = checkedId
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
recordTemplateAdapter = RecordTemplateAdapter()
|
||||
recordTemplateAdapter?.setListener(object :RecordTemplateAdapter.ClickTemplateListener{
|
||||
override fun onClick(recordTypeEntity: RecordTypeEntity) {
|
||||
//弹窗Topic清单列表
|
||||
showCaseTopicListDialog(recordTypeEntity)
|
||||
}
|
||||
|
||||
})
|
||||
val gridLayoutManager = GridLayoutManager(context,2)
|
||||
rvTemplate.layoutManager = gridLayoutManager
|
||||
rvTemplate.adapter = recordTemplateAdapter
|
||||
rvTemplate.visibility = View.GONE
|
||||
}
|
||||
|
||||
fun setClickListener(clickListener: ClickListener) {
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
fun setClickListener(clickListener: ClickListener) {
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
|
||||
override fun onAutopilotRecordConfig(config: MessagePad.RecordDataConfig) {
|
||||
super.onAutopilotRecordConfig(config)
|
||||
ThreadUtils.runOnUiThread{
|
||||
config.recordTypesList.iterator().forEach {
|
||||
if(it.id!=99){
|
||||
val radioButton = RadioButton(context)
|
||||
val lp = RadioGroup.LayoutParams(
|
||||
RadioGroup.LayoutParams.WRAP_CONTENT,
|
||||
RadioGroup.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
//设置RadioButton边距 (int left, int top, int right, int bottom)
|
||||
lp.setMargins(
|
||||
SizeUtils.dp2px(0f),
|
||||
SizeUtils.dp2px(8f),
|
||||
SizeUtils.dp2px(10f),
|
||||
SizeUtils.dp2px(8f)
|
||||
)
|
||||
//设置RadioButton背景
|
||||
radioButton.setTextColor(Color.WHITE)
|
||||
private fun showCaseTopicListDialog(recordTypeEntity: RecordTypeEntity){
|
||||
caseTopicListDialog = CaseTopicListDialog(context)
|
||||
caseTopicListDialog?.setData(recordTypeEntity)
|
||||
caseTopicListDialog?.show()
|
||||
}
|
||||
|
||||
radioButton.buttonDrawable = resources.getDrawable(R.drawable.badcase_radio_button_style)
|
||||
//设置文字距离四周的距离
|
||||
radioButton.setPadding(
|
||||
SizeUtils.dp2px(12f),
|
||||
SizeUtils.dp2px(5f),
|
||||
SizeUtils.dp2px(10f),
|
||||
SizeUtils.dp2px(5f)
|
||||
)
|
||||
radioButton.textSize = SizeUtils.sp2px(9f).toFloat()
|
||||
radioButton.id = it.id
|
||||
radioButton.isChecked = it.id == BadCaseConfig.type
|
||||
//设置文字
|
||||
radioButton.text = it.desc
|
||||
//将radioButton添加到radioGroup中
|
||||
rgRecordConfig.addView(radioButton, lp)
|
||||
rgRecordConfig.setOnCheckedChangeListener { _, checkedId ->
|
||||
mType = checkedId
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun onAutopilotRecordConfig(config: MessagePad.RecordDataConfig) {
|
||||
super.onAutopilotRecordConfig(config)
|
||||
ThreadUtils.runOnUiThread {
|
||||
if(BadCaseConfig.dockerVersion!!.contains("2.3.0")
|
||||
|| BadCaseConfig.dockerVersion!!.contains("2.4.0")
|
||||
|| BadCaseConfig.dockerVersion!!.contains("2.5.0")
|
||||
|| BadCaseConfig.dockerVersion!!.contains("2.6.0")
|
||||
|| BadCaseConfig.dockerVersion!!.contains("2.8.0")){
|
||||
rvTemplate.visibility = View.GONE
|
||||
}else{
|
||||
config.recordTypesList.iterator().forEach {
|
||||
if (it.id != 99){
|
||||
val topicList = ArrayList<TopicEntity>()
|
||||
it.topicsList.iterator().forEach {
|
||||
topicList.add(TopicEntity(it,true,false))
|
||||
}
|
||||
recordTypesList.add(RecordTypeEntity(it.id,it.desc,topicList))
|
||||
}
|
||||
}
|
||||
if(recordTypesList.size>1){
|
||||
rvTemplate.visibility = View.VISIBLE
|
||||
recordTemplateAdapter?.setData(recordTypesList)
|
||||
recordTemplateAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerAutopilotRecordListenerManager.addListener(TAG, this)
|
||||
//获取数据采集录制模式配置列表
|
||||
CallerAutoPilotManager.getBadCaseConfig()
|
||||
}
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerAutopilotRecordListenerManager.addListener(TAG, this)
|
||||
//获取数据采集录制模式配置列表
|
||||
CallerAutoPilotManager.getBadCaseConfig(0, 0, listOf())
|
||||
recordTypesList.add(RecordTypeEntity(0,"自定义", arrayListOf()))
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerAutopilotRecordListenerManager.removeListener(TAG)
|
||||
}
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerAutopilotRecordListenerManager.removeListener(TAG)
|
||||
recordTypesList.clear()
|
||||
}
|
||||
|
||||
interface ClickListener{
|
||||
fun onClose()
|
||||
}
|
||||
interface ClickListener {
|
||||
fun onClose()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.data.badcase.RecordCaseEntity;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.zhjt.mogo_core_function_devatools.R;
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.CaseListAdapter;
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description BadCase清单选择对话框
|
||||
* @since: 2022/10/19
|
||||
*/
|
||||
public class CaseListDialog extends Dialog implements IMoGoAutopilotRecordListener {
|
||||
|
||||
private TextView tvCancel;
|
||||
private RecyclerView rvCaseList;
|
||||
private CaseListAdapter caseListAdapter;
|
||||
private static final String TAG = "CaseListDialog";
|
||||
private ArrayList<RecordCaseEntity> recordTypeEntityArrayList = new ArrayList<>();
|
||||
private Activity activity;
|
||||
|
||||
public CaseListDialog(@NonNull Activity activity) {
|
||||
super(activity, R.style.bad_case_dialog);
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.dialog_case_list);
|
||||
setCanceledOnTouchOutside(false);
|
||||
init();
|
||||
initEvent();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
tvCancel = findViewById(R.id.tvCancel);
|
||||
rvCaseList = findViewById(R.id.rvCaseList);
|
||||
caseListAdapter = new CaseListAdapter();
|
||||
caseListAdapter.setListener(recordCaseEntity -> {
|
||||
//录制Bag包,弹窗
|
||||
InitiativeBadCaseWindow initiativeBadCaseWindow = new InitiativeBadCaseWindow(activity);
|
||||
initiativeBadCaseWindow.setClickListener(initiativeBadCaseWindow::hideFloatWindow);
|
||||
initiativeBadCaseWindow.showFloatWindow(recordCaseEntity);
|
||||
});
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(),2);
|
||||
gridLayoutManager.setOrientation(RecyclerView.VERTICAL);
|
||||
rvCaseList.setLayoutManager(gridLayoutManager);
|
||||
rvCaseList.setAdapter(caseListAdapter);
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
tvCancel.setOnClickListener(v -> dismiss());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
|
||||
//获取数据采集录制模式配置列表
|
||||
CallerAutoPilotManager.INSTANCE.getBadCaseConfig(0, 0,new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordResult(@NonNull RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordConfig(@NonNull MessagePad.RecordDataConfig config) {
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if(config.getRecordTypesCount()>0){
|
||||
for(int index=0;index<config.getRecordTypesCount();index++){
|
||||
if(config.getRecordTypes(index).getId() != 99){
|
||||
ArrayList<String> topicList = new ArrayList<>();
|
||||
// TODO java.lang.IndexOutOfBoundsException: Index: 38, Size: 38
|
||||
// for(int position=0;index<config.getRecordTypes(index).getTopicsCount();position++){
|
||||
// topicList.add(config.getRecordTypes(index).getTopicsList().get(position));
|
||||
// }
|
||||
recordTypeEntityArrayList.add(new RecordCaseEntity(
|
||||
config.getRecordTypes(index).getId(),config.getRecordTypes(index).getDesc(),
|
||||
topicList));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(BadCaseConfig.customTopicList.size()>0){
|
||||
recordTypeEntityArrayList.add(new RecordCaseEntity(0,"自定义A",BadCaseConfig.customTopicList));
|
||||
}
|
||||
caseListAdapter.setData(recordTypeEntityArrayList);
|
||||
caseListAdapter.notifyDataSetChanged();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.data.badcase.RecordTypeEntity;
|
||||
import com.mogo.eagle.core.data.badcase.TopicEntity;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.zhjt.mogo_core_function_devatools.R;
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.biz.adapter.TopicListAdapter;
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description BadCase Topic列表选择对话框
|
||||
* @since: 2022/10/19
|
||||
*/
|
||||
public class CaseTopicListDialog extends Dialog implements IMoGoAutopilotRecordListener {
|
||||
|
||||
private static final String TAG = "CaseTopicListDialog";
|
||||
private TextView tvCaseName;
|
||||
private TextView tvSave;
|
||||
private TextView tvCancel;
|
||||
private ImageView ivSearch;
|
||||
private EditText etSearch;
|
||||
private RecyclerView rvTopicList;
|
||||
private TopicListAdapter topicListAdapter;
|
||||
private String searchStr;
|
||||
private List<TopicEntity> allTopicList = new ArrayList<>();
|
||||
private RecordTypeEntity recordType;
|
||||
private List<String> addTopicList = new ArrayList<>();
|
||||
private List<TopicEntity> searchTopicList = new ArrayList<>();
|
||||
|
||||
public CaseTopicListDialog(@NonNull Context context) {
|
||||
super(context, R.style.bad_case_dialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.dialog_case_topic_list);
|
||||
setCanceledOnTouchOutside(false);
|
||||
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
|
||||
init();
|
||||
initEvent();
|
||||
//获取所有Topic
|
||||
CallerAutoPilotManager.INSTANCE.getBadCaseConfig(1, 0, new ArrayList<>());
|
||||
if(recordType!=null){
|
||||
tvCaseName.setText(recordType.getDesc());
|
||||
if(recordType.getTopicsList().size()>0){
|
||||
topicListAdapter.setData(recordType.getTopicsList());
|
||||
topicListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
public void setData(RecordTypeEntity recordTypeEntity){
|
||||
if(recordTypeEntity!=null){
|
||||
recordType = recordTypeEntity;
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
tvCaseName = findViewById(R.id.tvCaseName);
|
||||
tvSave = findViewById(R.id.tvSave);
|
||||
tvCancel = findViewById(R.id.tvCancel);
|
||||
ivSearch = findViewById(R.id.ivSearch);
|
||||
etSearch = findViewById(R.id.etSearch);
|
||||
rvTopicList = findViewById(R.id.rvTopicList);
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
rvTopicList.setLayoutManager(linearLayoutManager);
|
||||
topicListAdapter = new TopicListAdapter();
|
||||
topicListAdapter.setListener((topicName, clicked) -> {
|
||||
if(clicked){
|
||||
addTopicList.add(topicName);
|
||||
}else{
|
||||
addTopicList.remove(topicName);
|
||||
}
|
||||
});
|
||||
rvTopicList.setAdapter(topicListAdapter);
|
||||
}
|
||||
|
||||
private void initEvent() {
|
||||
etSearch.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
searchStr = s.toString();
|
||||
if(searchStr!=null && searchStr.length()>0){
|
||||
ivSearch.setImageDrawable(getContext().getDrawable(R.drawable.icon_bad_case_delect));
|
||||
} else {
|
||||
ivSearch.setImageDrawable(getContext().getDrawable(R.drawable.icon_bad_case_search));
|
||||
}
|
||||
if(searchStr!=null && searchStr.length()>0){
|
||||
searchTopicList.clear();
|
||||
for(int index=0;index<recordType.getTopicsList().size();index++){
|
||||
if(recordType.getTopicsList().get(index).getTopicName().contains(searchStr)){
|
||||
searchTopicList.add(recordType.getTopicsList().get(index));
|
||||
}
|
||||
}
|
||||
topicListAdapter.setData(searchTopicList);
|
||||
topicListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ivSearch.setOnClickListener(v -> {
|
||||
if(searchStr!=null && searchStr.length()>0){
|
||||
etSearch.setText("");
|
||||
ivSearch.setImageDrawable(getContext().getDrawable(R.drawable.icon_bad_case_search));
|
||||
topicListAdapter.setData(recordType.getTopicsList());
|
||||
topicListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
tvSave.setOnClickListener(v -> {
|
||||
if(recordType!=null){
|
||||
Boolean success=CallerAutoPilotManager.INSTANCE.getBadCaseConfig(2,recordType.getId(),addTopicList);
|
||||
if(Boolean.TRUE.equals(success)){
|
||||
ToastUtils.showShort("Topic设置成功");
|
||||
if(recordType.getId() == 0){
|
||||
//自定义Topic
|
||||
BadCaseConfig.customTopicList.clear();
|
||||
BadCaseConfig.customTopicList.addAll(addTopicList);
|
||||
}
|
||||
addTopicList.clear();
|
||||
recordType.getTopicsList().removeAll(allTopicList);
|
||||
dismiss();
|
||||
}else{
|
||||
ToastUtils.showShort("Topic设置失败");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
tvCancel.setOnClickListener(v -> {
|
||||
recordType.getTopicsList().removeAll(allTopicList);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordConfig(MessagePad.RecordDataConfig config) {
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
Log.i("houyanli","AllTopicsCount="+config.getAllTopicsCount());
|
||||
if(config.getAllTopicsCount()>0){
|
||||
for(int index=0;index<config.getAllTopicsCount();index++){
|
||||
if(!recordType.getTopicsList().contains(config.getAllTopics(index))){
|
||||
allTopicList.add(new TopicEntity(config.getAllTopics(index),false,true));
|
||||
}
|
||||
Log.i("houyanli","topic="+config.getAllTopics(index));
|
||||
}
|
||||
recordType.getTopicsList().addAll(allTopicList);
|
||||
topicListAdapter.setData(recordType.getTopicsList());
|
||||
topicListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordResult(@NonNull RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.badcase.RecordCaseEntity
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
@@ -137,13 +138,6 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(),this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerAutopilotCarStatusListenerManager.addListener(this.hashCode().toString(), this)
|
||||
//开启录包
|
||||
CallerAutoPilotManager.recordPackage(BadCaseConfig.type,
|
||||
Random(SystemClock.elapsedRealtime()).nextInt(),
|
||||
BadCaseConfig.totalDuration,
|
||||
BadCaseConfig.previousDuration
|
||||
)
|
||||
|
||||
viewAudioButton.setOnClickListener {
|
||||
audioStatus = !audioStatus
|
||||
setAudio(audioStatus)
|
||||
@@ -337,7 +331,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
return true
|
||||
}
|
||||
|
||||
fun showFloatWindow() {
|
||||
fun showFloatWindow(recordCaseEntity: RecordCaseEntity?) {
|
||||
if (mFloatLayout.parent == null) {
|
||||
val metrics = DisplayMetrics()
|
||||
// 默认固定位置,靠屏幕右边缘的中间
|
||||
@@ -345,6 +339,14 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
mWindowParams!!.x = metrics.widthPixels
|
||||
mWindowParams!!.y = metrics.heightPixels / 2 - getSysBarHeight(mActivity)-350
|
||||
mWindowManager!!.addView(mFloatLayout, mWindowParams)
|
||||
//开启录包
|
||||
if(recordCaseEntity!=null){
|
||||
CallerAutoPilotManager.recordPackage(recordCaseEntity.caseId,Random(SystemClock.elapsedRealtime()).nextInt(),
|
||||
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration,recordCaseEntity.topicList)
|
||||
}else{
|
||||
CallerAutoPilotManager.recordPackage(BadCaseConfig.type,Random(SystemClock.elapsedRealtime()).nextInt(),
|
||||
BadCaseConfig.totalDuration, BadCaseConfig.previousDuration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.badcase.RecordCaseEntity
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description Case清单列表适配器
|
||||
* @since: 2022/10/19
|
||||
*/
|
||||
class CaseListAdapter: RecyclerView.Adapter<CaseListAdapter.CaseListHolder>() {
|
||||
|
||||
private var data:List<RecordCaseEntity>? = null
|
||||
private var caseClickListener: CaseClickListener?=null
|
||||
|
||||
fun setData( data: List<RecordCaseEntity>?){
|
||||
this.data = data
|
||||
}
|
||||
|
||||
fun setListener(listener: CaseClickListener){
|
||||
caseClickListener = listener
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CaseListHolder {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_case_list, parent, false)
|
||||
return CaseListHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: CaseListHolder, position: Int) {
|
||||
data?.let {recordCaseEntity->
|
||||
holder.caseName.text = recordCaseEntity[position].caseName
|
||||
holder.caseName.setOnClickListener {
|
||||
caseClickListener?.onClick(recordCaseEntity[position])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = data?.size ?: 0
|
||||
|
||||
class CaseListHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
|
||||
var caseName: TextView = itemView.findViewById(R.id.caseName)
|
||||
}
|
||||
|
||||
interface CaseClickListener{
|
||||
fun onClick(recordCaseEntity: RecordCaseEntity)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.badcase.RecordTypeEntity
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.biz.BadCaseConfigView
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description 录制模板清单列表适配器
|
||||
* @since: 2022/10/19
|
||||
*/
|
||||
class RecordTemplateAdapter : RecyclerView.Adapter<RecordTemplateAdapter.RecordTemplateHolder>(){
|
||||
|
||||
private var data:List<RecordTypeEntity>? = null
|
||||
private var clickTemplateListener: ClickTemplateListener? = null
|
||||
|
||||
fun setData( data: List<RecordTypeEntity>?){
|
||||
this.data = data
|
||||
}
|
||||
|
||||
fun setListener(listener: ClickTemplateListener){
|
||||
clickTemplateListener = listener
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecordTemplateHolder {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_record_template, parent, false)
|
||||
return RecordTemplateHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecordTemplateHolder, position: Int) {
|
||||
data?.let {recordTypeEntity->
|
||||
holder.caseName.text = recordTypeEntity[position].desc
|
||||
holder.caseName.setOnClickListener {
|
||||
clickTemplateListener?.onClick(recordTypeEntity[position])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = data?.size ?: 0
|
||||
|
||||
class RecordTemplateHolder(itemView: View): RecyclerView.ViewHolder(itemView){
|
||||
var caseName: TextView = itemView.findViewById(R.id.caseName)
|
||||
}
|
||||
|
||||
interface ClickTemplateListener{
|
||||
fun onClick(recordTypeEntity: RecordTypeEntity)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.zhjt.mogo_core_function_devatools.badcase.biz.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.CheckBox
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.badcase.TopicEntity
|
||||
import com.zhjt.mogo_core_function_devatools.R
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description Topic列表适配器
|
||||
* @since: 2022/10/19
|
||||
*/
|
||||
class TopicListAdapter: RecyclerView.Adapter<TopicListAdapter.TopicListHolder>() {
|
||||
|
||||
private var data:MutableList<TopicEntity>? = null
|
||||
private var topicClickListener: TopicClickListener? = null
|
||||
|
||||
fun setData( data: MutableList<TopicEntity>?){
|
||||
this.data = data
|
||||
}
|
||||
|
||||
fun setListener(listener: TopicClickListener){
|
||||
topicClickListener = listener
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TopicListHolder {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_topic_list, parent, false)
|
||||
return TopicListHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: TopicListHolder, position: Int) {
|
||||
data?.let{topicList->
|
||||
holder.topic_check_box.text = topicList[position].topicName
|
||||
holder.topic_check_box.setOnCheckedChangeListener(null)
|
||||
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 { _, 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){
|
||||
var topic_check_box: CheckBox = itemView.findViewById(R.id.topic_check_box);
|
||||
}
|
||||
|
||||
interface TopicClickListener{
|
||||
fun onClick(topicName: String,clicked: Boolean)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,7 +27,10 @@ object BadCaseConfig {
|
||||
//工控机版本
|
||||
@JvmField
|
||||
var dockerVersion:String ?= null
|
||||
|
||||
@JvmField
|
||||
var recordKeyList:ArrayList<Long> = ArrayList()
|
||||
//自定义Topic清单列表
|
||||
@JvmField
|
||||
var customTopicList: ArrayList<String> = ArrayList()
|
||||
|
||||
}
|
||||
@@ -42,6 +42,11 @@ class FuncConfigCenter : IMogoOnMessageListener<FuncConfig>, IMoGoAutopilotCarCo
|
||||
MogoAiCloudSocketManager.getInstance(AbsMogoApplication.getApp().applicationContext)
|
||||
.registerOnMessageListener(FUNC_CONFIG_TYPE, this)
|
||||
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
|
||||
|
||||
//未连接到工控,默认配置
|
||||
val bizJson = SPUtils.getInstance("biz_config")
|
||||
.getString("config", GsonUtils.toJson(defaultFuncConfig()))
|
||||
refreshConfig(GsonUtils.fromJson(bizJson, FuncConfig::class.java))
|
||||
}
|
||||
|
||||
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
|
||||
@@ -49,14 +54,9 @@ class FuncConfigCenter : IMogoOnMessageListener<FuncConfig>, IMoGoAutopilotCarCo
|
||||
UiThreadHandler.post {
|
||||
funcConfigNetWorkModel.requestFuncConfig(carConfigResp.macAddress, {
|
||||
SPUtils.getInstance("biz_config").put("config", GsonUtils.toJson(it))
|
||||
refreshConfig(it)
|
||||
}, {
|
||||
val bizJson = SPUtils.getInstance("biz_config")
|
||||
.getString("config", GsonUtils.toJson(defaultFuncConfig()))
|
||||
refreshConfig(GsonUtils.fromJson(bizJson, FuncConfig::class.java))
|
||||
})
|
||||
refreshConfig(it) }, {})
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
ToastUtils.showLong("未获取到域控mac信息")
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ class FuncConfigCenter : IMogoOnMessageListener<FuncConfig>, IMoGoAutopilotCarCo
|
||||
|
||||
override fun onMsgReceived(obj: FuncConfig?) {
|
||||
obj?.let {
|
||||
refreshConfig(it)
|
||||
invokeUpdate(it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,10 @@ class FuncConfigCenter : IMogoOnMessageListener<FuncConfig>, IMoGoAutopilotCarCo
|
||||
)
|
||||
private fun refreshConfig(funcConfig: FuncConfig) {
|
||||
BizManager.updateBizConfigData(funcConfig)
|
||||
invokeUpdate(funcConfig)
|
||||
}
|
||||
|
||||
private fun invokeUpdate(funcConfig: FuncConfig) {
|
||||
funcConfig.business.forEach { business ->
|
||||
CallerDevaToolsFuncConfigListenerManager.invokeDevaToolsFuncConfigBizUpdate(
|
||||
business.biz.uppercase(),
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_LIMIT
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_LTA
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_OPT_LINE
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_PNC_ACTIONS
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_PNC_WARNING
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RAIN_MODE
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RTS
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_SLW
|
||||
@@ -90,6 +91,7 @@ class FuncConfigConst {
|
||||
foundationSubList.add(SubBiz(BIZ_BYPASS, lock = false, state = true, dependNode = "", data = ""))
|
||||
foundationSubList.add(SubBiz(BIZ_AUTOPILOT_LANE_SELECTION, lock = false, state = true, dependNode = "", data = ""))
|
||||
foundationSubList.add(SubBiz(BIZ_PNC_ACTIONS, lock = false, state = true, dependNode = "", data = ""))
|
||||
foundationSubList.add(SubBiz(BIZ_PNC_WARNING, lock = false, state = true, dependNode = "", data = ""))
|
||||
businessList.add(Business(FOUNDATION,foundationSubList))
|
||||
|
||||
return FuncConfig(0, AppUtils.getAppVersionCode(), getChannelCode(), getEnv(), businessList)
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhjt.mogo_core_function_devatools.funcconfig
|
||||
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_BEAUTY_MODE
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_PNC_WARNING
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RAIN_MODE
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_WARNING_UPLOAD
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.FOUNDATION
|
||||
@@ -14,7 +15,7 @@ object FuncConfigImpl {
|
||||
|
||||
fun init() {
|
||||
CallerDevaToolsFuncConfigListenerManager.registerDevaToolsFuncConfigListener(FOUNDATION,
|
||||
TAG,
|
||||
TAG,false,
|
||||
object : IMoGoDevaToolsFuncConfigListener {
|
||||
override fun updateBizData(
|
||||
type: String,
|
||||
@@ -23,7 +24,11 @@ object FuncConfigImpl {
|
||||
data: String?
|
||||
) {
|
||||
when (type) {
|
||||
}
|
||||
BIZ_BEAUTY_MODE -> FunctionBuildConfig.isDemoMode = state
|
||||
BIZ_RAIN_MODE -> FunctionBuildConfig.isRainMode = state
|
||||
BIZ_WARNING_UPLOAD -> FunctionBuildConfig.isReportWarning = state
|
||||
BIZ_PNC_WARNING -> FunctionBuildConfig.isPNCWarning = state
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -34,8 +34,9 @@ class FuncConfigNetWorkModel {
|
||||
if (error == null) {
|
||||
error = onError
|
||||
}
|
||||
//todo test
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["mac"] = mac
|
||||
map["mac"] = DeviceUtils.getMacAddress()
|
||||
map["channelVersion"] = FuncConfigConst.getChannelCode()
|
||||
}
|
||||
loader {
|
||||
|
||||
@@ -42,51 +42,51 @@ object StatusManager {
|
||||
private const val TAG = "StatusManager"
|
||||
|
||||
private lateinit var model: StatusModel
|
||||
private var timer: Job? = null
|
||||
// private var timer: Job? = null
|
||||
private var hasInit = false
|
||||
private val listeners by lazy { CopyOnWriteArrayList<IStatusListener>() }
|
||||
private var container: WeakReference<ViewGroup>? = null
|
||||
|
||||
private val listener = object : IMoGoAutopilotStatusListener {
|
||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
|
||||
super.onAutopilotGuardian(guardianInfo)
|
||||
guardianInfo?.code?.takeIf {
|
||||
CallerLogger.d("$M_DEVA$TAG", "-- onAutopilotGuardian ---: code: $it")
|
||||
it.contains("RTK_STATUS", true) || it.contains("CAN", true) || it == "ILCT_RTK_OR_SLAM_CHANGE"
|
||||
}?.run {
|
||||
CallerLogger.d("$M_DEVA$TAG", "-- onAutopilotGuardian trigger req ---: code: $this")
|
||||
req()
|
||||
}
|
||||
}
|
||||
}
|
||||
// private val listener = object : IMoGoAutopilotStatusListener {
|
||||
// override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
|
||||
// super.onAutopilotGuardian(guardianInfo)
|
||||
// guardianInfo?.code?.takeIf {
|
||||
// CallerLogger.d("$M_DEVA$TAG", "-- onAutopilotGuardian ---: code: $it")
|
||||
// it.contains("RTK_STATUS", true) || it.contains("CAN", true) || it == "ILCT_RTK_OR_SLAM_CHANGE"
|
||||
// }?.run {
|
||||
// CallerLogger.d("$M_DEVA$TAG", "-- onAutopilotGuardian trigger req ---: code: $this")
|
||||
// req()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private val appStateListener = object : IAppStateListener {
|
||||
|
||||
override fun onAppStateChanged(isForeground: Boolean) {
|
||||
if (isForeground) {
|
||||
req()
|
||||
} else {
|
||||
timer?.cancel()
|
||||
}
|
||||
}
|
||||
}
|
||||
// private val appStateListener = object : IAppStateListener {
|
||||
//
|
||||
// override fun onAppStateChanged(isForeground: Boolean) {
|
||||
// if (isForeground) {
|
||||
// req()
|
||||
// } else {
|
||||
// timer?.cancel()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private val flows: ArrayList<IFlow<out Status>> by lazy {
|
||||
ArrayList()
|
||||
}
|
||||
|
||||
private fun req() {
|
||||
timer?.cancel()
|
||||
model.viewModelScope.launch(Dispatchers.IO) {
|
||||
CallerAutoPilotManager.sendStatusQueryReq()
|
||||
while (true) {
|
||||
delay(60000) //一分钟主动请求一次
|
||||
CallerAutoPilotManager.sendStatusQueryReq()
|
||||
}
|
||||
}.also {
|
||||
timer = it
|
||||
}
|
||||
}
|
||||
// private fun req() {
|
||||
// timer?.cancel()
|
||||
// model.viewModelScope.launch(Dispatchers.IO) {
|
||||
// CallerAutoPilotManager.sendStatusQueryReq()
|
||||
// while (true) {
|
||||
// delay(60000) //一分钟主动请求一次
|
||||
// CallerAutoPilotManager.sendStatusQueryReq()
|
||||
// }
|
||||
// }.also {
|
||||
// timer = it
|
||||
// }
|
||||
// }
|
||||
|
||||
fun init(ctx: Context) {
|
||||
if (hasInit) {
|
||||
@@ -109,9 +109,9 @@ object StatusManager {
|
||||
|
||||
private fun onCreate(ctx: Context) {
|
||||
val values = model.status.value?.second ?: throw IllegalStateException("state is not right.")
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, listener)
|
||||
AppStateManager.registerAppStateListener(appStateListener)
|
||||
req()
|
||||
// CallerAutoPilotStatusListenerManager.addListener(TAG, listener)
|
||||
// AppStateManager.registerAppStateListener(appStateListener)
|
||||
// req()
|
||||
values.map {
|
||||
when (it) {
|
||||
is CanStatus -> CanImpl(ctx)
|
||||
@@ -166,9 +166,9 @@ object StatusManager {
|
||||
|
||||
private fun onDestroy(ctx: Context) {
|
||||
hasInit = false
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
AppStateManager.unRegisterAppStateListener(appStateListener)
|
||||
timer?.cancel()
|
||||
// CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
// AppStateManager.unRegisterAppStateListener(appStateListener)
|
||||
// timer?.cancel()
|
||||
flows.forEach {
|
||||
it.onDestroy()
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ internal class TracingImpl(ctx: Context): IFlow<TracingStatus>(ctx), IMoGoAutopi
|
||||
super.onAutopilotGuardian(guardianInfo)
|
||||
val current = guardianInfo?.code
|
||||
val newState = current?.toState(guardianInfo.msg)
|
||||
if (newState != null && newState != old) {
|
||||
send(TracingStatus(newState))
|
||||
if (newState != null) {
|
||||
old = newState
|
||||
send(TracingStatus(newState))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,14 +129,14 @@ internal class StatusAdapter(val ctx: Context, var data: ArrayList<Status>): Rec
|
||||
MAP_TRA_TYPE -> {
|
||||
"暂无轨迹"
|
||||
}
|
||||
MAP_DATA_EXIST -> "地图数据存在,正在加载${if (extraDesc.isEmpty()) "" else "[$extraDesc]" }"
|
||||
MAP_DATA_NOT_EXIST -> "地图数据不存在${if (extraDesc.isEmpty()) "" else "[$extraDesc]"}"
|
||||
TRACK_FINDED -> "轨迹类型:循迹[已找到轨迹$extraDesc]"
|
||||
TRACK_LOADED -> "轨迹类型:循迹[加载成功$extraDesc]"
|
||||
TRACK_NOT_EXIST -> "轨迹类型:循迹[不存在$extraDesc]"
|
||||
TRACK_LOAD_FAIL -> "轨迹类型:循迹[加载失败$extraDesc]"
|
||||
ROUTE_LOADED -> "轨迹类型:自主算路[加载成功$extraDesc]"
|
||||
ROUTE_FAILED -> "轨迹类型:自主算路[加载失败$extraDesc]"
|
||||
MAP_DATA_EXIST -> "地图数据存在,正在加载${ if(extraDesc.isNotEmpty()) "\n[$extraDesc]" else "" }"
|
||||
MAP_DATA_NOT_EXIST -> "地图数据不存在${ if(extraDesc.isNotEmpty()) "\n[$extraDesc]" else "" }"
|
||||
TRACK_FINDED -> "轨迹类型:循迹(已找到轨迹)${ if(extraDesc.isNotEmpty()) "\n[$extraDesc]" else "" }"
|
||||
TRACK_LOADED -> "轨迹类型:循迹(加载成功)${ if(extraDesc.isNotEmpty()) "\n[$extraDesc]" else "" }"
|
||||
TRACK_NOT_EXIST -> "轨迹类型:循迹(未找到轨迹)${ if(extraDesc.isNotEmpty()) "\n[$extraDesc]" else "" }"
|
||||
TRACK_LOAD_FAIL -> "轨迹类型:循迹(加载失败)${ if(extraDesc.isNotEmpty()) "\n[$extraDesc]" else "" }"
|
||||
ROUTE_LOADED -> "轨迹类型:自主算路(加载成功)${ if(extraDesc.isNotEmpty()) "\n[$extraDesc]" else "" }"
|
||||
ROUTE_FAILED -> "轨迹类型:自主算路(加载失败)${ if(extraDesc.isNotEmpty()) "\n[$extraDesc]" else "" }"
|
||||
UNKNOWN -> "暂无轨迹"
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 489 B |
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#3B4577" />
|
||||
<corners android:radius="32px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#29305E" />
|
||||
<corners android:radius="48px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#29305E" />
|
||||
<corners android:radius="20px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#2B6EFF" />
|
||||
<corners android:radius="20px" />
|
||||
</shape>
|
||||
@@ -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/case_list_select" android:state_focused="true" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/case_list_select" android:state_focused="false" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/case_list_select" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/case_list_select" android:state_focused="true" />
|
||||
<item android:drawable="@drawable/case_list_normal" />
|
||||
</selector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#33E1E5FF" />
|
||||
<corners android:radius="32px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#29305E" />
|
||||
<corners android:radius="32px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#3B4577" />
|
||||
<corners android:radius="24px" />
|
||||
</shape>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.eagle.core.widget.RoundConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="1110px"
|
||||
android:layout_height="668px"
|
||||
android:background="#3B4577"
|
||||
app:roundLayoutRadius="32px"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCaseListTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="case清单"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="56px"
|
||||
android:gravity="center"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="50px"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCancel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="取消"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="52px"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:paddingBottom="50px"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewCancelDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#66B8BFE8"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/tvCancel"
|
||||
android:layout_marginBottom="50px"
|
||||
/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvCaseList"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvCaseListTitle"
|
||||
app:layout_constraintBottom_toTopOf="@id/viewCancelDivider"
|
||||
android:layout_margin="50px"
|
||||
/>
|
||||
|
||||
</com.mogo.eagle.core.widget.RoundConstraintLayout>
|
||||
@@ -0,0 +1,126 @@
|
||||
<?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:layout_width="1270px"
|
||||
android:layout_height="959px"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCaseName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="56px"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="50px"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewVerticalLine"
|
||||
android:layout_width="2px"
|
||||
android:layout_height="160px"
|
||||
android:background="#66B8BFE8"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/viewHorizontalLine"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2px"
|
||||
android:background="#66B8BFE8"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/viewVerticalLine"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSave"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewHorizontalLine"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/viewVerticalLine"
|
||||
android:text="保存"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="52px"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewHorizontalLine"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/viewVerticalLine"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:text="取消"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="52px"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clSearchLayout"
|
||||
android:layout_width="1030px"
|
||||
android:layout_height="96px"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvCaseName"
|
||||
android:layout_marginTop="50px"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:background="@drawable/bad_case_search_bg"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSearch"
|
||||
android:layout_width="38px"
|
||||
android:layout_height="42px"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:src="@drawable/icon_bad_case_search"
|
||||
android:layout_marginEnd="40px"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etSearch"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/ivSearch"
|
||||
android:hint="topic搜索"
|
||||
android:textSize="38px"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textColorHint="#B3FFFFFF"
|
||||
android:background="@null"
|
||||
android:layout_marginStart="40px"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvTopicList"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/clSearchLayout"
|
||||
app:layout_constraintRight_toRightOf="@id/clSearchLayout"
|
||||
app:layout_constraintTop_toBottomOf="@id/clSearchLayout"
|
||||
app:layout_constraintBottom_toTopOf="@id/viewHorizontalLine"
|
||||
android:layout_marginTop="50px"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:scrollbars="vertical"
|
||||
android:fadeScrollbars="false"
|
||||
style="@style/rv_vertical_style"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/caseName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="116px"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="43px"
|
||||
android:background="@drawable/case_list_selector"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
>
|
||||
</TextView>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/caseName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="84px"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="34px"
|
||||
android:background="@drawable/case_list_selector"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
>
|
||||
</TextView>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/topic_check_box"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:button="@drawable/badcase_radio_button_style"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="38px"
|
||||
android:paddingStart="5dp"
|
||||
android:gravity="center_vertical"
|
||||
>
|
||||
</CheckBox>
|
||||
@@ -308,15 +308,18 @@
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rgRecordConfig"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvTemplate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tvRecordTemplate"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvRecordTemplate"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:background="@drawable/template_list_bg"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:layout_marginBottom="@dimen/dp_50"
|
||||
android:paddingBottom="10dp"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="bad_case_dialog" parent="@android:style/Theme.Dialog">
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowBackground">@drawable/bad_case_dialog_bg</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="rv_vertical_style">
|
||||
<item name="android:scrollbarSize">5dp</item>
|
||||
<item name="android:scrollbars">horizontal</item>
|
||||
<item name="android:scrollbarThumbVertical">@drawable/rv_scroll_bar_thumb</item>
|
||||
<item name="android:scrollbarTrackVertical">@drawable/rv_scroll_bar_track</item>
|
||||
</style>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -93,7 +93,7 @@ public class DispatchDialogManager {
|
||||
}
|
||||
|
||||
private void voice() {
|
||||
AIAssist.getInstance(mContext).speakTTSVoice("请立即停车!请立即停车!");
|
||||
AIAssist.getInstance(mContext).speakTTSVoiceWithLevel("请立即停车!请立即停车!",AIAssist.LEVEL0);
|
||||
}
|
||||
|
||||
public void releaseDialog() {
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.text.TextUtils
|
||||
import android.transition.*
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.view.WindowManager.LayoutParams
|
||||
import android.view.animation.*
|
||||
@@ -78,14 +79,18 @@ import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.IPCReportWindow
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.ReportListFloatWindow
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.SOPSettingView
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.AutoPilotAndCheckView
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.MaskView
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
|
||||
import com.mogo.eagle.core.utilcode.reminder.*
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.*
|
||||
@@ -126,6 +131,13 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
private var mDebugSettingViewFloat: WarningFloat.Builder? = null
|
||||
private var mDebugSettingView: DebugSettingView? = null
|
||||
|
||||
//SOPSettingView
|
||||
private var mSOPSettingViewFloat: WarningFloat.Builder? = null
|
||||
private var mSOPSettingView: SOPSettingView? = null
|
||||
|
||||
//StatusView
|
||||
private var statusBarViewFloat: WarningFloat.Builder? = null
|
||||
private var statusBarView: StatusBarView? = null
|
||||
|
||||
private var mNoticeFloat: WarningFloat.Builder? = null
|
||||
|
||||
@@ -186,7 +198,17 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
toggleStatusBarView()
|
||||
|
||||
initViewShowWithConfig()
|
||||
|
||||
//设置StatusBar初始状态
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
statusBarView?.updateRightView(true, "demoMode", DemoModeView(requireContext()))
|
||||
} else {
|
||||
statusBarView?.updateRightView(false, "demoMode", DemoModeView(requireContext()))
|
||||
}
|
||||
|
||||
ivCameraIcon?.setOnClickListener {
|
||||
if (cameraViewFloat == null) {
|
||||
showCameraList(CallerMonitorManager.getCameraList())
|
||||
@@ -408,6 +430,14 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
busOperationStatus?.showBusOperation()
|
||||
}
|
||||
|
||||
override fun setStatusBarDarkOrLight(light: Boolean) {
|
||||
statusBarView?.setStatusBarDarkOrLight(light)
|
||||
}
|
||||
|
||||
override fun updateStatusBarRightView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
|
||||
statusBarView?.updateRightView(insert, tag, viewGroup)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 红绿灯 代理View
|
||||
*/
|
||||
@@ -446,6 +476,10 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
dismissToolsFloatView()
|
||||
CallerDevaToolsManager.showFeedbackView(it)
|
||||
}
|
||||
|
||||
override fun showSOPSettingView() {
|
||||
toggleSOPView()
|
||||
}
|
||||
})
|
||||
}
|
||||
toolsViewFloat = WarningFloat.with(it)
|
||||
@@ -659,6 +693,103 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun toggleSOPView() {
|
||||
activity?.let {
|
||||
if (mSOPSettingViewFloat != null) {
|
||||
WarningFloat.dismiss(mSOPSettingViewFloat!!.config.floatTag, false)
|
||||
mSOPSettingViewFloat = null
|
||||
mSOPSettingView = null
|
||||
} else {
|
||||
if (mSOPSettingView == null) {
|
||||
mSOPSettingView = SOPSettingView(it)
|
||||
}
|
||||
var side = RIGHT
|
||||
var gravity = Gravity.RIGHT
|
||||
//调试窗默认靠右显示,Bus的乘客端右端有视图覆盖,调试窗靠左显示
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
|
||||
AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|
||||
) {
|
||||
side = LEFT
|
||||
gravity = Gravity.LEFT
|
||||
}
|
||||
mSOPSettingViewFloat = WarningFloat.with(it)
|
||||
.setTag("mSOPSettingView")
|
||||
.setLayout(mSOPSettingView!!)
|
||||
.setSidePattern(side)
|
||||
.setGravity(gravity, offsetY = 70)
|
||||
.setImmersionStatusBar(true)
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleStatusBarView() {
|
||||
activity?.let{
|
||||
if(statusBarViewFloat!= null){
|
||||
WarningFloat.dismiss(statusBarViewFloat!!.config.floatTag, false)
|
||||
statusBarViewFloat = null
|
||||
statusBarView = null
|
||||
}else{
|
||||
if (statusBarView == null){
|
||||
statusBarView = StatusBarView(it)
|
||||
}
|
||||
val side = TOP
|
||||
val gravity = Gravity.TOP
|
||||
statusBarViewFloat = WarningFloat.with(it)
|
||||
.setTag("statusBarView")
|
||||
.setLayout(statusBarView!!)
|
||||
.setSidePattern(side)
|
||||
.setWindowWidth(ScreenUtils.getScreenWidth())
|
||||
.setWindowHeight(BarUtils.getStatusBarHeight())
|
||||
.setGravity(gravity, 0)
|
||||
.setImmersionStatusBar(true)
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = LinearInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示VR下V2X预警
|
||||
*
|
||||
@@ -682,6 +813,21 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
activity?.let {
|
||||
val warningContent = alertContent
|
||||
?: EventTypeEnum.getWarningContent(v2xType)
|
||||
|
||||
//占道施工预警
|
||||
if (v2xType.equals("10006") || v2xType.equals("100061")) {
|
||||
val currentTime = System.currentTimeMillis() / 1000
|
||||
val oldTime =
|
||||
context?.let { it -> SharedPrefsMgr.getInstance(it).getLong("roadwork", 0) }
|
||||
if (currentTime - oldTime!! > 60) { //超过一分钟,才会继续播报重复提醒
|
||||
context?.let { it ->
|
||||
SharedPrefsMgr.getInstance(it)
|
||||
.putLong("roadwork", System.currentTimeMillis() / 1000)
|
||||
}
|
||||
CallerAutoPilotManager.sendTripInfo(5, "", "", "", false);
|
||||
}
|
||||
}
|
||||
|
||||
if (warningContent.isEmpty()) {
|
||||
CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!")
|
||||
return
|
||||
@@ -789,7 +935,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
it.invokeOnCancellation {
|
||||
AIAssist.getInstance(ctx).stopSpeakTts(text)
|
||||
}
|
||||
AIAssist.getInstance(ctx).speakTTSVoice(text, voiceCallback)
|
||||
AIAssist.getInstance(ctx).speakTTSVoiceWithLevel(text, AIAssist.LEVEL2, voiceCallback)
|
||||
} catch (t: Throwable) {
|
||||
it.resumeWith(Result.success(Unit))
|
||||
CallerLogger.d("$M_HMI$TAG", t.message)
|
||||
|
||||
@@ -42,7 +42,6 @@ import com.mogo.eagle.core.data.obu.ObuStatusInfo
|
||||
import com.mogo.eagle.core.data.report.ReportEntity
|
||||
import com.mogo.eagle.core.data.upgrade.UpgradeVersionEntity
|
||||
import com.mogo.eagle.core.function.api.autopilot.*
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener.Companion
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
|
||||
@@ -63,6 +62,7 @@ import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
|
||||
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
|
||||
import com.mogo.eagle.core.function.hmi.ui.upgrade.UpgradeListAdapter
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
|
||||
@@ -197,9 +197,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
//添加 业务配置监听
|
||||
CallerDevaToolsFuncConfigListenerManager.registerDevaToolsFuncConfigListener(
|
||||
FuncBizConfig.FOUNDATION,
|
||||
TAG,
|
||||
this
|
||||
FuncBizConfig.FOUNDATION, TAG, true, this
|
||||
)
|
||||
|
||||
if (logInfoView != null) {
|
||||
@@ -231,7 +229,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
CallerAutopilotVehicleStateListenerManager.removeListener(TAG)
|
||||
|
||||
// 移除 业务配置监听
|
||||
CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener(this)
|
||||
CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener( FuncBizConfig.FOUNDATION, TAG)
|
||||
|
||||
if (logInfoView != null) {
|
||||
logInfoView!!.onEnterBackground()
|
||||
@@ -569,11 +567,16 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
Log.i(
|
||||
"1026-emArrow",
|
||||
"debug setting FunctionBuildConfig.isDemoMode : ${FunctionBuildConfig.isDemoMode}"
|
||||
)
|
||||
// 演示模式,上一次勾选的数据
|
||||
tbIsDemoMode.isChecked = FunctionBuildConfig.isDemoMode
|
||||
|
||||
// 演示模式
|
||||
tbIsDemoMode.setOnCheckedChangeListener { _, isChecked ->
|
||||
CallerHmiManager.updateStatusBarRightView(isChecked, "demoMode", DemoModeView(context))
|
||||
CallerAutoPilotManager.setDemoMode(isChecked)
|
||||
if (!isChecked) {
|
||||
//关闭美化模式时,通知工控机
|
||||
@@ -1855,41 +1858,55 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateBizData(type: String, state: Boolean, lock: Boolean, data: String?) {
|
||||
override fun updateBizView(type: String, lock: Boolean) {
|
||||
when (type) {
|
||||
BIZ_BEAUTY_MODE -> {
|
||||
if(lock){
|
||||
tbIsDemoMode.background = resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
}else{
|
||||
tbIsDemoMode.background = resources.getDrawable(R.drawable.radio_button_normal_background_right)
|
||||
tbIsDemoMode.isClickable = !lock
|
||||
if (lock) {
|
||||
tbIsDemoMode.background =
|
||||
resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
} else {
|
||||
tbIsDemoMode.background =
|
||||
resources.getDrawable(R.drawable.radio_button_normal_background_right)
|
||||
}
|
||||
}
|
||||
BIZ_RAIN_MODE -> {
|
||||
if(lock){
|
||||
tbIsRainMode.background = resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
}else{
|
||||
tbIsRainMode.background = resources.getDrawable(R.drawable.radio_button_normal_background_right)
|
||||
tbIsRainMode.isClickable = !lock
|
||||
if (lock) {
|
||||
tbIsRainMode.background =
|
||||
resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
} else {
|
||||
tbIsRainMode.background =
|
||||
resources.getDrawable(R.drawable.radio_button_normal_background_right)
|
||||
}
|
||||
}
|
||||
BIZ_WARNING_UPLOAD -> {
|
||||
if(lock){
|
||||
tbReportWarning.background = resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
}else{
|
||||
tbReportWarning.isClickable = !lock
|
||||
if (lock) {
|
||||
tbReportWarning.background =
|
||||
resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
} else {
|
||||
tbReportWarning.background = null
|
||||
}
|
||||
}
|
||||
BIZ_BAG_RECORD -> {
|
||||
if (lock) {
|
||||
btnRecordBag.background = resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
btnRecordBag.isClickable = false
|
||||
btnRecordBag.background =
|
||||
resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
} else {
|
||||
btnRecordBag.isClickable = true
|
||||
btnRecordBag.requestFocus()
|
||||
btnRecordBag.background = null
|
||||
}
|
||||
}
|
||||
BIZ_FULL_LOG -> {
|
||||
if (lock) {
|
||||
tbLogCatch.background = resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
tbLogCatch.isClickable = false
|
||||
tbLogCatch.background =
|
||||
resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
} else {
|
||||
tbLogCatch.isClickable = true
|
||||
tbLogCatch.requestFocus()
|
||||
tbLogCatch.background = null
|
||||
}
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.setting
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
|
||||
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设置窗口
|
||||
*/
|
||||
class SOPSettingView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoDevaToolsFuncConfigListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "SOPSettingView"
|
||||
}
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_sop_setting, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
//绕障类功能开关
|
||||
tbObstacleAvoidance.isChecked = FunctionBuildConfig.isDetouring
|
||||
tbObstacleAvoidance.setOnCheckedChangeListener { _, isChecked ->
|
||||
CallerAutoPilotManager.sendDetouring(isChecked)
|
||||
FunctionBuildConfig.isDetouring = isChecked
|
||||
}
|
||||
|
||||
tbMarkingObstacles.isChecked = FunctionBuildConfig.isPNCWarning
|
||||
//危险障碍物颜色标记开关
|
||||
tbMarkingObstacles.setOnCheckedChangeListener { _, isChecked ->
|
||||
FunctionBuildConfig.isPNCWarning = isChecked
|
||||
}
|
||||
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
tbMarkingObstacles.visibility = View.GONE
|
||||
}
|
||||
|
||||
//引导线动态效果
|
||||
tbRouteDynamicEffect.isChecked =
|
||||
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) && !AppIdentityModeUtils.isBus(
|
||||
FunctionBuildConfig.appIdentityMode
|
||||
)
|
||||
tbRouteDynamicEffect.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
RouteStrategy.enable(true)
|
||||
} else {
|
||||
RouteStrategy.enable(false)
|
||||
}
|
||||
}
|
||||
|
||||
//红绿灯标识
|
||||
tbTrafficLight.isChecked = HmiBuildConfig.isShowTrafficLightView
|
||||
tbTrafficLight.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (!isChecked) {
|
||||
HmiBuildConfig.isShowTrafficLightView = false
|
||||
} else {
|
||||
HmiBuildConfig.isShowTrafficLightView = true
|
||||
CallerHmiManager.disableWarningTrafficLight()
|
||||
}
|
||||
}
|
||||
|
||||
//限速标识
|
||||
tbSpeedLimit.isChecked = HmiBuildConfig.isShowLimitingVelocityView
|
||||
tbSpeedLimit.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
HmiBuildConfig.isShowLimitingVelocityView = true
|
||||
} else {
|
||||
HmiBuildConfig.isShowLimitingVelocityView = false
|
||||
CallerHmiManager.disableLimitingVelocity()
|
||||
}
|
||||
}
|
||||
|
||||
// 演示模式,上一次勾选的数据
|
||||
tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode
|
||||
// 演示模式
|
||||
tbDemoMode.setOnCheckedChangeListener { _, isChecked ->
|
||||
CallerAutoPilotManager.setDemoMode(isChecked)
|
||||
if (!isChecked) {
|
||||
//关闭美化模式时,通知工控机
|
||||
CallerAutoPilotManager.setIPCDemoMode(isChecked)
|
||||
}
|
||||
FunctionBuildConfig.isDemoMode = isChecked
|
||||
}
|
||||
//只在司机端设置美化模式开关功能
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
tbDemoMode.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
// 雨天模式,上一次勾选的数据
|
||||
tbRainMode.isChecked = FunctionBuildConfig.isRainMode
|
||||
//雨天模式
|
||||
tbRainMode.setOnCheckedChangeListener { _, isChecked ->
|
||||
CallerAutoPilotManager.setRainMode(isChecked)
|
||||
FunctionBuildConfig.isRainMode = isChecked
|
||||
}
|
||||
//雨天模式按钮只在司机屏生效,乘客屏不显示
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
tbRainMode.visibility = View.GONE
|
||||
}
|
||||
|
||||
//OBU控制总开关
|
||||
tbObu.isChecked = CallerOBUManager.isConnected()
|
||||
tbObu.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (!isChecked) {
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerOBUManager.resetObuIpAddress("192.168.1.199")
|
||||
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerOBUManager.resetObuIpAddress("192.168.8.199")
|
||||
}
|
||||
} else {
|
||||
//断开链接
|
||||
CallerOBUManager.disConnectObu()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//是否开启异常上报
|
||||
tbIPCReport.isChecked = FunctionBuildConfig.isReportWarning
|
||||
tbIPCReport.setOnCheckedChangeListener { _, isChecked ->
|
||||
FunctionBuildConfig.isReportWarning = isChecked
|
||||
}
|
||||
|
||||
//变道绕障的目标障碍物速度阈值
|
||||
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
|
||||
ivSpeedReduce.setOnClickListener {
|
||||
if (FunctionBuildConfig.detouringSpeed <= 3) {
|
||||
ToastUtils.showShort("阈值最小可为3 m/s")
|
||||
} else {
|
||||
FunctionBuildConfig.detouringSpeed--
|
||||
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
|
||||
}
|
||||
}
|
||||
ivSpeedAdd.setOnClickListener {
|
||||
if (FunctionBuildConfig.detouringSpeed >= 7) {
|
||||
ToastUtils.showShort("阈值最大可为7 m/s")
|
||||
} else {
|
||||
FunctionBuildConfig.detouringSpeed++
|
||||
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
|
||||
}
|
||||
}
|
||||
btnSpeedSet.setOnClickListener {
|
||||
val isSuccess =
|
||||
CallerAutoPilotManager.sendDetouringSpeed(FunctionBuildConfig.detouringSpeed.toDouble())
|
||||
if (isSuccess == true) {
|
||||
ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置成功")
|
||||
} else {
|
||||
ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置失败")
|
||||
}
|
||||
}
|
||||
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
tvSpeedThresholdTitle.visibility = View.GONE
|
||||
ivSpeedReduce.visibility = View.GONE
|
||||
tvSpeed.visibility = View.GONE
|
||||
ivSpeedAdd.visibility = View.GONE
|
||||
btnSpeedSet.visibility = View.GONE
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
//添加 业务配置监听
|
||||
CallerDevaToolsFuncConfigListenerManager.registerDevaToolsFuncConfigListener(
|
||||
FuncBizConfig.FOUNDATION, TAG, true, this
|
||||
)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// 移除 业务配置监听
|
||||
CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener(FuncBizConfig.FOUNDATION, TAG)
|
||||
}
|
||||
|
||||
override fun updateBizView(type: String, lock: Boolean) {
|
||||
when (type) {
|
||||
FuncBizConfig.BIZ_BEAUTY_MODE -> {
|
||||
tbDemoMode.isClickable = !lock
|
||||
if (lock) {
|
||||
tbDemoMode.background =
|
||||
resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
} else {
|
||||
tbDemoMode.background =
|
||||
resources.getDrawable(R.drawable.radio_button_normal_background_right)
|
||||
}
|
||||
}
|
||||
FuncBizConfig.BIZ_RAIN_MODE -> {
|
||||
tbRainMode.isClickable = !lock
|
||||
if (lock) {
|
||||
tbRainMode.background =
|
||||
resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
} else {
|
||||
tbRainMode.background =
|
||||
resources.getDrawable(R.drawable.radio_button_normal_background_right)
|
||||
}
|
||||
}
|
||||
FuncBizConfig.BIZ_PNC_WARNING -> {
|
||||
tbMarkingObstacles.isClickable = !lock
|
||||
if (lock) {
|
||||
tbMarkingObstacles.background =
|
||||
resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
} else {
|
||||
tbMarkingObstacles.background =
|
||||
resources.getDrawable(R.drawable.radio_button_normal_background_right)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Process
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
@@ -59,15 +60,13 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
|
||||
companion object {
|
||||
private var maxAcceleration: Double = 2.0
|
||||
private var speedLimit: Double = 0.0
|
||||
private var speedLimit: Int = 0
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun initView() {
|
||||
background = ColorDrawable(Color.parseColor("#F0151D41"))
|
||||
if (keyBoardUtil == null) {
|
||||
keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed)
|
||||
}
|
||||
|
||||
keyBoardUtil?.setActionListener { inputContent ->
|
||||
inputContent.toIntOrNull()?.let { speed ->
|
||||
when {
|
||||
@@ -76,10 +75,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
ToastUtils.showShort("超过最大限速值60,设置失败")
|
||||
}
|
||||
else -> {
|
||||
llSpeedPosition.background =
|
||||
resources.getDrawable(R.drawable.pilot_speed_bg)
|
||||
keyBoardUtil?.hideKeyboard()
|
||||
etInputSpeed.clearFocus()
|
||||
// 设置自动驾驶速度
|
||||
val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speed)
|
||||
when {
|
||||
@@ -94,13 +89,15 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
KeyBoardUtil.hideSystemSoftKeyboard(context, etInputSpeed)
|
||||
ivCloseIcon.setOnClickListener {
|
||||
clickListener?.onClose(it)
|
||||
}
|
||||
rlKillLayout.setOnClickListener {
|
||||
killApp()
|
||||
}
|
||||
sopLayout.setOnClickListener {
|
||||
clickListener?.showSOPSettingView()
|
||||
}
|
||||
viewCheckStatus.setOnClickListener {
|
||||
clickListener?.go2CheckPage()
|
||||
}
|
||||
@@ -110,49 +107,54 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
ivDebugFeedback.onClick {
|
||||
clickListener?.showFeedbackView()
|
||||
}
|
||||
etInputSpeed.setOnFocusChangeListener { v, hasFocus ->
|
||||
when {
|
||||
hasFocus -> {
|
||||
llSpeedPosition.background =
|
||||
resources.getDrawable(R.drawable.pilot_speed_high_light_bg)
|
||||
if (keyBoardUtil == null) {
|
||||
keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed)
|
||||
}
|
||||
keyBoardUtil?.showKeyboard()
|
||||
}
|
||||
else -> llSpeedPosition.background =
|
||||
resources.getDrawable(R.drawable.pilot_speed_bg)
|
||||
}
|
||||
}
|
||||
etInputSpeed.setOnTouchListener { v, event ->
|
||||
var curTime = System.currentTimeMillis()
|
||||
if (curTime - lastTime < 1000) {
|
||||
return@setOnTouchListener true
|
||||
}
|
||||
if (!connectStatus) {
|
||||
ToastUtils.showShort("设置车速失败,请启动域控制器")
|
||||
keyBoardUtil?.hideKeyboard()
|
||||
return@setOnTouchListener true
|
||||
} else {
|
||||
return@setOnTouchListener false
|
||||
}
|
||||
}
|
||||
updateSpeedSettingViews()
|
||||
|
||||
if (AppConfigInfo.isConnectAutopilot) {
|
||||
CallerAutoPilotManager.getCarConfig()
|
||||
}
|
||||
if (maxAcceleration > 0) {
|
||||
tvAcceleration.text = "加速度 $maxAcceleration m/s²"
|
||||
}
|
||||
// if (maxAcceleration > 0) {
|
||||
// tvAcceleration.text = "加速度 $maxAcceleration m/s²"
|
||||
// }
|
||||
tvAcceleration.text = "每次调整车速±5km/h,点击确定生效"
|
||||
if (speedLimit > 0) {
|
||||
etInputSpeed.setText((speedLimit * 3.6).toInt().toString())
|
||||
tvSpeed.text = speedLimit.toString()
|
||||
}else{
|
||||
tvSpeed.text = "0"
|
||||
}
|
||||
initOchView()
|
||||
// // 比如需要设置默认速度
|
||||
// val speed = "30"
|
||||
// etInputSpeed.setText(speed)
|
||||
// etInputSpeed.setSelection(speed.length)
|
||||
|
||||
ivSpeedReduce.setOnClickListener {
|
||||
if(speedLimit>=5){
|
||||
speedLimit -= 5
|
||||
tvSpeed.text = speedLimit.toString()
|
||||
}else{
|
||||
ToastUtils.showShort("车速不能再减了")
|
||||
}
|
||||
}
|
||||
|
||||
ivSpeedAdd.setOnClickListener {
|
||||
if(speedLimit<=55){
|
||||
speedLimit += 5
|
||||
tvSpeed.text = speedLimit.toString()
|
||||
}else{
|
||||
ToastUtils.showShort("车速不能再加了")
|
||||
}
|
||||
}
|
||||
|
||||
//速度确认
|
||||
tvSureModify.setOnClickListener {
|
||||
val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speedLimit)
|
||||
when {
|
||||
isSuccess -> {
|
||||
//速度显示
|
||||
tvSpeed.text = speedLimit.toString()
|
||||
ToastUtils.showShort("车速设置成功,立即生效")
|
||||
}
|
||||
else -> {
|
||||
ToastUtils.showShort("设置车速失败,请启动域控制器")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initOchView()
|
||||
}
|
||||
|
||||
private fun initOchView() {
|
||||
@@ -189,11 +191,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
|
||||
private fun updateSpeedSettingViews() {
|
||||
tvSpeedTitle.visibility = View.VISIBLE
|
||||
llSpeedPosition.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
fun showAdUpgradeStatus(ipcUpgradeStateInfo: IPCUpgradeStateInfo) {
|
||||
systemVersionView?.showAdUpgradeStatus(ipcUpgradeStateInfo)
|
||||
}
|
||||
@@ -220,16 +217,20 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
fun onClose(v: View)
|
||||
fun showDebugPanelView()
|
||||
fun showFeedbackView()
|
||||
fun showSOPSettingView()
|
||||
}
|
||||
|
||||
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
|
||||
UiThreadHandler.post {
|
||||
tvAcceleration?.let {
|
||||
maxAcceleration = carConfigResp.maxAcceleration
|
||||
speedLimit = carConfigResp.speedLimit
|
||||
tvAcceleration.text = "加速度 ${carConfigResp.maxAcceleration} m/s²"
|
||||
etInputSpeed.setText((carConfigResp.speedLimit * 3.6).toInt().toString())
|
||||
}
|
||||
// tvAcceleration?.let {
|
||||
// maxAcceleration = carConfigResp.maxAcceleration
|
||||
// speedLimit = carConfigResp.speedLimit
|
||||
//// tvAcceleration.text = "加速度 ${carConfigResp.maxAcceleration} m/s²"
|
||||
// tvSpeed.text = (carConfigResp.speedLimit * 3.6).toInt().toString()
|
||||
// }
|
||||
maxAcceleration = carConfigResp.maxAcceleration
|
||||
speedLimit = (carConfigResp.speedLimit * 3.6).toInt()
|
||||
tvSpeed.text = speedLimit.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ class BusOperationView @JvmOverloads constructor(
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_och_bus_operation,this,true)
|
||||
context?.let {
|
||||
actvAccountPhone.text = SharedPrefs.getInstance(it).getString("account","")
|
||||
actvAccountPhone.text = phoneMask(SharedPrefs.getInstance(it).getString("och_account",""))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.BatteryManager
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
class BatteryGroupView : LinearLayout, IMoGoSkinModeChangeListener {
|
||||
|
||||
constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : super(context, attrs, defStyleAttr) {
|
||||
}
|
||||
|
||||
private var batteryHandler: BatteryHandler = BatteryHandler(this)
|
||||
private var view: View =
|
||||
LayoutInflater.from(context).inflate(R.layout.view_battery_group, this, true)
|
||||
private var batteryView: BatteryView = (view as BatteryGroupView).findViewById(R.id.viewBattery)
|
||||
private var ivBatteryCharge: ImageView = (view as BatteryGroupView).findViewById(R.id.ivBatteryCharge)
|
||||
private var mSkinMode = 0
|
||||
|
||||
private val batteryStateReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
when (intent.action) {
|
||||
Intent.ACTION_BATTERY_CHANGED -> {
|
||||
val level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0)
|
||||
val scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 0)
|
||||
val charge = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1)
|
||||
val percentage = (level * 100) / scale
|
||||
val message = Message.obtain()
|
||||
message.what = 0
|
||||
message.arg1 = percentage
|
||||
message.arg2 = charge
|
||||
batteryHandler.sendMessage(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
const val TAG = "BatteryGroupView"
|
||||
|
||||
class BatteryHandler(batteryGroupView: BatteryGroupView) : Handler() {
|
||||
|
||||
//虚引用
|
||||
private var stateViewWeakReference: WeakReference<BatteryGroupView>? = null
|
||||
|
||||
init {
|
||||
stateViewWeakReference = WeakReference(batteryGroupView)
|
||||
}
|
||||
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
val batteryGroupView = stateViewWeakReference?.get()
|
||||
batteryGroupView?.let {
|
||||
if (msg.what == 0) {
|
||||
it.batteryView.setPower(msg.arg1)
|
||||
val isCharging = msg.arg2 == BatteryManager.BATTERY_STATUS_CHARGING ||
|
||||
msg.arg2 == BatteryManager.BATTERY_STATUS_FULL
|
||||
it.batteryView.setCharging(isCharging)
|
||||
if (isCharging) {
|
||||
it.ivBatteryCharge.visibility = View.VISIBLE
|
||||
when(it.mSkinMode){
|
||||
0 -> it.ivBatteryCharge.setImageResource(R.drawable.battery_charge_light)
|
||||
1 -> it.ivBatteryCharge.setImageResource(R.drawable.battery_charge_dark)
|
||||
}
|
||||
} else {
|
||||
it.ivBatteryCharge.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
val intentFilter = IntentFilter()
|
||||
intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED)
|
||||
context.registerReceiver(batteryStateReceiver, intentFilter)
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
context.unregisterReceiver(batteryStateReceiver)
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
mSkinMode = skinMode
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.graphics.RectF
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import kotlin.math.abs
|
||||
|
||||
|
||||
class BatteryView : View , IMoGoSkinModeChangeListener {
|
||||
|
||||
companion object{
|
||||
const val TAG = "BatteryView"
|
||||
}
|
||||
|
||||
private val radius = context.resources.getDimension(R.dimen.dp_4) // 圆角角度
|
||||
private val border = context.resources.getDimension(R.dimen.dp_3) // 外边缘宽度
|
||||
private val margin = context.resources.getDimension(R.dimen.dp_6) // 边框与内部电量距离
|
||||
private val width = context.resources.getDimension(R.dimen.dp_57) // 电池宽度
|
||||
private val height = context.resources.getDimension(R.dimen.dp_28) // 电池高度
|
||||
private val headWidth = context.resources.getDimension(R.dimen.dp_3) // 电池头宽度
|
||||
private val headHeight = context.resources.getDimension(R.dimen.dp_8) // 电池头高度
|
||||
private val headRadius = context.resources.getDimension(R.dimen.dp_1) // 电池头圆角角度
|
||||
private val batteryNumSize = context.resources.getDimension(R.dimen.dp_20) // 电量显示文字大小
|
||||
private var batteryColor = context.resources.getColor(R.color.color_27FFFFFF) // 电量内部颜色
|
||||
private var powerColor = Color.WHITE
|
||||
|
||||
//默认满电
|
||||
private var mPower = 100
|
||||
|
||||
//是否充电
|
||||
private var mIsCharging = false
|
||||
|
||||
constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null
|
||||
) : super(context, attrs, 0) {
|
||||
|
||||
}
|
||||
|
||||
constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : super(context, attrs, defStyleAttr) {
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||
setMeasuredDimension(width.toInt(), height.toInt())
|
||||
}
|
||||
|
||||
@SuppressLint("DrawAllocation")
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
//电池头
|
||||
val paint = Paint()
|
||||
paint.style = Paint.Style.FILL
|
||||
paint.strokeWidth = 0f
|
||||
paint.isAntiAlias = true
|
||||
paint.color = powerColor
|
||||
|
||||
val rectHead =
|
||||
RectF(width - headWidth, (height - headHeight) / 2, width, (height + headHeight) / 2)
|
||||
canvas.drawRoundRect(rectHead, headRadius, headRadius, paint)
|
||||
|
||||
//边框
|
||||
paint.strokeWidth = border
|
||||
paint.style = Paint.Style.STROKE
|
||||
val rectF =
|
||||
RectF(radius / 2, radius / 2, width - headWidth - radius / 2, height - radius / 2)
|
||||
canvas.drawRoundRect(rectF, radius, radius, paint)
|
||||
|
||||
//文字画笔
|
||||
val textPaint = Paint()
|
||||
textPaint.color = powerColor
|
||||
textPaint.isAntiAlias = true
|
||||
textPaint.textSize = batteryNumSize
|
||||
textPaint.textAlign = Paint.Align.CENTER
|
||||
//画数字
|
||||
val fontMetrics = textPaint.fontMetrics
|
||||
canvas.drawText(mPower.toString(), rectF.centerX(), abs(fontMetrics.top), textPaint)
|
||||
|
||||
//电池电量
|
||||
val powerValues = mPower / 100.0f
|
||||
val paintPower = Paint(paint)
|
||||
paintPower.style = Paint.Style.FILL
|
||||
|
||||
//低电量
|
||||
val lowerPaint = Paint(paint)
|
||||
lowerPaint.style = Paint.Style.FILL
|
||||
lowerPaint.color = powerColor
|
||||
if (mPower < 20) {
|
||||
lowerPaint.color = Color.RED
|
||||
} else {
|
||||
lowerPaint.color = batteryColor
|
||||
}
|
||||
|
||||
//画电量
|
||||
if (powerValues != 0f) {
|
||||
val right = (width - margin - headWidth) * powerValues
|
||||
val bottom = height - margin
|
||||
val rect = RectF(margin, margin, right, bottom)
|
||||
//画矩形
|
||||
canvas.drawRoundRect(rect, radius, radius, lowerPaint)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前电量
|
||||
*/
|
||||
fun setPower(power: Int) {
|
||||
if (this.mPower < 0) {
|
||||
this.mPower = 0
|
||||
}
|
||||
if (this.mPower > 100) {
|
||||
this.mPower = 100
|
||||
}
|
||||
this.mPower = power
|
||||
if(isAttachedToWindow){
|
||||
invalidate()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否充电中
|
||||
*/
|
||||
fun setCharging(charging: Boolean) {
|
||||
this.mIsCharging = charging
|
||||
invalidate()
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
when (skinMode) {
|
||||
0 -> {
|
||||
batteryColor = resources.getColor(R.color.color_27FFFFFF)
|
||||
powerColor = Color.WHITE
|
||||
}
|
||||
1 -> {
|
||||
batteryColor = resources.getColor(R.color.color_1E111111)
|
||||
powerColor = resources.getColor(R.color.color_2C2E30)
|
||||
}
|
||||
}
|
||||
invalidate()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.RelativeLayout
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
|
||||
/**
|
||||
* 魔戒蓝牙控件
|
||||
* 放置于StatusBar右侧位置
|
||||
*/
|
||||
class BlueToothView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : RelativeLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_blue_tooth, this, true)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.RelativeLayout
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
|
||||
/**
|
||||
* 演示模式控件
|
||||
* 放置于StatusBar右侧位置
|
||||
*/
|
||||
class DemoModeView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : RelativeLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_demo_mode, this, true)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
@@ -49,7 +50,9 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
override fun showWarningTrafficLight(checkLightId: Int,lightSource: Int) {
|
||||
super.showWarningTrafficLight(checkLightId,lightSource)
|
||||
mCurrentLightId = checkLightId
|
||||
updateTrafficLightIcon(checkLightId,lightSource)
|
||||
if(!HmiBuildConfig.isShowTrafficLightView){
|
||||
updateTrafficLightIcon(checkLightId,lightSource)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.RelativeLayout
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ScreenUtils
|
||||
import kotlinx.android.synthetic.main.view_status_bar.view.*
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
class StatusBarView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : RelativeLayout(context, attrs, defStyleAttr), IMoGoSkinModeChangeListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "StatusBarView"
|
||||
}
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_status_bar, this, true)
|
||||
}
|
||||
|
||||
private val rightViewList = CopyOnWriteArrayList<String>()
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
val layoutParamsLeft =
|
||||
LayoutParams(ScreenUtils.getScreenWidth() / 3, BarUtils.getStatusBarHeight())
|
||||
viewStatusBarLeft.layoutParams = layoutParamsLeft
|
||||
val layoutParamsRight =
|
||||
LayoutParams(ScreenUtils.getScreenWidth() / 3 * 2, BarUtils.getStatusBarHeight())
|
||||
layoutParamsRight.addRule(ALIGN_PARENT_END)
|
||||
layoutParamsRight.addRule(CENTER_HORIZONTAL)
|
||||
layoutParamsRight.addRule(CENTER_IN_PARENT)
|
||||
layoutParamsRight.marginEnd = context.resources.getDimension(R.dimen.dp_44).toInt()
|
||||
viewStatusBarRight.layoutParams = layoutParamsRight
|
||||
viewStatusBarRight.addView(BatteryGroupView(this.context))
|
||||
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
when (skinMode) {
|
||||
0 -> setStatusBarDarkOrLight(false)
|
||||
1 -> setStatusBarDarkOrLight(true)
|
||||
}
|
||||
}
|
||||
|
||||
fun setStatusBarDarkOrLight(light: Boolean) {
|
||||
if (light) {
|
||||
setTextColor(resources.getColor(R.color.color_2C2E30))
|
||||
} else {
|
||||
setTextColor(resources.getColor(R.color.color_FFFFFF))
|
||||
}
|
||||
}
|
||||
|
||||
fun updateRightView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
|
||||
if (insert) {
|
||||
rightViewList.add(0, tag)
|
||||
viewStatusBarRight.addView(viewGroup, 0)
|
||||
} else {
|
||||
rightViewList.forEachIndexed { index, s ->
|
||||
if (s == tag) {
|
||||
rightViewList.removeAt(index)
|
||||
viewStatusBarRight.removeViewAt(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTextColor(color: Int) {
|
||||
viewTextClock.setTextColor(color)
|
||||
viewStatusBarTag.setTextColor(color)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.net.wifi.WifiManager
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import android.util.AttributeSet
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
|
||||
class WifiStateView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : AppCompatImageView(context, attrs, defStyleAttr), IMoGoSkinModeChangeListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "WifiStateView"
|
||||
|
||||
class WifiHandler(wifiStateView: WifiStateView) : Handler() {
|
||||
|
||||
//虚引用
|
||||
private var stateViewWeakReference: WeakReference<WifiStateView>? = null
|
||||
|
||||
init {
|
||||
stateViewWeakReference = WeakReference(wifiStateView)
|
||||
}
|
||||
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
val wifiStateView = stateViewWeakReference?.get()
|
||||
wifiStateView?.updateView(msg.what) {
|
||||
wifiStateView.setImageResource(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var wifiManager: WifiManager? = null
|
||||
private var wifiHandler: WifiHandler? = null
|
||||
|
||||
@Volatile
|
||||
private var mSkinMode: Int = 0
|
||||
|
||||
@Volatile
|
||||
private var level: Int = 0
|
||||
|
||||
init {
|
||||
wifiManager =
|
||||
context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager?
|
||||
wifiHandler = WifiHandler(this)
|
||||
}
|
||||
|
||||
private val wifiStateReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
when (intent.action) {
|
||||
WifiManager.WIFI_STATE_CHANGED_ACTION, WifiManager.RSSI_CHANGED_ACTION -> {
|
||||
if (wifiManager!!.wifiState == WifiManager.WIFI_STATE_DISABLED
|
||||
|| wifiManager!!.wifiState == WifiManager.WIFI_STATE_DISABLING
|
||||
) {
|
||||
wifiHandler?.sendEmptyMessage(-1)
|
||||
return
|
||||
}
|
||||
val wifiInfo = wifiManager!!.connectionInfo
|
||||
level = WifiManager.calculateSignalLevel(wifiInfo.rssi, 5)
|
||||
wifiHandler?.sendEmptyMessage(level)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
val intentFilter = IntentFilter()
|
||||
//Wifi连接状态变化
|
||||
intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION)
|
||||
//Wifi信号强度变化
|
||||
intentFilter.addAction(WifiManager.RSSI_CHANGED_ACTION)
|
||||
context.registerReceiver(wifiStateReceiver, intentFilter)
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
wifiHandler?.removeCallbacksAndMessages(null)
|
||||
context.unregisterReceiver(wifiStateReceiver)
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
mSkinMode = skinMode
|
||||
wifiHandler?.sendEmptyMessage(level)
|
||||
}
|
||||
|
||||
fun updateView(wifiState: Int, resId: ((Int) -> Unit)) {
|
||||
when (mSkinMode) {
|
||||
0 -> {
|
||||
when (wifiState) {
|
||||
-1 -> resId.invoke(R.drawable.wifi_light_state_close)
|
||||
0 -> resId.invoke(R.drawable.wifi_light_state_one)
|
||||
1 -> resId.invoke(R.drawable.wifi_light_state_two)
|
||||
2 -> resId.invoke(R.drawable.wifi_light_state_three)
|
||||
3 -> resId.invoke(R.drawable.wifi_light_state_four)
|
||||
4 -> resId.invoke(R.drawable.wifi_light_state_five)
|
||||
}
|
||||
}
|
||||
1 -> {
|
||||
when (wifiState) {
|
||||
-1 -> resId.invoke(R.drawable.wifi_light_state_close)
|
||||
0 -> resId.invoke(R.drawable.wifi_dark_state_one)
|
||||
1 -> resId.invoke(R.drawable.wifi_dark_state_two)
|
||||
2 -> resId.invoke(R.drawable.wifi_dark_state_three)
|
||||
3 -> resId.invoke(R.drawable.wifi_dark_state_four)
|
||||
4 -> resId.invoke(R.drawable.wifi_dark_state_five)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,9 @@ import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -38,6 +40,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView;
|
||||
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
|
||||
import com.mogo.eagle.core.function.main.service.MogoMainService;
|
||||
import com.mogo.eagle.core.function.main.stagetwo.AutopilotStartup;
|
||||
@@ -47,6 +50,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
|
||||
import com.mogo.map.listener.IMogoHosListenerRegister;
|
||||
@@ -115,6 +119,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
injectStatusBar();
|
||||
getWindow().setBackgroundDrawable(null);
|
||||
|
||||
mFloatingLayout = findViewById(R.id.module_main_id_floating_view);
|
||||
@@ -135,6 +140,24 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
}
|
||||
}
|
||||
|
||||
private void injectStatusBar() {
|
||||
FrameLayout decorView =(FrameLayout) this.getWindow().getDecorView();
|
||||
View contentView = ((ViewGroup)decorView.findViewById(android.R.id.content)).getChildAt(0);
|
||||
contentView.setFitsSystemWindows(false);
|
||||
decorView.setClipToPadding(false);
|
||||
|
||||
View statusBarView = decorView.findViewWithTag("status_bar");
|
||||
if (statusBarView == null) {
|
||||
statusBarView = new StatusBarView(this);
|
||||
statusBarView.setTag("status_bar");
|
||||
}
|
||||
FrameLayout.LayoutParams statusBarLP =
|
||||
new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, BarUtils.getStatusBarHeight());
|
||||
statusBarLP.topMargin = 0;
|
||||
statusBarLP.gravity = Gravity.TOP;
|
||||
decorView.addView(statusBarView, statusBarLP);
|
||||
}
|
||||
|
||||
// 隐藏布局
|
||||
protected void hideLayout() {
|
||||
mFloatingLayout.setVisibility(View.GONE);
|
||||
@@ -173,6 +196,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
if (hasFocus) {
|
||||
// 统计代码
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.function.main.moujie.BluetoothMonitorReceiver;
|
||||
@@ -34,7 +35,6 @@ import com.mogo.eagle.core.function.main.moujie.ConnectBluetoothEvent;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.BarUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
@@ -71,7 +71,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
|
||||
private BluetoothMonitorReceiver mBluetoothReceiver = null;
|
||||
private BluetoothAdapter mBluetoothAdapter;
|
||||
private List<BluetoothDevice> mAreadlyConnectedList = new ArrayList<>();//已连接设备集合
|
||||
// private List<BluetoothDevice> mAreadlyConnectedList = new ArrayList<>();//已连接设备集合
|
||||
private int numberA = 0;
|
||||
private boolean isLongPressA = false;
|
||||
private int numberB = 0;
|
||||
@@ -98,13 +98,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
super.onResume();
|
||||
|
||||
initBluetooth();
|
||||
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (!mBluetoothAdapter.isEnabled()) {
|
||||
mBluetoothAdapter.enable();
|
||||
}
|
||||
mBluetoothAdapter.startDiscovery();
|
||||
|
||||
showBondedDevice(mBluetoothAdapter);
|
||||
}
|
||||
|
||||
@@ -212,31 +210,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { //向上长按 开启自动驾驶
|
||||
long currentTime = System.currentTimeMillis() / (1000);
|
||||
long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_up", 0);
|
||||
// Log.d("liyz", "time = " + (currentTime - oldTime));
|
||||
if (currentTime - oldTime > 6) {
|
||||
SharedPrefsMgr.getInstance(getContext()).putLong("old_time_up", System.currentTimeMillis() / 1000);
|
||||
// ToastUtils.showShort("长按 ↑↑↑ 开启自动驾驶");
|
||||
// CallerAutoPilotManager.INSTANCE.setControlAutopilotCarAuto(true);
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { //下和中间键盘长按,减速为-2
|
||||
long currentTime = System.currentTimeMillis() / (1000);
|
||||
long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_down", 0);
|
||||
if (currentTime - oldTime > 6) {
|
||||
SharedPrefsMgr.getInstance(getContext()).putLong("old_time_down", System.currentTimeMillis() / 1000);
|
||||
// ToastUtils.showShort("长按 ↓↓↓ 减速 -2 ");
|
||||
sendAcc(true, -2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Log.e("liyz", "onKeyDown keyCode = " + keyCode + "--action = " + event.getAction() + "---" + event);
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@@ -244,109 +217,112 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
// Log.d("liyz", "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
|
||||
if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击向左变道,长按-1
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
numberA++;
|
||||
if (numberA > 2) {
|
||||
if (!isLongPressA) {
|
||||
// ToastUtils.showShort("方块 长按A -2 ");
|
||||
sendAcc(true, -2);
|
||||
isLongPressA = true;
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (numberA == 1) {
|
||||
// ToastUtils.showShort("方块 点击A -1 ");
|
||||
sendAcc(true, -1);
|
||||
}
|
||||
numberA = 0;
|
||||
isLongPressA = false;
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_B) { //单击向右变道,长按-2
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
numberB++;
|
||||
if (numberB > 2) {
|
||||
if (!isLongPressB) {
|
||||
// ToastUtils.showShort("方块 长按B 无操作 ");
|
||||
isLongPressB = true;
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (numberB == 1) {
|
||||
// ToastUtils.showShort("方块 单击B 复原 ");
|
||||
sendAcc(false, 0.0);
|
||||
}
|
||||
numberB = 0;
|
||||
isLongPressB = false;
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击鸣笛,
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
numberC++;
|
||||
if (numberC > 2) {
|
||||
if (!isLongPressC) {
|
||||
// ToastUtils.showShort("方块 长按C 无操作");
|
||||
isLongPressC = true;
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (numberC == 1) {
|
||||
// ToastUtils.showShort("方块 单击C ← 向左变道 ");
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneLeft();
|
||||
}
|
||||
numberC = 0;
|
||||
isLongPressC = false;
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击开启自动驾驶,
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
numberD++;
|
||||
if (numberD > 2) {
|
||||
if (!isLongPressD) {
|
||||
// ToastUtils.showShort("方块 长按D 无操作");
|
||||
isLongPressD = true;
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (numberD == 1) {
|
||||
// ToastUtils.showShort("方块 单击D → 向右变道 ");
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
|
||||
}
|
||||
numberD = 0;
|
||||
isLongPressD = false;
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击复原,
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
numberE++;
|
||||
if (numberE > 2) {
|
||||
if (!isLongPressE) {
|
||||
// ToastUtils.showShort("方块 长按E 鸣笛 ");
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
|
||||
if (timerHorn == null) {
|
||||
timerHorn = new Timer();
|
||||
String bluetoothName = SharedPrefsMgr.getInstance(getContext()).getString("BLUETOOTH");
|
||||
if (bluetoothName.equals("MINI_KEYBOARD")) {
|
||||
if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击向左变道,长按-1
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
numberA++;
|
||||
if (numberA > 2) {
|
||||
if (!isLongPressA) {
|
||||
ToastUtils.showShort("方块 长按A -2 ");
|
||||
sendAcc(true, -2);
|
||||
isLongPressA = true;
|
||||
}
|
||||
timerHorn.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(2);
|
||||
timerHorn = null;
|
||||
}
|
||||
}, 500);
|
||||
isLongPressE = true;
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (numberA == 1) {
|
||||
ToastUtils.showShort("方块 点击A -1 ");
|
||||
sendAcc(true, -1);
|
||||
}
|
||||
numberA = 0;
|
||||
isLongPressA = false;
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (numberE == 1) {
|
||||
// ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_B) { //单击向右变道,长按-2
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
numberB++;
|
||||
if (numberB > 2) {
|
||||
if (!isLongPressB) {
|
||||
ToastUtils.showShort("方块 长按B 无操作 ");
|
||||
isLongPressB = true;
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (numberB == 1) {
|
||||
ToastUtils.showShort("方块 单击B 复原 ");
|
||||
sendAcc(false, 0.0);
|
||||
}
|
||||
numberB = 0;
|
||||
isLongPressB = false;
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击鸣笛,
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
numberC++;
|
||||
if (numberC > 2) {
|
||||
if (!isLongPressC) {
|
||||
ToastUtils.showShort("方块 长按C 无操作");
|
||||
isLongPressC = true;
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (numberC == 1) {
|
||||
ToastUtils.showShort("方块 单击C ← 向左变道 ");
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneLeft();
|
||||
}
|
||||
numberC = 0;
|
||||
isLongPressC = false;
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击开启自动驾驶,
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
numberD++;
|
||||
if (numberD > 2) {
|
||||
if (!isLongPressD) {
|
||||
ToastUtils.showShort("方块 长按D 无操作");
|
||||
isLongPressD = true;
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (numberD == 1) {
|
||||
ToastUtils.showShort("方块 单击D → 向右变道 ");
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
|
||||
}
|
||||
numberD = 0;
|
||||
isLongPressD = false;
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击复原,
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
numberE++;
|
||||
if (numberE > 2) {
|
||||
if (!isLongPressE) {
|
||||
ToastUtils.showShort("方块 长按E 鸣笛 ");
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
|
||||
if (timerHorn == null) {
|
||||
timerHorn = new Timer();
|
||||
}
|
||||
timerHorn.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(2);
|
||||
timerHorn = null;
|
||||
}
|
||||
}, 500);
|
||||
isLongPressE = true;
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (numberE == 1) {
|
||||
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
|
||||
// CallerAutoPilotManager.INSTANCE.setControlAutopilotCarAuto(true);
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
|
||||
}
|
||||
numberE = 0;
|
||||
isLongPressE = false;
|
||||
}
|
||||
numberE = 0;
|
||||
isLongPressE = false;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.dispatchKeyEvent(event);
|
||||
@@ -354,54 +330,13 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||
// Log.d("liyz", "dispatchTouchEvent event.getX() = " + event.getX() + "--event.getY() = " + event.getY() + "--action = " + event.getAction());
|
||||
if (event.getX() == -1469.6875 && event.getY() == 530.0) { //向左变道
|
||||
// ToastUtils.showShort("← 向左变道");
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneLeft();
|
||||
|
||||
return true;
|
||||
} else if (event.getX() == -1096.25 && event.getY() == 132.5) { //鸣笛
|
||||
// ToastUtils.showShort("↑ 鸣笛 ");
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
|
||||
|
||||
if (timerHorn == null) {
|
||||
timerHorn = new Timer();
|
||||
}
|
||||
timerHorn.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(2);
|
||||
timerHorn = null;
|
||||
}
|
||||
}, 500);
|
||||
|
||||
return true;
|
||||
} else if (event.getX() == -863.4375 && event.getY() == 690.0) { //向右变道
|
||||
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
|
||||
// ToastUtils.showShort("→ 向右变道");
|
||||
return true;
|
||||
} else if (event.getX() == -1096.25 && event.getY() == 1099.0) { // -1减速
|
||||
sendAcc(true, -1);
|
||||
// ToastUtils.showShort("↓ 减速 -1 ");
|
||||
|
||||
return true;
|
||||
} else if (event.getX() == -1096.25 && event.getY() == 690.0) { //复原
|
||||
// ToastUtils.showShort("O 复原 ");
|
||||
sendAcc(false, 0.0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.dispatchTouchEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSkinModeChange(int skinMode) {
|
||||
if (skinMode == 0) {
|
||||
BarUtils.setStatusBarLightMode(this, false);
|
||||
} else {
|
||||
BarUtils.setStatusBarLightMode(this, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private synchronized void sendAcc(boolean isSend, double acc) {
|
||||
@@ -445,10 +380,9 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
/**
|
||||
* 查找蓝牙连接过的蓝牙设备
|
||||
*
|
||||
* @param bluetoothAdapter
|
||||
*/
|
||||
private void showBondedDevice(BluetoothAdapter bluetoothAdapter) {
|
||||
mAreadlyConnectedList.clear();
|
||||
// mAreadlyConnectedList.clear();
|
||||
Set<BluetoothDevice> deviceList = bluetoothAdapter.getBondedDevices();
|
||||
for (BluetoothDevice device : deviceList) {
|
||||
try {
|
||||
@@ -456,15 +390,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
Method isConnectedMethod = BluetoothDevice.class.getDeclaredMethod("isConnected", (Class[]) null);
|
||||
isConnectedMethod.setAccessible(true);
|
||||
boolean isConnected = (boolean) isConnectedMethod.invoke(device, (Object[]) null);
|
||||
// Log.e("liyz", "showBondedDevice Name:" + device.getName() + " Mac:" + device.getAddress() + "---isConnected = " + isConnected);
|
||||
mAreadlyConnectedList.add(device);
|
||||
if (device.getName().equals("JX-05")) { //后面魔戒可能不使用了
|
||||
SharedPrefsMgr.getInstance(getContext()).putString("BT_MAC", device.getAddress());
|
||||
}
|
||||
if (!isConnected) {
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
connectBluetooth(); //主动连接一次
|
||||
}, 4000L);
|
||||
// mAreadlyConnectedList.add(device);
|
||||
// Log.d("liyz", "-- device.getName() = " + device.getName()); //device.getAddress()
|
||||
if (device.getName().equals("MINI_KEYBOARD")) {
|
||||
SharedPrefsMgr.getInstance(getContext()).putString("BLUETOOTH", device.getName());
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
@@ -476,43 +405,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onAutoConnection(ConnectBluetoothEvent event) {
|
||||
// connectBluetooth();
|
||||
}
|
||||
|
||||
/**
|
||||
* 主动连接最近的一次连接
|
||||
*/
|
||||
private void connectBluetooth() {
|
||||
// Log.d("liyz", "connectBluetooth ----> size() = " + mAreadlyConnectedList.size());
|
||||
if (mAreadlyConnectedList.size() > 0) {
|
||||
try {
|
||||
Method method = BluetoothDevice.class.getMethod("createBond");
|
||||
String macAddress = SharedPrefsMgr.getInstance(getContext()).getString("BT_MAC");
|
||||
int pos = -1;
|
||||
for (int i = 0; i < mAreadlyConnectedList.size(); i++) {
|
||||
if (macAddress.equals(mAreadlyConnectedList.get(i).getAddress())) {
|
||||
pos = i;
|
||||
}
|
||||
}
|
||||
|
||||
// Log.d("liyz", "connectBluetooth macAddress = " + macAddress + "---pos = " + pos);
|
||||
if (mAreadlyConnectedList.size() > pos && (pos >= 0)) {
|
||||
method.invoke(mAreadlyConnectedList.get(pos));
|
||||
}
|
||||
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.elegant.utils.UiThreadHandler;
|
||||
import com.mogo.cloud.socket.SocketBuildConfig;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
@@ -56,6 +57,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
initCrashConfig();
|
||||
initLogConfig();
|
||||
initTipToast();
|
||||
AIAssist.getInstance(this);
|
||||
initModules();
|
||||
if (DebugConfig.isDebug()) {
|
||||
initKoom();
|
||||
|
||||
@@ -45,13 +45,11 @@ public class BluetoothMonitorReceiver extends BroadcastReceiver {
|
||||
|
||||
case BluetoothDevice.ACTION_ACL_CONNECTED:
|
||||
// Toast.makeText(context, "蓝牙设备已连接", Toast.LENGTH_SHORT).show();
|
||||
// Log.d("liyz", "蓝牙设备已连接 ----> ");
|
||||
// SharedPrefsMgr.getInstance(context).putBoolean("BLUETOOTH", true);
|
||||
break;
|
||||
|
||||
case BluetoothDevice.ACTION_ACL_DISCONNECTED:
|
||||
// SharedPrefsMgr.getInstance(context).putBoolean("BLUETOOTH", false);
|
||||
// Log.d("liyz", "蓝牙设备已断开 ----> ");
|
||||
// Toast.makeText(context, "蓝牙设备已断开", Toast.LENGTH_SHORT).show();
|
||||
EventBus.getDefault().post(new ConnectBluetoothEvent());
|
||||
break;
|
||||
|
||||
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 387 B |
|
After Width: | Height: | Size: 302 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 640 B |
|
After Width: | Height: | Size: 467 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 399 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="24px"/>
|
||||
<solid android:color="#1E3062" />
|
||||
</shape>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
@@ -8,7 +8,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/viewShowDebugView"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_width="@dimen/dp_400"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -50,10 +50,10 @@
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.takeover.TakeOverView
|
||||
android:id="@+id/clTakeOverView"
|
||||
android:visibility="gone"
|
||||
android:layout_width="@dimen/hmi_take_over_request_width"
|
||||
android:layout_height="@dimen/hmi_take_over_request_height"
|
||||
android:layout_marginTop="@dimen/hmi_take_over_request_m_top"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_check_title"
|
||||
app:layout_constraintTop_toBottomOf="@+id/v_second_group">
|
||||
|
||||
@@ -144,6 +145,32 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/sopLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_216"
|
||||
android:layout_marginTop="@dimen/dp_90"
|
||||
app:layout_constraintTop_toBottomOf="@id/checkLayout"
|
||||
app:layout_constraintLeft_toLeftOf="@id/checkLayout">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="150px"
|
||||
android:layout_height="150px"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/debug_icon_sop" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="42px"
|
||||
android:text="@string/debug_sop"
|
||||
android:textColor="@color/color_FFA7B6F0"
|
||||
android:textSize="32px"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_check_title"
|
||||
android:layout_width="84px"
|
||||
@@ -164,7 +191,7 @@
|
||||
android:layout_marginTop="94px"
|
||||
android:background="@color/color_FF2966EC"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/checkLayout" />
|
||||
app:layout_constraintTop_toBottomOf="@id/sopLayout" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSpeedTitle"
|
||||
@@ -177,45 +204,68 @@
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="42px"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/checkLayout" />
|
||||
app:layout_constraintTop_toBottomOf="@id/sopLayout" />
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/llSpeedPosition"
|
||||
android:layout_width="390px"
|
||||
<ImageView
|
||||
android:id="@+id/ivSpeedReduce"
|
||||
android:layout_width="105px"
|
||||
android:layout_height="140px"
|
||||
android:layout_marginStart="113px"
|
||||
android:layout_marginTop="40px"
|
||||
android:background="@drawable/pilot_speed_bg"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="horizontal"
|
||||
android:src="@drawable/icon_speed_reduce"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSpeedTitle">
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSpeedTitle"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/etInputSpeed"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="92px"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:gravity="center"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="80px"
|
||||
tools:ignore="SpeakableTextPresentCheck" />
|
||||
<TextView
|
||||
android:id="@+id/tvSpeed"
|
||||
android:layout_width="189px"
|
||||
android:layout_height="140px"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedReduce"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedReduce"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivSpeedReduce"
|
||||
android:background="#1E3062"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="80px"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="93px"
|
||||
android:layout_height="53px"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="28px"
|
||||
android:text="km/h"
|
||||
android:textColor="@color/color_B3FFFFFF"
|
||||
android:textSize="38px" />
|
||||
<ImageView
|
||||
android:id="@+id/ivSpeedAdd"
|
||||
android:layout_width="105px"
|
||||
android:layout_height="140px"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSpeed"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSpeed"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvSpeed"
|
||||
android:src="@drawable/icon_speed_add"
|
||||
/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
<TextView
|
||||
android:id="@+id/tvUnit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="km/h"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="38px"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivSpeedAdd"
|
||||
android:layout_marginStart="40px" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tvSureModify"
|
||||
android:layout_width="200px"
|
||||
android:layout_height="135px"
|
||||
android:background="@drawable/taxi_loginout_sure_bg"
|
||||
android:gravity="center"
|
||||
android:text="确定"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="42px"
|
||||
android:layout_marginLeft="50px"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSpeed"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSpeed"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvUnit"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAcceleration"
|
||||
@@ -226,7 +276,7 @@
|
||||
android:textColor="#A7B6F0"
|
||||
android:textSize="32px"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/llSpeedPosition" />
|
||||
app:layout_constraintTop_toBottomOf="@id/ivSpeedReduce" />
|
||||
|
||||
<View
|
||||
android:layout_width="14px"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.BatteryView
|
||||
android:id="@+id/viewBattery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivBatteryCharge"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_marginStart="@dimen/dp_6"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/battery_charge_light"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_54">
|
||||
|
||||
<ImageView
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/blue_tooth"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_54">
|
||||
|
||||
<ImageView
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/demo_mode"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,213 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_800"
|
||||
android:layout_height="@dimen/dp_1100"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!--绕障类功能-->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbObstacleAvoidance"
|
||||
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:textColor="#000"
|
||||
android:textOff="开启绕障类功能"
|
||||
android:textOn="关闭绕障类功能"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
<!--危险障碍物颜色标记-->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbMarkingObstacles"
|
||||
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:textColor="#000"
|
||||
android:textOff="开启「危险障碍物颜色标记」"
|
||||
android:textOn="关闭「危险障碍物颜色标记」"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbObstacleAvoidance"
|
||||
/>
|
||||
<!--引导线动态效果-->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbRouteDynamicEffect"
|
||||
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:textColor="#000"
|
||||
android:textOff="开启「引导线动态效果」"
|
||||
android:textOn="关闭「引导线动态效果」"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbMarkingObstacles"
|
||||
/>
|
||||
<!--红绿灯标识-->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbTrafficLight"
|
||||
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:textColor="#000"
|
||||
android:textOff="隐藏红绿灯标识"
|
||||
android:textOn="展示红绿灯标识"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbRouteDynamicEffect"
|
||||
/>
|
||||
<!--限速标识-->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbSpeedLimit"
|
||||
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:textColor="#000"
|
||||
android:textOff="展示限速标识"
|
||||
android:textOn="隐藏限速标识"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbTrafficLight"
|
||||
/>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbDemoMode"
|
||||
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:textColor="#000"
|
||||
android:textOff="开启美化模式"
|
||||
android:textOn="关闭美化模式"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbSpeedLimit"
|
||||
/>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbRainMode"
|
||||
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:textColor="#000"
|
||||
android:textOff="开启雨天模式"
|
||||
android:textOn="关闭雨天模式"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbDemoMode"
|
||||
/>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbObu"
|
||||
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:textColor="#000"
|
||||
android:textOff="关闭OBU"
|
||||
android:textOn="开启OBU"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbRainMode"
|
||||
/>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbIPCReport"
|
||||
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:textColor="#000"
|
||||
android:textOff="开启异常上报提示"
|
||||
android:textOn="关闭异常上报提示"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbObu"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSpeedThresholdTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbIPCReport"
|
||||
android:text="变道速度阈值:"
|
||||
android:textSize="18sp"
|
||||
android:textColor="#1A1A1A"
|
||||
android:layout_margin="10dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSpeedReduce"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvSpeedThresholdTitle"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSpeedThresholdTitle"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSpeedThresholdTitle"
|
||||
android:src="@drawable/icon_reduce"
|
||||
android:padding="10dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSpeed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedReduce"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedReduce"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivSpeedReduce"
|
||||
android:textSize="18sp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/debug_setting_edit_bg"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSpeedAdd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSpeed"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSpeed"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvSpeed"
|
||||
android:src="@drawable/icon_add"
|
||||
android:padding="10dp"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSpeedSet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivSpeedAdd"
|
||||
android:text="设置阈值"
|
||||
android:layout_marginStart="10dp"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:background="#F0F0F0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnSpeedSet"
|
||||
/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_72">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/viewStatusBarLeft"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_72"
|
||||
android:layout_alignParentStart="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextClock
|
||||
android:id="@+id/viewTextClock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:layout_marginStart="@dimen/dp_24"
|
||||
android:format12Hour="HH:mm"
|
||||
android:format24Hour="HH:mm"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_2C2E30"
|
||||
android:textSize="@dimen/dp_45"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/viewStatusBarTag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_27"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/status_bar_tag"
|
||||
android:textColor="@color/color_2C2E30"
|
||||
android:textSize="@dimen/dp_35" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_18" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/viewStatusBarRight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="@dimen/dp_44"
|
||||
android:gravity="end|center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -9,4 +9,6 @@
|
||||
<color name="acc_default_txt_color">#FF343C63</color>
|
||||
<color name="hmi_check_keyboard_input_field">#FF282F62</color>
|
||||
<color name="bus_autopilot_text_color_normal">#FFFFFF</color>
|
||||
<color name="color_2C2E30">#2C2E30</color>
|
||||
<color name="color_D4D8DC">#D4D8DC</color>
|
||||
</resources>
|
||||
@@ -18,6 +18,10 @@
|
||||
<color name="color_FF0006">#FF0006</color>
|
||||
<color name="color_0099dd">#0099dd</color>
|
||||
<color name="color_FFFFFF">#FFFFFF</color>
|
||||
<color name="color_2C2E30">#2C2E30</color>
|
||||
<color name="color_D4D8DC">#D4D8DC</color>
|
||||
<color name="color_27FFFFFF">#27FFFFFF</color>
|
||||
<color name="color_1E111111">#1E111111</color>
|
||||
|
||||
<color name="background_wtf">#FF999900</color>
|
||||
<color name="background_error">#FFCC0000</color>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<string name="check_vehicle_detection">车辆检测</string>
|
||||
<string name="debug_panel">调试面板</string>
|
||||
<string name="debug_panel_fb">录包设置</string>
|
||||
<string name="debug_sop">运营面板</string>
|
||||
<string name="check_vehicle_speed_setting">车速设置</string>
|
||||
<string name="bus_operation_title">账户信息</string>
|
||||
<string name="check_system_operation">系统运行</string>
|
||||
@@ -51,5 +52,5 @@
|
||||
<string name="modify_binding_car">是否修改车机绑定?</string>
|
||||
<string name="to_binding_car">是否绑定车机?</string>
|
||||
|
||||
|
||||
<string name="status_bar_tag">蘑菇星云</string>
|
||||
</resources>
|
||||
|
||||
@@ -59,9 +59,10 @@ object TrackerSourceHelper {
|
||||
}
|
||||
|
||||
// pnc预警
|
||||
val pncColor = WarningHelper.getPncColor(data.uuid.toString())
|
||||
if (pncColor.isNotBlank()) {
|
||||
color = pncColor
|
||||
WarningHelper.getPncColor(data.uuid.toString()){
|
||||
if (it.isNotBlank()) {
|
||||
color = it
|
||||
}
|
||||
}
|
||||
return color
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.mogo.eagle.core.function.map.identify
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.FOUNDATION
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.data.traffic.threatLevelColor
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84SatelliteTime
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.PlanningObject
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@@ -97,7 +98,6 @@ object WarningHelper {
|
||||
return
|
||||
}
|
||||
if (exist) {
|
||||
Log.i("EmArrow0926","obu color uuid : ${obuTrafficData.uuid}")
|
||||
obuWarningTrafficData[obuTrafficData.uuid!!] = obuTrafficData
|
||||
} else {
|
||||
obuWarningTrafficData.remove(obuTrafficData.uuid)
|
||||
@@ -111,30 +111,33 @@ object WarningHelper {
|
||||
return ""
|
||||
}
|
||||
|
||||
fun getPncColor(uuid: String): String {
|
||||
fun getPncColor(uuid: String, color:((String) -> Unit)) {
|
||||
if(!FunctionBuildConfig.isPNCWarning){
|
||||
color.invoke("")
|
||||
return
|
||||
}
|
||||
if (FunctionBuildConfig.isBeautyMode) {
|
||||
// 判断物体是否有预警信息
|
||||
if (pncWarningBeautyTrafficData.containsKey(uuid)) {
|
||||
val planningTrack = pncWarningBeautyTrafficData[uuid]
|
||||
if (planningTrack != null && !timeOut(planningTrack.time)) {
|
||||
Log.i("EmArrow0926","pnc color uuid : $uuid")
|
||||
return planningTrack.color
|
||||
color.invoke(planningTrack.color)
|
||||
} else {
|
||||
pncWarningBeautyTrafficData.remove(uuid)
|
||||
}
|
||||
}
|
||||
return ""
|
||||
color.invoke("")
|
||||
} else {
|
||||
// 判断物体是否有预警信息
|
||||
if (pncWarningOriginTrafficData.containsKey(uuid)) {
|
||||
val planningTrack = pncWarningOriginTrafficData[uuid]
|
||||
if (planningTrack != null && !timeOut(planningTrack.time)) {
|
||||
return planningTrack.color
|
||||
color.invoke(planningTrack.color)
|
||||
} else {
|
||||
pncWarningOriginTrafficData.remove(uuid)
|
||||
}
|
||||
}
|
||||
return ""
|
||||
color.invoke("")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -38,6 +39,7 @@ public class SmallMapFragment extends BaseFragment
|
||||
IMoGoAutopilotStatusListener {
|
||||
private final String TAG = "SmallMapFragment";
|
||||
protected SmallMapDirectionView mSmallMapDirectionView;
|
||||
private int autoPilotStatus = 0;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
@@ -139,9 +141,13 @@ public class SmallMapFragment extends BaseFragment
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
if (autoPilotStatusInfo.getPilotmode() != 1) {
|
||||
int tempStatus = autoPilotStatusInfo.getPilotmode();
|
||||
if (tempStatus != 1) {
|
||||
clearPolyline();
|
||||
}else if (tempStatus == 1 && autoPilotStatus == 0){
|
||||
CallerAutoPilotManager.INSTANCE.getGlobalPath();
|
||||
}
|
||||
autoPilotStatus = tempStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,7 +55,7 @@ class PushViewModel(
|
||||
VOICE_ACTION_PUSH_MAIN -> {
|
||||
AnalyticsUtils.track(Config.NEWS_CARD_CLICK, "trigger_type", isClick)
|
||||
if (isClick == "2") {
|
||||
mVoiceClient.speakTTSVoice("好的", voiceCmdCallback)
|
||||
mVoiceClient.speakTTSVoiceWithLevel("好的",AIAssist.LEVEL1, voiceCmdCallback)
|
||||
}
|
||||
if (it.mainSchema.isNotEmpty()) {
|
||||
dealSchema(it.mainSchema, mContext)
|
||||
@@ -71,7 +71,7 @@ class PushViewModel(
|
||||
isClick, "btn_text", it.buttons[0].text
|
||||
)
|
||||
if (isClick == "2") {
|
||||
mVoiceClient.speakTTSVoice("好的", voiceCmdCallback)
|
||||
mVoiceClient.speakTTSVoiceWithLevel("好的", AIAssist.LEVEL1,voiceCmdCallback)
|
||||
}
|
||||
if (it.buttons[0].action.isNotEmpty()) {
|
||||
dealSchema(it.buttons[0].action, mContext)
|
||||
@@ -87,7 +87,7 @@ class PushViewModel(
|
||||
isClick, "btn_text", it.buttons[1].text
|
||||
)
|
||||
if (isClick == "2") {
|
||||
mVoiceClient.speakTTSVoice("好的", voiceCmdCallback)
|
||||
mVoiceClient.speakTTSVoiceWithLevel("好的",AIAssist.LEVEL1 ,voiceCmdCallback)
|
||||
}
|
||||
if (it.buttons[1].action.isNotEmpty()) {
|
||||
dealSchema(it.buttons[1].action, mContext)
|
||||
@@ -100,7 +100,7 @@ class PushViewModel(
|
||||
isClick
|
||||
)
|
||||
if (isClick == "2") {
|
||||
mVoiceClient.speakTTSVoice("好的", voiceCmdCallback)
|
||||
mVoiceClient.speakTTSVoiceWithLevel("好的",AIAssist.LEVEL1, voiceCmdCallback)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ class PushViewModel(
|
||||
}
|
||||
|
||||
fun speakDefault(voice: String) {
|
||||
mVoiceClient.speakTTSVoice(voice, voiceCmdCallback)
|
||||
mVoiceClient.speakTTSVoiceWithLevel(voice,AIAssist.LEVEL3 ,voiceCmdCallback)
|
||||
}
|
||||
|
||||
fun pauseAnimator(on: Boolean) {
|
||||
|
||||
@@ -54,5 +54,12 @@ class MoGoObuProvider : IMoGoObuProvider {
|
||||
|
||||
}
|
||||
|
||||
override fun disConnect() {
|
||||
MogoPrivateObuManager.INSTANCE.disConnectObu()
|
||||
}
|
||||
|
||||
override fun isConnected(): Boolean {
|
||||
return MogoPrivateObuManager.INSTANCE.isConnected()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -77,6 +77,19 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
fun disConnectObu(){
|
||||
try {
|
||||
MogoObuManager.getInstance().disConnect()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun isConnected(): Boolean{
|
||||
return MogoObuManager.getInstance().isConnected
|
||||
}
|
||||
|
||||
private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() {
|
||||
// OBU连接成功
|
||||
override fun onConnected() {
|
||||
|
||||
@@ -329,69 +329,42 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
|
||||
private fun refreshCarState(location: MogoLocation) {
|
||||
V2XStatusManager.getInstance().location = location
|
||||
// V2XAiRoadEventMarker.onLocationChanged(location)
|
||||
// 只有车速大于 5 的时候进行计算
|
||||
if (location.speed < 5) return
|
||||
val v2xPolyline = BridgeApi.v2xPolyline()?.mogoPolyline
|
||||
val isRoadEventPOIShow = BridgeApi.v2xStatus()?.isRoadEventPOIShow ?: false
|
||||
val isOtherSeekHelpPOIShow = BridgeApi.v2xStatus()?.isOtherSeekHelpPOIShow ?: false
|
||||
val v2xStatusManager = V2XStatusManager.getInstance()
|
||||
if (v2xPolyline != null && (isRoadEventPOIShow or isOtherSeekHelpPOIShow) && v2xStatusManager.targetMoGoLatLng != null) { // 取出原有的绘制线的经纬度点
|
||||
if (v2xPolyline != null && (isRoadEventPOIShow) && v2xStatusManager.targetMoGoLatLng != null) { // 取出原有的绘制线的经纬度点
|
||||
// 取出原有的绘制线的经纬度点
|
||||
val pointsOdl: MutableList<MogoLatLng> = v2xPolyline.points // 重新设置第一个坐标,也就是当前车辆位置
|
||||
// 重新设置第一个坐标,也就是当前车辆位置
|
||||
pointsOdl[0] = MogoLatLng(location.latitude, location.longitude)
|
||||
v2xPolyline.points = pointsOdl
|
||||
|
||||
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
|
||||
val zoomLevel: Float = CallerMapUIServiceManager.getMapUIController()?.zoomLevel ?: 0.0f
|
||||
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
|
||||
if (zoomLevel > 0 && zoomLevel <= 17 && BridgeApi.v2xStatus()?.isRoadEventWindowShow == false) { // 缩放地图
|
||||
if (zoomLevel > 0 && zoomLevel <= 17) { // 缩放地图
|
||||
val context: Context = context()
|
||||
MapUtils.zoomMap(v2xStatusManager.targetMoGoLatLng, context)
|
||||
}
|
||||
}
|
||||
|
||||
// if (DebugConfig.isMapBased()) { // 只有自研车机才有疲劳驾驶检测
|
||||
// // 只有自研车机才有疲劳驾驶检测
|
||||
// if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
// V2XAlarmServer.getFatigueDrivingShow(location) { drivingShowEntity ->
|
||||
// CallerLogger.i("$M_V2X$TAG", "疲劳驾驶POI查询结果为: " + GsonUtil.jsonFromObject(drivingShowEntity))
|
||||
// val style = if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) "1" else "2"
|
||||
// com.mogo.module.v2x.listener.V2XLocationListener.trackWithType(ALERT_FATIGUE_DRIVING.poiType, drivingShowEntity.getLon(), drivingShowEntity.getLat(), style)
|
||||
// val v2XMessageEntity = V2XMessageEntity<V2XPushMessageEntity>()
|
||||
// v2XMessageEntity.type = V2XTypeEnum.ALERT_FATIGUE_DRIVING
|
||||
// v2XMessageEntity.setContent(drivingShowEntity)
|
||||
// v2XMessageEntity.isShowState = drivingShowEntity.isShowWindow() // 广播给ADAS Launcher
|
||||
// ADASUtils.broadcastToADAS(context(), drivingShowEntity)
|
||||
// V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// 巡航处理
|
||||
val v2XRoadEventEntity = V2XAlarmServer.getDriveFrontAlarmEvent(
|
||||
BridgeApi.v2xMarker()?.v2XRoadEventEntityList,
|
||||
V2XStatusManager.getInstance().location
|
||||
) // 距离是否大于10米 && 消息是否不为空
|
||||
// 距离是否大于10米 && 消息是否不为空
|
||||
if (v2XRoadEventEntity != null && v2XRoadEventEntity.distance >= 5) { // CallerLogger.w("$M_V2X$TAG",
|
||||
// //"\nV2X预警--当前导航状态:" + V2XServiceManager.getNavi().isNaviing() +
|
||||
// //"\nV2X预警--roadEventIsNullCount:" + roadEventIsNullCount +
|
||||
// "\nV2X预警--当前预警事件:" + v2XRoadEventEntity
|
||||
// );
|
||||
// CallerLogger.w("$M_V2X$TAG", "V2X预警--前方数据距离:" + v2XRoadEventEntity.getDistance());
|
||||
// 触发展示操作
|
||||
TrackUtils.trackV2xRoadProduceEvent(1)
|
||||
val v2XMessageEntity = V2XMessageEntity<V2XRoadEventEntity>()
|
||||
v2XMessageEntity.type = V2XTypeEnum.ALERT_ROAD_WARNING
|
||||
v2XMessageEntity.content = v2XRoadEventEntity
|
||||
v2XMessageEntity.isShowState = true
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity)
|
||||
|
||||
// 存储本地,出行动态作展示
|
||||
saveLocalStory(V2XTypeEnum.ALERT_ROAD_WARNING, v2XRoadEventEntity.noveltyInfo)
|
||||
|
||||
)
|
||||
if (v2XRoadEventEntity != null) { // CallerLogger.w("$M_V2X$TAG",
|
||||
val distance = v2XRoadEventEntity.distance
|
||||
val min = if (EventTypeEnum.AI_ROAD_WORK.poiType == v2XRoadEventEntity.poiType) 0 else 5
|
||||
Logger.d(TAG, "--- trigger show before ---:data=>[${location.longitude}, ${location.latitude}, ${location.speed}], distance: $distance, minDistance: $min, poiType: ${v2XRoadEventEntity.poiType}")
|
||||
if (distance >= min) {
|
||||
Logger.d(TAG, "--- trigger show ---:poiType:" + v2XRoadEventEntity.poiType)
|
||||
TrackUtils.trackV2xRoadProduceEvent(1)
|
||||
val v2XMessageEntity = V2XMessageEntity<V2XRoadEventEntity>()
|
||||
v2XMessageEntity.type = V2XTypeEnum.ALERT_ROAD_WARNING
|
||||
v2XMessageEntity.content = v2XRoadEventEntity
|
||||
v2XMessageEntity.isShowState = true
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,11 +480,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
|
||||
private fun handleRoadMarkerEvent(data: V2XMarkerCardResult) {
|
||||
try {
|
||||
BridgeApi.v2xStatus()?.let {
|
||||
if (it.isRoadEventWindowShow) {
|
||||
return
|
||||
}
|
||||
}
|
||||
scope.launch(Dispatchers.Default) {
|
||||
BridgeApi.v2xMarker()?.analysisV2XRoadEvent(data)
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.alarm;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.DrivingDirectionUtils;
|
||||
import com.mogo.eagle.core.utilcode.constant.TimeConstants;
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import io.netty.util.internal.ConcurrentSet;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
@@ -29,11 +24,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
public class V2XAlarmServer {
|
||||
|
||||
// 记录道路播报的事件
|
||||
public static ConcurrentHashMap<V2XRoadEventEntity, String> mAlertRoadEventList = new ConcurrentHashMap<>();
|
||||
|
||||
// 记录违章停车播报事件
|
||||
private static final HashMap<MarkerExploreWay, String> mAlertIllegalParkEventList = new HashMap<>();
|
||||
|
||||
private static ConcurrentSet<V2XRoadEventEntity> showedEvents = new ConcurrentSet<>();
|
||||
/**
|
||||
* 获取当前车辆前方距离最近的道路事件
|
||||
*/
|
||||
@@ -41,9 +32,22 @@ public class V2XAlarmServer {
|
||||
CopyOnWriteArrayList<V2XRoadEventEntity> v2XRoadEventEntityList,
|
||||
MogoLocation currentLocation) {
|
||||
try {
|
||||
// 检测道路事件是否需UGC问答
|
||||
V2XEarlyWarningServer.roadEventUgcCheck(currentLocation);
|
||||
// 60(km/h)
|
||||
if (!showedEvents.isEmpty()) {
|
||||
Iterator<V2XRoadEventEntity> iterator = showedEvents.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
V2XRoadEventEntity next = iterator.next();
|
||||
if (next == null) {
|
||||
continue;
|
||||
}
|
||||
MarkerLocation poiLocation = next.getLocation();
|
||||
if (poiLocation == null) {
|
||||
continue;
|
||||
}
|
||||
if (isOutOfRange(poiLocation.getLon(), poiLocation.getLat(), currentLocation.getLongitude(), currentLocation.getLatitude(), currentLocation.getBearing())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentLocation != null && v2XRoadEventEntityList != null) {
|
||||
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
|
||||
for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) {
|
||||
@@ -73,71 +77,14 @@ public class V2XAlarmServer {
|
||||
(int) currentLocation.getBearing()
|
||||
);
|
||||
if (0 <= eventAngle && eventAngle <= 20) {
|
||||
// 判断是否已经提示过道路事件
|
||||
boolean isAlreadyAlert = false;
|
||||
String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity);
|
||||
if (!TextUtils.isEmpty(lastTime)) {
|
||||
long timeSpan = Math.abs(TimeUtils.getTimeSpanByNow(lastTime, TimeConstants.MIN));
|
||||
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer",
|
||||
// "V2X预警--事件ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
// "\n上一次预警时间:" + lastTime +
|
||||
// "\n距离当前时间:" + timeSpan);
|
||||
// 5分钟内不重复提醒
|
||||
if (timeSpan < 5) {
|
||||
isAlreadyAlert = true;
|
||||
}
|
||||
if (showedEvents.contains(v2XRoadEventEntity)) {
|
||||
return null;
|
||||
}
|
||||
// 进行提醒
|
||||
if (!isAlreadyAlert) {
|
||||
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--车辆与事件信息:" +
|
||||
// "\n事件详情ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
// "\n事件详情:" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo()) +
|
||||
// "\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
|
||||
// "\n是否已经提醒:" + isAlreadyAlert +
|
||||
// "\n当前车辆-经度:" + currentLocation.getLongitude() +
|
||||
// "\n当前车辆-经度:" + currentLocation.getLatitude() +
|
||||
// "\n当前车辆-角度:" + currentLocation.getBearing() +
|
||||
// "\n道路事件-经度:" + eventLocation.getLon() +
|
||||
// "\n道路事件-经度:" + eventLocation.getLat() +
|
||||
// "\n道路事件-角度:" + eventLocation.getAngle() +
|
||||
// "\n夹角角度:" + eventAngle + " 度"
|
||||
// );
|
||||
mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
|
||||
return v2XRoadEventEntity;
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--事件与车头角度夹角过大:" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
// "\n当前车辆-经度:" + currentLocation.getLongitude() +
|
||||
// "\n当前车辆-经度:" + currentLocation.getLatitude() +
|
||||
// "\n当前车辆-角度:" + currentLocation.getBearing() +
|
||||
// "\n道路事件-经度:" + eventLocation.getLon() +
|
||||
// "\n道路事件-经度:" + eventLocation.getLat() +
|
||||
// "\n道路事件-角度:" + eventLocation.getAngle() +
|
||||
// "\n夹角角度:" + eventAngle + " 度"
|
||||
// );
|
||||
showedEvents.add(v2XRoadEventEntity);
|
||||
return v2XRoadEventEntity;
|
||||
}
|
||||
} else {
|
||||
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer",
|
||||
// "V2X预警--车头方向与事件方向角度不一致:" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
// "\n车头方向: " + carBearing +
|
||||
// "\n事件方向:" + eventBearing +
|
||||
// "\n角度差值:" + diffAngle
|
||||
// );
|
||||
}
|
||||
} else {
|
||||
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--车辆距离事件距离大于500米了:" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
// "\n距离:" + v2XRoadEventEntity.getDistance() + "米"
|
||||
// );
|
||||
}
|
||||
} else {
|
||||
// CallerLogger.INSTANCE.e(M_V2X + "V2XAlarmServer",
|
||||
// "V2X预警--道路事件没有角度信息" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
|
||||
// );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,4 +94,14 @@ public class V2XAlarmServer {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private static boolean isOutOfRange(double poi_lon, double poi_lat, double car_lon, double car_lat, double car_angle) {
|
||||
return !isFrontOfCar(poi_lon, poi_lat, car_lon, car_lat, car_angle);
|
||||
}
|
||||
|
||||
private static boolean isFrontOfCar(double poi_lon, double poi_lat, double car_lon, double car_lat, double car_angle) {
|
||||
double degree = DrivingDirectionUtils.getDegreeOfCar2Poi(car_lon, car_lat, poi_lon, poi_lat, (int)car_angle);
|
||||
return degree <= 90;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.alarm;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.DrivingDirectionUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* V2X 道路预警服务
|
||||
*/
|
||||
public class V2XEarlyWarningServer {
|
||||
private static final String TAG = "V2XEarlyWarningServer";
|
||||
|
||||
private static ArrayList<String> alertMessageId = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 对提醒过的道路事件进行UGC检测
|
||||
*
|
||||
* @param currentLocation 当前车辆位置
|
||||
*/
|
||||
public static void roadEventUgcCheck(MogoLocation currentLocation) {
|
||||
|
||||
try {
|
||||
if (currentLocation != null) {
|
||||
// 循环已经播报的道路事件,将刚行驶过的道路事件进行弹窗交互,进行UGC问答,
|
||||
Set<V2XRoadEventEntity> keySet = V2XAlarmServer.mAlertRoadEventList.keySet();
|
||||
for (V2XRoadEventEntity v2XRoadEventEntity : keySet) {
|
||||
// 计算车辆距离指定气泡的距离
|
||||
MarkerLocation eventLocation = v2XRoadEventEntity.getLocation();
|
||||
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
currentLocation.getLongitude(),
|
||||
currentLocation.getLatitude(),
|
||||
eventLocation.getLon(),
|
||||
eventLocation.getLat(),
|
||||
(int) currentLocation.getBearing()
|
||||
);
|
||||
|
||||
double carBearing = currentLocation.getBearing();
|
||||
String roadInfoId = v2XRoadEventEntity.getNoveltyInfo().getInfoId();
|
||||
|
||||
// 封路、施工、拥堵、拥堵 才会有UGC提示
|
||||
if (EventTypeEnum.isNeedRoadEventUgc(v2XRoadEventEntity.getPoiType())) {
|
||||
// CallerLogger.INSTANCE.d(M_V2X + TAG,
|
||||
// "V2X预警--UGC检测:" +
|
||||
// "\n事件详情:" + roadInfoId +
|
||||
// "\n事件详情:" + EventTypeUtils.getPoiTypeStr(v2XRoadEventEntity.getPoiType()) +
|
||||
// "\n车头方向: " + carBearing +
|
||||
// "\n车与事件夹角:" + eventAngle +
|
||||
// "\n已经UGC的事件:" + GsonUtil.jsonFromObject(alertMessageId)
|
||||
// );
|
||||
// 判断是否预警过了
|
||||
if (!alertMessageId.contains(roadInfoId)) {
|
||||
// 判断车辆行驶角度是否与事件相反,相反的话表示已经行驶过去了
|
||||
if (80 <= eventAngle) {
|
||||
// CallerLogger.INSTANCE.d(M_V2X + TAG, "V2X预警UGC--事件与车头角度夹角过大:" +
|
||||
// "\n角度:" + eventAngle + " 度" +
|
||||
// "\n事件详情:" + roadInfoId +
|
||||
// "\n库存事件:" + V2XAlarmServer.mAlertRoadEventList.size()
|
||||
// );
|
||||
|
||||
// 记录已经 UGC 提醒过的数据
|
||||
alertMessageId.add(roadInfoId);
|
||||
|
||||
// 加载数据源
|
||||
V2XMessageEntity<V2XRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2XRoadEventEntity);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
// 弹出UGC
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
|
||||
LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent);
|
||||
|
||||
}
|
||||
// 移出已经预警的事件列表
|
||||
//V2XAlarmServer.mAlertRoadEventList.remove(v2XRoadEventEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,26 +15,6 @@ public interface IMoGoV2XStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isRoadEventPOIShow();
|
||||
|
||||
/**
|
||||
* 按钮区 V2X道路预警 是否在展示
|
||||
*/
|
||||
boolean isRoadEventButtonShow();
|
||||
|
||||
/**
|
||||
* 头部 V2X道路预警 UI 是否在展示
|
||||
*/
|
||||
boolean isRoadEventWindowShow();
|
||||
|
||||
/**
|
||||
* 头部 他人车辆故障求助 UI 是否在展示
|
||||
*/
|
||||
boolean isOtherSeekHelpWindowShow();
|
||||
|
||||
/**
|
||||
* 地图区域 他人车辆故障求助POI 是否在展示
|
||||
*/
|
||||
boolean isOtherSeekHelpPOIShow();
|
||||
|
||||
/**
|
||||
* 设置 V2X道路预警POI 是否在展示
|
||||
*
|
||||
@@ -43,67 +23,6 @@ public interface IMoGoV2XStatusManager extends IProvider {
|
||||
*/
|
||||
void setRoadEventPOIShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 V2X道路预警 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setRoadEventButtonShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 右侧2/3 头部 V2X道路预警 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setRoadEventWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 右侧2/3 头部 V2X的道路直播 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setRoadLiveCarWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 他人车辆故障求助 UI 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setOtherSeekHelpWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 右侧2/3 全屏 V2X 场景动画 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setV2XAnimationWindowShow(String tag, boolean show);
|
||||
|
||||
/*
|
||||
* 道路事件图片/视频资源 全屏
|
||||
* */
|
||||
void setV2XRoadVideoWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 模拟直播车机 UI 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setLiveCarWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 推送弹窗的状态
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setPushWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 地图区域 推送的 POI 是否在展示
|
||||
*
|
||||
@@ -112,11 +31,4 @@ public interface IMoGoV2XStatusManager extends IProvider {
|
||||
*/
|
||||
void setPushPOIShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 地图区域 疲劳驾驶 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setFatigueDrivingWindowShow(String tag, boolean show);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
private static final CopyOnWriteArraySet<V2XRoadEventEntity> mV2XRoadEventEntityArrayList = new CopyOnWriteArraySet<>();
|
||||
// 上次的道路事件的预警Marker
|
||||
private static IMogoMarker mAlarmInfoMarker;
|
||||
private static IMogoMarker m3DMarker;
|
||||
|
||||
@Override
|
||||
public void drawableLastAllPOI() {
|
||||
@@ -81,7 +80,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
CopyOnWriteArrayList<V2XRoadEventEntity> roadEventEntities = new CopyOnWriteArrayList<>();
|
||||
// 当前车辆数据
|
||||
MogoLocation currentLocation = V2XStatusManager.getInstance().getLocation();
|
||||
|
||||
if (currentLocation != null) {
|
||||
// 重新计算距离
|
||||
for (V2XRoadEventEntity v2XRoadEventEntity : mV2XRoadEventEntityArrayList) {
|
||||
@@ -96,7 +94,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
}
|
||||
roadEventEntities.add(v2XRoadEventEntity);
|
||||
}
|
||||
|
||||
// 按照与当前车辆距离排序
|
||||
for (int i = 0; i < roadEventEntities.size(); i++) {
|
||||
for (int j = i; j > 0; j--) {
|
||||
@@ -107,37 +104,17 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
//输出日志查看结果
|
||||
// for (int i = 0; i < roadEventEntities.size(); i++) {
|
||||
// CallerLogger.INSTANCE.w(M_V2X + TAG, "V2X===" +
|
||||
// "事件名称:" + roadEventEntities.get(i).getNoveltyInfo() +
|
||||
// "\t 事件距离:" + roadEventEntities.get(i).getDistance());
|
||||
// }
|
||||
}
|
||||
|
||||
return roadEventEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void analysisV2XRoadEvent(V2XMarkerCardResult markerCardResult) {
|
||||
boolean isShowEventWindow = false;
|
||||
boolean isShowEventButton = false;
|
||||
boolean isOtherSeekHelpWindowShow = false;
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
//预警Window状态
|
||||
isShowEventWindow = v2xStatus.isRoadEventWindowShow();
|
||||
//预警按钮状态
|
||||
isShowEventButton = v2xStatus.isRoadEventButtonShow();
|
||||
//道路求助的window
|
||||
isOtherSeekHelpWindowShow = v2xStatus.isOtherSeekHelpWindowShow();
|
||||
}
|
||||
try {
|
||||
//当没有预警提示的时候重新绘制地图POI点
|
||||
if (markerCardResult != null && !isShowEventWindow && !isShowEventButton && !isOtherSeekHelpWindowShow) {
|
||||
if (markerCardResult != null) {
|
||||
// 清除上次的道路事件, 这里注意,道路事件的触发和这里是异步操作会触发异常
|
||||
mV2XRoadEventEntityArrayList.clear();
|
||||
|
||||
// 获取探路以及新鲜事儿
|
||||
List<V2XMarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
if (exploreWayList != null) {
|
||||
@@ -149,7 +126,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
v2XRoadEventEntity.setLocation(EntityUtilsKt.toMarkerLocation(markerLocation));
|
||||
// 探路目前只有上报拥堵
|
||||
String poi = markerExploreWay.getPoiType();
|
||||
|
||||
v2XRoadEventEntity.setPoiType(poi);
|
||||
v2XRoadEventEntity.setNoveltyInfo(EntityUtilsKt.toMarkExploreWay(markerExploreWay,markerCardResult.getExtras()));
|
||||
v2XRoadEventEntity.setExpireTime(20000);
|
||||
|
||||