[6.7.0] replace taxi base f view to new bone

This commit is contained in:
EmArrow
2024-09-27 19:41:42 +08:00
parent d998b4366a
commit 99d1012b77
39 changed files with 729 additions and 998 deletions

View File

@@ -12,12 +12,12 @@ import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.map.MogoLocation
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.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
import com.mogo.eagle.core.function.view.SiteMarkerBean
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.och.charter.passenger.R
import com.mogo.och.charter.passenger.bean.response.LineInfoResponse
import com.mogo.och.charter.passenger.bean.response.OrderInfoResponse
@@ -115,7 +115,7 @@ class BusPassengerPresenter(view: MainFragment?) :
}
OrderStatusEnum.OrderNoLine -> {
CallerOrderListenerManager.invokeOrderRemoval()
CallerEagleBaseFunctionCall4OchManager.onOrderRemoval()
showNoviceGuidance()
}

View File

@@ -11,7 +11,7 @@ import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
@@ -179,7 +179,7 @@ object LoginModel {
if (null != data && 0 == data.code) {
// 不用登录也可以获得支持的业务模式
LoginStatusManager.setBusinessType(data.data.businessType)
CallerOrderListenerManager.invokeTenantIdUpdate(data.data.tenantId)
CallerEagleBaseFunctionCall4OchManager.updateTenantId(data.data.tenantId)
iTaxiLoginCallback?.searchStatusSuccess()
// 后台已登录
if(!FunctionBuildConfig.isOffLine){

View File

@@ -13,7 +13,6 @@ 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.map.CallerMapGlobalTrajectoryDrawManager
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
@@ -137,7 +136,7 @@ object LineManager : CallerBase<ILineCallback>() {
fun setLineInfo(lineInfo: LineInfo?) {
if (lineInfo == null) {
clearGlobalTrajectory(true)
CallerOrderListenerManager.invokeOrderLineUpdate("")
CallerEagleBaseFunctionCall4OchManager.updateOrderLine("")
}
this._lineInfos = lineInfo
setAutopilotControlParameters()
@@ -148,7 +147,7 @@ object LineManager : CallerBase<ILineCallback>() {
line.multiMap?.forEach {
sb.append(it.value)
}
CallerOrderListenerManager.invokeOrderLineUpdate(sb.toString())
CallerEagleBaseFunctionCall4OchManager.updateOrderLine(sb.toString())
}
}
}

View File

@@ -16,7 +16,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.function.hmi.ui.setting.SopView
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
@@ -176,10 +176,10 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
d(TAG, "登录状态发生改变 $currentStatus")
when (currentStatus) {
LoginStatusEnum.Login -> {
CallerOrderListenerManager.invokeLoginStatusUpdate(true)
CallerEagleBaseFunctionCall4OchManager.updateLoginStatus(true)
}
else -> {
CallerOrderListenerManager.invokeLoginStatusUpdate(false)
CallerEagleBaseFunctionCall4OchManager.updateLoginStatus(false)
}
}
UiThreadHandler.post {

View File

@@ -55,8 +55,6 @@ class ShuttleFragment : MvpFragment<ShuttleFragment?, BusPresenter?>() {
override fun initViews() {
context?.let {
boneContainerView.addBizView(SwitchBizView(it))
CallerEagleBaseFunctionCall4OchManager.addSingleToolKitDefaultItem(runningTaskGateWay,"本地缓存任务", R.drawable.bus_running_task_history,4)
CallerEagleBaseFunctionCall4OchManager.addToolKitDefaultItemClickListener(runningTaskGateWay,object :
IToolKitItemClickListener{

View File

@@ -14,7 +14,7 @@ import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.mvp.Presenter;
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.order.CallerOrderListenerManager;
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.common.module.biz.login.ILoginCallback;
@@ -313,7 +313,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
public void run() {
if(mView!=null) {
mView.updateCtvAutopilotStatusTag(true);
CallerOrderListenerManager.INSTANCE.invokeOrderStatus(true);
CallerEagleBaseFunctionCall4OchManager.INSTANCE.updateOrderStatus(true);
mView.setGuidHide();
}
}
@@ -338,7 +338,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
mView.updateCtvAutopilotStatusTag(false);
if (TaxiOrderStatusEnum.ArriveAtEnd.getCode() == order.orderStatus) {
CallerOrderListenerManager.INSTANCE.invokeOrderStatus(false);
CallerEagleBaseFunctionCall4OchManager.INSTANCE.updateOrderStatus(false);
}
}
}
@@ -512,14 +512,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
}
}
String finalRole = role;
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
if(mView!=null) {
mView.setRole(finalRole);
}
}
}, UiThreadHandler.MODE.QUEUE);
}
@Override
@@ -527,13 +519,5 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
if(businessEnum==OpenOrderStatusEnum.Ordering){
TaxiModel.getInstance().startOrStopOrderLoop(LoginStatusManager.isLogin()&&LoginStatusManager.isOpenOrderType());
}
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
if(mView!=null) {
mView.updateOperationStatus(LoginStatusManager.getOpenOrderType());
}
}
}, UiThreadHandler.MODE.QUEUE);
}
}

View File

@@ -55,19 +55,9 @@ import java.lang.ref.WeakReference;
public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener {
private static final String TAG = "BaseOchFragment";
private RelativeLayout ctvAutopilotStatusRL;
protected OrderStatusView tvOperationStatus;
protected TextView mDriverRole;
protected FrameLayout flStationPanelContainer;
private FrameLayout flNaviPanelContainer;
private MapRoamView mapRoamView;
private Group groupTestPanel;
// private FrameLayout mSpeedView;
private ImageView mAutopilotImage;
private TextView mAutopilotTv;
private ImageView mCloseNaviIcon;
// protected VisualViewDirver visualViewDirver;
protected TaxiAmapNaviFragment ochAmapNaviFragment = null;
protected TaxiRottingNaviFragment taxiRottingNaviFragment = null;
@@ -92,100 +82,17 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
protected void initViews() {
mapContainerLayout = findViewById(R.id.mapContainerLayout);
mapRoamView = findViewById(R.id.mapRoamView);
groupTestPanel = findViewById(R.id.groupTestPanel);
ctvAutopilotStatusRL = findViewById(R.id.module_mogo_och_autopilot_status);
ctvAutopilotStatusRL.setBackground(getResources().getDrawable(R.drawable.taxi_autopilot_bg_selector));
updateCtvAutopilotStatusTag(false);
mAutopilotImage = findViewById(R.id.module_och_autopilot_iv);
mAutopilotTv = findViewById(R.id.module_och_autopilot_tv);
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
// visualViewDirver = findViewById(R.id.vvd_change_angle);
// mSpeedView = findViewById(R.id.taxi_speed_contain);
// if (mSpeedView != null) {
// CallerDevaToolsManager.INSTANCE.attachAutopilotBeforeLaunchView(mSpeedView.getContext(), mSpeedView);
// }
mCloseNaviIcon = findViewById(R.id.taxi_close_navi_icon);
flNaviPanelContainer = findViewById(R.id.module_mogo_och_navi_panel_container);
// mSpeedView.setLongClickable(true); //调试按钮任意模式下都开
tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status);
mDriverRole = findViewById(R.id.taxi_driver_role_tv);
LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
ctvAutopilotStatusRL.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
// 如果能自动驾驶,就自动驾驶,不能就提示
if (CallerAutoPilotStatusListenerManager.INSTANCE.getState() ==
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
return; //远程代驾状态下不可开启自动驾驶,只能等远程代驾主动退出
} else if (!(boolean) ctvAutopilotStatusRL.getTag()) {
ToastUtils.showShort(ResourcesUtils.getString(R.string.module_och_taxi_auto_disable_tip1));
} else {
startAutopilot();
}
}
});
// debug下调用测试面板 长按速度值 任意模式下调试都打开
// mSpeedView.setOnLongClickListener(v -> {
// if (groupTestPanel.getVisibility() == View.VISIBLE) {
// groupTestPanel.setVisibility(View.GONE);
// } else {
// groupTestPanel.setVisibility(View.VISIBLE);
// }
// return false;
// });
CallerHmiViewControlListenerManager.INSTANCE.invokeMainPageViewVisible(View.VISIBLE);
onAutopilotStatusChanged(CallerAutoPilotStatusListenerManager.INSTANCE.getState(), CallerAutoPilotControlManager.INSTANCE.isCanStartAutopilot(false, 0));
// 模拟 不可自动驾驶目前场景是刚开机adas还未和工控机连接
findViewById(R.id.btnAutopilotDisable).setOnClickListener(view ->
onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE, true)
);
// 模拟 可自动驾驶,工控机连接正常,且处于人工干预状态
findViewById(R.id.btnAutopilotEnable).setOnClickListener(view ->
onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE, true)
);
// 模拟 自动驾驶能力,自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人
findViewById(R.id.btnAutopilotRunning).setOnClickListener(view ->
onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING, true)
);
findViewById(R.id.btnAutopilotmanco).setOnClickListener(view ->
onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING, true));
tvOperationStatus.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
onChangeOperationStatus();
}
});
mCloseNaviIcon.setOnClickListener(v -> {
showAmapNaviToStationFragment(false);
showRottingToStationFragment(false);
});
// smallMapView = findViewById(R.id.smallMapView);
// acivShowGuid = findViewById(R.id.aciv_show_guid);
// smallMapView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// if(overMapDialog==null){
// overMapDialog = new OverMapDialog(getContext());
// }
// acivShowGuid.setVisibility(View.GONE);
// overMapDialog.showDialog();
// }
// });
if (getContext() != null) {
CallerEagleBaseFunctionCall4OchManager.INSTANCE.addSingleToolKitDefaultItem(runningTaskGateWay, "运营面板", R.drawable.common_biz_operation, 4);
CallerEagleBaseFunctionCall4OchManager.INSTANCE.addToolKitDefaultItemClickListener(runningTaskGateWay, new IToolKitItemClickListener() {
@@ -252,16 +159,9 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
overMapDialog = null;
}
super.onDestroyView();
ctvAutopilotStatusRL = null;
tvOperationStatus = null;
mDriverRole = null;
flStationPanelContainer = null;
flNaviPanelContainer = null;
mapContainerLayout = null;
mapRoamView = null;
groupTestPanel = null;
mAutopilotImage = null;
mAutopilotTv = null;
mCloseNaviIcon = null;
ochAmapNaviFragment = null;
taxiRottingNaviFragment = null;
@@ -303,7 +203,6 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
}
public void updateCtvAutopilotStatusTag(boolean tag) {
ctvAutopilotStatusRL.setTag(tag);
}
public void onCheckPilotConditionSafe() {
@@ -314,55 +213,14 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
protected abstract void updateOrderBottomBtnUI();
public void autopilotStatusAnimchanged(int status, boolean canStart) {
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
mAutopilotTv.setText("自动驾驶");
mAutopilotTv.setTextColor(ResourcesUtils.getColor(R.color.taxi_autopilot_text_color_normal));
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot);
ctvAutopilotStatusRL.setBackgroundResource(R.drawable.common_autopilot_in_autopilot);
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status) {
mAutopilotTv.setText("自动驾驶");
if (canStart) {
mAutopilotTv.setTextColor(ResourcesUtils.getColor(R.color.taxi_autopilot_text_color_normal));
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot);
ctvAutopilotStatusRL.setBackgroundResource(R.drawable.common_autopilot_press);
} else {
mAutopilotTv.setTextColor(ResourcesUtils.getColor(R.color.taxi_autopilot_text_color_disable));
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot_disable);
ctvAutopilotStatusRL.setBackgroundResource(R.drawable.common_autopilot_press);
}
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING == status) {
mAutopilotTv.setText("远程代驾");
mAutopilotTv.setTextColor(ResourcesUtils.getColor(R.color.taxi_autopilot_text_color_normal));
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot);
ctvAutopilotStatusRL.setBackgroundResource(R.drawable.common_autopilot_pxjs);
// 平行驾驶
} else {
mAutopilotTv.setText("自动驾驶");
mAutopilotTv.setTextColor(ResourcesUtils.getColor(R.color.taxi_autopilot_text_color_disable));
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot_disable);
ctvAutopilotStatusRL.setBackgroundResource(R.drawable.common_autopilot_start_fail);
}
}
private void startAutopilotDone(boolean success) {
if (mAutopilotImage == null) {
return;
}
if (autopilotLoadingAnimator != null) {
autopilotLoadingAnimator.end();
mAutopilotImage.clearAnimation();
autopilotLoadingAnimator = null;
}
if (success) {
mAutopilotTv.setText("成功");
mAutopilotTv.setTextColor(ResourcesUtils.getColor(R.color.taxi_autopilot_text_color_normal));
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot_success);
} else {
mAutopilotTv.setText("失败");
mAutopilotTv.setTextColor(ResourcesUtils.getColor(R.color.taxi_autopilot_text_color_normal));
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot_failed);
}
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
@@ -378,26 +236,11 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
public void startOrStopLoadingAnim(boolean start) {
if (start) {
isStarting = true;
mAutopilotTv.setText("启动中");
mAutopilotTv.setTextColor(ResourcesUtils.getColor(R.color.taxi_autopilot_text_color_normal));
mAutopilotImage.setImageResource(R.drawable.taxi_ic_autopilot_loading);
if (autopilotLoadingAnimator == null) {
autopilotLoadingAnimator = ObjectAnimator.ofFloat(mAutopilotImage,
"rotation", 0f, 360f);
}
autopilotLoadingAnimator.setInterpolator(new LinearInterpolator());
autopilotLoadingAnimator.setRepeatCount(-1);//无限循环
autopilotLoadingAnimator.setStartDelay(100);
autopilotLoadingAnimator.setDuration(1000);//设置持续时间
autopilotLoadingAnimator.start();//动画开始
startingAutoApilotCountDown();
} else {
isStarting = false;
if (autopilotLoadingAnimator != null) {
autopilotLoadingAnimator.end();
mAutopilotImage.clearAnimation();
autopilotLoadingAnimator = null;
}
}
@@ -421,67 +264,6 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
}, TIMER_START_AUTOPILOT_INTERVAL);
}
public void hidPanel() {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
if (flStationPanelContainer != null) {
flStationPanelContainer.setVisibility(View.GONE);
// ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) visualViewDirver.getLayoutParams();
// layoutParams.startToStart = ConstraintLayout.LayoutParams.PARENT_ID;
// layoutParams.bottomToTop = R.id.toolsView;
// if (getContext() != null) {
// layoutParams.setMarginStart(AutoSizeUtils.dp2px(getContext(), 29));
// }
// visualViewDirver.setLayoutParams(layoutParams);
}
}
}, UiThreadHandler.MODE.QUEUE);
}
public void showPanel() {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
if (flStationPanelContainer != null) {
flStationPanelContainer.setVisibility(View.VISIBLE);
// ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) visualViewDirver.getLayoutParams();
// layoutParams.startToStart = ConstraintLayout.LayoutParams.PARENT_ID;
// layoutParams.bottomToTop = R.id.toolsView;
// if (getContext() != null) {
// layoutParams.setMarginStart(AutoSizeUtils.dp2px(getContext(), 618));
// }
// visualViewDirver.setLayoutParams(layoutParams);
}
}
}, UiThreadHandler.MODE.QUEUE);
}
/**
* 获取站点面板view在{@link #initViews()}时候添加到container中
*
* @return 站点面板view
*/
public abstract int getStationPanelViewId();
/**
* 重新开启自动驾驶
*/
public abstract void startAutopilot();
public void changeOperationViewVisible(int visible) {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
if (tvOperationStatus == null) {
return;
}
tvOperationStatus.setVisibility(visible);
}
}, UiThreadHandler.MODE.QUEUE);
}
protected void showAmapNaviToStationFragment(boolean isShow) {
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();

View File

@@ -612,12 +612,10 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment
if (being) {
mNoDataView.setVisibility(View.GONE);
mBeingOrderLayout.setVisibility(View.VISIBLE);
mTaxiFragment.changeOperationViewVisible(View.GONE);
} else {
mNoDataView.setVisibility(View.VISIBLE);
mNoDatasTv.setText("暂无进行中订单");
mBeingOrderLayout.setVisibility(View.GONE);
mTaxiFragment.changeOperationViewVisible(View.VISIBLE);
}
}catch (NullPointerException e){ //可能会出现订单信息已经轮询回来,但进行中页面控件还未初始化完成的情况

View File

@@ -73,21 +73,21 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
public int getStationPanelViewId() {
return R.layout.taxi_panel;
}
@Override
public void startAutopilot() {
// 在自动驾驶中,或者自己确认车辆环境可开启自动驾驶 则可点击
if ((mPresenter.getCurOrderStatus() == TaxiOrderStatusEnum.OnTheWayToEnd ||
mPresenter.getCurOrderStatus() == TaxiOrderStatusEnum.UserArriveAtStart)
&& !isStarting) {
CallerLogger.d(M_TAXI + TAG, "startAutopilot");
mPresenter.startAutoPilot();
}
}
// @Override
// public int getStationPanelViewId() {
// return R.layout.taxi_panel;
// }
//
// @Override
// public void startAutopilot() {
// // 在自动驾驶中,或者自己确认车辆环境可开启自动驾驶 则可点击
// if ((mPresenter.getCurOrderStatus() == TaxiOrderStatusEnum.OnTheWayToEnd ||
// mPresenter.getCurOrderStatus() == TaxiOrderStatusEnum.UserArriveAtStart)
// && !isStarting) {
// CallerLogger.d(M_TAXI + TAG, "startAutopilot");
// mPresenter.startAutoPilot();
// }
// }
@Override
public void startNaviToEndStation(boolean isShow) {
@@ -103,42 +103,39 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
protected void initViews() {
super.initViews();
initFragment();
hidPanel();
tvOperationStatus.setVisibility(View.VISIBLE);
initOrderTestBar();
}
private void initFragment() {
serverOrdersFragmentWR = new WeakReference<>(TaxiServerOrdersFragment.newInstance());
grabOrderFragmentWR = new WeakReference<>(TaxiGrabOrderFragment.newInstance());
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
//默认显示OCHTaxiServerOrdersFragment
transaction.add(R.id.fragment_container, serverOrdersFragmentWR.get()).show(serverOrdersFragmentWR.get());
transaction.add(R.id.fragment_container, grabOrderFragmentWR.get()).hide(grabOrderFragmentWR.get());
transaction.commitAllowingStateLoss();
// serverOrdersFragmentWR = new WeakReference<>(TaxiServerOrdersFragment.newInstance());
//// grabOrderFragmentWR = new WeakReference<>(TaxiGrabOrderFragment.newInstance());
// FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
// //默认显示OCHTaxiServerOrdersFragment
// transaction.add(R.id.fragment_container, serverOrdersFragmentWR.get()).show(serverOrdersFragmentWR.get());
// transaction.add(R.id.fragment_container, grabOrderFragmentWR.get()).hide(grabOrderFragmentWR.get());
// transaction.commitAllowingStateLoss();
}
private void showGrabFragmentAndUpdate() {
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
if (grabOrderFragmentWR == null || grabOrderFragmentWR.get() == null) {
grabOrderFragmentWR = new WeakReference<>(TaxiGrabOrderFragment.newInstance());
transaction.add(R.id.fragment_container, grabOrderFragmentWR.get())
.show(grabOrderFragmentWR.get()).commitAllowingStateLoss();
} else {
transaction.show(grabOrderFragmentWR.get()).hide(serverOrdersFragmentWR.get()).commitAllowingStateLoss();
}
// FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
// if (grabOrderFragmentWR == null || grabOrderFragmentWR.get() == null) {
// grabOrderFragmentWR = new WeakReference<>(TaxiGrabOrderFragment.newInstance());
// transaction.add(R.id.fragment_container, grabOrderFragmentWR.get())
// .show(grabOrderFragmentWR.get()).commitAllowingStateLoss();
// } else {
// transaction.show(grabOrderFragmentWR.get()).hide(serverOrdersFragmentWR.get()).commitAllowingStateLoss();
// }
}
public void showServerFragmentAndUpdate() {
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
if (serverOrdersFragmentWR == null || serverOrdersFragmentWR.get() == null) {
serverOrdersFragmentWR = new WeakReference<>(TaxiServerOrdersFragment.newInstance());
transaction.add(R.id.fragment_container, serverOrdersFragmentWR.get())
.show(serverOrdersFragmentWR.get());
} else {
transaction.show(serverOrdersFragmentWR.get()).hide(grabOrderFragmentWR.get()).commitAllowingStateLoss();
}
// FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
// if (serverOrdersFragmentWR == null || serverOrdersFragmentWR.get() == null) {
// serverOrdersFragmentWR = new WeakReference<>(TaxiServerOrdersFragment.newInstance());
// transaction.add(R.id.fragment_container, serverOrdersFragmentWR.get())
// .show(serverOrdersFragmentWR.get());
// } else {
// transaction.show(serverOrdersFragmentWR.get()).hide(grabOrderFragmentWR.get()).commitAllowingStateLoss();
// }
}
@NonNull
@@ -166,36 +163,15 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
super.onDestroyView();
}
/**
* 状态变更
* @param inOperation true 可以接单 false 暂停接单
*/
public void updateOperationStatus(OpenOrderStatusEnum inOperation) {
CallerLogger.e(M_TAXI + TAG, "onOperationChanged:" + inOperation);
if (LoginStatusManager.isOpenOrderType()) {
showPanel();
} else {
hidPanel();
}
}
public void setRole(String role){
if (!TextUtils.isEmpty(role)){
mDriverRole.setVisibility(View.VISIBLE);
mDriverRole.setText(role);
}else {
mDriverRole.setVisibility(View.GONE);
}
}
public void updateAutopilotStatus(int status,boolean canStart) {
onAutopilotStatusChanged(status,canStart);
}
@RequiresApi(api = Build.VERSION_CODES.P)
public void updateCurrentOrderStatusChanged(OrderQueryRespBean.Result order) {
if (serverOrdersFragmentWR != null && serverOrdersFragmentWR.get() != null) {
serverOrdersFragmentWR.get().updateCurrentOrderStatusChanged(order);
}
// if (serverOrdersFragmentWR != null && serverOrdersFragmentWR.get() != null) {
// serverOrdersFragmentWR.get().updateCurrentOrderStatusChanged(order);
// }
updateTaxiTestBarInfo(); //更新调试bar中信息
}
@@ -334,24 +310,24 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
* 订单流转debug START
*/
public void initOrderTestBar() {
findViewById(R.id.test_bar_to_start).setOnClickListener(v -> {
TaxiModel.getInstance().setArriveAtStartStation();
});
findViewById(R.id.test_bar_to_end).setOnClickListener(v -> {
TaxiModel.getInstance().setArriveAtEndStation();
});
findViewById(R.id.test_bar_start_service_confirm).setOnClickListener(v -> {
TaxiModel.getInstance().setDriverConfirmCondition();
});
findViewById(R.id.test_bar_on_the_way_to_end).setOnClickListener(v -> {
if (!isStarting){
mPresenter.startAutoPilot();
}
TaxiModel.getInstance().setOnTheWayToEndStation();
});
findViewById(R.id.test_bar_route).setOnClickListener(v -> {
testRouteInfoUpload();
});
// findViewById(R.id.test_bar_to_start).setOnClickListener(v -> {
// TaxiModel.getInstance().setArriveAtStartStation();
// });
// findViewById(R.id.test_bar_to_end).setOnClickListener(v -> {
// TaxiModel.getInstance().setArriveAtEndStation();
// });
// findViewById(R.id.test_bar_start_service_confirm).setOnClickListener(v -> {
// TaxiModel.getInstance().setDriverConfirmCondition();
// });
// findViewById(R.id.test_bar_on_the_way_to_end).setOnClickListener(v -> {
// if (!isStarting){
// mPresenter.startAutoPilot();
// }
// TaxiModel.getInstance().setOnTheWayToEndStation();
// });
// findViewById(R.id.test_bar_route).setOnClickListener(v -> {
// testRouteInfoUpload();
// });
}
@Subscribe(threadMode = ThreadMode.MAIN)

View File

@@ -1,62 +1,24 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugViewTrigger
android:layout_width="@dimen/dp_400"
android:layout_height="@dimen/dp_100"
android:layout_marginTop="@dimen/dp_status_bar_height"
android:longClickable="true"
app:layout_constraintBottom_toBottomOf="parent"
<com.mogo.eagle.core.function.hmi.map.MapContainerLayout
android:id="@+id/mapContainerLayout"
android:layout_width="1560dp"
android:layout_height="1533dp"
android:layout_marginTop="@dimen/dp_76"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:locationIcon3DRes="@raw/chuzuche" />
<FrameLayout
android:id="@+id/taxi_speed_contain"
android:layout_width="@dimen/dp_618"
android:layout_height="@dimen/dp_269"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_status_bar_height"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:id="@+id/module_mogo_och_autopilot_status"
android:layout_width="@dimen/dp_616"
android:layout_height="@dimen/dp_180"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginTop="-31dp"
android:background="@drawable/taxi_autopilot_bg_selector"
android:gravity="center"
android:paddingTop="@dimen/dp_27"
android:paddingBottom="@dimen/dp_32"
<com.mogo.eagle.core.function.hmi.bone.BoneContainerView
android:id="@+id/boneContainerView"
android:layout_width="@dimen/dp_1046"
android:layout_height="match_parent"
android:elevation="100dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/taxi_speed_contain">
<ImageView
android:id="@+id/module_och_autopilot_iv"
android:layout_width="73dp"
android:layout_height="73dp"
android:layout_centerVertical="true"
android:src="@drawable/taxi_ic_autopilot" />
<TextView
android:id="@+id/module_och_autopilot_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="28dp"
android:layout_toRightOf="@+id/module_och_autopilot_iv"
android:text="自动驾驶"
android:textColor="@color/bus_autopilot_text_color_normal"
android:textSize="@dimen/dp_32"
android:textStyle="bold" />
</RelativeLayout>
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.och.common.module.wigets.rodedata.OchAutomaticExplorationView
android:layout_width="wrap_content"
@@ -78,113 +40,6 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--订单详情-->
<FrameLayout
android:id="@+id/module_mogo_och_station_panel_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginTop="-25dp"
android:background="@android:color/transparent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/module_mogo_och_autopilot_status"
tools:visibility="visible" />
<com.mogo.och.common.module.wigets.map.orderstatus.OrderStatusView
android:id="@+id/module_mogo_och_operation_status"
android:layout_width="@dimen/dp_316"
android:layout_height="@dimen/dp_144"
android:layout_marginStart="@dimen/dp_19"
android:layout_marginBottom="@dimen/dp_16"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<TextView
android:id="@+id/taxi_driver_role_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
android:textColor="@color/taxi_role_text_color"
android:textSize="@dimen/taxi_diver_role_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<com.mogo.och.common.module.wigets.map.toolsview.ToolsView
android:id="@+id/toolsView"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"
android:layout_marginStart="-11dp"
android:layout_marginBottom="@dimen/dp_17"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_operation_status" />
<com.mogo.och.common.module.wigets.map.reportworkorder.ReportWorkOrderView
android:id="@+id/reportworkorderview"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"
android:layout_marginStart="-10dp"
android:layout_marginBottom="@dimen/dp_17"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/toolsView" />
<com.mogo.och.common.module.wigets.map.drawline.LineView
android:id="@+id/lineView"
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"
android:layout_marginStart="-11dp"
android:layout_marginBottom="@dimen/dp_17"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/reportworkorderview" />
<Button
android:id="@+id/btnAutopilotDisable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="模拟 自动驾驶Disable"
android:textSize="@dimen/dp_40"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnAutopilotEnable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="模拟 自动驾驶Enable"
android:textSize="@dimen/dp_40"
android:visibility="gone"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotDisable" />
<Button
android:id="@+id/btnAutopilotRunning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="模拟 自动驾驶Running"
android:textSize="@dimen/dp_40"
android:visibility="gone"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotEnable" />
<Button
android:id="@+id/btnAutopilotmanco"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="模拟 人机共驾"
android:textSize="@dimen/dp_40"
android:visibility="gone"
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
<androidx.constraintlayout.widget.Group
android:id="@+id/groupTestPanel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="btnAutopilotDisable,btnAutopilotEnable,btnAutopilotRunning,btnAutopilotmanco"
tools:visibility="gone" />
<FrameLayout
android:id="@+id/module_mogo_och_navi_panel_container"
android:layout_width="600dp"
@@ -205,35 +60,18 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<!-- <androidx.appcompat.widget.AppCompatImageView-->
<!-- android:id="@+id/aciv_show_guid"-->
<!-- android:layout_width="@dimen/dp_209"-->
<!-- android:layout_height="@dimen/dp_91"-->
<!-- android:layout_marginBottom="-32dp"-->
<!-- android:src="@drawable/taxi_overmap_tag"-->
<!-- android:visibility="gone"-->
<!-- app:layout_constraintBottom_toTopOf="@+id/smallMapView"-->
<!-- app:layout_constraintEnd_toEndOf="@+id/smallMapView"-->
<!-- app:layout_constraintStart_toStartOf="@+id/smallMapView" />-->
<!-- TODO:"挪到ExchangeChildLayout中去" -->
<com.mogo.och.common.module.wigets.LoadingMapStatusView
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.mogo.eagle.core.function.hmi.map.MapContainerLayout
android:id="@+id/mapContainerLayout"
android:layout_width="1560dp"
android:layout_height="1534dp"
<com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugViewTrigger
android:layout_width="@dimen/dp_400"
android:layout_height="@dimen/dp_100"
android:layout_marginTop="@dimen/dp_status_bar_height"
android:longClickable="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintStart_toStartOf="parent"
app:locationIcon3DRes="@raw/chuzuche" />
<com.mogo.eagle.core.function.hmi.bone.BoneContainerView
android:id="@+id/boneContainerView"
android:layout_width="@dimen/dp_1046"
android:layout_height="match_parent"
android:elevation="100dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -11,7 +11,7 @@ import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
@@ -288,12 +288,12 @@ object TaxiPassengerModel {
AutopilotManager.updateAutopilotControlParameters()
startOrStopReadyToAutopilotLoop(false)
setStation()
CallerOrderListenerManager.invokeOrderStatus(true)
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(true)
}
TaxiOrderStatusEnum.ArriveAtEnd -> {
AutopilotManager.clearAutopilotControlParameters()
//startOrStopQueryOrderRemaining(false)
CallerOrderListenerManager.invokeOrderStatus(false)
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(false)
cleanStation()
}
TaxiOrderStatusEnum.JourneyCompleted -> {

View File

@@ -11,7 +11,7 @@ import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_TAXI_P
@@ -404,14 +404,14 @@ object TaxiPassengerModel {
//startOrStopQueryOrderRemaining(true)
AutopilotManager.updateAutopilotControlParameters()
setStation()
CallerOrderListenerManager.invokeOrderStatus(true)
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(true)
}
TaxiOrderStatusEnum.ArriveAtEnd -> {
AutopilotManager.clearAutopilotControlParameters()
queryOrderRouteInfo()
//startOrStopQueryOrderRemaining(false)
CallerOrderListenerManager.invokeOrderStatus(false)
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(false)
clearStation()
}

View File

@@ -29,6 +29,26 @@ class DataCenterBizProvider:IDataCenterBizProvider {
CallerDataCenterBizListener.invokeCarNo(plateNumber)
}
override fun notifyOrderStatus(inOrder: Boolean) {
CallerDataCenterBizListener.invokeOrderStatus(inOrder)
}
override fun notifyOrderRemoval() {
CallerDataCenterBizListener.invokeOrderRemoval()
}
override fun notifyOrderLine(lineName: String) {
CallerDataCenterBizListener.invokeOrderLine(lineName)
}
override fun notifyTenantId(tenantId: Long) {
CallerDataCenterBizListener.invokeTenantId(tenantId)
}
override fun notifyLoginStatus(isLogin: Boolean) {
CallerDataCenterBizListener.invokeLoginStatus(isLogin)
}
override fun onDestroy() {
}

View File

@@ -41,10 +41,10 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoFsm2024Listener
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.map.deva.IMoGoMapScreenListener
import com.mogo.eagle.core.function.api.order.IOrderListener
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.autopilot.CallerAutopilotRecordListenerManager
@@ -52,12 +52,12 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsList
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapScreenListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.call.takeover.CallerTakeOverManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -85,7 +85,7 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
IMoGoChassisLocationGCJ02Listener, IMsgBoxListener, IMoGoDevaToolsListener,
IMogoStatusChangedListener, IMoGoMapScreenListener , IMoGoFsm2024Listener,
IMoGoAutopilotStatisticsListener, IMoGoChassisStatesListener, IMoGoAutopilotStatusListener,
IOrderListener {
IDataCenterBizListener {
const val TAG = "BadCase"
@@ -128,7 +128,7 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
if(ProjectUtils.isSaas()){
// CallerFsm2024ListenerManager.addListener(TAG,this)
CallerAutopilotStatisticsListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
CallerAutoPilotStatusListenerManager.addListener("RecordViewManager",this)
CallerChassisStatesListenerManager.addListener(TAG,this)
}
@@ -690,21 +690,21 @@ internal object BadCaseManager : LifecycleEventObserver, IMoGoAutopilotRecordLis
}
}
override fun onOrderLineUpdate(lineName: String) {
override fun invokeOrderLine(lineName: String) {
BadCaseConfig.lineName = lineName
}
/**
* 获取租户ID
*/
override fun onTenantIdUpdate(tenantId: Long) {
override fun invokeTenantId(tenantId: Long) {
BadCaseConfig.tenantId = tenantId
}
/**
* 监听登录登出状态
*/
override fun onLoginStatusUpdate(isLogin: Boolean) {
override fun invokeLoginStatus(isLogin: Boolean) {
if(reportTypeWindow?.getWindowShowStatus() == true){
reportTypeWindow?.hideFloatWindow()
reportTypeWindow = null

View File

@@ -4,13 +4,13 @@ import android.content.Context
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoFsm2024Listener
import com.mogo.eagle.core.function.api.autopilot.IMoGoNodeStateListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
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.autopilot.CallerFsm2024ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerNodeStateListenerManager
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.zhjt.mogo.adas.data.AdasConstants
@@ -24,7 +24,7 @@ import kotlinx.coroutines.launch
import java.util.concurrent.atomic.AtomicReference
internal class FSMImpl(ctx: Context) : IFlow<FSMStatus>(ctx), IMoGoAutopilotStatusListener,
IMoGoFsm2024Listener, IMoGoNodeStateListener, IOrderListener {
IMoGoFsm2024Listener, IMoGoNodeStateListener, IDataCenterBizListener {
companion object {
const val TAG = "FSMImpl"
@@ -76,7 +76,7 @@ internal class FSMImpl(ctx: Context) : IFlow<FSMStatus>(ctx), IMoGoAutopilotStat
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerFsm2024ListenerManager.addListener(TAG, this)
CallerNodeStateListenerManager.addNodeStateListener(TAG, setOf(AdasConstants.NodeName.FSM2024), this)
CallerOrderListenerManager.addListener(TAG, this)
CallerDataCenterBizListener.addListener(TAG, this)
}
override fun onAutopilotIpcConnectStatusChanged(
status: AdasConstants.IpcConnectionStatus,
@@ -127,8 +127,8 @@ internal class FSMImpl(ctx: Context) : IFlow<FSMStatus>(ctx), IMoGoAutopilotStat
}
}
override fun onLoginStatusUpdate(isLogin: Boolean) {
super.onLoginStatusUpdate(isLogin)
override fun invokeLoginStatus(isLogin: Boolean) {
super.invokeLoginStatus(isLogin)
if (!isLogin) {
CallerLogger.d(TAG, "onLoginStatusUpdate isLogin=$isLogin")
CallerHmiManager.dismissFSMExceptionStatusWindow()
@@ -141,6 +141,6 @@ internal class FSMImpl(ctx: Context) : IFlow<FSMStatus>(ctx), IMoGoAutopilotStat
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerFsm2024ListenerManager.removeListener(TAG)
CallerNodeStateListenerManager.removeNodeStateListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
}
}

View File

@@ -46,11 +46,9 @@ import com.mogo.eagle.core.data.deva.report.CategoryInfo
import com.mogo.eagle.core.data.deva.report.PadAddProblemReq
import com.mogo.eagle.core.data.deva.report.PadProblemInfo
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.eagle.core.utilcode.util.JsonParser
import com.mogo.eagle.core.utilcode.util.ThreadUtils
@@ -66,9 +64,9 @@ import com.zhjt.mogo_core_function_devatools.workorder.adapter.OrderReasonAdapte
* 故障原因编辑窗口
*/
class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
IMoGoDevaToolsListener, IOrderListener {
IMoGoDevaToolsListener {
companion object{
companion object {
const val TAG = "FaultReasonWindow"
}
@@ -84,6 +82,7 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
// 语音听写对象
private var mIat: SpeechRecognizer? = null
// 用HashMap存储听写结果
private val mIatResults: HashMap<String, String> = LinkedHashMap()
@@ -126,8 +125,8 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
private var hasLevel2: Boolean = false //是否有二级分类
private var hasLevel3: Boolean = false //是否有三级分类
private var typeList: List<CategoryInfo> ?= null //故障类型列表
private var reasonList: List<CategoryInfo> ?= null //故障原因列表
private var typeList: List<CategoryInfo>? = null //故障类型列表
private var reasonList: List<CategoryInfo>? = null //故障原因列表
private var faultTypeSelectStatus: Boolean = false //故障类型选择状态
private var faultReasonSelectStatus: Boolean = false //故障原因选择状态
@@ -139,8 +138,9 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
}
@SuppressLint("InflateParams")
private fun initFloatWindow(){
mFloatLayout = LayoutInflater.from(mActivity).inflate(R.layout.view_fault_reason, null) as View
private fun initFloatWindow() {
mFloatLayout =
LayoutInflater.from(mActivity).inflate(R.layout.view_fault_reason, null) as View
mFloatLayout.setOnTouchListener(this)
// 初始化识别无UI识别对象
@@ -160,7 +160,7 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
}
}
private fun initView(){
private fun initView() {
tvFaultTitle = mFloatLayout.findViewById(R.id.tvFaultTitle)
tvFaultTime = mFloatLayout.findViewById(R.id.tvFaultTime)
tvFaultType = mFloatLayout.findViewById(R.id.tvFaultType)
@@ -179,28 +179,34 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
rvFaultList.layoutManager = linearLayoutManager
orderReasonAdapter = OrderReasonAdapter()
orderReasonAdapter.setListener(object: OrderReasonAdapter.ReasonSelectListener{
orderReasonAdapter.setListener(object : OrderReasonAdapter.ReasonSelectListener {
override fun onSelectReason(reason: CategoryInfo, mSource: Int) {
if(mSource == 1){
if (mSource == 1) {
//类型
tvFaultType.text = reason.name
//选择了故障类型
tvFaultType.performClick()
if(level2Id != 0 && level2Id == reason.id){
if (level2Id != 0 && level2Id == reason.id) {
//故障类型选择没有变化
reasonList?.let { orderReasonAdapter.setData(it,2) }
}else{
reasonList?.let { orderReasonAdapter.setData(it, 2) }
} else {
//故障类型发生了变化
level2Id = reason.id
level2Name = reason.name
source = 2
//获取故障三级分类即故障原因
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,3,level2Id,type,0)
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
3,
level2Id,
type,
0
)
tvFaultReason.text = ""
level3Id = 0
level3Name = ""
}
}else{
} else {
//原因
tvFaultReason.text = reason.name
tvFaultReason.performClick()
@@ -213,33 +219,32 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
}
@SuppressLint("SetTextI18n")
private fun initEvent(){
private fun initEvent() {
CallerDevaToolsListenerManager.addListener(TAG, this)
CallerOrderListenerManager.addListener(TAG,this)
val iconDown = ContextCompat.getDrawable(mActivity, R.drawable.icon_fault_expand)
iconDown?.setBounds(0, 0, iconDown.minimumWidth, iconDown.minimumHeight)
val iconUp = ContextCompat.getDrawable(mActivity, R.drawable.icon_fault_retract)
iconUp?.setBounds(0, 0, iconUp.minimumWidth, iconUp.minimumHeight)
//获取一级分类
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,1,0,type,0)
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId, 1, 0, type, 0)
//弹窗展示时间
tvFaultTime.text = mActivity.resources.getString(R.string.take_over_time) +
millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())
//故障类型选择
tvFaultType.setOnClickListener {
if(!hasLevel2){
if (!hasLevel2) {
ToastUtils.showShort("运营后台没有配置故障类型")
return@setOnClickListener
}
if(faultTypeSelectStatus){
if (faultTypeSelectStatus) {
//关闭
faultTypeSelectStatus = false
tvFaultType.setCompoundDrawables(null, null, iconDown, null)
//隐藏列表
rvFaultList.visibility = View.GONE
}else{
} else {
//如果故障原因此时为打开状态,则关闭
if(faultReasonSelectStatus){
if (faultReasonSelectStatus) {
tvFaultReason.performClick()
}
//打开
@@ -247,68 +252,76 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
tvFaultType.setCompoundDrawables(null, null, iconUp, null)
//展示列表
rvFaultList.visibility = View.VISIBLE
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvFaultType
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom =
R.id.tvFaultType
source = 1
if(typeList.isNullOrEmpty()){
if (typeList.isNullOrEmpty()) {
//获取故障二级分类即故障类型
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
}else{
orderReasonAdapter.setData(typeList!!,source)
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
2,
level1Id,
type,
0
)
} else {
orderReasonAdapter.setData(typeList!!, source)
}
}
}
//故障原因选择
tvFaultReason.setOnClickListener {
if(tvFaultType.text.isEmpty()){
if (tvFaultType.text.isEmpty()) {
ToastUtils.showShort("请先选择故障类型")
return@setOnClickListener
}
if(faultReasonSelectStatus){
if (faultReasonSelectStatus) {
//关闭
faultReasonSelectStatus = false
tvFaultReason.setCompoundDrawables(null, null, iconDown, null)
//隐藏列表
rvFaultList.visibility = View.GONE
}else{
} else {
//打开
faultReasonSelectStatus = true
tvFaultReason.setCompoundDrawables(null, null, iconUp, null)
//展示列表
rvFaultList.visibility = View.VISIBLE
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvFaultReason
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom =
R.id.tvFaultReason
}
}
//发生时间
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
ivTimeReduce.setOnClickListener {
workOrderOccurrenceTime -= 60000
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
tvOccurrenceTime.text =
millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
}
ivTimeAdd.setOnClickListener {
if(workOrderOccurrenceTime + 60000 > System.currentTimeMillis()){
if (workOrderOccurrenceTime + 60000 > System.currentTimeMillis()) {
ToastUtils.showShort("发生时间应在当前时间之前")
return@setOnClickListener
}
workOrderOccurrenceTime += 60000
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
tvOccurrenceTime.text =
millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
}
//补充描述
etNoteInput.onFocusChangeListener = OnFocusChangeListener { v, hasFocus ->
val edit = v as EditText
if(hasFocus){
if (hasFocus) {
edit.hint = ""
}else{
} else {
edit.hint = "手动输入"
}
}
etNoteInput.addTextChangedListener(object: TextWatcher{
etNoteInput.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
@@ -325,26 +338,30 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
//问题描述录音
ivNoteAudio.setOnClickListener {
audioStatus = !audioStatus
if(audioStatus){
ivNoteAudio.setImageDrawable(ContextCompat.getDrawable(
mActivity,
R.drawable.icon_reason_audio_pressed
))
}else{
ivNoteAudio.setImageDrawable(ContextCompat.getDrawable(
mActivity,
R.drawable.icon_reason_audio_normal
))
if (audioStatus) {
ivNoteAudio.setImageDrawable(
ContextCompat.getDrawable(
mActivity,
R.drawable.icon_reason_audio_pressed
)
)
} else {
ivNoteAudio.setImageDrawable(
ContextCompat.getDrawable(
mActivity,
R.drawable.icon_reason_audio_normal
)
)
}
setAudio(audioStatus)
}
//上报
tvFaultReport.setOnClickListener{
if(level2Name.isEmpty()){
tvFaultReport.setOnClickListener {
if (level2Name.isEmpty()) {
ToastUtils.showShort("请完整填写再上报")
return@setOnClickListener
}
if(hasLevel3 && level3Name.isEmpty()){
if (hasLevel3 && level3Name.isEmpty()) {
ToastUtils.showShort("请完整填写再上报")
return@setOnClickListener
}
@@ -354,22 +371,26 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
faultCodeList.add(it.faultId)
}
val geocodeSearch = GeocodeSearch(mActivity)
geocodeSearch.setOnGeocodeSearchListener(object: GeocodeSearch.OnGeocodeSearchListener {
geocodeSearch.setOnGeocodeSearchListener(object :
GeocodeSearch.OnGeocodeSearchListener {
override fun onRegeocodeSearched(regeocodeResult: RegeocodeResult?, p1: Int) {
regeocodeResult?.regeocodeAddress?.formatAddress?.let {
address = it
}
val padProblemList= ArrayList<PadProblemInfo>()
val note = if(reportNote.isEmpty()){
val padProblemList = ArrayList<PadProblemInfo>()
val note = if (reportNote.isEmpty()) {
"$level1Name-$level2Name-$level3Name"
}else{
} else {
"$level1Name-$level2Name-$level3Name($reportNote)"
}
val padProblemInfo = PadProblemInfo(address,faultCodeList,millis2String(workOrderOccurrenceTime),level1Id,
level2Id,level3Id,BadCaseConfig.lineName,note,reportType,
SharedPrefsMgr.getInstance().getString("och_account",""))
val padProblemInfo = PadProblemInfo(
address, faultCodeList, millis2String(workOrderOccurrenceTime), level1Id,
level2Id, level3Id, BadCaseConfig.lineName, note, reportType,
SharedPrefsMgr.getInstance().getString("och_account", "")
)
padProblemList.add(padProblemInfo)
val padAddProblemReq = PadAddProblemReq(padProblemList,AppConfigInfo.plateNumber)
val padAddProblemReq =
PadAddProblemReq(padProblemList, AppConfigInfo.plateNumber)
CallerDevaToolsManager.problemPadAdd(padAddProblemReq)
}
@@ -377,8 +398,11 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
}
})
val latLon = LatLonPoint(CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude)
val q = RegeocodeQuery(latLon,200f,GeocodeSearch.AMAP)
val latLon = LatLonPoint(
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude,
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude
)
val q = RegeocodeQuery(latLon, 200f, GeocodeSearch.AMAP)
geocodeSearch.getFromLocationAsyn(q)
}
//取消
@@ -388,8 +412,8 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
}
private fun setAudio(status: Boolean){
if(status){
private fun setAudio(status: Boolean) {
if (status) {
//开始录音
mIat?.let {
//清空之前的内容
@@ -405,11 +429,12 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
val scaleAnimation = ScaleAnimation(
1.0f, 0.8f, 1.0f, 0.8f,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f)
Animation.RELATIVE_TO_SELF, 0.5f
)
scaleAnimation.duration = 1000
scaleAnimation.repeatCount = -1
ivNoteAudio.startAnimation(scaleAnimation)
}else{
} else {
//停止语音听写
mIat?.stopListening()
//结束动画
@@ -433,7 +458,7 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
/**
* 听写监听器。
*/
private val mRecognizerListener: RecognizerListener = object : RecognizerListener{
private val mRecognizerListener: RecognizerListener = object : RecognizerListener {
override fun onVolumeChanged(p0: Int, p1: ByteArray?) {
//showTip("当前正在说话,音量大小 = " + volume + " 返回音频数据 = " + data.length);
}
@@ -479,15 +504,16 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
private fun printResult(results: RecognizerResult) {
val text: String = JsonParser.parseIatResult(results.resultString)
Log.i(TAG, "语音内容=$text")
if(text.isNotEmpty()){
if(etNoteInput.text.toString().isEmpty()){
if (text.isNotEmpty()) {
if (etNoteInput.text.toString().isEmpty()) {
etNoteInput.setText(text)
etNoteInput.setSelection(text.length)
}else{
val startStr = etNoteInput.text.toString().substring(0,etNoteInput.selectionStart)
val endStr = etNoteInput.text.toString().substring(etNoteInput.selectionEnd,etNoteInput.text.toString().length)
etNoteInput.setText(startStr+text+endStr)
etNoteInput.setSelection(startStr.length+text.length)
} else {
val startStr = etNoteInput.text.toString().substring(0, etNoteInput.selectionStart)
val endStr = etNoteInput.text.toString()
.substring(etNoteInput.selectionEnd, etNoteInput.text.toString().length)
etNoteInput.setText(startStr + text + endStr)
etNoteInput.setSelection(startStr.length + text.length)
}
}
@@ -505,6 +531,7 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
mInScreenX = motionEvent.rawX
mInScreenY = motionEvent.rawY
}
MotionEvent.ACTION_MOVE -> {
// 更新浮动窗口位置参数
mInScreenX = motionEvent.rawX
@@ -523,19 +550,16 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
val metrics = DisplayMetrics()
// 默认固定位置,靠屏幕右边缘的中间
mWindowManager!!.defaultDisplay.getMetrics(metrics)
mWindowParams!!.x = metrics.widthPixels-890
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-1140
mWindowParams!!.x = metrics.widthPixels - 890
mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight() - 1140
mWindowManager!!.addView(mFloatLayout, mWindowParams)
}
}
fun hideFloatWindow() {
etNoteInput.clearFocus()
CallerDevaToolsListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
if (mFloatLayout.parent != null){
if (mFloatLayout.parent != null) {
mWindowManager!!.removeView(mFloatLayout)
}
}
@@ -563,7 +587,7 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
val successHandler = Handler(Looper.getMainLooper())
successHandler.postDelayed({
hideFloatWindow()
},1500)
}, 1500)
}
}
@@ -575,28 +599,34 @@ class FaultReasonWindow constructor(activity: Activity) : View.OnTouchListener,
override fun getCategoriesSuccess(list: List<CategoryInfo>) {
super.getCategoriesSuccess(list)
ThreadUtils.runOnUiThread {
if(list.isNotEmpty()){
if(source == 0){
if (list.isNotEmpty()) {
if (source == 0) {
level1Id = list[0].id
level1Name = list[0].name
source = 1
//获取故障二级分类即故障类型
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
}else{
if(source == 1){
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
2,
level1Id,
type,
0
)
} else {
if (source == 1) {
typeList = list
hasLevel2 = true
}else{
} else {
reasonList = list
hasLevel3 = true
}
orderReasonAdapter.setData(list,source)
orderReasonAdapter.setData(list, source)
}
}else{
if(source == 2){
} else {
if (source == 2) {
hasLevel3 = false
}else{
} else {
hasLevel2 = false
ToastUtils.showShort("故障类型列表为空")
}

View File

@@ -6,6 +6,7 @@ import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.call.och.CallerOchBizFunctionCall4EagleManager
import com.mogo.eagle.core.function.call.och.CallerOchCustomViewManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_bone_container.view.clBoneBiz
import kotlinx.android.synthetic.main.view_bone_container.view.clBoneTab
@@ -31,6 +32,10 @@ class BoneContainerView @JvmOverloads constructor(
clBoneTab.loginOut {
CallerOchBizFunctionCall4EagleManager.logout()
}
val bizView = CallerOchCustomViewManager.getOchBusinessView(context)
bizView?.let{
clBoneBiz.addView(it)
}
}
fun addBizView(view: View) {

View File

@@ -7,16 +7,11 @@ import android.os.Handler
import android.os.Looper
import android.text.Editable
import android.text.TextWatcher
import com.iflytek.cloud.ErrorCode
import com.iflytek.cloud.InitListener
import com.iflytek.cloud.RecognizerListener
import com.iflytek.cloud.RecognizerResult
import com.iflytek.cloud.SpeechError
import com.iflytek.cloud.SpeechRecognizer
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.View.OnFocusChangeListener
import android.view.animation.Animation
import android.view.animation.ScaleAnimation
import android.widget.EditText
@@ -28,17 +23,21 @@ import com.amap.api.services.geocoder.GeocodeResult
import com.amap.api.services.geocoder.GeocodeSearch
import com.amap.api.services.geocoder.RegeocodeQuery
import com.amap.api.services.geocoder.RegeocodeResult
import com.iflytek.cloud.ErrorCode
import com.iflytek.cloud.InitListener
import com.iflytek.cloud.RecognizerListener
import com.iflytek.cloud.RecognizerResult
import com.iflytek.cloud.SpeechError
import com.iflytek.cloud.SpeechRecognizer
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.deva.report.CategoryInfo
import com.mogo.eagle.core.data.deva.report.PadAddProblemReq
import com.mogo.eagle.core.data.deva.report.PadProblemInfo
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.JsonParser
import com.mogo.eagle.core.utilcode.util.ThreadUtils
@@ -69,12 +68,13 @@ class FaultReasonView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoDevaToolsListener, IOrderListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoDevaToolsListener {
private val TAG = "FaultReasonView"
// 语音听写对象
private var mIat: SpeechRecognizer? = null
// 用HashMap存储听写结果
private val mIatResults: HashMap<String, String> = LinkedHashMap()
@@ -102,8 +102,8 @@ class FaultReasonView @JvmOverloads constructor(
private var hasLevel2: Boolean = false //是否有二级分类
private var hasLevel3: Boolean = false //是否有三级分类
private var typeList: List<CategoryInfo> ?= null //故障类型列表
private var reasonList: List<CategoryInfo> ?= null //故障原因列表
private var typeList: List<CategoryInfo>? = null //故障类型列表
private var reasonList: List<CategoryInfo>? = null //故障原因列表
private var faultTypeSelectStatus: Boolean = false //故障类型选择状态
private var faultReasonSelectStatus: Boolean = false //故障原因选择状态
@@ -116,7 +116,7 @@ class FaultReasonView @JvmOverloads constructor(
initEvent()
}
private fun initView(){
private fun initView() {
// 初始化识别无UI识别对象
// 使用SpeechRecognizer对象可根据回调消息自定义界面
mIat = SpeechRecognizer.createRecognizer(context, mInitListener)
@@ -124,28 +124,34 @@ class FaultReasonView @JvmOverloads constructor(
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
rvFaultList.layoutManager = linearLayoutManager
orderReasonAdapter = OrderReasonAdapter()
orderReasonAdapter.setListener(object: OrderReasonAdapter.ReasonSelectListener{
orderReasonAdapter.setListener(object : OrderReasonAdapter.ReasonSelectListener {
override fun onSelectReason(reason: CategoryInfo, mSource: Int) {
if(mSource == 1){
if (mSource == 1) {
//类型
tvFaultType.text = reason.name
//选择了故障类型
tvFaultType.performClick()
if(level2Id != 0 && level2Id == reason.id){
if (level2Id != 0 && level2Id == reason.id) {
//故障类型选择没有变化
reasonList?.let { orderReasonAdapter.setData(it,2) }
}else{
reasonList?.let { orderReasonAdapter.setData(it, 2) }
} else {
//故障类型发生了变化
level2Id = reason.id
level2Name = reason.name
source = 2
//获取故障三级分类即故障原因
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,3,level2Id,type,0)
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
3,
level2Id,
type,
0
)
tvFaultReason.text = ""
level3Id = 0
level3Name = ""
}
}else{
} else {
//原因
tvFaultReason.text = reason.name
tvFaultReason.performClick()
@@ -158,32 +164,32 @@ class FaultReasonView @JvmOverloads constructor(
}
@SuppressLint("SetTextI18n")
private fun initEvent(){
private fun initEvent() {
CallerDevaToolsListenerManager.addListener(TAG, this)
CallerOrderListenerManager.addListener(TAG,this)
val iconDown = ContextCompat.getDrawable(context, R.drawable.icon_fault_expand)
iconDown?.setBounds(0, 0, iconDown.minimumWidth, iconDown.minimumHeight)
val iconUp = ContextCompat.getDrawable(context, R.drawable.icon_fault_retract)
iconUp?.setBounds(0, 0, iconUp.minimumWidth, iconUp.minimumHeight)
//获取一级分类
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,1,0,type,0)
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId, 1, 0, type, 0)
//弹窗展示时间
tvFaultTime.text = millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())
tvFaultTime.text =
millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())
//故障类型选择
tvFaultType.setOnClickListener {
if(!hasLevel2){
if (!hasLevel2) {
ToastUtils.showShort("运营后台没有配置故障类型")
return@setOnClickListener
}
if(faultTypeSelectStatus){
if (faultTypeSelectStatus) {
//关闭
faultTypeSelectStatus = false
tvFaultType.setCompoundDrawables(null, null, iconDown, null)
//隐藏列表
rvFaultList.visibility = View.GONE
}else{
} else {
//如果故障原因此时为打开状态,则关闭
if(faultReasonSelectStatus){
if (faultReasonSelectStatus) {
tvFaultReason.performClick()
}
//打开
@@ -191,36 +197,44 @@ class FaultReasonView @JvmOverloads constructor(
tvFaultType.setCompoundDrawables(null, null, iconUp, null)
//展示列表
rvFaultList.visibility = View.VISIBLE
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvFaultType
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom =
R.id.tvFaultType
source = 1
if(typeList.isNullOrEmpty()){
if (typeList.isNullOrEmpty()) {
//获取故障二级分类即故障类型
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
}else{
orderReasonAdapter.setData(typeList!!,source)
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
2,
level1Id,
type,
0
)
} else {
orderReasonAdapter.setData(typeList!!, source)
}
}
}
//故障原因选择
tvFaultReason.setOnClickListener {
if(tvFaultType.text.isEmpty()){
if (tvFaultType.text.isEmpty()) {
ToastUtils.showShort("请先选择故障类型")
return@setOnClickListener
}
if(faultReasonSelectStatus){
if (faultReasonSelectStatus) {
//关闭
faultReasonSelectStatus = false
tvFaultReason.setCompoundDrawables(null, null, iconDown, null)
//隐藏列表
rvFaultList.visibility = View.GONE
}else{
} else {
//打开
faultReasonSelectStatus = true
tvFaultReason.setCompoundDrawables(null, null, iconUp, null)
//展示列表
rvFaultList.visibility = View.VISIBLE
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom = R.id.tvFaultReason
(rvFaultList.layoutParams as ConstraintLayout.LayoutParams).topToBottom =
R.id.tvFaultReason
}
}
@@ -228,27 +242,29 @@ class FaultReasonView @JvmOverloads constructor(
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
ivTimeReduce.setOnClickListener {
workOrderOccurrenceTime -= 60000
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
tvOccurrenceTime.text =
millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
}
ivTimeAdd.setOnClickListener {
if(workOrderOccurrenceTime + 60000 > System.currentTimeMillis()){
if (workOrderOccurrenceTime + 60000 > System.currentTimeMillis()) {
ToastUtils.showShort("发生时间应在当前时间之前")
return@setOnClickListener
}
workOrderOccurrenceTime += 60000
tvOccurrenceTime.text = millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
tvOccurrenceTime.text =
millis2String(workOrderOccurrenceTime, TimeUtils.getHourMinFormat())
}
//补充描述
etNoteInput.onFocusChangeListener = OnFocusChangeListener { v, hasFocus ->
val edit = v as EditText
if(hasFocus){
if (hasFocus) {
edit.hint = ""
}else{
} else {
edit.hint = "手动输入"
}
}
etNoteInput.addTextChangedListener(object: TextWatcher {
etNoteInput.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
@@ -265,26 +281,30 @@ class FaultReasonView @JvmOverloads constructor(
//问题描述录音
ivNoteAudio.setOnClickListener {
audioStatus = !audioStatus
if(audioStatus){
ivNoteAudio.setImageDrawable(ContextCompat.getDrawable(
context,
R.drawable.icon_reason_audio_pressed
))
}else{
ivNoteAudio.setImageDrawable(ContextCompat.getDrawable(
context,
R.drawable.icon_reason_audio_normal
))
if (audioStatus) {
ivNoteAudio.setImageDrawable(
ContextCompat.getDrawable(
context,
R.drawable.icon_reason_audio_pressed
)
)
} else {
ivNoteAudio.setImageDrawable(
ContextCompat.getDrawable(
context,
R.drawable.icon_reason_audio_normal
)
)
}
setAudio(audioStatus)
}
//上报
tvFaultReport.setOnClickListener{
if(level2Name.isEmpty()){
tvFaultReport.setOnClickListener {
if (level2Name.isEmpty()) {
ToastUtils.showShort("请完整填写再上报")
return@setOnClickListener
}
if(hasLevel3 && level3Name.isEmpty()){
if (hasLevel3 && level3Name.isEmpty()) {
ToastUtils.showShort("请完整填写再上报")
return@setOnClickListener
}
@@ -294,22 +314,26 @@ class FaultReasonView @JvmOverloads constructor(
faultCodeList.add(it.faultId)
}
val geocodeSearch = GeocodeSearch(context)
geocodeSearch.setOnGeocodeSearchListener(object: GeocodeSearch.OnGeocodeSearchListener {
geocodeSearch.setOnGeocodeSearchListener(object :
GeocodeSearch.OnGeocodeSearchListener {
override fun onRegeocodeSearched(regeocodeResult: RegeocodeResult?, p1: Int) {
regeocodeResult?.regeocodeAddress?.formatAddress?.let {
address = it
}
val padProblemList= ArrayList<PadProblemInfo>()
val note = if(reportNote.isEmpty()){
val padProblemList = ArrayList<PadProblemInfo>()
val note = if (reportNote.isEmpty()) {
"$level1Name-$level2Name-$level3Name"
}else{
} else {
"$level1Name-$level2Name-$level3Name($reportNote)"
}
val padProblemInfo = PadProblemInfo(address,faultCodeList,millis2String(workOrderOccurrenceTime),level1Id,
level2Id,level3Id,BadCaseConfig.lineName,note,reportType,
SharedPrefsMgr.getInstance().getString("och_account",""))
val padProblemInfo = PadProblemInfo(
address, faultCodeList, millis2String(workOrderOccurrenceTime), level1Id,
level2Id, level3Id, BadCaseConfig.lineName, note, reportType,
SharedPrefsMgr.getInstance().getString("och_account", "")
)
padProblemList.add(padProblemInfo)
val padAddProblemReq = PadAddProblemReq(padProblemList, AppConfigInfo.plateNumber)
val padAddProblemReq =
PadAddProblemReq(padProblemList, AppConfigInfo.plateNumber)
CallerDevaToolsManager.problemPadAdd(padAddProblemReq)
}
@@ -317,8 +341,11 @@ class FaultReasonView @JvmOverloads constructor(
}
})
val latLon = LatLonPoint(CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude, CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude)
val q = RegeocodeQuery(latLon,200f,GeocodeSearch.AMAP)
val latLon = LatLonPoint(
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().latitude,
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().longitude
)
val q = RegeocodeQuery(latLon, 200f, GeocodeSearch.AMAP)
geocodeSearch.getFromLocationAsyn(q)
}
@@ -329,8 +356,8 @@ class FaultReasonView @JvmOverloads constructor(
}
}
private fun setAudio(status: Boolean){
if(status){
private fun setAudio(status: Boolean) {
if (status) {
//开始录音
mIat?.let {
//清空之前的内容
@@ -346,11 +373,12 @@ class FaultReasonView @JvmOverloads constructor(
val scaleAnimation = ScaleAnimation(
1.0f, 0.8f, 1.0f, 0.8f,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f)
Animation.RELATIVE_TO_SELF, 0.5f
)
scaleAnimation.duration = 1000
scaleAnimation.repeatCount = -1
ivNoteAudio.startAnimation(scaleAnimation)
}else{
} else {
//停止语音听写
mIat?.stopListening()
//结束动画
@@ -370,7 +398,7 @@ class FaultReasonView @JvmOverloads constructor(
/**
* 听写监听器。
*/
private val mRecognizerListener: RecognizerListener = object : RecognizerListener{
private val mRecognizerListener: RecognizerListener = object : RecognizerListener {
override fun onVolumeChanged(p0: Int, p1: ByteArray?) {
//showTip("当前正在说话,音量大小 = " + volume + " 返回音频数据 = " + data.length);
}
@@ -412,15 +440,16 @@ class FaultReasonView @JvmOverloads constructor(
private fun printResult(results: RecognizerResult) {
val text: String = JsonParser.parseIatResult(results.resultString)
Log.i(TAG, "语音内容=$text")
if(text.isNotEmpty()){
if(etNoteInput.text.toString().isEmpty()){
if (text.isNotEmpty()) {
if (etNoteInput.text.toString().isEmpty()) {
etNoteInput.setText(text)
etNoteInput.setSelection(text.length)
}else{
val startStr = etNoteInput.text.toString().substring(0,etNoteInput.selectionStart)
val endStr = etNoteInput.text.toString().substring(etNoteInput.selectionEnd,etNoteInput.text.toString().length)
etNoteInput.setText(startStr+text+endStr)
etNoteInput.setSelection(startStr.length+text.length)
} else {
val startStr = etNoteInput.text.toString().substring(0, etNoteInput.selectionStart)
val endStr = etNoteInput.text.toString()
.substring(etNoteInput.selectionEnd, etNoteInput.text.toString().length)
etNoteInput.setText(startStr + text + endStr)
etNoteInput.setSelection(startStr.length + text.length)
}
}
@@ -450,7 +479,7 @@ class FaultReasonView @JvmOverloads constructor(
successHandler.postDelayed({
this@FaultReasonView.visibility = View.GONE
clickListener?.closeFaultReasonView()
},1500)
}, 1500)
}
}
@@ -462,28 +491,34 @@ class FaultReasonView @JvmOverloads constructor(
override fun getCategoriesSuccess(list: List<CategoryInfo>) {
super.getCategoriesSuccess(list)
ThreadUtils.runOnUiThread {
if(list.isNotEmpty()){
if(source == 0){
if (list.isNotEmpty()) {
if (source == 0) {
level1Id = list[0].id
level1Name = list[0].name
source = 1
//获取故障二级分类即故障类型
CallerDevaToolsManager.getCategories(BadCaseConfig.tenantId,2,level1Id,type,0)
}else{
if(source == 1){
CallerDevaToolsManager.getCategories(
BadCaseConfig.tenantId,
2,
level1Id,
type,
0
)
} else {
if (source == 1) {
typeList = list
hasLevel2 = true
}else{
} else {
reasonList = list
hasLevel3 = true
}
orderReasonAdapter.setData(list,source)
orderReasonAdapter.setData(list, source)
}
}else{
if(source == 2){
} else {
if (source == 2) {
hasLevel3 = false
}else{
} else {
hasLevel2 = false
ToastUtils.showShort("故障类型列表为空")
}

View File

@@ -12,13 +12,13 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.bone.tab.adapter.MsgBoxTabAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
@@ -38,8 +38,7 @@ class MsgBoxTabView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener,
IOrderListener {
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener, IDataCenterBizListener {
init {
LayoutInflater.from(context).inflate(R.layout.view_msg_box_tab, this, true)
@@ -285,7 +284,7 @@ class MsgBoxTabView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
EventBus.getDefault().register(this)
}
@@ -293,7 +292,7 @@ class MsgBoxTabView @JvmOverloads constructor(
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
EventBus.getDefault().unregister(this)
}
@@ -338,7 +337,8 @@ class MsgBoxTabView @JvmOverloads constructor(
}
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
}

View File

@@ -9,13 +9,13 @@ import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelStoreOwner
import com.mogo.commons.env.ProjectUtils
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.och.toolkit.IToolKitItemClickListener
import com.mogo.eagle.core.function.api.och.toolkit.ToolKitCustomItemAddParam
import com.mogo.eagle.core.function.api.och.toolkit.ToolKitDefaultItemAddParam
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.bone.toolkit.custom.ToolDriverRomaView
import com.mogo.eagle.core.function.hmi.bone.toolkit.custom.ToolRestartSystemView
@@ -32,7 +32,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import java.util.concurrent.ConcurrentHashMap
import kotlin.system.exitProcess
object ToolKitDataManager : IToolKitItemClickListener, IOrderListener {
object ToolKitDataManager : IToolKitItemClickListener, IDataCenterBizListener {
const val TAG = "ToolKitDataManager"
enum class ToolTypeEnum {
@@ -76,7 +76,7 @@ object ToolKitDataManager : IToolKitItemClickListener, IOrderListener {
return
}
// 注册登录/登出 监听
CallerOrderListenerManager.addListener(TAG, this)
CallerDataCenterBizListener.addListener(TAG, this)
// 添加默认的工具箱items
toolList.also {
it += ToolKitBean(
@@ -360,8 +360,8 @@ object ToolKitDataManager : IToolKitItemClickListener, IOrderListener {
// }
}
override fun onLoginStatusUpdate(isLogin: Boolean) {
super.onLoginStatusUpdate(isLogin)
override fun invokeLoginStatus(isLogin: Boolean) {
super.invokeLoginStatus(isLogin)
Logger.i(TAG, "onLoginStatusUpdate isLogin=$isLogin")
if (!isLogin) {
unInit()
@@ -371,4 +371,5 @@ object ToolKitDataManager : IToolKitItemClickListener, IOrderListener {
}
}
}
}

View File

@@ -14,8 +14,8 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.marginStart
import androidx.core.view.marginTop
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
import com.mogo.map.listener.IMogoMapListener
@@ -29,7 +29,8 @@ class MapContainerLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMogoMapListener, IOrderListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMogoMapListener,
IDataCenterBizListener {
@Volatile
private var isScaled = false
@@ -104,7 +105,7 @@ class MapContainerLayout @JvmOverloads constructor(
"${TAG}${this.hashCode()}",
this
)
CallerOrderListenerManager.addListener("${TAG}${this.hashCode()}", this)
CallerDataCenterBizListener.addListener("${TAG}${this.hashCode()}", this)
}
override fun onDetachedFromWindow() {
@@ -125,8 +126,8 @@ class MapContainerLayout @JvmOverloads constructor(
super.onMapClick(latLng)
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
super.onUpdateOrderStatus(inOrder)
override fun invokeOrderStatus(inOrder: Boolean) {
super.invokeOrderStatus(inOrder)
if (!inOrder) {// 订单结束
if (isScaled) {// 行程总览地图
overMapView.clearAllMarkersAndPolyline()

View File

@@ -17,19 +17,18 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.data.msgbox.MsgFmData
import com.mogo.eagle.core.function.api.autopilot.IMoGoNodeStateListener
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
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.autopilot.CallerNodeStateListenerManager
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.DriverMsgBoxBubbleAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.SoundPoolUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.zhjt.mogo.adas.data.AdasConstants
@@ -47,22 +46,25 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener,IOrderListener,
IMoGoNodeStateListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener,
IMoGoNodeStateListener, IDataCenterBizListener {
init {
LayoutInflater.from(context).inflate(R.layout.layout_driver_msg_box_bubble, this, true)
initView()
}
var driverMsgBoxBubbleAdapter: DriverMsgBoxBubbleAdapter ?=null
var driverMsgBoxBubbleAdapter: DriverMsgBoxBubbleAdapter? = null
private val TAG = "DriverMsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
private val TAG = "DriverMsgBoxBubbleView"
private val dataList: ArrayList<MsgBoxCountDownBean> = ArrayList()
private var isShowData = true
private var isShowSummary = false //是否展示汇总消息
private val fsmNodeState by lazy { // 是否存在 FSM 模块
AtomicReference<NodeState>(CallerAutoPilotControlManager.getNodeStateInfo(AdasConstants.NodeName.FSM2024)?.nodeState ?: NodeState.NODE_UNKNOWN)
AtomicReference<NodeState>(
CallerAutoPilotControlManager.getNodeStateInfo(AdasConstants.NodeName.FSM2024)?.nodeState
?: NodeState.NODE_UNKNOWN
)
}
private fun initView() {
@@ -71,9 +73,10 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
linearLayoutManager.stackFromEnd = true
linearLayoutManager.reverseLayout = true
driverMsgBoxBubbleAdapter = DriverMsgBoxBubbleAdapter(context as Activity)
driverMsgBoxBubbleAdapter?.setChangeListener(object : DriverMsgBoxBubbleAdapter.ChangeViewListener{
driverMsgBoxBubbleAdapter?.setChangeListener(object :
DriverMsgBoxBubbleAdapter.ChangeViewListener {
override fun notifyView() {
if(dataList.isEmpty()){
if (dataList.isEmpty()) {
clMsgBubbleLayout.visibility = View.GONE
}
}
@@ -87,7 +90,7 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
* 是否展示接收消息,消息盒子打开状态下不再展示气泡消息
* @param show true 展示false 不展示
*/
fun isShowData(show: Boolean){
fun isShowData(show: Boolean) {
isShowData = show
}
@@ -97,86 +100,97 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
MsgCategory.NOTICE -> {
MsgBoxConfig.noticeList.add(msgBoxBean)
}
MsgCategory.SYS_INFO -> {
MsgBoxConfig.systemInfoList.add(msgBoxBean)
}
MsgCategory.RECORD_BAG -> {
MsgBoxConfig.recordBagList.add(msgBoxBean)
}
else -> {}
}
if(isShowData){
if(category == MsgCategory.RECORD_BAG){
if(!FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isShowBagRecordWindow){
if (isShowData) {
if (category == MsgCategory.RECORD_BAG) {
if (!FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isShowBagRecordWindow) {
//弹出被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,context as Activity,true)
CallerDevaToolsManager.onReceiveBadCaseRecord(
msgBoxBean,
context as Activity,
true
)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
}
} else if(category == MsgCategory.SYS_INFO){
} else if (category == MsgCategory.SYS_INFO) {
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(msgBoxBean.type == MsgBoxType.REPORT){
if (msgBoxBean.type == MsgBoxType.REPORT) {
val reportMsg = msgBoxBean.bean as ReportEntity
//P8-P1均只收在消息盒子里P0消息盒子弹出其中P0弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
var isShowReport = false
for(action in reportMsg.actionsList){
if("ACTION_MANUAL_HANDLE_IMMEDIATELY" == action){
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
for (action in reportMsg.actionsList) {
if ("ACTION_MANUAL_HANDLE_IMMEDIATELY" == action) {
if (CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7
) {
isShowReport = true
}
}
}
if(isShowReport){
if (isShowReport) {
//展示消息
showData(msgBoxBean)
}
}
} else if(category == MsgCategory.FM_INFO){
} else if (category == MsgCategory.FM_INFO) {
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(FunctionBuildConfig.isTakeoverRemind){
if (FunctionBuildConfig.isTakeoverRemind) {
//属于停车警示(包括择机靠边停车、立即舒适停车、就地紧急停车)时,需要弹出消息气泡并伴有提示音
val fmInfoMsg = msgBoxBean.bean as FMInfoMsg
var curFaultLevel = 5 //默认级别遍历数组找出级别最高的level数越小级别越高
fmInfoMsg.fmInfoList?.forEach { faultInfo ->
if(faultInfo.faultActionCount>0){
faultInfo.faultActionList.forEach {actionCode ->
if (faultInfo.faultActionCount > 0) {
faultInfo.faultActionList.forEach { actionCode ->
//获取建议操作级别,得到建议操作级别最高的操作
if(MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel){
curFaultLevel = MsgFmData.FaultAction.getFaultLevel(actionCode)
if (MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel) {
curFaultLevel =
MsgFmData.FaultAction.getFaultLevel(actionCode)
}
}
}
}
//P0级消息弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
if(curFaultLevel == 0){
if (curFaultLevel == 0) {
//自动驾驶状态 0是不可用 1是ready 2是自动驾驶中 7:平行驾驶中
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
if (CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7
) {
// 6.6.0 ,因为 FSM 模块也会弹修改为只有没有 FSM 模块才弹
// 6.6.0 20240823 考虑到 FSM 初期消息不一定全,先不加限制,产品先观察功能后再考虑是否过滤
// if (hasNoneFSMNode()) {
//语音提示
try {
SoundPoolUtils.getSoundPool().playSoundWithRedId(context,R.raw.weak_net_tips)
}catch (e: Exception){
e.printStackTrace()
}
//展示消息
showData(msgBoxBean)
//语音提示
try {
SoundPoolUtils.getSoundPool()
.playSoundWithRedId(context, R.raw.weak_net_tips)
} catch (e: Exception) {
e.printStackTrace()
}
//展示消息
showData(msgBoxBean)
//}
}
}
}
} else{
if(msgBoxBean.sourceType == DataSourceType.SUMMARY){
} else {
if (msgBoxBean.sourceType == DataSourceType.SUMMARY) {
//在一次订单中汇总消息只展示一次
if(isShowSummary){
if (isShowSummary) {
showData(msgBoxBean)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
isShowSummary = false
}
}else{
if(msgBoxBean.type == MsgBoxType.V2X){
} else {
if (msgBoxBean.type == MsgBoxType.V2X) {
//鹰眼650需求不再展示气泡态V2X消息
return@post
}
@@ -190,23 +204,27 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerNodeStateListenerManager.addNodeStateListener(TAG, setOf(AdasConstants.NodeName.FSM2024), this)
CallerMsgBoxListenerManager.addListener(TAG, this)
CallerDataCenterBizListener.addListener(TAG, this)
CallerNodeStateListenerManager.addNodeStateListener(
TAG,
setOf(AdasConstants.NodeName.FSM2024),
this
)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
CallerNodeStateListenerManager.removeNodeStateListener(TAG)
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
private fun showData(msgBoxBean: MsgBoxBean){
private fun showData(msgBoxBean: MsgBoxBean) {
clMsgBubbleLayout.visibility = View.VISIBLE
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxBean)
dataList.add(msgBoxCountDownBean)

View File

@@ -7,21 +7,19 @@ import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.DriverMsgBoxListAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.layout_driver_msg_box_list.view.*
import org.greenrobot.eventbus.EventBus
@@ -37,8 +35,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener,
IOrderListener {
) : ConstraintLayout(context, attrs, defStyleAttr) , IMsgBoxListener, IMsgBoxEventListener, IDataCenterBizListener {
init {
LayoutInflater.from(context).inflate(R.layout.layout_driver_msg_box_list, this, true)
@@ -280,7 +277,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
EventBus.getDefault().register(this)
}
@@ -288,7 +285,7 @@ class DriverMsgBoxListView @JvmOverloads constructor(
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
EventBus.getDefault().unregister(this)
}
@@ -333,7 +330,8 @@ class DriverMsgBoxListView @JvmOverloads constructor(
}
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
}

View File

@@ -6,10 +6,10 @@ import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_m1_msg_box_button.view.*
@@ -20,7 +20,8 @@ class MMsgBoxButtonView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
): ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener, IOrderListener {
): ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener,
IDataCenterBizListener {
companion object {
const val TAG = "MMsgBoxButtonView"
@@ -43,13 +44,13 @@ class MMsgBoxButtonView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
}
override fun onSummaryClickEvent() {
@@ -88,7 +89,8 @@ class MMsgBoxButtonView @JvmOverloads constructor(
fun showMsgBoxList(show: Boolean)
}
override fun onOrderRemoval() {
override fun invokeOrderRemoval() {
super.invokeOrderRemoval()
//核销订单,去除红点
msgBoxMTipView.visibility = View.GONE
}

View File

@@ -13,13 +13,13 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.data.msgbox.OperationMsg
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.MMsgBoxListAdapter
import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable
@@ -33,11 +33,12 @@ class MMsgBoxListView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener,
IOrderListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener, IDataCenterBizListener {
private val TAG = "MMsgBoxListView"
var mMsgBoxListAdapter: MMsgBoxListAdapter?= null
companion object{
private const val TAG = "MMsgBoxListView"
}
private var mMsgBoxListAdapter: MMsgBoxListAdapter?= null
private var noticeList: ArrayList<MsgBoxBean> ?= null
init{
@@ -89,14 +90,14 @@ class MMsgBoxListView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
}
override fun onSummaryClickEvent() {
@@ -121,7 +122,7 @@ class MMsgBoxListView @JvmOverloads constructor(
}
override fun onOrderRemoval() {
override fun invokeOrderRemoval() {
//清除历史消息,并刷新列表
CallerMsgBoxManager.delMsgTable(context)
noticeList?.let {

View File

@@ -16,13 +16,13 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxCountDownBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.data.msgbox.MsgFmData
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.MsgBoxToastAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
@@ -38,22 +38,25 @@ class MsgBoxToastView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IOrderListener{
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener,
IDataCenterBizListener {
companion object {
private const val TAG = "MsgBoxToastView"
}
init {
LayoutInflater.from(context).inflate(R.layout.layout_msg_box_bubble, this, true)
initView()
}
var msgBoxToastAdapter: MsgBoxToastAdapter ?= null
private val TAG = "MsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
private var msgBoxToastAdapter: MsgBoxToastAdapter? = null
private val dataList: ArrayList<MsgBoxCountDownBean> = ArrayList()
private var isShowData = true
private var isShowSummary = false //是否展示汇总消息
private fun initView(){
private fun initView() {
val linearLayoutManager = LinearLayoutManager(context)
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
linearLayoutManager.stackFromEnd = true
@@ -61,7 +64,7 @@ class MsgBoxToastView @JvmOverloads constructor(
msgBoxToastAdapter = MsgBoxToastAdapter(context as Activity)
msgBoxToastAdapter?.setChangeListener(object : MsgBoxToastAdapter.ChangeViewListener{
override fun notifyView() {
if(dataList.isEmpty()){
if (dataList.isEmpty()) {
llMsgBubbleLayout.visibility = View.GONE
}
}
@@ -75,7 +78,7 @@ class MsgBoxToastView @JvmOverloads constructor(
* 是否展示接收消息,消息盒子打开状态下不再展示气泡消息
* @param show true 展示false 不展示
*/
fun isShowData(show: Boolean){
fun isShowData(show: Boolean) {
isShowData = show
}
@@ -85,68 +88,79 @@ class MsgBoxToastView @JvmOverloads constructor(
MsgCategory.NOTICE -> {
MsgBoxConfig.noticeList.add(msgBoxBean)
}
MsgCategory.SYS_INFO -> {
MsgBoxConfig.systemInfoList.add(msgBoxBean)
}
MsgCategory.RECORD_BAG -> {
MsgBoxConfig.recordBagList.add(msgBoxBean)
}
else -> {}
}
if(isShowData){
if(category == MsgCategory.RECORD_BAG){
if(!FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isShowBagRecordWindow){
if (isShowData) {
if (category == MsgCategory.RECORD_BAG) {
if (!FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isShowBagRecordWindow) {
//弹出被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,context as Activity,true)
CallerDevaToolsManager.onReceiveBadCaseRecord(
msgBoxBean,
context as Activity,
true
)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
}
} else if(category == MsgCategory.SYS_INFO){
} else if (category == MsgCategory.SYS_INFO) {
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(msgBoxBean.type == MsgBoxType.REPORT){
if (msgBoxBean.type == MsgBoxType.REPORT) {
val reportMsg = msgBoxBean.bean as ReportEntity
//P8-P1均只收在消息盒子里P0消息盒子弹出其中P0弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
var isShowReport = false
for(action in reportMsg.actionsList){
if("ACTION_MANUAL_HANDLE_IMMEDIATELY" == action){
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
for (action in reportMsg.actionsList) {
if ("ACTION_MANUAL_HANDLE_IMMEDIATELY" == action) {
if (CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7
) {
isShowReport = true
}
}
}
if(isShowReport){
if (isShowReport) {
//展示消息
showData(msgBoxBean)
}
}
} else if(category == MsgCategory.FM_INFO){
} else if (category == MsgCategory.FM_INFO) {
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
if(FunctionBuildConfig.isTakeoverRemind){
if (FunctionBuildConfig.isTakeoverRemind) {
//属于停车警示(包括择机靠边停车、立即舒适停车、就地紧急停车)时,需要弹出消息气泡并伴有提示音
val fmInfoMsg = msgBoxBean.bean as FMInfoMsg
var curFaultLevel = 5 //默认级别遍历数组找出级别最高的level数越小级别越高
fmInfoMsg.fmInfoList?.forEach { faultInfo ->
if(faultInfo.faultActionCount>0){
faultInfo.faultActionList.forEach {actionCode ->
if (faultInfo.faultActionCount > 0) {
faultInfo.faultActionList.forEach { actionCode ->
//获取建议操作级别,得到建议操作级别最高的操作
if(MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel){
curFaultLevel = MsgFmData.FaultAction.getFaultLevel(actionCode)
if (MsgFmData.FaultAction.getFaultLevel(actionCode) < curFaultLevel) {
curFaultLevel =
MsgFmData.FaultAction.getFaultLevel(actionCode)
}
}
}
}
//P0级消息弹出时需要判断驾驶状态非自动驾驶、非平行驾驶状态不弹出其余状态弹出
if(curFaultLevel == 0){
if (curFaultLevel == 0) {
//自动驾驶状态 0是不可用 1是ready 2是自动驾驶中 7:平行驾驶中
if(CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7){
if (CallerAutoPilotStatusListenerManager.getState() == 2
|| CallerAutoPilotStatusListenerManager.getState() == 7
) {
// 6.6.0 ,因为 FSM 模块也会弹修改为只有没有 FSM 模块才弹
// 6.6.0 20240823 考虑到 FSM 初期消息不一定全,先不加限制,产品先观察功能后再考虑是否过滤
// if (hasNoneFSMNode()) {
//语音提示
try {
SoundPoolUtils.getSoundPool().playSoundWithRedId(context,R.raw.weak_net_tips)
}catch (e: Exception){
SoundPoolUtils.getSoundPool()
.playSoundWithRedId(context, R.raw.weak_net_tips)
} catch (e: Exception) {
e.printStackTrace()
}
//展示消息
@@ -155,16 +169,16 @@ class MsgBoxToastView @JvmOverloads constructor(
}
}
}
} else{
if(msgBoxBean.sourceType == DataSourceType.SUMMARY){
} else {
if (msgBoxBean.sourceType == DataSourceType.SUMMARY) {
//在一次订单中汇总消息只展示一次
if(isShowSummary){
if (isShowSummary) {
showData(msgBoxBean)
CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true)
isShowSummary = false
}
}else{
if(msgBoxBean.type == MsgBoxType.V2X){
} else {
if (msgBoxBean.type == MsgBoxType.V2X) {
//鹰眼650需求不再展示气泡态V2X消息
return@post
}
@@ -178,21 +192,21 @@ class MsgBoxToastView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerMsgBoxListenerManager.addListener(TAG, this)
CallerDataCenterBizListener.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}
private fun showData(msgBoxBean: MsgBoxBean){
private fun showData(msgBoxBean: MsgBoxBean) {
llMsgBubbleLayout.visibility = View.VISIBLE
val msgBoxCountDownBean = MsgBoxCountDownBean(msgBoxBean)
dataList.add(msgBoxCountDownBean)

View File

@@ -12,12 +12,12 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxCountDownBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.data.msgbox.VoiceMsg
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.PassengerMsgBoxBubbleAdapter
import com.mogo.eagle.core.function.msgbox.MsgBoxConfig
@@ -34,8 +34,8 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IOrderListener,
IMsgBoxEventListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener,
IMsgBoxEventListener, IDataCenterBizListener {
private val TAG = "PassengerMsgBoxBubbleView"
private val dataList :ArrayList<MsgBoxCountDownBean> = ArrayList()
@@ -174,18 +174,18 @@ class PassengerMsgBoxBubbleView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}

View File

@@ -11,13 +11,13 @@ import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.MsgCategory
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener
import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.PassengerMsgBoxListAdapter
import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable
@@ -34,7 +34,7 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener,
IOrderListener {
IDataCenterBizListener {
private val TAG = "PassengerMsgBoxListView"
var passengerMsgBoxListAdapter: PassengerMsgBoxListAdapter ?= null
@@ -93,14 +93,14 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
super.onAttachedToWindow()
CallerMsgBoxListenerManager.addListener(TAG,this)
CallerMsgBoxEventListenerManager.addListener(TAG,this)
CallerOrderListenerManager.addListener(TAG,this)
CallerDataCenterBizListener.addListener(TAG,this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerMsgBoxListenerManager.removeListener(TAG)
CallerMsgBoxEventListenerManager.removeListener(TAG)
CallerOrderListenerManager.removeListener(TAG)
CallerDataCenterBizListener.removeListener(TAG)
}
override fun onSummaryClickEvent() {
@@ -125,7 +125,7 @@ class PassengerMsgBoxListView @JvmOverloads constructor(
}
override fun onUpdateOrderStatus(inOrder: Boolean) {
override fun invokeOrderStatus(inOrder: Boolean) {
isShowSummary = inOrder
}

View File

@@ -7,9 +7,8 @@ import android.view.View
import android.view.WindowManager
import android.view.animation.OvershootInterpolator
import com.mogo.eagle.core.data.enums.SidePattern
import com.mogo.eagle.core.data.status.StatusSummaryEntity
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator
import com.mogo.eagle.core.utilcode.util.BarUtils
@@ -33,9 +32,9 @@ class StatusView private constructor() {
}
init {
CallerOrderListenerManager.addListener(TAG, object : IOrderListener{
override fun onLoginStatusUpdate(isLogin: Boolean) {
super.onLoginStatusUpdate(isLogin)
CallerDataCenterBizListener.addListener(TAG, object : IDataCenterBizListener {
override fun invokeLoginStatus(isLogin: Boolean) {
super.invokeLoginStatus(isLogin)
if (!isLogin) {
dismiss()
}
@@ -43,7 +42,11 @@ class StatusView private constructor() {
})
}
fun toggle(context: Context, gravity: Int = Gravity.RIGHT, sidePattern: SidePattern = SidePattern.RIGHT) {
fun toggle(
context: Context,
gravity: Int = Gravity.RIGHT,
sidePattern: SidePattern = SidePattern.RIGHT
) {
if (mStatusSummaryViewFloat != null) {
dismiss()
} else {
@@ -57,7 +60,7 @@ class StatusView private constructor() {
}
val height = AutoSizeUtils.dp2px(context, 1100f)
val maxHeight = ScreenUtils.getScreenHeight() - BarUtils.getStatusBarHeight()
val currentHeight = if(height>maxHeight) maxHeight else height
val currentHeight = if (height > maxHeight) maxHeight else height
mStatusSummaryViewFloat = WarningFloat.with(context)
.setTag("StatusSummaryView")
.setLayout(mStatusSummaryView!!)

View File

@@ -20,7 +20,7 @@
android:id="@+id/clBoneBiz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_309"
android:layout_marginTop="@dimen/dp_385"
android:layout_marginStart="@dimen/dp_19"
android:elevation="1dp"
app:layout_constraintLeft_toLeftOf="parent"
@@ -30,7 +30,7 @@
android:id="@+id/clBoneTab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_309"
android:layout_marginTop="@dimen/dp_385"
android:elevation="20dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -124,7 +124,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_39"
android:layout_marginEnd="@dimen/dp_23"
android:visibility="visible"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -134,7 +134,7 @@
android:layout_height="@dimen/dp_790"
android:layout_marginTop="@dimen/dp_39"
android:layout_marginEnd="@dimen/dp_4"
android:visibility="visible"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -7,4 +7,19 @@ interface IDataCenterBizListener {
fun invokeCarRes(res:Int){}
fun invokeCarNo(no:String?){}
fun invokeOrderStatus(inOrder: Boolean){}
fun invokeOrderRemoval(){}
fun invokeOrderLine(lineName: String){}
fun invokeTenantId(tenantId: Long){}
fun invokeLoginStatus(isLogin: Boolean){}
fun isLoginStatus(): Boolean{
return false
}
}

View File

@@ -76,6 +76,35 @@ interface IEagleBaseFunctionCall4Och {
*/
fun setOchLoginNo(loginNo: String?){}
/**
* 通知订单状态
* @param inOrder true:开始订单false:订单结束
*/
fun updateOrderStatus(inOrder: Boolean){}
/**
* 订单核销
*/
fun onOrderRemoval(){}
/**
* 订单路线名称变化监听
* @param lineName 路线名称
*/
fun updateOrderLine(lineName: String){}
/**
* 租户id变化监听
* @param tenantId 租户id
*/
fun updateTenantId(tenantId: Long){}
/**
* 登录状态变化通知
* @param isLogin 是否已登录
*/
fun updateLoginStatus(isLogin: Boolean) {}
/**
* Och设置 启动自动驾驶附带的orderId
*/

View File

@@ -12,7 +12,7 @@ interface IOchFunctionCallNotify {
/**
* 网约车回调登陆信息
*/
fun notifyLoginInfo(loginNo: String?) {}
fun notifyLoginInfo(loginNo: String?)
// 车型变化回调
fun notifyCarMode(carModel: Carmodel)
@@ -20,6 +20,18 @@ interface IOchFunctionCallNotify {
// 车牌变化回调
fun notifyPlateNumber(plateNumber: String?)
fun loginOut() {}
// 订单状态变化回调
fun notifyOrderStatus(inOrder: Boolean)
// 订单核销
fun notifyOrderRemoval()
// 订单线路变化,BadCase使用非业务订单ID
fun notifyOrderLine(lineName: String)
// 订单租户变化
fun notifyTenantId(tenantId: Long)
// 登录状态变化
fun notifyLoginStatus(isLogin: Boolean)
}

View File

@@ -1,38 +0,0 @@
package com.mogo.eagle.core.function.api.order
/**
* @author XuXinChao
* @date 2023/4/20
* 订单事件监听回调
*/
interface IOrderListener {
/**
* 通知订单状态
* @param inOrder true:开始订单false:订单结束
*/
fun onUpdateOrderStatus(inOrder: Boolean){}
/**
* 订单核销
*/
fun onOrderRemoval(){}
/**
* 订单路线名称变化监听
* @param lineName 路线名称
*/
fun onOrderLineUpdate(lineName: String){}
/**
* 租户id变化监听
* @param tenantId 租户id
*/
fun onTenantIdUpdate(tenantId: Long){}
/**
* 登录状态变化通知
* @param isLogin 是否已登录
*/
fun onLoginStatusUpdate(isLogin: Boolean) {}
}

View File

@@ -2,21 +2,33 @@ package com.mogo.eagle.core.function.call.datacenter
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
import com.mogo.eagle.core.function.call.base.CallerBase
import java.util.concurrent.atomic.AtomicBoolean
object CallerDataCenterBizListener : CallerBase<IDataCenterBizListener>() {
private var res:Int = 0
private var loginNo:String? = null
private var no:String? = null
@Volatile
private var res: Int = 0
@Volatile
private var loginNo: String? = null
@Volatile
private var no: String? = null
@Volatile
private var inOrder: Boolean = false
private val isLoginStatus by lazy { AtomicBoolean(false) }
override fun doSomeAfterAddListener(tag: String, listener: IDataCenterBizListener) {
super.doSomeAfterAddListener(tag, listener)
listener.invokeLoginNo(no)
listener.invokeCarRes(res)
listener.invokeCarNo(no)
listener.invokeOrderStatus(inOrder)
}
fun invokeLoginNo(loginNo: String?){
fun invokeLoginNo(loginNo: String?) {
this.loginNo = loginNo
M_LISTENERS.forEach {
it.value.invokeLoginNo(loginNo)
@@ -36,4 +48,40 @@ object CallerDataCenterBizListener : CallerBase<IDataCenterBizListener>() {
it.value.invokeCarNo(no)
}
}
fun invokeOrderStatus(inOrder: Boolean) {
this.inOrder = inOrder
M_LISTENERS.forEach {
it.value.invokeOrderStatus(inOrder)
}
}
fun invokeOrderRemoval() {
M_LISTENERS.forEach {
it.value.invokeOrderRemoval()
}
}
fun invokeOrderLine(lineName: String) {
M_LISTENERS.forEach {
it.value.invokeOrderLine(lineName)
}
}
fun invokeTenantId(tenantId: Long) {
M_LISTENERS.forEach {
it.value.invokeTenantId(tenantId)
}
}
fun invokeLoginStatus(isLogin: Boolean) {
isLoginStatus.set(isLogin)
M_LISTENERS.forEach {
it.value.invokeLoginStatus(isLogin)
}
}
fun isLoginStatus(): Boolean {
return isLoginStatus.get()
}
}

View File

@@ -28,4 +28,24 @@ object CallerDataCenterBizManager: IOchFunctionCallNotify {
dataCenterBizProviderApi?.notifyPlateNumber(plateNumber)
}
override fun notifyOrderStatus(inOrder: Boolean) {
dataCenterBizProviderApi?.notifyOrderStatus(inOrder)
}
override fun notifyOrderRemoval() {
dataCenterBizProviderApi?.notifyOrderRemoval()
}
override fun notifyOrderLine(lineName: String) {
dataCenterBizProviderApi?.notifyOrderLine(lineName)
}
override fun notifyTenantId(tenantId: Long) {
dataCenterBizProviderApi?.notifyTenantId(tenantId)
}
override fun notifyLoginStatus(isLogin: Boolean) {
dataCenterBizProviderApi?.notifyLoginStatus(isLogin)
}
}

View File

@@ -111,6 +111,26 @@ object CallerEagleBaseFunctionCall4OchManager : IEagleBaseFunctionCall4Och {
CallerDataCenterBizManager.notifyLoginInfo(loginNo)
}
override fun updateOrderStatus(inOrder: Boolean) {
CallerDataCenterBizManager.notifyOrderStatus(inOrder)
}
override fun updateTenantId(tenantId: Long) {
CallerDataCenterBizManager.notifyTenantId(tenantId)
}
override fun updateOrderLine(lineName: String) {
CallerDataCenterBizManager.notifyOrderLine(lineName)
}
override fun updateLoginStatus(isLogin: Boolean) {
CallerDataCenterBizManager.notifyLoginStatus(isLogin)
}
override fun onOrderRemoval() {
CallerDataCenterBizManager.notifyOrderRemoval()
}
override fun setOchAutopilotOrderId(orderId: String?) {
super.setOchAutopilotOrderId(orderId)
_autopilotOrderId = orderId

View File

@@ -1,78 +0,0 @@
package com.mogo.eagle.core.function.call.order
import com.mogo.eagle.core.function.api.order.IOrderListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import java.util.concurrent.atomic.AtomicBoolean
/**
* @author XuXinChao //todo emArrow 合并dataCenter
* @date 2023/4/20
* 订单监听管理
*/
object CallerOrderListenerManager: CallerBase<IOrderListener>() {
const val TAG = "CallerOrderListenerManager"
/**
* 是否登录状态
*/
private val isLoginStatus by lazy { AtomicBoolean(false) }
fun invokeOrderStatus(inOrder: Boolean){
M_LISTENERS.forEach{
val listener = it.value
listener.onUpdateOrderStatus(inOrder)
}
}
fun invokeOrderRemoval(){
M_LISTENERS.forEach{
val listener = it.value
listener.onOrderRemoval()
}
}
/**
* 订单路线名称变化监听
* @param lineName 路线名称
*/
fun invokeOrderLineUpdate(lineName: String){
M_LISTENERS.forEach{
val listener = it.value
listener.onOrderLineUpdate(lineName)
}
}
/**
* 租户id变化监听
* @param tenantId 租户id
*/
fun invokeTenantIdUpdate(tenantId: Long){
M_LISTENERS.forEach{
val listener = it.value
listener.onTenantIdUpdate(tenantId)
}
}
/**
* 登录状态变化通知
* @param isLogin 是否已登录
*/
fun invokeLoginStatusUpdate(isLogin: Boolean) {
CallerLogger.i(TAG, "invokeLoginStatusUpdate isLogin=$isLogin")
isLoginStatus.set(isLogin)
M_LISTENERS.forEach{
val listener = it.value
listener.onLoginStatusUpdate(isLogin)
}
}
/**
* 查询是否是登录状态
*/
fun isLoginStatus(): Boolean {
return isLoginStatus.get()
}
}