[add] 首页监听车辆监控状态,修改检测入口预警标识的显示状态
This commit is contained in:
@@ -28,14 +28,16 @@ public class NetworkStatusUtil {
|
||||
private static int mSignalStrength;
|
||||
private static SignalStrength signal;
|
||||
private static NetWorkStatus netWorkStatus1 = new NetWorkStatus();
|
||||
|
||||
/**
|
||||
* 监听网络强度
|
||||
*/
|
||||
public static NetWorkStatus networkState(Context context) {
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo info = connectivityManager.getActiveNetworkInfo();
|
||||
String netWorkStatus = CommonUtils.getNetworkType(context);
|
||||
netWorkStatus1.status = netWorkStatus;
|
||||
if (info != null && info.isAvailable()) {
|
||||
String netWorkStatus = CommonUtils.getNetworkType(context);
|
||||
netWorkStatus1.status = netWorkStatus;
|
||||
switch (info.getType()) {
|
||||
case ConnectivityManager.TYPE_WIFI:
|
||||
@@ -68,11 +70,6 @@ public class NetworkStatusUtil {
|
||||
}
|
||||
Method method = signal.getClass().getMethod("getDbm");
|
||||
mSignalStrength = (int) method.invoke(signal);
|
||||
if (mSignalStrength > -90) {
|
||||
Log.e("CheckActivity", "getNetWorkInfo: 信号强度强");
|
||||
} else {
|
||||
Log.e("CheckActivity", "getNetWorkInfo: 信号强度弱");
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.map.check;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 监听指标发生变化, 通知首页检测入口处预警图标重新渲染
|
||||
* @since: 8/26/21
|
||||
*/
|
||||
public interface IMogoCheckListener {
|
||||
void updateMonitoringStatus(boolean hasError);
|
||||
}
|
||||
@@ -46,6 +46,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(path: ':modules:mogo-module-service')
|
||||
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.mogo.module.check;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.module.check.view.CheckActivity;
|
||||
import com.mogo.service.check.ICheckProvider;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* 鹰眼系统、自动驾驶系统 检测模块
|
||||
*
|
||||
* @date 4/21/21 3:39 PM
|
||||
* 需求地址
|
||||
* wiki:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=58204952
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_CHECK)
|
||||
public class CheckProvider implements ICheckProvider {
|
||||
private static final String TAG = "CheckProvider";
|
||||
private Context mContext;
|
||||
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "初始化 CheckProvider 模块");
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startCheckActivity(Context context) {
|
||||
if (context != null) {
|
||||
CheckActivity.start(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCheckDialog(Context context) {
|
||||
if (context != null) {
|
||||
CheckActivity.showDialog(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkMonitor(Context context) {
|
||||
if (context != null) {
|
||||
CheckActivity.checkMonitor();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.mogo.module.check;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.check.IMogoCheckListener;
|
||||
import com.mogo.module.check.view.CheckActivity;
|
||||
import com.mogo.service.check.ICheckProvider;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.v2x.IV2XWarningListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* 鹰眼系统、自动驾驶系统 检测模块
|
||||
*
|
||||
* @date 4/21/21 3:39 PM
|
||||
* 需求地址
|
||||
* wiki:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=58204952
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_CHECK)
|
||||
public class VehicleMonitoringManager implements ICheckProvider {
|
||||
private static final String TAG = "VehicleMonitoringManager";
|
||||
private Context mContext;
|
||||
private final Map<String, CopyOnWriteArrayList> mListeners = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "初始化 CheckProvider 模块");
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerVehicleMonitoringListener(String module, IMogoCheckListener listener) {
|
||||
if (listener == null || module == null) {
|
||||
Log.d(TAG, "listener == null || intent == null");
|
||||
return;
|
||||
}
|
||||
if (!mListeners.containsKey(module)) {
|
||||
Log.d(TAG, "intent==" + module + "listener" + listener);
|
||||
mListeners.put(module, new CopyOnWriteArrayList<>());
|
||||
}
|
||||
mListeners.get(module).add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterListener(String module, IMogoCheckListener listener) {
|
||||
if (mListeners.containsKey(module)) {
|
||||
mListeners.get(module).remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startCheckActivity(Context context) {
|
||||
if (context != null) {
|
||||
CheckActivity.start(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCheckDialog(Context context) {
|
||||
if (context != null) {
|
||||
CheckActivity.showDialog(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkMonitor(Context context) {
|
||||
if (context != null) {
|
||||
return CheckActivity.checkMonitor();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMonitoringStatus(String module, boolean hasError) {
|
||||
List<IMogoCheckListener> listeners = mListeners.get(module);
|
||||
if (listeners != null && !listeners.isEmpty()) {
|
||||
for (IMogoCheckListener listener : listeners) {
|
||||
if (listener != null) {
|
||||
listener.updateMonitoringStatus(hasError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,13 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.check.IMogoCheckListener;
|
||||
import com.mogo.module.check.R;
|
||||
import com.mogo.module.check.model.CheckItemInfo;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.view.ImageViewClipBounds;
|
||||
import com.mogo.module.common.view.SpacesItemDecoration;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.utils.CommonUtils;
|
||||
import com.mogo.utils.network.utils.NetworkStatusUtil;
|
||||
import com.tencent.bugly.beta.Beta;
|
||||
@@ -39,7 +42,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* @description 车辆监控页面
|
||||
* @since: 7/27/21
|
||||
*/
|
||||
public class CheckActivity extends AppCompatActivity {
|
||||
public class CheckActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "CheckActivity";
|
||||
private RecyclerView mRecyclerView;
|
||||
@@ -113,8 +116,8 @@ public class CheckActivity extends AppCompatActivity {
|
||||
/**
|
||||
* 自动驾驶状态下指标监测
|
||||
*/
|
||||
public static void checkMonitor() {
|
||||
Log.d(TAG,"checkMonitor");
|
||||
public static boolean checkMonitor() {
|
||||
Log.d(TAG, "checkMonitor");
|
||||
//版本检测
|
||||
versionCheckResult();
|
||||
//系统检测
|
||||
@@ -125,6 +128,8 @@ public class CheckActivity extends AppCompatActivity {
|
||||
hardware();
|
||||
//根据以上4个结果插入第一个元素(自动驾驶车辆是否存在风险)
|
||||
topListTitle();
|
||||
MogoApisHandler.getInstance().getApis().getCheckProvider().updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING,false);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,7 +353,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
//网络类型
|
||||
sNetWorkStatus = NetworkStatusUtil.networkState(context);
|
||||
//网络强度
|
||||
if (sNetWorkStatus.getStatus() != null && sNetWorkStatus.getStatus() != "UNKNOWN") {
|
||||
if (sNetWorkStatus != null && sNetWorkStatus.getStatus() != null && sNetWorkStatus.getStatus() != "UNKNOWN") {
|
||||
Log.d(TAG, "网络类型:" + sNetWorkStatus.getStatus() + "网络强度:" + sNetWorkStatus.getSignalStrength());
|
||||
if (sNetWorkStatus.getSignalStrength() <= -90) {
|
||||
AIAssist.getInstance(context).speakTTSVoice("网络信号差");
|
||||
@@ -570,4 +575,5 @@ public class CheckActivity extends AppCompatActivity {
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.check.IMogoCheckListener;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
@@ -132,7 +133,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
IMogoStatusChangedListener,
|
||||
IMogoIntentListener,
|
||||
// IMogoLocationListener,
|
||||
IMogoCarLocationChangedListener2 {
|
||||
IMogoCarLocationChangedListener2,
|
||||
IMogoCheckListener {
|
||||
|
||||
|
||||
private static final String TAG = "EntranceFragment";
|
||||
|
||||
@@ -245,7 +248,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
private final AdasNoticeHelper adasNoticeHelper = new AdasNoticeHelper();
|
||||
private final CameraLiveNoticeHelper mCameraLiveNoticeHelper = new CameraLiveNoticeHelper();
|
||||
protected TextView jumpCheck;
|
||||
//检测
|
||||
private TextView jumpCheck;
|
||||
private ImageView tipImageView;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -400,7 +405,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
localIsVrMode = true;
|
||||
}
|
||||
// //检测入口
|
||||
jumpCheck = (TextView) findViewById(R.id.module_ext_enter_check);
|
||||
jumpCheck = findViewById(R.id.module_ext_enter_check);
|
||||
tipImageView = findViewById(R.id.error_tip_image);
|
||||
jumpCheck.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -733,7 +739,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
mMogoRegisterCenter.registerMogoNaviListener(TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoMapListener(TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoAimlessModeListener(TAG, this);
|
||||
//车辆监控
|
||||
mApis.getCheckProvider().registerVehicleMonitoringListener(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, this);
|
||||
|
||||
mMogoMarkerManager = mService.getMarkerManager(getContext());
|
||||
|
||||
@@ -785,6 +792,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mCameraLiveNoticeHelper.release();
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener(TAG, this);
|
||||
mApis.getCheckProvider().unregisterListener(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1414,4 +1422,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
public void onCarLocationChanged(MogoLatLng latLng) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMonitoringStatus(boolean hasError) {
|
||||
Log.d(TAG, "updateCheckStatus");
|
||||
if (hasError == true) {
|
||||
tipImageView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
tipImageView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,9 +59,9 @@ public class VehicleMonitoring implements Handler.Callback {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void vehicleMonitor() {
|
||||
public boolean vehicleMonitor() {
|
||||
Log.d(TAG, "vehicleMonitor");
|
||||
MogoApisHandler.getInstance().getApis().getCheckProvider().checkMonitor(mContext);
|
||||
return MogoApisHandler.getInstance().getApis().getCheckProvider().checkMonitor(mContext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ public class MogoReceiver extends BroadcastReceiver {
|
||||
public static final String ACTION_V2X_FRONT_WARNING = "ACTION_V2X_FRONT_WARNING";
|
||||
//v2x预警弹框清除
|
||||
public static final String ACTION_V2X_REMOVE_TIP_WINDOW = "ACTION_V2X_REMOVE_TIP_WINDOW";
|
||||
//车辆监控
|
||||
public static final String ACTION_CHECK_VEHICLE_MONITORING = "ACTION_CHECK_VEHICLE_MONITORING";
|
||||
|
||||
private IMogoIntentManager mMogoIntentManager;
|
||||
|
||||
|
||||
@@ -3,11 +3,28 @@ package com.mogo.service.check;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.check.IMogoCheckListener;
|
||||
import com.mogo.service.datamanager.IMogoDataChangedListener;
|
||||
|
||||
/**
|
||||
* 检测接口
|
||||
*/
|
||||
public interface ICheckProvider extends IProvider {
|
||||
/**
|
||||
* 注册车辆监控变化监听
|
||||
*
|
||||
* @param module 监听模块
|
||||
* @param listener
|
||||
*/
|
||||
void registerVehicleMonitoringListener(String module, IMogoCheckListener listener);
|
||||
|
||||
/**
|
||||
* 注销车辆监控变化监听
|
||||
*
|
||||
* @param module
|
||||
*/
|
||||
void unregisterListener(String module, IMogoCheckListener listener);
|
||||
|
||||
/**
|
||||
* 启动检测模块
|
||||
*/
|
||||
@@ -21,7 +38,11 @@ public interface ICheckProvider extends IProvider {
|
||||
/**
|
||||
* 指标监测
|
||||
*/
|
||||
void checkMonitor(Context context);
|
||||
boolean checkMonitor(Context context);
|
||||
|
||||
/**
|
||||
* 根据监测指标修改主页检测按钮
|
||||
*/
|
||||
void updateMonitoringStatus(String module, boolean hasError);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.service.module;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.check.IMogoCheckListener;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
|
||||
Reference in New Issue
Block a user