@@ -1,158 +0,0 @@
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* 鹰眼系统、自动驾驶系统 检测模块
|
||||
*
|
||||
* @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<>();
|
||||
private boolean hasTipShow = false;//是否已经弹框提示
|
||||
CheckDialog dialog;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
LogUtils.dTag(TAG, "初始化 CheckProvider 模块");
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerVehicleMonitoringListener(String module, IMogoCheckListener listener) {
|
||||
if (listener == null || module == null) {
|
||||
LogUtils.dTag(TAG, "listener == null || intent == null");
|
||||
return;
|
||||
}
|
||||
if (!mListeners.containsKey(module)) {
|
||||
LogUtils.dTag(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) {
|
||||
Intent starter = new Intent(context, CheckActivity.class);
|
||||
starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCheckDialog(Context context) {
|
||||
showDialog(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkMonitor(Context context) {
|
||||
if (context != null) {
|
||||
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;//已弹框
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指标异常弹框
|
||||
*/
|
||||
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, Integer state) {
|
||||
List<IMogoCheckListener> listeners = mListeners.get(module);
|
||||
if (listeners != null && !listeners.isEmpty()) {
|
||||
for (IMogoCheckListener listener : listeners) {
|
||||
if (listener != null) {
|
||||
listener.updateMonitoringStatus(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.mogo.eagle.core.function.check
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.function.api.check.ICheckProvider
|
||||
import com.mogo.eagle.core.function.api.check.IMogoCheckListener
|
||||
import com.mogo.eagle.core.function.check.view.CheckActivity
|
||||
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.module.service.receiver.MogoReceiver
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.utils.ActivityLifecycleManager
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
* 鹰眼系统、自动驾驶系统 检测模块
|
||||
*
|
||||
* @date 4/21/21 3:39 PM
|
||||
* 需求地址
|
||||
* wiki:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=58204952
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_CHECK)
|
||||
class VehicleMonitoringManager : ICheckProvider {
|
||||
private val TAG = "VehicleMonitoringManager"
|
||||
|
||||
private var mContext: Context? = null
|
||||
private val mListeners: ConcurrentHashMap<String, IMogoCheckListener> = ConcurrentHashMap()
|
||||
private var hasTipShow = false //是否已经弹框提示
|
||||
var dialog: CheckDialog? = null
|
||||
|
||||
override fun init(context: Context) {
|
||||
LogUtils.dTag(TAG, "初始化 CheckProvider 模块")
|
||||
mContext = context
|
||||
}
|
||||
|
||||
override fun registerVehicleMonitoringListener(module: String, listener: IMogoCheckListener) {
|
||||
mListeners[module] = listener
|
||||
}
|
||||
|
||||
override fun unregisterListener(module: String) {
|
||||
if (mListeners.containsKey(module)) {
|
||||
mListeners.remove(module)
|
||||
}
|
||||
}
|
||||
|
||||
override fun startCheckActivity(context: Context) {
|
||||
val starter = Intent(context, CheckActivity::class.java)
|
||||
starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(starter)
|
||||
}
|
||||
|
||||
override fun showCheckDialog(context: Context) {
|
||||
showDialog(context)
|
||||
}
|
||||
|
||||
override fun checkMonitor(context: Context) {
|
||||
CheckActivity.checkMonitor(context) { state ->
|
||||
updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, state)
|
||||
if (state == 1) {
|
||||
hasTipShow = false
|
||||
} else {
|
||||
if (!hasTipShow) {
|
||||
showDialog(context)
|
||||
hasTipShow = true //已弹框
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指标异常弹框
|
||||
*/
|
||||
private fun showDialog(context: Context) {
|
||||
try {
|
||||
if (ActivityLifecycleManager.getInstance().isAppActive &&
|
||||
AppUtils.isAppRunning(
|
||||
AppUtils.getAppPackageName()
|
||||
) && ActivityUtils.getTopActivity() !is CheckActivity
|
||||
) {
|
||||
if (dialog != null) {
|
||||
dialog!!.dismiss()
|
||||
}
|
||||
dialog = CheckDialog(context, true)
|
||||
dialog!!.show()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateMonitoringStatus(module: String, state: Int) {
|
||||
for (listener in mListeners) {
|
||||
listener.value.updateMonitoringStatus(state)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.eagle.core.function.check.api;
|
||||
|
||||
import com.mogo.service.adas.IMogoAdasDataCallback;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 自车检测结果回调
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.mogo.eagle.core.function.check.net;
|
||||
|
||||
import java.util.Map;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,9 +6,6 @@ import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
@@ -23,17 +20,13 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
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.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;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
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.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.NetworkStatusUtil;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -16,8 +15,6 @@ import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.model.CheckItemInfo;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
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;
|
||||
import android.view.ViewGroup;
|
||||
@@ -15,7 +13,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,8 +3,6 @@ package com.mogo.eagle.core.function.check.view;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
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;
|
||||
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.model.CheckItemInfo;
|
||||
|
||||
Reference in New Issue
Block a user