Merge branch 'dev_arch_opt_3.0' into 'dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0'

Dev arch opt 3.0

See merge request zhjt/AndroidApp/MoGoEagleEye!581
This commit is contained in:
wangmingjun
2023-02-21 12:41:05 +00:00
52 changed files with 611 additions and 601 deletions

View File

@@ -60,8 +60,8 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
leftView?.setOnClickListener {
when {
isConfirm -> {
cacheHDOfflineData()
showNewContent(isLoading = true, false)
cacheHDOfflineData()
}
else -> {
dismiss()
@@ -72,6 +72,7 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
rightView?.setOnClickListener {
when {
isRetry -> {
showNewContent(isLoading = true, false)
cacheHDOfflineData()
}
else -> {
@@ -81,6 +82,9 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
}
okView?.setOnClickListener {
if (isLoading) {
CallerMapUIServiceManager.cancelDownloadCacheData()
}
dismiss()
}
}
@@ -90,6 +94,12 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
updateProgress(progress.toInt())
}
override fun onMapHdCacheResult(cityId: Int, state: Int) {
if (state == 0) {// 失败
showNewContent(isLoading = false, false)
}
}
})
}
@@ -131,6 +141,7 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
@SuppressLint("UseCompatLoadingForDrawables")
private fun showNewContent(isLoading: Boolean, isSuccess: Boolean) {
this.isLoading = isLoading
change2NewStyle()
when {
isLoading -> {
@@ -150,11 +161,14 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
downloadResultImg?.background = ContextCompat.getDrawable(context, R.drawable.download_success_icon)
}
else -> {
isRetry = true
isConfirm = false
offlineTitleView?.text = context.resources.getString(R.string.offline_download_failure)
okView?.visibility = View.GONE
progressBar?.visibility = View.GONE
downloadPercentView?.visibility = View.GONE
leftView?.visibility = View.VISIBLE
leftView?.text = context.resources.getString(R.string.ok_tip)
rightView?.visibility = View.VISIBLE
vertLineView?.visibility = View.VISIBLE
rightView?.text = context.resources.getString(R.string.retry)

View File

@@ -672,11 +672,6 @@ internal class DebugSettingView @JvmOverloads constructor(
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = isChecked
}
//TODO
tbIsDrawPath.setOnCheckedChangeListener { _, isChecked ->
}
// 初始化 GSP数据源 数据
rgGpsProvider.check(
when (FunctionBuildConfig.gpsProvider) {

View File

@@ -117,7 +117,6 @@ internal class SOPSettingView @JvmOverloads constructor(
tbObuToDcView.setOnCheckedChangeListener { _, isChecked ->
// 默认开启
HmiBuildConfig.isShowObuToDcV2iView = !isChecked
// Log.d("liyz", "HmiBuildConfig.isShowObuToDcV2iView = " + HmiBuildConfig.isShowObuToDcV2iView)
}
//红绿灯标识

View File

@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_START_UP;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_INIT;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_F;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
@@ -21,20 +20,15 @@ import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.intent.IMogoIntentListener;
import com.mogo.commons.module.intent.IntentManager;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.mofang.MfConstants;
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.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.mofang.CallerMofangListenerManager;
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
import com.mogo.eagle.core.function.hmi.R;
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.ActivityUtils;
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.rousetime.android_startup.model.CostTimesModel;
import com.zhjt.service.chain.ChainLog;
import com.zhjt.service.chain.TracingConstants;
@@ -43,8 +37,6 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
/**
* 针对作为Launcher的情况做个性化操作
@@ -57,31 +49,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
private final static Handler handlerV2XEvent = new Handler();
private static Runnable runnableV2XEvent;
private volatile double accelerated;//加速度
private Timer timerHorn;
private Timer timerAcc;
private boolean isShowToast = false; //toast 控制
private long startPressTime = 0; //开始按减时间
private boolean isPressEnd = false; //按键是否结束
private volatile int isCombinationKey = 0; //是否是组合按键 1单击2长按3组合
private long pressADownTime = 0;
private long pressAUpTime = 0;
private long pressBDownTime = 0;
private long pressBUpTime = 0;
private long pressCDownTime = 0;
private long pressCUpTime = 0;
private long pressDDownTime = 0;
private long pressDUpTime = 0;
private long pressEDownTime = 0;
private long pressEUpTime = 0;
private int clickTime = 300; //单击
private int clickTimeInterval = 330;
private int longPressTime = 670;
private int longPressTimeInterval = 700;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -240,200 +207,15 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
*/
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
String bluetoothName = SharedPrefsMgr.getInstance(getContext()).getString(MfConstants.BLUETOOTH_NAME);
if (!isPressEnd) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---1--- bluetoothName = " + bluetoothName);
if(CallerMofangListenerManager.INSTANCE.invokeMofangHandle(event.getKeyCode(), event.getAction())) {
return true;
} else {
return super.dispatchKeyEvent(event);
}
if (bluetoothName.equals("MINI_KEYBOARD")) {
if (!isPressEnd) {
isPressEnd = true;
startPressTime = System.currentTimeMillis();
}
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---2--- bluetoothName = " + bluetoothName + "--- code = " + event.getKeyCode() + "--action = " + event.getAction());
if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击 -1长按无操作AB组合-2
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressADownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
if ((pressADownTime - startPressTime) > clickTimeInterval && (pressADownTime - startPressTime) < longPressTime && pressBDownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 A 按AB组合 +1 ");
}
sendAcc(true, +1);
isCombinationKey = 3;
}
if (isCombinationKey != 3 && isCombinationKey != 1) {
if ((pressADownTime - startPressTime) > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按A -2 ");
}
sendAcc(true, -2);
isCombinationKey = 2;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressAUpTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
if ((pressAUpTime - startPressTime) < clickTime && isCombinationKey != 3) {
isCombinationKey = 1;
if (isShowToast) {
ToastUtils.showShort("方块 单击A -1 ");
}
sendAcc(true, -1);
}
pressADownTime = 0;
isPressEnd = false;
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
isCombinationKey = 0;
}
}, 300);
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_B) { //单击复原,长按+1AB组合-2
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressBDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
if ((pressBDownTime - startPressTime) > clickTimeInterval && (pressBDownTime - startPressTime) < longPressTime && pressADownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 B 按AB组合 +1 ");
}
sendAcc(true, +1);
isCombinationKey = 3;
}
if (isCombinationKey != 3 && isCombinationKey != 1) {
if ((pressBDownTime - startPressTime) > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按B 无操作 ");
}
isCombinationKey = 2;
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressBUpTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
if ((pressBUpTime - startPressTime) < clickTime && isCombinationKey != 3) {
if (isShowToast) {
ToastUtils.showShort("方块 单击B 0 ");
}
sendAcc(false, 0.0);
isCombinationKey = 1;
}
pressBDownTime = 0;
isPressEnd = false;
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
isCombinationKey = 0;
}
}, 300);
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击左变道,长按无操作
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressCDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按C 无操作 time dif = " + (pressCDownTime - startPressTime));
if ((pressCDownTime - startPressTime) > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按C 无操作 ");
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressCUpTime = System.currentTimeMillis();
isPressEnd = false;
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击C ← 向左变道 time dif = " + (pressCUpTime - startPressTime));
if ((pressCUpTime - startPressTime) < clickTime) {
if (isShowToast) {
ToastUtils.showShort("方块 单击C ← 向左变道 ");
}
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneLeft();
}
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击向右变道,双击无操作
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressDDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按D 无操作 time dif = " + (pressDDownTime - startPressTime));
if ((pressDDownTime - startPressTime) > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按D 无操作 ");
}
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressDUpTime = System.currentTimeMillis();
isPressEnd = false;
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击D → 向右变道 time dif = " + (pressDUpTime - startPressTime));
if ((pressDUpTime - startPressTime) < clickTime) {
if (isShowToast) {
ToastUtils.showShort("方块 单击D → 向右变道 ");
}
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneRight();
}
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressEDownTime = System.currentTimeMillis();
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按E 鸣笛 time dif = " + (pressEDownTime - startPressTime));
if ((pressEDownTime - startPressTime) > longPressTimeInterval) {
if (isShowToast) {
ToastUtils.showShort("方块 长按E 鸣笛 ");
}
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(1);
if (timerHorn == null) {
timerHorn = new Timer();
}
timerHorn.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(2);
timerHorn = null;
}
}, 500);
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressEUpTime = System.currentTimeMillis();
isPressEnd = false;
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "方块 单击E 开启自动驾驶 time dif = " + (pressEUpTime - startPressTime));
if ((pressEUpTime - startPressTime) < clickTime) {
if (isShowToast) {
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
}
CallerAutoPilotControlManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
}
}
return true;
}
}
return super.dispatchKeyEvent(event);
}
@Override
public void onSkinModeChange(int skinMode) {
}
private synchronized void sendAcc(boolean isSend, double acc) {
if (isSend) {
accelerated = acc;
if (timerAcc == null) {
timerAcc = new Timer();
timerAcc.schedule(new TimerTask() {
@Override
public void run() {
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(accelerated);
}
}, 0, 500);
}
} else {
if (timerAcc != null) {
timerAcc.cancel();
timerAcc = null;
}
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(acc);
}
}
}