Merge branch 'dev_robotaxi-d-app-module_2130_221116_2.13.0' into mutidev_robotaxi-d-app-module_2130_221116_2.13.0_multi_display

# Conflicts:
#	core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java
This commit is contained in:
donghongyu
2022-12-08 11:00:21 +08:00
17 changed files with 172 additions and 140 deletions

View File

@@ -237,7 +237,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
if (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().autopilotControlParameters == null) {
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
context?.let {
CallerHmiManager.updateStatusBarRightView(
CallerHmiManager.updateStatusBarLeftView(
FunctionBuildConfig.isDemoMode,
"demoMode",
DemoModeView(it)
@@ -455,6 +455,10 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
statusBarView?.updateRightView(insert, tag, viewGroup)
}
override fun updateStatusBarLeftView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
statusBarView?.updateLeftView(insert, tag, viewGroup)
}
override fun updateStatusBarDownloadView(insert: Boolean, tag: String, progress: Int) {
statusBarView?.updateProgressView(insert, tag, progress)
}

View File

@@ -22,6 +22,9 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.layout_driver_msg_box_list.view.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
/**
* @author XuXinChao
@@ -186,6 +189,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
super.onAttachedToWindow()
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
CallerMsgBoxListenerManager.addListener(TAG,this)
EventBus.getDefault().register(this)
}
}
@@ -193,8 +197,16 @@ class DriverMsgBoxListView @JvmOverloads constructor(
super.onDetachedFromWindow()
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
CallerMsgBoxListenerManager.removeListener(TAG)
EventBus.getDefault().unregister(this)
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun notifyList(msgBoxList: MsgBoxBean){
badCaseList?.let {
it.remove(msgBoxList)
driverMsgBoxListAdapter?.notifyItemRemoved(it.indexOf(msgBoxList))
}
}
}

View File

@@ -2,9 +2,7 @@ package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter
import android.annotation.SuppressLint
import android.app.Activity
import android.util.Log
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
@@ -13,7 +11,6 @@ import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
@@ -24,7 +21,6 @@ import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTran
import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
import com.mogo.eagle.core.widget.RoundConstraintLayout
/**
* @author XuXinChao
@@ -79,7 +75,6 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
holder.tvBagReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBagRecordTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
val msgBoxBean = it[position]
// val recordBagMsg = (it[position].bean as RecordBagMsg)
holder.tvRecordCheck.setOnClickListener {
//打开被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,activity,false)

View File

@@ -586,7 +586,7 @@ class DebugSettingView @JvmOverloads constructor(
// 演示模式
tbIsDemoMode.setOnCheckedChangeListener { _, isChecked ->
CallerHmiManager.updateStatusBarRightView(isChecked, "demoMode", DemoModeView(context))
CallerHmiManager.updateStatusBarLeftView(isChecked, "demoMode", DemoModeView(context))
CallerAutoPilotManager.setDemoMode(isChecked)
if (!isChecked) {
//关闭美化模式时,通知工控机

View File

@@ -120,7 +120,7 @@ class SOPSettingView @JvmOverloads constructor(
tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode
// 演示模式
tbDemoMode.setOnCheckedChangeListener { _, isChecked ->
CallerHmiManager.updateStatusBarRightView(isChecked, "demoMode", DemoModeView(context))
CallerHmiManager.updateStatusBarLeftView(isChecked, "demoMode", DemoModeView(context))
CallerAutoPilotManager.setDemoMode(isChecked)
if (!isChecked) {
//关闭美化模式时,通知工控机

View File

@@ -2,12 +2,15 @@ package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.*
import android.widget.*
import com.mogo.eagle.core.data.mofang.MfConstants
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.call.devatools.*
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
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.*
@@ -29,6 +32,7 @@ class StatusBarView @JvmOverloads constructor(
}
private val rightViewList = CopyOnWriteArrayList<String>()
private val leftViewList = CopyOnWriteArrayList<String>()
override fun onAttachedToWindow() {
super.onAttachedToWindow()
@@ -39,6 +43,11 @@ class StatusBarView @JvmOverloads constructor(
// 添加换肤监听
CallerSkinModeListenerManager.addListener(TAG, this)
var isBluetoothConnect = SharedPrefsMgr.getInstance(context).getBoolean(MfConstants.BLUETOOTH_STATUS, false)
if (isBluetoothConnect) {
updateMfStatus("MoFangManager", true)
}
}
override fun onSkinModeChange(skinMode: Int) {
@@ -70,6 +79,20 @@ class StatusBarView @JvmOverloads constructor(
}
}
fun updateLeftView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
if (insert) {
leftViewList.add(0, tag)
viewStatusBarLeft.addView(viewGroup, 0)
} else {
leftViewList.forEachIndexed { index, s ->
if (s == tag) {
leftViewList.removeAt(index)
viewStatusBarLeft.removeViewAt(index)
}
}
}
}
fun updateProgressView(insert: Boolean, tag: String, progress: Int) {
if (insert) {
viewProgressTv.visibility = VISIBLE
@@ -81,9 +104,9 @@ class StatusBarView @JvmOverloads constructor(
fun updateMfStatus(tag: String, status: Boolean) {
if (status) {
// viewMofangStatus.setImageResource(R.drawable.icon_car_red)
viewMofangStatus.setImageResource(R.drawable.icon_bluetooth_p)
} else {
// viewMofangStatus.setImageResource(R.drawable.icon_car_red)
viewMofangStatus.setImageResource(R.drawable.blue_tooth)
}
}

View File

@@ -3,11 +3,9 @@ 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 android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
import android.os.Process;
@@ -17,11 +15,13 @@ import android.view.KeyEvent;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
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.CallerAutoPilotManager;
@@ -29,7 +29,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
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;
import com.mogo.eagle.core.function.main.utils.MultiDisplayUtils;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
@@ -43,9 +42,7 @@ import com.zhjt.service.chain.TracingConstants;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
@@ -66,8 +63,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
private Timer timerHorn;
private Timer timerAcc;
private BluetoothMonitorReceiver mBluetoothReceiver = null;
private BluetoothAdapter mBluetoothAdapter;
private boolean isShowToast = false; //toast 控制
private long startPressTime = 0; //开始按减时间
private boolean isPressEnd = false; //按键是否结束
@@ -94,14 +89,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
protected void onResume() {
super.onResume();
initBluetooth();
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (!mBluetoothAdapter.isEnabled()) {
mBluetoothAdapter.enable();
}
mBluetoothAdapter.startDiscovery();
showBondedDevice(mBluetoothAdapter);
}
@Override
@@ -129,7 +116,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
protected void onPause() {
super.onPause();
mIsHomeKeyDown = false;
unregisterReceiver(this.mBluetoothReceiver);
}
@Override
@@ -246,12 +232,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
*/
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// Log.d(TAG, "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
String bluetoothName = SharedPrefsMgr.getInstance(getContext()).getString("BLUETOOTH");
// CallerHmiManager.INSTANCE.updateMfStatusView("mofang", true);
// 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) {
Log.e(TAG, "dispatchKeyEvent bluetoothName = " + bluetoothName);
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent bluetoothName = " + bluetoothName);
}
if (bluetoothName.equals("MINI_KEYBOARD")) {
if (!isPressEnd) {
@@ -262,7 +246,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击 -1长按无操作AB组合-2
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressADownTime = System.currentTimeMillis();
Log.d(TAG, "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
if ((pressADownTime - startPressTime) > 320 && (pressADownTime - startPressTime) < 1300 && pressBDownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 A 按AB组合 -2 ");
@@ -281,7 +265,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressAUpTime = System.currentTimeMillis();
Log.e(TAG, "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
if ((pressAUpTime - startPressTime) < 300 && isCombinationKey != 3) {
isCombinationKey = 1;
if (isShowToast) {
@@ -298,12 +282,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
}
}, 300);
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_B) {//单击复原,长按+1AB组合-2
} else if (event.getKeyCode() == KeyEvent.KEYCODE_B) { //单击复原,长按+1AB组合-2
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressBDownTime = System.currentTimeMillis();
Log.d(TAG, "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
if ((pressBDownTime - startPressTime) > 320 && (pressBDownTime - startPressTime) < 1300 && pressADownTime > 0) {
if (isShowToast) {
ToastUtils.showShort("方块 B 按AB组合 ");
@@ -322,7 +305,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
pressBUpTime = System.currentTimeMillis();
Log.e(TAG, "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
if ((pressBUpTime - startPressTime) < 300 && isCombinationKey != 3) {
if (isShowToast) {
ToastUtils.showShort("方块 单击B 0 ");
@@ -340,12 +323,12 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
}
}, 300);
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击左变道,长按无操作
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressCDownTime = System.currentTimeMillis();
if ((pressCDownTime - startPressTime) > 1320) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按C 无操作 ");
if (isShowToast) {
ToastUtils.showShort("方块 长按C 无操作 ");
}
@@ -354,6 +337,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
pressCUpTime = System.currentTimeMillis();
isPressEnd = false;
if ((pressCUpTime - startPressTime) < 300) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击C ← 向左变道 ");
if (isShowToast) {
ToastUtils.showShort("方块 单击C ← 向左变道 ");
}
@@ -365,6 +349,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (event.getAction() == KeyEvent.ACTION_DOWN) {
pressDDownTime = System.currentTimeMillis();
if ((pressDDownTime - startPressTime) > 1320) {
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按D 无操作 ");
if (isShowToast) {
ToastUtils.showShort("方块 长按D 无操作 ");
}
@@ -376,10 +361,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (isShowToast) {
ToastUtils.showShort("方块 单击D → 向右变道 ");
}
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击D → 向右变道 ");
CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight();
}
}
return true;
} else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛
if (event.getAction() == KeyEvent.ACTION_DOWN) {
@@ -388,6 +373,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (isShowToast) {
ToastUtils.showShort("方块 长按E 鸣笛 ");
}
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按E 鸣笛 ");
CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1);
if (timerHorn == null) {
timerHorn = new Timer();
@@ -407,20 +393,18 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
if (isShowToast) {
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
}
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击E 开启自动驾驶 ");
CallerAutoPilotManager.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) {
@@ -444,42 +428,4 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
}
}
/**
* 初始化蓝牙广播
*/
private void initBluetooth() {
this.mBluetoothReceiver = new BluetoothMonitorReceiver();
IntentFilter intentFilter = new IntentFilter();
// 监视蓝牙关闭和打开的状态
intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
// 监视蓝牙设备与APP连接的状态
intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
intentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
// 注册广播
registerReceiver(this.mBluetoothReceiver, intentFilter);
}
/**
* 查找蓝牙连接过的蓝牙设备
*/
private void showBondedDevice(BluetoothAdapter bluetoothAdapter) {
Set<BluetoothDevice> deviceList = bluetoothAdapter.getBondedDevices();
for (BluetoothDevice device : deviceList) {
try {
//使用反射调用获取设备连接状态方法
Method isConnectedMethod = BluetoothDevice.class.getDeclaredMethod("isConnected", (Class[]) null);
isConnectedMethod.setAccessible(true);
// boolean isConnected = (boolean) isConnectedMethod.invoke(device, (Object[]) null);
Log.d(TAG, "-- device.getName() = " + device.getName()); //device.getAddress()
if (device.getName().equals("MINI_KEYBOARD")) {
SharedPrefsMgr.getInstance(getContext()).putString("BLUETOOTH", device.getName());
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -40,8 +40,17 @@
android:id="@+id/viewMofangStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/blue_tooth"
android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_27" />
android:layout_marginStart="@dimen/dp_8" />
<LinearLayout
android:id="@+id/viewStatusBarLeft"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="end|center"
android:orientation="horizontal"
android:layout_marginStart="@dimen/dp_8"/>
<!--app下载进度-->
<TextView
@@ -51,7 +60,7 @@
android:layout_gravity="center"
android:visibility="gone"
android:background="@drawable/app_download_bg"
android:layout_marginStart="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_15"
android:gravity="center"
android:drawableLeft="@drawable/icon_download_guide"
android:textColor="@color/background_debug"