Merge branch 'dev/dev_eagle_architecture_upgrade' into dev/dev_eagle_wuhan_sikua_obu
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
defaultConfig {
|
||||
@@ -11,14 +13,16 @@ android {
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -45,11 +49,9 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.coroutinescore
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
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')
|
||||
implementation rootProject.ext.dependencies.material
|
||||
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
@@ -58,13 +60,12 @@ dependencies {
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(':services:mogo-service-api')
|
||||
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':modules:mogo-module-service')
|
||||
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
}
|
||||
implementation 'com.tencent.bugly:crashreport_upgrade:latest.release'
|
||||
//其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如2.1.9
|
||||
implementation 'com.tencent.bugly:nativecrashreport:latest.release'
|
||||
//其中latest.release指代最新Bugly NDK版本号,也可以指定明确的版本号,例如3.0
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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,112 @@
|
||||
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.common.MogoApisHandler
|
||||
import com.mogo.module.service.receiver.MogoReceiver
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
||||
import com.mogo.service.statusmanager.StatusDescriptor
|
||||
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, IMogoStatusChangedListener {
|
||||
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
|
||||
MogoApisHandler.getInstance().apis.statusManagerApi.registerStatusChangedListener(
|
||||
TAG,
|
||||
StatusDescriptor.MAIN_PAGE_RESUME,
|
||||
this
|
||||
)
|
||||
}
|
||||
|
||||
override fun registerVehicleMonitoringListener(module: String, listener: IMogoCheckListener) {
|
||||
mListeners[module] = listener
|
||||
}
|
||||
|
||||
override fun unregisterListener(module: String) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStatusChanged(descriptor: StatusDescriptor, isTrue: Boolean) {
|
||||
if (descriptor == StatusDescriptor.MAIN_PAGE_RESUME) {
|
||||
if (!isTrue) {
|
||||
if (dialog != null && dialog!!.isShowing) {
|
||||
dialog!!.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -51,7 +44,7 @@ import io.reactivex.schedulers.Schedulers;
|
||||
public class CheckActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "CheckActivity";
|
||||
private static RecyclerView mRecyclerView;
|
||||
private RecyclerView mRecyclerView;
|
||||
private static CheckResultData sCheckResultData;
|
||||
private static NetworkStatusUtil.NetWorkStatus sNetWorkStatus;
|
||||
private ImageView mImageView;
|
||||
@@ -71,7 +64,6 @@ public class CheckActivity extends AppCompatActivity {
|
||||
private ProgressBar mProgressBar;
|
||||
private final static long DURATION_TIME = 1000;
|
||||
private static CheckAdapter mCheckAdapter;
|
||||
private static boolean isFront = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -90,7 +82,6 @@ public class CheckActivity extends AppCompatActivity {
|
||||
* 列表View初始化
|
||||
*/
|
||||
public void initView() {
|
||||
isFront = true;
|
||||
setAnimation = new AnimatorSet();
|
||||
mImageView = findViewById(R.id.btnBack);
|
||||
scanBottomCarImage = findViewById(R.id.scan_car_image);
|
||||
@@ -107,7 +98,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
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(this, sCheckResultData);
|
||||
mCheckAdapter = new CheckAdapter(CheckActivity.this, sCheckResultData);
|
||||
mRecyclerView.setAdapter(mCheckAdapter);
|
||||
}
|
||||
|
||||
@@ -245,6 +236,9 @@ public class CheckActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if (mCheckAdapter!=null){
|
||||
mCheckAdapter.dismissDialog();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -260,7 +254,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
isFront = false;
|
||||
mCheckAdapter.ondestry();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -35,7 +32,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
public CheckAdapter(@NonNull Context context, @NonNull CheckResultData checkResult) {
|
||||
mContext = context;
|
||||
mCheckResultData = checkResult;
|
||||
mLayoutInflater = LayoutInflater.from(context);
|
||||
mLayoutInflater = LayoutInflater.from(mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,6 +59,17 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
return holder;
|
||||
}
|
||||
|
||||
public void dismissDialog() {
|
||||
if (mCheckInfoListDialog!=null && mCheckInfoListDialog.isShowing()){
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public void ondestry() {
|
||||
mContext = null;
|
||||
mCheckInfoListDialog = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 顶部view列表
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
@@ -100,4 +97,8 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return position;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -79,8 +74,6 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
|
||||
public List showInfoResult() {
|
||||
|
||||
// List<CheckResultData.CheckListItem> test = new ArrayList();//测试数据
|
||||
|
||||
if (result.size() > 0) {
|
||||
result.clear();
|
||||
}
|
||||
@@ -106,9 +99,6 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
// test.addAll(result);
|
||||
// test.addAll(result);
|
||||
// test.addAll(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.mogo.utils.logger.Logger
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 2021/8/5 5:29 下午
|
||||
* 弹窗Window 管理
|
||||
*/
|
||||
internal class WarningFloatWindowHelper(
|
||||
val context: Context,
|
||||
@@ -62,8 +63,8 @@ internal class WarningFloatWindowHelper(
|
||||
// 设置浮窗以外的触摸事件可以传递给后面的窗口、不自动获取焦点
|
||||
flags = if (config.immersionStatusBar)
|
||||
// 没有边界限制,允许窗口扩展到屏幕外
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
else WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
else WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
||||
width = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
|
||||
@@ -142,7 +143,7 @@ internal class WarningFloatWindowHelper(
|
||||
.enterAnim()?.apply {
|
||||
// 可以延伸到屏幕外,动画结束按需去除该属性,不然旋转屏幕可能置于屏幕外部
|
||||
params.flags =
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
|
||||
addListener(object : Animator.AnimatorListener {
|
||||
override fun onAnimationRepeat(animation: Animator?) {}
|
||||
@@ -152,7 +153,7 @@ internal class WarningFloatWindowHelper(
|
||||
if (!config.immersionStatusBar) {
|
||||
// 不需要延伸到屏幕外了,防止屏幕旋转的时候,浮窗处于屏幕外
|
||||
params.flags =
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +188,7 @@ internal class WarningFloatWindowHelper(
|
||||
if (config.isAnim) return
|
||||
config.isAnim = true
|
||||
params.flags =
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
animator.addListener(object : Animator.AnimatorListener {
|
||||
override fun onAnimationRepeat(animation: Animator?) {}
|
||||
|
||||
|
||||
@@ -4,11 +4,15 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.constants.MoGoOBUConfig
|
||||
import com.mogo.eagle.core.data.obu.ObuStatusInfo
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
|
||||
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
||||
|
||||
/**
|
||||
@@ -43,10 +47,20 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
private fun initView() {
|
||||
tvObuInfo.text = CallerObuListenerManager.getObuStatusInfo()
|
||||
btnSetObuIP.setOnClickListener {
|
||||
val obuIP = etObuIP.text.toString()
|
||||
if (obuIP.isNotEmpty()) {
|
||||
CallerOBUManager.resetObuIpAddress(obuIP)
|
||||
} else {
|
||||
ToastUtils.showShort("请输入正确的IP地址")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onObuStatusResponse(obuStatusInfo: ObuStatusInfo) {
|
||||
tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
|
||||
etObuIP.setText(obuStatusInfo.connectIP)
|
||||
etObuIP.text?.let { etObuIP.setSelection(it.length) }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,13 +6,16 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AdasOCHData
|
||||
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.android.synthetic.main.view_autopilot_status.view.*
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -20,8 +23,8 @@ import kotlinx.android.synthetic.main.view_autopilot_status.view.*
|
||||
* 自动驾驶状态按钮
|
||||
*/
|
||||
class AutoPilotStatusView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet
|
||||
context: Context,
|
||||
attrs: AttributeSet
|
||||
) : ConstraintLayout(context, attrs), View.OnClickListener, IMogoAdasOCHCallback {
|
||||
|
||||
private val TAG = "AutopilotStatusView"
|
||||
@@ -53,7 +56,7 @@ class AutoPilotStatusView @JvmOverloads constructor(
|
||||
when (mAutopilotStatus) {
|
||||
0 -> {// 不可自动驾驶,adas与工控机没有链接,或工控机异常
|
||||
LogUtils.eTag(TAG, "不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查")
|
||||
ToastUtils.showShort("不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查")
|
||||
// ToastUtils.showShort("不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查")
|
||||
// TODO 这里临时触发自动驾驶能力,测试功过这里删除
|
||||
CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(true)
|
||||
}
|
||||
@@ -64,6 +67,15 @@ class AutoPilotStatusView @JvmOverloads constructor(
|
||||
CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(false)
|
||||
}
|
||||
}
|
||||
// startAutoPilot();
|
||||
}
|
||||
private fun startAutoPilot() {
|
||||
val currentAutopilot = RemoteControlAutoPilotParameters()
|
||||
currentAutopilot.isSpeakVoice = false
|
||||
currentAutopilot.startLatLon = RemoteControlAutoPilotParameters.AutoPilotLonLat(40.194795425,116.724476409);
|
||||
currentAutopilot.endLatLon = RemoteControlAutoPilotParameters.AutoPilotLonLat(40.199730,116.735687);
|
||||
currentAutopilot.vehicleType = 10
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.aiCloudToAdasData(currentAutopilot)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.api.check.IMogoCheckListener
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import kotlinx.android.synthetic.main.view_check_status.view.*
|
||||
|
||||
/**
|
||||
*@author xiaoyuzhou
|
||||
*@date 2021/8/6 12:25 下午
|
||||
*/
|
||||
class CheckStatusView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMogoCheckListener {
|
||||
private val TAG = "CheckStatusView"
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_check_status, this, true)
|
||||
|
||||
setOnClickListener {
|
||||
// 启动检测页面
|
||||
CallerCheckManager.startCheckActivity(getContext())
|
||||
}
|
||||
}
|
||||
|
||||
private fun showErrorIcon() {
|
||||
errorTipImage.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun dismissErrorIcon() {
|
||||
errorTipImage.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun updateMonitoringStatus(state: Int?) {
|
||||
Logger.d(TAG, "updateCheckStatus")
|
||||
if (state == 1) {
|
||||
dismissErrorIcon()
|
||||
} else {
|
||||
showErrorIcon()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
Logger.d(TAG, "onAttachedToWindow")
|
||||
//车辆监控
|
||||
CallerCheckManager.registerVehicleMonitoringListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
Logger.d(TAG, "onDetachedFromWindow")
|
||||
//车辆监控
|
||||
CallerCheckManager.unregisterListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,5 +61,13 @@
|
||||
app:layout_goneMarginTop="40px"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.CheckStatusView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="40px"
|
||||
android:layout_marginBottom="@dimen/dp_490"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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:id="@+id/clAutopilotStatus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!--车辆检测入口-->
|
||||
<TextView
|
||||
android:id="@+id/moduleHmiCheck"
|
||||
android:layout_width="@dimen/dp_128"
|
||||
android:layout_height="@dimen/dp_128"
|
||||
android:background="@drawable/module_ext_check"
|
||||
android:gravity="center"
|
||||
android:text="检测"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/module_hmi_btn_text_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/errorTipImage"
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:src="@drawable/check_error_image"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintRight_toRightOf="@+id/moduleHmiCheck"
|
||||
app:layout_constraintTop_toTopOf="@+id/moduleHmiCheck" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -9,9 +9,10 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitleObu"
|
||||
@@ -24,6 +25,26 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/etObuIP"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#32009688"
|
||||
android:gravity="center"
|
||||
android:inputType="number"
|
||||
android:padding="@dimen/dp_5"
|
||||
android:text="192.168.1.199"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSetObuIP"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_5"
|
||||
android:text="设置IP"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvObuInfo"
|
||||
android:layout_width="match_parent"
|
||||
@@ -33,7 +54,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvTitleObu" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@ package com.mogo.eagle.core.function.obu.mogo
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.constants.MoGoOBUConfig
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuProvider
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -14,9 +16,22 @@ import com.mogo.service.MogoServicePaths
|
||||
class MoGoObuProvider : IMoGoObuProvider {
|
||||
private val TAG = "MoGoObuProvider"
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
override fun init(context: Context) {
|
||||
LogUtils.dTag(TAG, "初始化蘑菇自研OBU……")
|
||||
|
||||
MogoPrivateObuManager.INSTANCE.init(context)
|
||||
mContext = context
|
||||
val ipAddress =
|
||||
SharedPrefsMgr.getInstance(context).getString(MoGoOBUConfig.OBU_IP, "192.168.1.199")
|
||||
MogoPrivateObuManager.INSTANCE.init(context, ipAddress)
|
||||
}
|
||||
|
||||
override fun connect(ipAddress: String) {
|
||||
mContext?.let {
|
||||
// 保存本地OBU IP地址
|
||||
SharedPrefsMgr.getInstance(it).putString(MoGoOBUConfig.OBU_IP, ipAddress)
|
||||
MogoPrivateObuManager.INSTANCE.connectObu(it, ipAddress)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,18 +41,33 @@ class MogoPrivateObuManager private constructor() {
|
||||
private var mContext: Context? = null
|
||||
private var mObuStatusInfo = ObuStatusInfo()
|
||||
|
||||
fun init(context: Context?) {
|
||||
fun init(context: Context, ipAddress: String) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "obuManager初始化--")
|
||||
mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
|
||||
.navigation(context) as IMogoServiceApis
|
||||
mContext = context
|
||||
mIMogoMapService = mMogoServiceApis!!.mapServiceApi
|
||||
|
||||
//自研obu
|
||||
MogoObuManager.getInstance().connect(context, mObuStatusInfo.connectIP)
|
||||
connectObu(context, ipAddress)
|
||||
MogoObuManager.getInstance().registerListener(mogoObuListener)
|
||||
}
|
||||
|
||||
fun connectObu(context: Context, ipAddress: String) {
|
||||
//自研obu初始化
|
||||
mObuStatusInfo.connectIP = ipAddress
|
||||
if (!MogoObuManager.getInstance().isConnected) {
|
||||
MogoObuManager.getInstance().connect(context, mObuStatusInfo.connectIP)
|
||||
} else {
|
||||
MogoObuManager.getInstance().disConnect()
|
||||
try {
|
||||
Thread.sleep(500)
|
||||
MogoObuManager.getInstance().connect(context, mObuStatusInfo.connectIP)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() {
|
||||
// OBU连接成功
|
||||
override fun onConnected() {
|
||||
|
||||
Reference in New Issue
Block a user