Merge branch 'dev/dev_eagle_architecture_upgrade' into dev/dev_eagle_wuhan_sikua_obu
# Conflicts: # .idea/misc.xml # core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckActivity.java # core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt
This commit is contained in:
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@@ -15,6 +15,8 @@
|
||||
<entry key="../../../../../layout/custom_preview.xml" value="0.19947916666666668" />
|
||||
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml" value="0.15572916666666667" />
|
||||
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="0.5" />
|
||||
<entry key="modules/mogo-module-adas/src/main/res/drawable/module_adas_left_corner_bg.xml" value="0.22125" />
|
||||
<entry key="modules/mogo-module-adas/src/main/res/layout/dialog_adas_dispatch_remind.xml" value="0.22658490296325878" />
|
||||
<entry key="modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml" value="0.34427083333333336" />
|
||||
<entry key="modules/mogo-module-hmi/src/main/res/layout/module_hmi_warning_v2x.xml" value="0.246875" />
|
||||
<entry key="modules/mogo-module-hmi/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.3453125" />
|
||||
@@ -23,10 +25,12 @@
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_adas_dispatch.xml" value="0.184" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_adas_dispatch_affirm.xml" value="0.19166666666666668" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_map_marker_blue_info.xml" value="0.184" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/module_adas_left_corner_bg.xml" value="0.22125" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_cars_affirm_bg.xml" value="0.218" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_cars_bg.xml" value="0.218" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_cars_cancel_bg.xml" value="0.218" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_dispatch_timer_bg.xml" value="0.218" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/module_service_right_corner_bg.xml" value="0.22125" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_cars.xml" value="0.5546876453218006" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_remind.xml" value="0.35734252929687504" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/layout/module_services_fragment_online_car_panel.xml" value="0.28919677734374993" />
|
||||
|
||||
@@ -34,9 +34,12 @@ ext {
|
||||
androidxjunit : "androidx.test.ext:junit:1.1.2",
|
||||
androidxespressocore : "androidx.test.espresso:espresso-core:3.3.0",
|
||||
// 地图
|
||||
amapnavi3dmap : "com.amap.api:navi-3dmap:8.0.1_3dmap8.0.1",
|
||||
amapsearch : "com.amap.api:search:7.9.0",
|
||||
amaplocation : "com.amap.api:location:5.5.0",
|
||||
// amapnavi3dmap : "com.amap.api:navi-3dmap:8.0.1_3dmap8.0.1",
|
||||
// amapsearch : "com.amap.api:search:7.9.0",
|
||||
// amaplocation : "com.amap.api:location:5.5.0",
|
||||
amapnavi3dmap : "com.amap.api:navi-3dmap:7.2.0_3dmap7.2.0",
|
||||
amapsearch : "com.amap.api:search:7.1.0",
|
||||
amaplocation : "com.amap.api:location:5.3.1",
|
||||
// json 转换
|
||||
gson : "com.google.code.gson:gson:2.8.4",
|
||||
// 内存泄漏检测
|
||||
|
||||
@@ -1,19 +1,40 @@
|
||||
package com.mogo.eagle.core.function.check;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.elegant.network.ParamsBuilder;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager;
|
||||
import com.mogo.eagle.core.function.check.api.ICheckResultCallBack;
|
||||
import com.mogo.eagle.core.function.check.net.CheckApiServiceFactory;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
import com.mogo.eagle.core.function.check.view.CheckDialog;
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils;
|
||||
import com.mogo.eagle.core.function.api.check.IMogoCheckListener;
|
||||
import com.mogo.eagle.core.function.check.view.CheckActivity;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.eagle.core.function.api.check.ICheckProvider;
|
||||
import com.mogo.utils.ActivityLifecycleManager;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
|
||||
/**
|
||||
* 鹰眼系统、自动驾驶系统 检测模块
|
||||
@@ -27,6 +48,8 @@ public class VehicleMonitoringManager implements ICheckProvider {
|
||||
private static final String TAG = "VehicleMonitoringManager";
|
||||
private Context mContext;
|
||||
private final Map<String, CopyOnWriteArrayList> mListeners = new ConcurrentHashMap<>();
|
||||
private boolean hasTipShow = false;//是否已经弹框提示
|
||||
CheckDialog dialog;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
@@ -56,33 +79,78 @@ public class VehicleMonitoringManager implements ICheckProvider {
|
||||
|
||||
@Override
|
||||
public void startCheckActivity(Context context) {
|
||||
if (context != null) {
|
||||
CheckActivity.start(context);
|
||||
}
|
||||
Intent starter = new Intent(context, CheckActivity.class);
|
||||
starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCheckDialog(Context context) {
|
||||
if (context != null) {
|
||||
CheckActivity.showDialog(context);
|
||||
}
|
||||
showDialog(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkMonitor(Context context) {
|
||||
public void checkMonitor(Context context) {
|
||||
if (context != null) {
|
||||
return CheckActivity.checkMonitor(context);
|
||||
CheckActivity.checkMonitor(context, new ICheckResultCallBack() {
|
||||
@Override
|
||||
public void callBackWithErrorState(Integer state) {
|
||||
updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, state);
|
||||
if (state == 1) {
|
||||
hasTipShow = false;
|
||||
} else {
|
||||
if (hasTipShow == false) {
|
||||
showDialog(context);
|
||||
hasTipShow = true;//已弹框
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指标异常弹框
|
||||
*/
|
||||
public void showDialog(Context context) {
|
||||
try {
|
||||
if (ActivityLifecycleManager.getInstance().isAppActive() == true &&
|
||||
AppUtils.isAppRunning(getPackageName(context)) &&
|
||||
ActivityUtils.getTopActivity() instanceof CheckActivity == false) {
|
||||
if (dialog != null) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
dialog = new CheckDialog(context, true);
|
||||
dialog.show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @return 当前应用的版本名称
|
||||
*/
|
||||
public static synchronized String getPackageName(Context context) {
|
||||
try {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo(
|
||||
context.getPackageName(), 0);
|
||||
return packageInfo.packageName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "com.mogo.launcher.f";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMonitoringStatus(String module, boolean hasError) {
|
||||
public void updateMonitoringStatus(String module, Integer state) {
|
||||
List<IMogoCheckListener> listeners = mListeners.get(module);
|
||||
if (listeners != null && !listeners.isEmpty()) {
|
||||
for (IMogoCheckListener listener : listeners) {
|
||||
if (listener != null) {
|
||||
listener.updateMonitoringStatus(hasError);
|
||||
listener.updateMonitoringStatus(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.api;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 8/6/21
|
||||
*/
|
||||
public interface ICheckListener {
|
||||
|
||||
/**
|
||||
* 工控机->鹰眼定位数据延时
|
||||
*/
|
||||
void getAutoLocationTimeCallbackDelayed(long time);
|
||||
|
||||
/**
|
||||
* 工控机->鹰眼识别数据延时
|
||||
*/
|
||||
void getAutoDataCallbackDelayed(long time);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.mogo.eagle.core.function.check.api;
|
||||
|
||||
import com.mogo.service.adas.IMogoAdasDataCallback;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 自车检测结果回调
|
||||
* @since: 9/28/21
|
||||
*/
|
||||
public interface ICheckResultCallBack {
|
||||
void callBackWithErrorState(Integer state);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.api;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/7/5 2:54 下午
|
||||
* <p>
|
||||
* 软件环境检测
|
||||
* -----> 自动驾驶版本
|
||||
* -----> 鹰眼版本
|
||||
*/
|
||||
public interface SoftCheckApi {
|
||||
|
||||
/**
|
||||
* 检测「自动驾驶」版本
|
||||
*/
|
||||
void checkAutoPilotSoftVersion();
|
||||
|
||||
/**
|
||||
* 检测「鹰眼」版本
|
||||
*/
|
||||
void checkEagleEyeSoftVersion();
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.check.net;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -38,7 +39,7 @@ public class CheckResultData extends BaseData {
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class Data {
|
||||
public static class Data implements Serializable{
|
||||
private Vehicle vehicle;
|
||||
private List<CheckListItem> soft;
|
||||
private List<CheckListItem> devices;
|
||||
@@ -97,7 +98,7 @@ public class CheckResultData extends BaseData {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Vehicle {
|
||||
public static class Vehicle implements Serializable {
|
||||
private String id;
|
||||
private String sn;
|
||||
private String vin;
|
||||
@@ -236,7 +237,7 @@ public class CheckResultData extends BaseData {
|
||||
}
|
||||
}
|
||||
|
||||
public static class CheckListItem {
|
||||
public static class CheckListItem implements Serializable{
|
||||
private String name;
|
||||
private String stateValue;
|
||||
private List<CheckResultData.CheckListItem> items;
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager;
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.api.ICheckResultCallBack;
|
||||
import com.mogo.eagle.core.function.check.net.CheckApiServiceFactory;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
|
||||
@@ -52,10 +53,9 @@ public class CheckActivity extends AppCompatActivity {
|
||||
private static final String TAG = "CheckActivity";
|
||||
private static RecyclerView mRecyclerView;
|
||||
private static CheckResultData sCheckResultData;
|
||||
private static Context context;
|
||||
private static Context mContext;
|
||||
private static NetworkStatusUtil.NetWorkStatus sNetWorkStatus;
|
||||
private ImageView mImageView;
|
||||
private static String packageName = "com.mogo.launcher.f";
|
||||
//车模
|
||||
private ImageView scanBottomCarImage;
|
||||
//扫描束
|
||||
@@ -73,7 +73,6 @@ public class CheckActivity extends AppCompatActivity {
|
||||
private final static long DURATION_TIME = 1000;
|
||||
private static CheckAdapter mCheckAdapter;
|
||||
private static boolean isFront = false;
|
||||
private static CheckDialog dialog;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -82,6 +81,12 @@ public class CheckActivity extends AppCompatActivity {
|
||||
initView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
animation();
|
||||
loadDetail(mContext, null);
|
||||
}
|
||||
/**
|
||||
* 列表View初始化
|
||||
*/
|
||||
@@ -94,40 +99,39 @@ public class CheckActivity extends AppCompatActivity {
|
||||
scanTopImageView = findViewById(R.id.scan_car_top_image);
|
||||
tipsImageView = findViewById(R.id.scan_car_tips);
|
||||
mProgressBar = findViewById(R.id.check_progress);
|
||||
context = mImageView.getContext();
|
||||
packageName = getPackageName(context);
|
||||
mContext = mImageView.getContext();
|
||||
mImageView.setOnClickListener(v -> {
|
||||
finish();
|
||||
});
|
||||
animation();
|
||||
loadDetail(context);
|
||||
|
||||
mRecyclerView = findViewById(R.id.check_list);
|
||||
CheckLinearLayout linearLayoutManager =
|
||||
new CheckLinearLayout(this, CheckLinearLayout.VERTICAL, false);
|
||||
mRecyclerView.addItemDecoration(new SpacesItemDecoration((int) getResources().getDimension(R.dimen.check_item_space_vr)));
|
||||
mRecyclerView.setLayoutManager(linearLayoutManager);
|
||||
mCheckAdapter = new CheckAdapter(context, sCheckResultData);
|
||||
mCheckAdapter = new CheckAdapter(mContext, sCheckResultData);
|
||||
mRecyclerView.setAdapter(mCheckAdapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态下指标监测
|
||||
*/
|
||||
public static boolean checkMonitor(Context context) {
|
||||
public static void checkMonitor(Context context, ICheckResultCallBack checkResultCallBack) {
|
||||
Log.d(TAG, "checkMonitor");
|
||||
loadDetail(context);
|
||||
return true;
|
||||
mContext = context;
|
||||
loadDetail(mContext, checkResultCallBack);
|
||||
}
|
||||
|
||||
//网络请求,获取自车检测结果(工控机上报云端)
|
||||
public static void loadDetail(Context context) {
|
||||
public static void loadDetail(Context context, ICheckResultCallBack checkResultCallBack) {
|
||||
mContext = context;
|
||||
final Map<String, Object> params = ParamsBuilder.of(false)
|
||||
.append("sn", MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.build();
|
||||
CheckApiServiceFactory.getDataApiService(context).loadMonitorDetail(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<CheckResultData>(RequestOptions.create(context)) {
|
||||
.subscribe(new SubscribeImpl<CheckResultData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(CheckResultData o) {
|
||||
super.onSuccess(o);
|
||||
@@ -139,12 +143,8 @@ public class CheckActivity extends AppCompatActivity {
|
||||
mCheckAdapter.mCheckResultData = o;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
if (((CheckResultData) o).getData().getVehicle().getState() == 1) {
|
||||
CallerCheckManager.updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, false);
|
||||
} else {
|
||||
CallerCheckManager.updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, true);
|
||||
showDialog(context);
|
||||
if (checkResultCallBack != null) {
|
||||
checkResultCallBack.callBackWithErrorState(o.getData().getVehicle().getState());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -153,29 +153,11 @@ public class CheckActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Log.d(TAG, "车辆自检失败,请稍后重试" + "==" + message + String.valueOf(code));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @return 当前应用的版本名称
|
||||
*/
|
||||
public static synchronized String getPackageName(Context context) {
|
||||
try {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo(
|
||||
context.getPackageName(), 0);
|
||||
Log.d(TAG, "包名:" + packageInfo.packageName);
|
||||
return packageInfo.packageName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "com.mogo.launcher.f";
|
||||
}
|
||||
|
||||
/**
|
||||
* **************************************************************************************检测动画
|
||||
*/
|
||||
@@ -264,28 +246,19 @@ public class CheckActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent starter = new Intent(context, CheckActivity.class);
|
||||
starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(starter);
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指标异常弹框
|
||||
*/
|
||||
public static void showDialog(Context context) {
|
||||
try {
|
||||
if (AppUtils.isAppRunning(getPackageName(context)) &&
|
||||
(ActivityUtils.getTopActivity() instanceof CheckActivity == false)) {
|
||||
if (dialog != null) {
|
||||
dialog.cancel();
|
||||
}
|
||||
dialog = new CheckDialog(context, true);
|
||||
dialog.show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -294,9 +267,4 @@ public class CheckActivity extends AppCompatActivity {
|
||||
isFront = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
LayoutInflater mLayoutInflater;
|
||||
CheckResultData mCheckResultData;
|
||||
private Context mContext;
|
||||
private static CheckInfoListDialog mCheckInfoListDialog;
|
||||
CheckInfoListDialog mCheckInfoListDialog;
|
||||
|
||||
public CheckAdapter(@NonNull Context context, @NonNull CheckResultData checkResult) {
|
||||
mContext = context;
|
||||
|
||||
@@ -40,11 +40,11 @@ public class CheckDialog extends BaseFloatDialog {
|
||||
setContentView(R.layout.check_dialog);
|
||||
cancel = findViewById(R.id.cancel_button);
|
||||
cancel.setOnClickListener(v -> {
|
||||
cancel();
|
||||
dismiss();
|
||||
});
|
||||
checkDetail = findViewById(R.id.check_detail);
|
||||
checkDetail.setOnClickListener(v -> {
|
||||
cancel();
|
||||
dismiss();
|
||||
if (mContext != null) {
|
||||
CallerCheckManager.startCheckActivity(mContext);
|
||||
}
|
||||
@@ -63,11 +63,11 @@ public class CheckDialog extends BaseFloatDialog {
|
||||
|
||||
|
||||
public void cancel() {
|
||||
super.dismiss();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
|
||||
super.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextPaint;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -23,7 +24,6 @@ import java.util.List;
|
||||
* @since: 9/23/21
|
||||
*/
|
||||
public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
private static final String TAG = "CheckInfoAdapter";
|
||||
LayoutInflater mLayoutInflater;
|
||||
private Context mContext;
|
||||
private String mStyle;
|
||||
@@ -48,37 +48,29 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (position == 0 || position == 2) {
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("模块名称");
|
||||
} else if (position == 1 || position == 3) {
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("运行状态");
|
||||
} else {
|
||||
try {
|
||||
if ((position - 4) < showData.size() * 2) {
|
||||
int index = (position - 4) / 2;
|
||||
CheckResultData.CheckListItem positionItem = showData.get(index);
|
||||
if (isEven(position) == true) {//偶数隐藏图片显示检测指标
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(positionItem.getName());
|
||||
} else {//奇数显示图片和检测指标结果
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.VISIBLE);
|
||||
String state = (String) positionItem.getStateValue();
|
||||
if (state.equals("1")) {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("正常");
|
||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_right);
|
||||
} else if ((state.equals("0"))) {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("异常");
|
||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_wrong);
|
||||
} else {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(state);
|
||||
}
|
||||
try {
|
||||
if (position < showData.size() * 2) {
|
||||
int index = position / 2;
|
||||
CheckResultData.CheckListItem positionItem = showData.get(index);
|
||||
if (isEven(position) == true) {//偶数隐藏图片显示检测指标
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(positionItem.getName());
|
||||
} else {//奇数显示图片和检测指标结果
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.VISIBLE);
|
||||
String state = (String) positionItem.getStateValue();
|
||||
if (state.equals("1")) {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("正常");
|
||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_right);
|
||||
} else if ((state.equals("0"))) {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("异常");
|
||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_wrong);
|
||||
} else {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(state);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -94,7 +86,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return showData.size() * 2 + 4;
|
||||
return showData.size() * 2;
|
||||
}
|
||||
|
||||
public class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
@@ -107,4 +99,5 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
mTextView = v.findViewById(R.id.info_result_tx);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -25,7 +27,7 @@ import java.util.List;
|
||||
public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
|
||||
private static final String TAG = "CheckInfoListDialog";
|
||||
private RecyclerView mRecyclerView;
|
||||
private CheckInfoRecyclerView mRecyclerView;
|
||||
private Context mContext;
|
||||
private TextView titleView;
|
||||
private int span;
|
||||
@@ -33,7 +35,6 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
private CheckResultData mCheckResultData;
|
||||
private List<CheckResultData.CheckListItem> result = new ArrayList<>();
|
||||
|
||||
|
||||
public CheckInfoListDialog(@NonNull Context context, String style, CheckResultData checkResultData) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
@@ -68,14 +69,18 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
e.printStackTrace();
|
||||
}
|
||||
List resultData = showInfoResult();
|
||||
mRecyclerView.setAdapter(new CheckInfoAdapter(mContext, mStyle, resultData));
|
||||
CheckInfoAdapter adapter = new CheckInfoAdapter(mContext, mStyle, resultData);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
//关闭按钮
|
||||
findViewById(R.id.cancel_info_list_button).setOnClickListener(v -> {
|
||||
cancel();
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
public List showInfoResult() {
|
||||
|
||||
// List<CheckResultData.CheckListItem> test = new ArrayList();//测试数据
|
||||
|
||||
if (result.size() > 0) {
|
||||
result.clear();
|
||||
}
|
||||
@@ -98,19 +103,22 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.d(TAG, "检测指标结果值===" + result.toString());
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
// test.addAll(result);
|
||||
// test.addAll(result);
|
||||
// test.addAll(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
super.dismiss();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 列表自适应高+限高
|
||||
* @since: 9/29/21
|
||||
*/
|
||||
public class CheckInfoRecyclerView extends RecyclerView {
|
||||
private int maxHeight = (int) getContext().getResources().getDimension(R.dimen.check_height);
|
||||
private int maxWeight = (int) getContext().getResources().getDimension(R.dimen.check_width);
|
||||
|
||||
public CheckInfoRecyclerView(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public CheckInfoRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public CheckInfoRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthSpec, int heightSpec) {
|
||||
super.onMeasure(widthSpec, heightSpec);
|
||||
int limitHeight = getMeasuredHeight();
|
||||
if (getMeasuredHeight() > maxHeight) {
|
||||
limitHeight = maxHeight;
|
||||
}
|
||||
setMeasuredDimension(maxWeight, limitHeight);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#767FCD"/>
|
||||
<stroke android:width="3px"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="@color/check_info_position_line_color" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:left="@dimen/dp_3"
|
||||
android:right="@dimen/dp_3"
|
||||
android:top="@dimen/dp_3"><!--设置只有顶部和左右边有边框-->
|
||||
<shape>
|
||||
<solid android:color="@color/check_info_title_back" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -22,7 +22,7 @@
|
||||
android:layout_height="@dimen/dp_106"
|
||||
android:layout_marginLeft="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:src="@drawable/module_common_icon_close"
|
||||
android:src="@drawable/check_close"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
android:layout_height="@dimen/dp_106"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:src="@drawable/module_common_icon_close"
|
||||
android:src="@drawable/check_close"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -2,34 +2,38 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/dp_405"
|
||||
android:layout_height="@dimen/dp_127">
|
||||
android:layout_height="@dimen/dp_127"
|
||||
android:layout_gravity="left">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_46"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:gravity="left"
|
||||
android:paddingRight="@dimen/dp_25"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/info_check_icon"
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_marginLeft="@dimen/dp_40"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/check_right" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info_result_tx"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="检测中"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginLeft="@dimen/dp_27"
|
||||
android:ellipsize="end"
|
||||
android:gravity="left"
|
||||
android:maxLines="2"
|
||||
android:text="检测中检测中检测中检测中老链路来了来了"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/dp_38"
|
||||
android:layout_marginLeft="@dimen/dp_27"
|
||||
app:layout_constraintLeft_toRightOf="@+id/info_check_icon" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?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="1900px"
|
||||
android:layout_height="1140px"
|
||||
android:layout_gravity="center"
|
||||
@@ -12,7 +13,7 @@
|
||||
android:layout_height="@dimen/dp_106"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:src="@drawable/module_common_icon_close"
|
||||
android:src="@drawable/check_close"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -20,7 +21,7 @@
|
||||
android:id="@+id/check_info_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_69"
|
||||
android:layout_marginTop="@dimen/dp_70"
|
||||
android:gravity="center"
|
||||
android:text="自检结果"
|
||||
android:textColor="#fff"
|
||||
@@ -29,17 +30,29 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<include
|
||||
android:id="@+id/check_title_item"
|
||||
layout="@layout/check_info_title_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_127"
|
||||
android:layout_marginLeft="@dimen/dp_143"
|
||||
android:layout_marginTop="@dimen/dp_66"
|
||||
android:layout_marginRight="@dimen/dp_143"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/check_info_title"></include>
|
||||
|
||||
<com.mogo.eagle.core.function.check.view.CheckInfoRecyclerView
|
||||
android:id="@+id/check_list_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_143"
|
||||
android:layout_marginTop="@dimen/dp_184"
|
||||
android:layout_marginRight="@dimen/dp_143"
|
||||
android:layout_marginBottom="@dimen/dp_80"
|
||||
android:background="@drawable/check_recycler_shape"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/check_title_item" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/check_width"
|
||||
android:layout_height="@dimen/dp_127"
|
||||
android:background="@drawable/check_title_item_shape"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_one"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="模块名称"
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/title_two"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_two"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="运行状态"
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toRightOf="@+id/title_one"
|
||||
app:layout_constraintRight_toLeftOf="@+id/title_thr"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_thr"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="模块名称"
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintRight_toLeftOf="@+id/title_for"
|
||||
app:layout_constraintLeft_toRightOf="@+id/title_two"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_for"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="运行状态"
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toRightOf="@+id/title_thr"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -11,6 +11,7 @@
|
||||
<color name="check_icon_error_color">#EE3132</color>
|
||||
<color name="check_info_position_line_color">#666DA5</color>
|
||||
<color name="check_info_shape_color">#767FCD</color>
|
||||
<color name="check_info_title_back">#151738</color>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<dimen name="check_width">1900px</dimen>
|
||||
<dimen name="check_height">730px</dimen>
|
||||
</resources>
|
||||
@@ -6,6 +6,6 @@
|
||||
@android:drawable/progress_indeterminate_horizontal
|
||||
</item>
|
||||
<item name="android:progressDrawable">@drawable/check_progress</item>
|
||||
<item name="android:listDivider">@drawable/check_driver</item>
|
||||
<item name="android:listDivider">@drawable/check_title_item_shape</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -46,7 +46,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
mIMogoMapService = mMogoServiceApis!!.mapServiceApi
|
||||
|
||||
//自研obu
|
||||
MogoObuManager.getInstance().connect(context, "192.168.43.51")
|
||||
MogoObuManager.getInstance().connect(context, "192.168.20.199")
|
||||
MogoObuManager.getInstance().registerListener(mogoObuListener)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.smp;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -87,8 +88,8 @@ public class SmallMapDirectionView
|
||||
View smpView = LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
|
||||
|
||||
mAMapNaviView = (TextureMapView)smpView.findViewById(R.id.aMapNaviView);
|
||||
rlSmallMapBorder = findViewById(R.id.rlSmallMapBorder);
|
||||
rlSmallMapBorder.addView(mAMapNaviView);
|
||||
// rlSmallMapBorder = findViewById(R.id.rlSmallMapBorder);
|
||||
// rlSmallMapBorder.addView(mAMapNaviView);
|
||||
|
||||
initAMapView();
|
||||
|
||||
@@ -280,4 +281,27 @@ public class SmallMapDirectionView
|
||||
}
|
||||
}
|
||||
|
||||
public void onCreateView(Bundle savedInstanceState) {
|
||||
if(mAMapNaviView != null){
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
if(mAMapNaviView != null){
|
||||
mAMapNaviView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
if(mAMapNaviView != null){
|
||||
mAMapNaviView.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
if(mAMapNaviView != null){
|
||||
mAMapNaviView.onDestroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.smp.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -34,6 +33,7 @@ public class SmallMapFragment extends Fragment {
|
||||
if (mRootView == null) {
|
||||
mRootView = inflater.inflate(R.layout.module_small_map_fragment, container, false);
|
||||
mSmallMapDirectionView = mRootView.findViewById(R.id.smallMapDirectionView);
|
||||
mSmallMapDirectionView.onCreateView(savedInstanceState);
|
||||
} else {
|
||||
ViewGroup viewGroup = (ViewGroup) mRootView.getParent();
|
||||
if (viewGroup != null) {
|
||||
@@ -55,4 +55,23 @@ public class SmallMapFragment extends Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mSmallMapDirectionView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mSmallMapDirectionView.onPause();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
mSmallMapDirectionView.onDestroy();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,12 @@ enum class TrafficTypeEnum(
|
||||
R.raw.daba,
|
||||
R.raw.daba
|
||||
),
|
||||
TYPE_TRAFFIC_ID_CAMERA(
|
||||
9,
|
||||
"摄像头",
|
||||
R.raw.shexiangtou,
|
||||
R.raw.shexiangtou
|
||||
),
|
||||
TYPE_TRAFFIC_ID_SPECIAL_VEHICLE(
|
||||
11,
|
||||
"特殊车辆",
|
||||
|
||||
@@ -7,20 +7,22 @@ import androidx.annotation.Keep
|
||||
*/
|
||||
@Keep
|
||||
data class AdvanceWarningBean(
|
||||
var objectId: String,
|
||||
var status: Int,
|
||||
var typeId: Int,
|
||||
var objectId: String,// 物体唯一标识
|
||||
var objectType: Int,// 物体类型 1-人 2-自行车 3-小轿车 4-摩托车 5-红绿灯 6-bus 8-truck 9-路边摄像头
|
||||
var status: Int,// 1.add 2.update 3.delete
|
||||
var typeId: Int,// 首位大类标识 1预警 2规划 3拥堵 4事故
|
||||
var time: Long,
|
||||
var level: Int,
|
||||
var level: Int,// 预警等级
|
||||
var threatLevel: Int,// 危险等级:0保留,1模型原始颜色,2通知--黄,3警告--红
|
||||
var position: Position,
|
||||
var heading: Int,
|
||||
var heading: Double,
|
||||
var speed: Double,
|
||||
var distance: Double,
|
||||
var roadId: String,
|
||||
var laneId: String,
|
||||
var laneNum: Int,
|
||||
var gdLocusList: List<Position>,
|
||||
var locusList: List<Position>
|
||||
var roadId: String,// 道路id
|
||||
var laneId: String,// 车道id
|
||||
var laneNum: Int,// 车道号:中心线编号为0, 中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3
|
||||
var gdLocusList: List<Position>,// 线性经纬度轨迹列表(高德)
|
||||
var locusList: List<Position>// 轨迹列表(Wgs84坐标系)
|
||||
)
|
||||
|
||||
@Keep
|
||||
|
||||
@@ -36,11 +36,11 @@ public interface ICheckProvider extends IProvider {
|
||||
/**
|
||||
* 指标监测
|
||||
*/
|
||||
boolean checkMonitor(Context context);
|
||||
void checkMonitor(Context context);
|
||||
|
||||
/**
|
||||
* 根据监测指标修改主页检测按钮
|
||||
*/
|
||||
void updateMonitoringStatus(String module, boolean hasError);
|
||||
void updateMonitoringStatus(String module, Integer state);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@ package com.mogo.eagle.core.function.api.check;
|
||||
* @since: 8/26/21
|
||||
*/
|
||||
public interface IMogoCheckListener {
|
||||
void updateMonitoringStatus(boolean hasError);
|
||||
void updateMonitoringStatus(Integer state);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.mogo.eagle.core.function.call.base.CallerBase;
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/17 8:26 下午
|
||||
*
|
||||
* <p>
|
||||
* HMI 调用者管理,这里对外及其他模块提供功能的调用,用啥写啥,不要过度设计,不允许直接将Provider暴露出去
|
||||
*/
|
||||
public class CallerCheckManager extends CallerBase {
|
||||
@@ -49,14 +49,14 @@ public class CallerCheckManager extends CallerBase {
|
||||
/**
|
||||
* 根据监测指标修改主页检测按钮
|
||||
*/
|
||||
public static void updateMonitoringStatus(String module, boolean hasError) {
|
||||
getCheckProvider().updateMonitoringStatus(module, hasError);
|
||||
public static void updateMonitoringStatus(String module, Integer state) {
|
||||
getCheckProvider().updateMonitoringStatus(module, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* 指标监测
|
||||
*/
|
||||
public static boolean checkMonitor(Context context) {
|
||||
return getCheckProvider().checkMonitor(context);
|
||||
public static void checkMonitor(Context context) {
|
||||
getCheckProvider().checkMonitor(context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,14 @@ public class ActivityLifecycleManager {
|
||||
/**
|
||||
* 当前出于 Start 状态的 Activity
|
||||
*/
|
||||
private ArrayList< Activity > mStartedActivities = new ArrayList<>();
|
||||
private ArrayList<Activity> mStartedActivities = new ArrayList<>();
|
||||
|
||||
private ArrayList<AppStateListener> mAppStateListeners = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 当前存活的 Activity
|
||||
*/
|
||||
private HashMap< Activity, ActivityTrace> mAliveActivities = new HashMap<>();
|
||||
private HashMap<Activity, ActivityTrace> mAliveActivities = new HashMap<>();
|
||||
|
||||
/**
|
||||
* App 是否出于前台
|
||||
@@ -44,10 +44,10 @@ public class ActivityLifecycleManager {
|
||||
|
||||
private DefActivityLifecycleCallbacks mInnerActivityListener = new DefActivityLifecycleCallbacks() {
|
||||
@Override
|
||||
public void onActivityStarted( Activity activity) {
|
||||
public void onActivityStarted(Activity activity) {
|
||||
if (mStartedActivities.isEmpty()) {
|
||||
mIsAppActive = true;
|
||||
notifyAppStateChanged( AppStateListener.ACTIVE);
|
||||
notifyAppStateChanged(AppStateListener.ACTIVE);
|
||||
}
|
||||
mStartedActivities.add(activity);
|
||||
|
||||
@@ -58,11 +58,11 @@ public class ActivityLifecycleManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStopped( Activity activity) {
|
||||
public void onActivityStopped(Activity activity) {
|
||||
mStartedActivities.remove(activity);
|
||||
if (mStartedActivities.isEmpty()) {
|
||||
mIsAppActive = false;
|
||||
notifyAppStateChanged( AppStateListener.INACTIVE);
|
||||
notifyAppStateChanged(AppStateListener.INACTIVE);
|
||||
}
|
||||
|
||||
ActivityTrace trace = mAliveActivities.get(activity);
|
||||
@@ -72,7 +72,7 @@ public class ActivityLifecycleManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResumed( Activity activity) {
|
||||
public void onActivityResumed(Activity activity) {
|
||||
mCurrentResumedActivity = activity;
|
||||
ActivityTrace trace = mAliveActivities.get(activity);
|
||||
if (trace != null) {
|
||||
@@ -81,7 +81,7 @@ public class ActivityLifecycleManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused( Activity activity) {
|
||||
public void onActivityPaused(Activity activity) {
|
||||
ActivityTrace trace = mAliveActivities.get(activity);
|
||||
if (trace != null) {
|
||||
trace.pauseCnt++;
|
||||
@@ -89,33 +89,34 @@ public class ActivityLifecycleManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated( Activity activity, Bundle savedInstanceState) {
|
||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||
mAliveActivities.put(activity, new ActivityTrace(activity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed( Activity activity) {
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
mAliveActivities.remove(activity);
|
||||
}
|
||||
};
|
||||
|
||||
private ActivityLifecycleManager() {}
|
||||
private ActivityLifecycleManager() {
|
||||
}
|
||||
|
||||
public static ActivityLifecycleManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder{
|
||||
private static class SingletonHolder {
|
||||
private static final ActivityLifecycleManager INSTANCE = new ActivityLifecycleManager();
|
||||
}
|
||||
|
||||
public void start( Application application) {
|
||||
public void start(Application application) {
|
||||
this.mApplication = application;
|
||||
registerInnerActivityListener();
|
||||
registerHomeKeyEventReceiver();
|
||||
}
|
||||
|
||||
public void stop(){
|
||||
public void stop() {
|
||||
unregisterActivityLifecycleCallbacks(mInnerActivityListener);
|
||||
unregisterHomeKeyEventReceiver();
|
||||
}
|
||||
@@ -125,12 +126,12 @@ public class ActivityLifecycleManager {
|
||||
*
|
||||
* @param callbacks Activity 生命周期的回调
|
||||
*/
|
||||
public void registerActivityLifecycleCallbacks( Application.ActivityLifecycleCallbacks callbacks) {
|
||||
public void registerActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callbacks) {
|
||||
if (mApplication == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -142,12 +143,12 @@ public class ActivityLifecycleManager {
|
||||
*
|
||||
* @param callbacks Activity 生命周期的回调
|
||||
*/
|
||||
public void unregisterActivityLifecycleCallbacks( Application.ActivityLifecycleCallbacks callbacks) {
|
||||
public void unregisterActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callbacks) {
|
||||
if (mApplication == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -161,7 +162,11 @@ public class ActivityLifecycleManager {
|
||||
return mIsAppActive;
|
||||
}
|
||||
|
||||
public Activity getCurrentActivity(){
|
||||
public void setAppActive(boolean appActive) {
|
||||
mIsAppActive = appActive;
|
||||
}
|
||||
|
||||
public Activity getCurrentActivity() {
|
||||
return mCurrentResumedActivity;
|
||||
}
|
||||
|
||||
@@ -248,7 +253,7 @@ public class ActivityLifecycleManager {
|
||||
|
||||
private void registerHomeKeyEventReceiver() {
|
||||
android.content.IntentFilter filter = new android.content.IntentFilter();
|
||||
filter.addAction( Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||
|
||||
mHomeKeyEventReceiver = new HomeKeyEventReceiver();
|
||||
mApplication.registerReceiver(mHomeKeyEventReceiver, filter);
|
||||
@@ -267,31 +272,45 @@ public class ActivityLifecycleManager {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi( Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
public static abstract class DefActivityLifecycleCallbacks implements Application.ActivityLifecycleCallbacks {
|
||||
@Override
|
||||
public void onActivityCreated( Activity activity, Bundle savedInstanceState) {}
|
||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted( Activity activity) {}
|
||||
public void onActivityStarted(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResumed( Activity activity) {}
|
||||
public void onActivityResumed(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused( Activity activity) {}
|
||||
public void onActivityPaused(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStopped( Activity activity) {}
|
||||
public void onActivityStopped(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivitySaveInstanceState( Activity activity, Bundle outState) {}
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed( Activity activity) {}
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
}
|
||||
}
|
||||
|
||||
public interface AppStateListener {
|
||||
int INACTIVE = 0;
|
||||
int ACTIVE = 1;
|
||||
|
||||
/**
|
||||
* App 状态的回调
|
||||
*/
|
||||
void onStateChanged( int state );
|
||||
void onStateChanged(int state);
|
||||
|
||||
}
|
||||
|
||||
@@ -312,7 +331,7 @@ public class ActivityLifecycleManager {
|
||||
int startCnt;
|
||||
int stopCnt;
|
||||
|
||||
ActivityTrace( Activity activity) {
|
||||
ActivityTrace(Activity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
}
|
||||
@@ -322,9 +341,9 @@ public class ActivityLifecycleManager {
|
||||
private final String SYSTEM_DIALOG_REASON_HOME_KEY = "homekey";
|
||||
|
||||
@Override
|
||||
public void onReceive( Context context, Intent intent) {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if ( Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
|
||||
if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
|
||||
String reason = intent.getStringExtra(SYSTEM_DIALOG_REASON_KEY);
|
||||
if (reason != null && reason.equals(SYSTEM_DIALOG_REASON_HOME_KEY)) {
|
||||
onHomeKeyPressed();
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.service.v2x.IV2XWarningListener;
|
||||
import com.mogo.utils.ActivityLifecycleManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -90,6 +91,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
getApis().getIntentManagerApi().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
|
||||
ActivityLifecycleManager.getInstance().setAppActive(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,6 +104,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getApis().getIntentManagerApi().unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
|
||||
ActivityLifecycleManager.getInstance().setAppActive(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ public class AdasProvider implements IProvider {
|
||||
Logger.d(TAG, "初始化 AdasProvider 模块");
|
||||
adasEventManager = AdasEventManager.getInstance();
|
||||
initAdas(context, adasEventManager);
|
||||
initAutoPilotBusiness(context);
|
||||
// initAutoPilotBusiness(context);
|
||||
|
||||
addAdasStatusListener(new IAdasStatusListener() {
|
||||
@Override
|
||||
|
||||
@@ -1402,12 +1402,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMonitoringStatus(boolean hasError) {
|
||||
public void updateMonitoringStatus(Integer state) {
|
||||
Log.d(TAG, "updateCheckStatus");
|
||||
if (hasError == true) {
|
||||
tipImageView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (state == 1) {
|
||||
tipImageView.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
tipImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@ public class VehicleMonitoring implements Handler.Callback {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean vehicleMonitor() {
|
||||
public void vehicleMonitor() {
|
||||
Log.d(TAG, "vehicleMonitor");
|
||||
return CallerCheckManager.checkMonitor(mContext);
|
||||
CallerCheckManager.checkMonitor(mContext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/module_services_remind_background" />
|
||||
<corners android:bottomLeftRadius="@dimen/module_services_dispatch_cars_dialog_corner" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/module_services_remind_background" />
|
||||
<corners android:bottomRightRadius="@dimen/module_services_dispatch_cars_dialog_corner" />
|
||||
</shape>
|
||||
@@ -67,6 +67,7 @@
|
||||
android:layout_width="@dimen/module_services_dispatch_cars_dialog_btn_width"
|
||||
android:layout_height="@dimen/module_services_dispatch_cars_dialog_line_margin_bottom"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/module_service_left_corner_bg"
|
||||
android:text="@string/module_services_dispatch_cars_affirm"
|
||||
android:textColor="@color/module_services_dispatch_cars_text_loc"
|
||||
android:textSize="@dimen/module_services_dispatch_cars_dialog_title_size"
|
||||
@@ -88,6 +89,7 @@
|
||||
android:gravity="center"
|
||||
android:text="@string/module_services_dispatch_cars_cancel"
|
||||
android:textColor="@color/module_services_dispatch_cars_cancel"
|
||||
android:background="@drawable/module_service_right_corner_bg"
|
||||
android:textSize="@dimen/module_services_dispatch_cars_dialog_title_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<dimen name="module_services_dispatch_cars_dialog_title_margin_top">55px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_content_size">38px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_content_margin_top">179px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_loc_size">56px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_loc_size">54px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_loc_margin_top">251px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_line_margin_bottom">152px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_btn_width">474.5px</dimen>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<dimen name="module_services_dispatch_cars_dialog_title_margin_top">41px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_content_size">28px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_content_margin_top">134px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_loc_size">42px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_loc_size">40px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_loc_margin_top">188px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_line_margin_bottom">114px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_btn_width">355px</dimen>
|
||||
|
||||
@@ -18,4 +18,5 @@
|
||||
<color name="module_services_dispatch_cars_count_down_bg">#4D000000</color>
|
||||
<color name="module_services_dispatch_cars_line">#66B8BFE8</color>
|
||||
<color name="module_services_dispatch_cars_cancel">#AFB3C7</color>
|
||||
<color name="module_services_remind_background">#E63B4577</color>
|
||||
</resources>
|
||||
@@ -88,7 +88,7 @@
|
||||
<dimen name="module_services_dispatch_cars_dialog_title_margin_top">55px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_content_size">38px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_content_margin_top">179px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_loc_size">56px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_loc_size">54px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_loc_margin_top">251px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_line_margin_bottom">152px</dimen>
|
||||
<dimen name="module_services_dispatch_cars_dialog_btn_width">474.5px</dimen>
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mogo.module.v2x.listener;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
import com.mogo.eagle.core.data.v2x.AdvanceWarningBean;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
/**
|
||||
* @author chenfufeng
|
||||
* @description 路口碰撞预警、盲区预警等
|
||||
* @since: 2021/9/23
|
||||
*/
|
||||
public class V2XMessageListener_404000 implements IMogoOnMessageListener<AdvanceWarningBean> {
|
||||
@Override
|
||||
public Class target() {
|
||||
return AdvanceWarningBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(AdvanceWarningBean message) {
|
||||
// 将接收到的数据转换成最优车道推荐的场景数据
|
||||
Logger.i(MODULE_NAME, "V2XMessageListener_404000:" + GsonUtil.jsonFromObject(message));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.mogo.module.v2x.listener
|
||||
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener
|
||||
import com.mogo.eagle.core.data.v2x.AdvanceWarningBean
|
||||
import com.mogo.module.v2x.V2XConst
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
|
||||
import com.mogo.module.common.drawer.TrafficMarkerDrawer
|
||||
import com.mogo.module.common.enums.EventTypeEnum
|
||||
import com.mogo.module.v2x.utils.V2XUtils
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
/**
|
||||
* @author chenfufeng
|
||||
* @description 路口碰撞预警、盲区预警等
|
||||
* @since: 2021/9/23
|
||||
*/
|
||||
class V2XMessageListener_404000 : IMogoOnMessageListener<AdvanceWarningBean> {
|
||||
override fun target(): Class<AdvanceWarningBean> {
|
||||
return AdvanceWarningBean::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(message: AdvanceWarningBean?) {
|
||||
if (message == null) {
|
||||
Logger.i(V2XConst.MODULE_NAME, "V2XMessageListener_404000:message is null!")
|
||||
return
|
||||
}
|
||||
Logger.i(
|
||||
V2XConst.MODULE_NAME,
|
||||
"V2XMessageListener_404000:" + com.mogo.utils.network.utils.GsonUtil.jsonFromObject(
|
||||
message
|
||||
)
|
||||
)
|
||||
V2XUtils.runOnUiThread {
|
||||
var trafficData = buildTrafficData(message)
|
||||
when (message.status) {
|
||||
1 -> {
|
||||
var tts = ""
|
||||
var content = ""
|
||||
var appId = 0
|
||||
when (message.typeId) {
|
||||
// 弱势交通碰撞预警
|
||||
1001 -> {
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt()
|
||||
tts = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.tts
|
||||
content = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.content
|
||||
}
|
||||
// 弱势交通逆行预警
|
||||
1002 -> {
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt()
|
||||
tts = "行人逆行预警"
|
||||
content = "行人逆行预警"
|
||||
}
|
||||
// 交叉路口碰撞预警
|
||||
1003 -> {
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_ICW.poiType.toInt()
|
||||
tts = EventTypeEnum.TYPE_USECASE_ID_ICW.tts
|
||||
content = EventTypeEnum.TYPE_USECASE_ID_ICW.content
|
||||
}
|
||||
// 盲区预警
|
||||
1004 -> {
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_BSW.poiType.toInt()
|
||||
tts = String.format(EventTypeEnum.TYPE_USECASE_ID_BSW.tts, getWarningDirection())
|
||||
content = EventTypeEnum.TYPE_USECASE_ID_BSW.content
|
||||
}
|
||||
// 逆向超车预警
|
||||
1005 -> {
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_DNPW.poiType.toInt()
|
||||
tts = EventTypeEnum.TYPE_USECASE_ID_DNPW.tts
|
||||
content = EventTypeEnum.TYPE_USECASE_ID_DNPW.content
|
||||
}
|
||||
}
|
||||
// 显示弹框,语音提示
|
||||
CallerHmiManager.showWarningV2X(appId, content, tts,
|
||||
"$appId", object : WarningStatusListener {
|
||||
override fun onShow() {}
|
||||
override fun onDismiss() {
|
||||
}
|
||||
})
|
||||
TrafficMarkerDrawer.updateITrafficInfo(trafficData)
|
||||
}
|
||||
2 -> {
|
||||
TrafficMarkerDrawer.updateITrafficInfo(trafficData)
|
||||
}
|
||||
3 -> {
|
||||
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(trafficData.uuid)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildTrafficData(message: AdvanceWarningBean): TrafficData {
|
||||
return TrafficData().apply {
|
||||
type = when (message.objectType) {
|
||||
1 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE
|
||||
2 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE
|
||||
3 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE
|
||||
4 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO
|
||||
6 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS
|
||||
8 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK
|
||||
9 -> TrafficTypeEnum.TYPE_TRAFFIC_ID_CAMERA
|
||||
else -> TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI
|
||||
}
|
||||
uuid = message.objectId
|
||||
lat = message.position.lat
|
||||
lon = message.position.lon
|
||||
heading = message.heading
|
||||
threatLevel = message.threatLevel
|
||||
}
|
||||
}
|
||||
|
||||
private fun getWarningDirection(): String {
|
||||
return "右"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user