Merge branch 'dev/dev_eagle_architecture_upgrade' into dev/dev_eagle_wuhan_sikua_obu
This commit is contained in:
1
.idea/codeStyles/Project.xml
generated
1
.idea/codeStyles/Project.xml
generated
@@ -8,6 +8,7 @@
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="KEEP_LINE_BREAKS" value="false" />
|
||||
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
|
||||
3
.idea/gradle.xml
generated
3
.idea/gradle.xml
generated
@@ -18,11 +18,14 @@
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/core" />
|
||||
<option value="$PROJECT_DIR$/core/function-impl" />
|
||||
<option value="$PROJECT_DIR$/core/function-impl/mogo-core-function-autopilot" />
|
||||
<option value="$PROJECT_DIR$/core/function-impl/mogo-core-function-check" />
|
||||
<option value="$PROJECT_DIR$/core/function-impl/mogo-core-function-hmi" />
|
||||
<option value="$PROJECT_DIR$/core/function-impl/mogo-core-function-map" />
|
||||
<option value="$PROJECT_DIR$/core/function-impl/mogo-core-function-notice" />
|
||||
<option value="$PROJECT_DIR$/core/function-impl/mogo-core-function-obu-mogo" />
|
||||
<option value="$PROJECT_DIR$/core/function-impl/mogo-core-function-smp" />
|
||||
<option value="$PROJECT_DIR$/core/function-impl/mogo-core-function-v2x" />
|
||||
<option value="$PROJECT_DIR$/core/mogo-core-data" />
|
||||
<option value="$PROJECT_DIR$/core/mogo-core-function-api" />
|
||||
<option value="$PROJECT_DIR$/core/mogo-core-function-call" />
|
||||
|
||||
22
.idea/misc.xml
generated
22
.idea/misc.xml
generated
@@ -13,11 +13,28 @@
|
||||
<map>
|
||||
<entry key="../../../../../../layout/custom_preview.xml" value="0.390625" />
|
||||
<entry key="../../../../../layout/custom_preview.xml" value="0.19947916666666668" />
|
||||
<entry key="OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml" value="0.27239583333333334" />
|
||||
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml" value="0.25" />
|
||||
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_warning.xml" value="0.19895833333333332" />
|
||||
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_autopilot_status.xml" value="1.0" />
|
||||
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml" value="0.18333333333333332" />
|
||||
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml" value="0.81228986597212" />
|
||||
<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" />
|
||||
<entry key="modules/mogo-module-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="0.25" />
|
||||
<entry key="modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml" value="0.3125" />
|
||||
<entry key="modules/mogo-module-push/src/main/res/drawable/module_push_decrease_timer_bkg.xml" value="0.266875" />
|
||||
<entry key="modules/mogo-module-push/src/main/res/drawable/module_push_dialog_check_background.xml" value="0.33" />
|
||||
<entry key="modules/mogo-module-push/src/main/res/drawable/module_push_item_backgroud.xml" value="0.18125" />
|
||||
<entry key="modules/mogo-module-push/src/main/res/drawable/module_push_item_background.xml" value="0.190625" />
|
||||
<entry key="modules/mogo-module-push/src/main/res/drawable/module_push_item_background_origin.xml" value="0.108203125" />
|
||||
<entry key="modules/mogo-module-push/src/main/res/drawable/module_push_left_button.xml" value="0.266875" />
|
||||
<entry key="modules/mogo-module-push/src/main/res/layout/module_push_dialog_check.xml" value="0.1562204230010497" />
|
||||
<entry key="modules/mogo-module-push/src/main/res/layout/module_push_item.xml" value="0.21650669144397774" />
|
||||
<entry key="modules/mogo-module-push/src/main/res/layout/module_push_item_origin.xml" value="0.1" />
|
||||
<entry key="modules/mogo-module-push/src/main/res/layout/module_push_item_vertical.xml" value="0.38255608566765825" />
|
||||
<entry key="modules/mogo-module-push/src/main/res/layout/module_push_message_hisotry_fragment.xml" value="0.134375" />
|
||||
<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" />
|
||||
@@ -25,9 +42,14 @@
|
||||
<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/layout/module_dialog_adas_dispatch_airport.xml" value="0.169140625" />
|
||||
<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" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/layout/module_services_online_car_panel_item.xml" value="0.2734375" />
|
||||
<entry key="modules/mogo-module-v2x/src/main/res/drawable/v2x_front_warning_bg.xml" value="0.18125" />
|
||||
<entry key="modules/mogo-module-v2x/src/main/res/layout/v2x_road_front_warning_vr.xml" value="0.169140625" />
|
||||
<entry key="modules/mogo-module-v2x/src/main/res/layout/window_fault_help.xml" value="0.1062192118226601" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
@@ -31,12 +30,11 @@ import com.mogo.och.bus.bean.UpdateSiteStatusRequest;
|
||||
import com.mogo.och.bus.fragment.OchBusFragment;
|
||||
import com.mogo.och.bus.net.IOchBusApiService;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.adas.entity.AdasOCHData;
|
||||
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.eagle.core.data.autopilot.AdasOCHData;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,8 +15,8 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.och.taxi.ui.OCHTaxiUiController;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.adas.entity.AdasOCHData;
|
||||
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.eagle.core.data.autopilot.AdasOCHData;
|
||||
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
|
||||
@@ -39,20 +39,16 @@ public class OCHTaxiOverlayManager {
|
||||
/**
|
||||
* 绘制最优路线
|
||||
*
|
||||
* @param polylinePoint 要绘制的经纬度度集合
|
||||
* @param routelist 要绘制的经纬度度集合
|
||||
*/
|
||||
public IMogoPolyline draw(MogoLocation carLocal, List<MogoLatLng> polylinePoint) {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mPolylinePointList.clear();
|
||||
mPolylineColors.clear();
|
||||
}
|
||||
if (polylinePoint != null) {
|
||||
public IMogoPolyline draw(MogoLocation carLocal, List<MogoLatLng> routelist) {
|
||||
clearMogoRouteOverlay();
|
||||
if (routelist != null) {
|
||||
|
||||
// 将当前车辆位置放进去
|
||||
mPolylinePointList.add(new MogoLatLng(carLocal.getLatitude(), carLocal.getLongitude()));
|
||||
// 过滤后台推送的推荐路线集合
|
||||
for (MogoLatLng polyline : polylinePoint) {
|
||||
for (MogoLatLng polyline : routelist) {
|
||||
//需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃
|
||||
if (LocationUtils.isPointOnCarFront(carLocal, polyline)) {
|
||||
mPolylinePointList.add(polyline);
|
||||
@@ -69,4 +65,12 @@ public class OCHTaxiOverlayManager {
|
||||
return mMoGoPolyline;
|
||||
}
|
||||
|
||||
public void clearMogoRouteOverlay(){
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mPolylinePointList.clear();
|
||||
mPolylineColors.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.view.SlidePanelView;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.service.adas.IMogoAdasRouteCallBack;
|
||||
import com.mogo.service.adas.entity.AdasOCHData;
|
||||
import com.mogo.eagle.core.data.autopilot.AdasOCHData;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -358,23 +358,22 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
}
|
||||
|
||||
private Location mLocation;
|
||||
private MogoLocation mogoLocation;
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location location ) {
|
||||
OCHTaxiUiController.getInstance().runOnUIThread( () -> {
|
||||
calculateTravelDistance( location );
|
||||
} );
|
||||
// //坐标转换
|
||||
// MogoLocation loc = new MogoLocation();
|
||||
// loc.setTime(loc.getTime());
|
||||
// loc.setAccuracy(location.getAccuracy());
|
||||
// loc.setSpeed(location.getSpeed());
|
||||
// loc.setLongitude(location.getLongitude());
|
||||
// loc.setLatitude(location.getLatitude());
|
||||
// loc.setAltitude(location.getAltitude());
|
||||
// loc.setBearing(location.getBearing());
|
||||
// loc.setProvider(location.getProvider());
|
||||
// mogoLocation = loc;
|
||||
//坐标转换
|
||||
MogoLocation loc = new MogoLocation();
|
||||
loc.setTime(loc.getTime());
|
||||
loc.setAccuracy(location.getAccuracy());
|
||||
loc.setSpeed(location.getSpeed());
|
||||
loc.setLongitude(location.getLongitude());
|
||||
loc.setLatitude(location.getLatitude());
|
||||
loc.setAltitude(location.getAltitude());
|
||||
loc.setBearing(location.getBearing());
|
||||
loc.setProvider(location.getProvider());
|
||||
drawRouteOverlay(loc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -478,24 +477,24 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
});
|
||||
}
|
||||
private OCHTaxiOverlayManager ochTaxiOverlayManager;
|
||||
|
||||
private List<MogoLatLng> mRouteList;
|
||||
@Override
|
||||
public void routeResult(List<MogoLatLng> routeList) {
|
||||
if (routeList == null ) return;
|
||||
// double distance = calculateTravelDistance(mogoLocation,routeList);
|
||||
// if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
|
||||
// MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance );
|
||||
// updateOrderBaseStatusInfo();
|
||||
// }
|
||||
// Logger.d("lianglihui","routeResult 剩余导航距离:"+distance);
|
||||
// if (routeList != null && routeList.size() >0){
|
||||
// Logger.d("lianglihui","routeResult:"+routeList.size());
|
||||
// //adas回调导航路径 绘制引导线
|
||||
// if ( ochTaxiOverlayManager == null){
|
||||
// ochTaxiOverlayManager = new OCHTaxiOverlayManager(this.getContext());
|
||||
// }
|
||||
// ochTaxiOverlayManager.draw(mogoLocation,routeList);
|
||||
// }
|
||||
mRouteList = routeList;
|
||||
}
|
||||
|
||||
private void drawRouteOverlay(MogoLocation location){
|
||||
if (mRouteList == null && ochTaxiOverlayManager!= null){
|
||||
ochTaxiOverlayManager.clearMogoRouteOverlay();
|
||||
return;
|
||||
}
|
||||
if (mRouteList.size() >0){
|
||||
//adas回调导航路径 绘制引导线
|
||||
if ( ochTaxiOverlayManager == null){
|
||||
ochTaxiOverlayManager = new OCHTaxiOverlayManager(this.getContext());
|
||||
}
|
||||
ochTaxiOverlayManager.draw(location,mRouteList);
|
||||
}
|
||||
}
|
||||
|
||||
public double calculateTravelDistance(MogoLocation carLocation,List<MogoLatLng> routeList){
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.view.OnPreventFastClickListener;
|
||||
import com.mogo.och.view.SlidePanelView;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,9 +34,9 @@ ext {
|
||||
androidxjunit : "androidx.test.ext:junit:1.1.2",
|
||||
androidxespressocore : "androidx.test.espresso:espresso-core:3.3.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",
|
||||
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",
|
||||
// json 转换
|
||||
gson : "com.google.code.gson:gson:2.8.4",
|
||||
// 内存泄漏检测
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
- function-impl 目录下编写的都是对mogo-core-function-api定的功能实现,
|
||||
- mogo-core-function-check 程序及车辆检测模块
|
||||
- mogo-core-function-hmi UI呈现及交互模块
|
||||
- mogo-core-function-map 地图相关的模块
|
||||
- mogo-core-function-notice 云端公告、调度相关模块
|
||||
- mogo-core-function-obu-mogo 自研OBU预警模块
|
||||
- mogo-core-function-smp 小地图模块
|
||||
- mogo-core-function-v2x 自车+云端预警模块
|
||||
|
||||
- mogo-core-data:定义基础业务所需要的数据结构
|
||||
|
||||
|
||||
1
core/function-impl/mogo-core-function-autopilot/.gitignore
vendored
Normal file
1
core/function-impl/mogo-core-function-autopilot/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
67
core/function-impl/mogo-core-function-autopilot/build.gradle
Normal file
67
core/function-impl/mogo-core-function-autopilot/build.gradle
Normal file
@@ -0,0 +1,67 @@
|
||||
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
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
implementation "com.zhidao.support.adas:high:1.2.0.2"
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
|
||||
} else {
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.eagle.core
|
||||
POM_ARTIFACT_ID=function-autopilot
|
||||
VERSION_CODE=1
|
||||
21
core/function-impl/mogo-core-function-autopilot/proguard-rules.pro
vendored
Normal file
21
core/function-impl/mogo-core-function-autopilot/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.autopilot">
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.mogo.eagle.core.function.autopilot;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AdasControlCommandParameter;
|
||||
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutoPilotProvider;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutoPilotStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/22 8:43 下午
|
||||
*/
|
||||
public class MoGoAutoPilotProvider implements IMoGoAutoPilotProvider {
|
||||
|
||||
private static final String TAG = "MogoAutoPilotProvider";
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAutoPilot(RemoteControlAutoPilotParameters result) {
|
||||
if (AdasManager.getInstance().isSocketConnect()) {
|
||||
AdasControlCommandParameter parameter = new AdasControlCommandParameter(TAG, result);
|
||||
AdasManager.getInstance().aiCloudToAdasData(GsonUtils.toJson(parameter));
|
||||
} else {
|
||||
LogUtils.eTag(TAG, "车机与工控机链接失败,无法开启自动驾驶");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelAutoPilot() {
|
||||
if (AdasManager.getInstance().isSocketConnect()) {
|
||||
AdasManager.getInstance().controlAutopilotCarHead();
|
||||
} else {
|
||||
LogUtils.eTag(TAG, "车机与工控机链接失败,无法断开自动驾驶");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAutopilotStatus() {
|
||||
// int status = IMoGoAutoPilotStatusListener.STATUS_AUTOPILOT_DISABLE;
|
||||
// try {
|
||||
// status = adasProvider.autopilotStateCall().getState();
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,6 +43,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.callchatprovider
|
||||
implementation rootProject.ext.dependencies.coroutinesandroid
|
||||
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')
|
||||
|
||||
@@ -71,7 +71,7 @@ public class VehicleMonitoringManager implements ICheckProvider {
|
||||
@Override
|
||||
public boolean checkMonitor(Context context) {
|
||||
if (context != null) {
|
||||
return CheckActivity.checkMonitor();
|
||||
return CheckActivity.checkMonitor(context);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -126,6 +126,11 @@ public class CheckItemInfo implements Serializable {
|
||||
int ITEM_TYPE_CHECK_LIST = 1;
|
||||
int ITEM_TYPE_CHECK_IMAGE = 2;
|
||||
}
|
||||
|
||||
public interface CheckInfoStyle {
|
||||
String CHECK_INFO_STYLE_DEVICES = "devices";
|
||||
String CHECK_INFO_STYLE_SOFT = "soft";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
package com.mogo.eagle.core.function.check.net;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -6,5 +12,97 @@ package com.mogo.eagle.core.function.check.net;
|
||||
* @since: 8/13/21
|
||||
*/
|
||||
public class CheckApiServiceFactory {
|
||||
private static CheckApiServices mDevaApiService;
|
||||
private static CheckApiServices mDataApiService;
|
||||
private static CheckApiServices mLauncherSnapshotApiService;
|
||||
private static CheckApiServices mGeoFenceCarServiceApiService;
|
||||
private static CheckApiServices mRealtimeLocationApiService;
|
||||
private static CheckApiServices mDataServiceApiService;
|
||||
|
||||
/**
|
||||
* 获取指定域名下的 API 服务
|
||||
*/
|
||||
public static CheckApiServices getApiService(Context context, String netHost) {
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_SERVICES_NETWORK)
|
||||
.navigation(context);
|
||||
return network.create(CheckApiServices.class, netHost);
|
||||
}
|
||||
|
||||
public static CheckApiServices getDevaApiService(Context context) {
|
||||
if (mDevaApiService == null) {
|
||||
synchronized (CheckApiServiceFactory.class) {
|
||||
if (mDevaApiService == null) {
|
||||
mDevaApiService = getApiService(context, HostConst.DEVA_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mDevaApiService;
|
||||
}
|
||||
|
||||
public static CheckApiServices getDataApiService(Context context) {
|
||||
if (mDataApiService == null) {
|
||||
synchronized (CheckApiServiceFactory.class) {
|
||||
if (mDataApiService == null) {
|
||||
mDataApiService = getApiService(context, HostConst.DATA_SERVICE_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mDataApiService;
|
||||
}
|
||||
|
||||
public static CheckApiServices getLauncherSnapshotApiService(Context context) {
|
||||
if (mLauncherSnapshotApiService == null) {
|
||||
synchronized (CheckApiServiceFactory.class) {
|
||||
if (mLauncherSnapshotApiService == null) {
|
||||
mLauncherSnapshotApiService = getApiService(context, HostConst.LAUNCHER_SNAPSHOT_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mLauncherSnapshotApiService;
|
||||
}
|
||||
|
||||
public static CheckApiServices getGeoFenceCarServiceApiService(Context context) {
|
||||
if (mGeoFenceCarServiceApiService == null) {
|
||||
synchronized (CheckApiServiceFactory.class) {
|
||||
if (mGeoFenceCarServiceApiService == null) {
|
||||
mGeoFenceCarServiceApiService = getApiService(context, HostConst.GEOFENCE_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mGeoFenceCarServiceApiService;
|
||||
}
|
||||
|
||||
public static CheckApiServices getRealtimeLocationApiService(Context context) {
|
||||
if (mRealtimeLocationApiService == null) {
|
||||
synchronized (CheckApiServiceFactory.class) {
|
||||
if (mRealtimeLocationApiService == null) {
|
||||
mRealtimeLocationApiService = getApiService(context, HostConst.REALTIME_LOCATION_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mRealtimeLocationApiService;
|
||||
}
|
||||
|
||||
public static CheckApiServices getDataServiceApiService(Context context) {
|
||||
if (mDataServiceApiService == null) {
|
||||
synchronized (CheckApiServiceFactory.class) {
|
||||
if (mDataServiceApiService == null) {
|
||||
mDataServiceApiService = getApiService(context, HostConst.DATA_SERVICE_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mDataServiceApiService;
|
||||
}
|
||||
public static CheckApiServices getStrategyPushApiService(Context context) {
|
||||
if (mDataServiceApiService == null) {
|
||||
synchronized (CheckApiServiceFactory.class) {
|
||||
if (mDataServiceApiService == null) {
|
||||
mDataServiceApiService = getApiService(context, HostConst.STRATEGY_PUSH_HOST);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mDataServiceApiService;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.mogo.eagle.core.function.check.net;
|
||||
|
||||
import android.database.Observable;
|
||||
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.QueryMap;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -12,6 +15,6 @@ import retrofit2.http.POST;
|
||||
*/
|
||||
public interface CheckApiServices {
|
||||
|
||||
@POST("/yycp-vehicle-management-service/monitor/reciveInfo")
|
||||
Observable<CheckResultData> uploadCheckDetail(@FieldMap Map<String, String> param);
|
||||
@GET("/yycp-vehicle-management-service/monitor/license/detail")
|
||||
Observable<CheckResultData> loadMonitorDetail(@QueryMap Map<String, Object> param);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,277 @@ package com.mogo.eagle.core.function.check.net;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 8/13/21
|
||||
*/
|
||||
public class CheckResultData extends BaseData {
|
||||
private Data data;
|
||||
private boolean success;
|
||||
|
||||
public Data getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Data data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CheckResultData{" +
|
||||
"data=" + data +
|
||||
", success=" + success +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class Data {
|
||||
private Vehicle vehicle;
|
||||
private List<CheckListItem> soft;
|
||||
private List<CheckListItem> devices;
|
||||
private Integer deviceState = 1;//硬件状态
|
||||
private Integer softState = 0;//系统(软件)状态
|
||||
|
||||
public Vehicle getVehicle() {
|
||||
return vehicle;
|
||||
}
|
||||
|
||||
public void setVehicle(Vehicle vehicle) {
|
||||
this.vehicle = vehicle;
|
||||
}
|
||||
|
||||
public List<CheckListItem> getSoft() {
|
||||
return soft;
|
||||
}
|
||||
|
||||
public void setSoft(List<CheckListItem> soft) {
|
||||
this.soft = soft;
|
||||
}
|
||||
|
||||
public List<CheckListItem> getDevices() {
|
||||
return devices;
|
||||
}
|
||||
|
||||
public void setDevices(List<CheckListItem> devices) {
|
||||
this.devices = devices;
|
||||
}
|
||||
|
||||
public Integer getSoftState() {
|
||||
return softState;
|
||||
}
|
||||
|
||||
public void setSoftState(Integer softState) {
|
||||
this.softState = softState;
|
||||
}
|
||||
|
||||
public Integer getDeviceState() {
|
||||
return deviceState;
|
||||
}
|
||||
|
||||
public void setDeviceState(Integer deviceState) {
|
||||
this.deviceState = deviceState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Data{" +
|
||||
"vehicle=" + vehicle +
|
||||
", soft=" + soft +
|
||||
", devices=" + devices +
|
||||
", softState=" + softState +
|
||||
", deviceState=" + deviceState +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class Vehicle {
|
||||
private String id;
|
||||
private String sn;
|
||||
private String vin;
|
||||
private String carBrand;
|
||||
private String carLicense;
|
||||
private String carType;
|
||||
private String userName;
|
||||
private String userPhone;
|
||||
private String carImage;
|
||||
private double createTime;
|
||||
private Integer state;
|
||||
private Integer ipcState;
|
||||
private Integer autoState;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getVin() {
|
||||
return vin;
|
||||
}
|
||||
|
||||
public void setVin(String vin) {
|
||||
this.vin = vin;
|
||||
}
|
||||
|
||||
public String getCarBrand() {
|
||||
return carBrand;
|
||||
}
|
||||
|
||||
public void setCarBrand(String carBrand) {
|
||||
this.carBrand = carBrand;
|
||||
}
|
||||
|
||||
public String getCarLicense() {
|
||||
return carLicense;
|
||||
}
|
||||
|
||||
public void setCarLicense(String carLicense) {
|
||||
this.carLicense = carLicense;
|
||||
}
|
||||
|
||||
public String getCarType() {
|
||||
return carType;
|
||||
}
|
||||
|
||||
public void setCarType(String carType) {
|
||||
this.carType = carType;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserPhone() {
|
||||
return userPhone;
|
||||
}
|
||||
|
||||
public void setUserPhone(String userPhone) {
|
||||
this.userPhone = userPhone;
|
||||
}
|
||||
|
||||
public String getCarImage() {
|
||||
return carImage;
|
||||
}
|
||||
|
||||
public void setCarImage(String carImage) {
|
||||
this.carImage = carImage;
|
||||
}
|
||||
|
||||
public double getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(double createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Integer getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(Integer state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Integer getIpcState() {
|
||||
return ipcState;
|
||||
}
|
||||
|
||||
public void setIpcState(Integer ipcState) {
|
||||
this.ipcState = ipcState;
|
||||
}
|
||||
|
||||
public Integer getAutoState() {
|
||||
return autoState;
|
||||
}
|
||||
|
||||
public void setAutoState(Integer autoState) {
|
||||
this.autoState = autoState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "vehicle{" +
|
||||
"id='" + id + '\'' +
|
||||
", sn='" + sn + '\'' +
|
||||
", vin='" + vin + '\'' +
|
||||
", carBrand='" + carBrand + '\'' +
|
||||
", carLicense='" + carLicense + '\'' +
|
||||
", carType='" + carType + '\'' +
|
||||
", userName='" + userName + '\'' +
|
||||
", userPhone='" + userPhone + '\'' +
|
||||
", carImage='" + carImage + '\'' +
|
||||
", createTime='" + createTime + '\'' +
|
||||
", state='" + state + '\'' +
|
||||
", ipcState='" + ipcState + '\'' +
|
||||
", autoState='" + autoState + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class CheckListItem {
|
||||
private String name;
|
||||
private String stateValue;
|
||||
private List<CheckResultData.CheckListItem> items;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Object getStateValue() {
|
||||
return stateValue;
|
||||
}
|
||||
|
||||
public void setStateValue(String stateValue) {
|
||||
this.stateValue = stateValue;
|
||||
}
|
||||
|
||||
public List getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "soft{" +
|
||||
"name='" + name + '\'' +
|
||||
", stateValue=" + stateValue +
|
||||
", items=" + items +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,32 +20,41 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.elegant.network.ParamsBuilder;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
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.model.CheckItemInfo;
|
||||
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.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.CommonUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.NetworkStatusUtil;
|
||||
import com.tencent.bugly.beta.Beta;
|
||||
import com.tencent.bugly.beta.UpgradeInfo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 车辆监控页面
|
||||
* @description 车辆监控页面首页
|
||||
* @since: 7/27/21
|
||||
*/
|
||||
public class CheckActivity extends AppCompatActivity {
|
||||
public class CheckActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "CheckActivity";
|
||||
private RecyclerView mRecyclerView;
|
||||
private static ArrayList dataArrayList = new ArrayList();
|
||||
private static RecyclerView mRecyclerView;
|
||||
private static CheckResultData sCheckResultData;
|
||||
private static Context context;
|
||||
private static NetworkStatusUtil.NetWorkStatus sNetWorkStatus;
|
||||
private ImageView mImageView;
|
||||
@@ -64,7 +73,10 @@ public class CheckActivity extends AppCompatActivity {
|
||||
private float movement = 1162f;
|
||||
//进度条
|
||||
private ProgressBar mProgressBar;
|
||||
private final static long DURATION_TIME = 3000;
|
||||
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) {
|
||||
@@ -77,6 +89,7 @@ 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);
|
||||
@@ -89,60 +102,64 @@ public class CheckActivity extends AppCompatActivity {
|
||||
mImageView.setOnClickListener(v -> {
|
||||
finish();
|
||||
});
|
||||
//检测动画
|
||||
animation();
|
||||
//版本检测 和系统检查放在第二期
|
||||
// versionCheckResult();
|
||||
// //系统检测
|
||||
// systemCheckResult();
|
||||
//软件检测
|
||||
software();
|
||||
//硬件检测
|
||||
hardware();
|
||||
//根据以上4个结果插入第一个元素(自动驾驶车辆是否存在风险)
|
||||
topListTitle();
|
||||
|
||||
loadDetail(context);
|
||||
mRecyclerView = findViewById(R.id.check_list);
|
||||
mRecyclerView.setAdapter(new CheckAdapter(context, dataArrayList));
|
||||
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);
|
||||
mRecyclerView.setAdapter(mCheckAdapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态下指标监测
|
||||
*/
|
||||
public static boolean checkMonitor() {
|
||||
dataArrayList.clear();
|
||||
public static boolean checkMonitor(Context context) {
|
||||
Log.d(TAG, "checkMonitor");
|
||||
//版本检测
|
||||
// versionCheckResult();
|
||||
// //系统检测
|
||||
// systemCheckResult();
|
||||
//软件检测
|
||||
software();
|
||||
//硬件检测
|
||||
hardware();
|
||||
//根据以上4个结果插入第一个元素(自动驾驶车辆是否存在风险)
|
||||
topListTitle();
|
||||
CallerCheckManager.updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING,false);
|
||||
loadDetail(context);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶是否存在风险
|
||||
*/
|
||||
private static void topListTitle() {
|
||||
ArrayList list = new ArrayList(1);
|
||||
CheckItemInfo info = new CheckItemInfo();
|
||||
info.setUsual(false);
|
||||
info.setTitle("自动驾驶车辆存在风险");
|
||||
info.setStyle(CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_TITLE);
|
||||
list.add(info);
|
||||
dataArrayList.add(0, list);
|
||||
//网络请求,获取自车检测结果(工控机上报云端)
|
||||
public static void loadDetail(Context 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)) {
|
||||
@Override
|
||||
public void onSuccess(CheckResultData o) {
|
||||
super.onSuccess(o);
|
||||
Log.d(TAG, "车辆自检结果是:" + o.toString());
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (o != null && mCheckAdapter != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Log.d(TAG, "车辆自检失败,请稍后重试" + "==" + message + String.valueOf(code));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,10 +183,12 @@ public class CheckActivity extends AppCompatActivity {
|
||||
* **************************************************************************************检测动画
|
||||
*/
|
||||
public void animation() {
|
||||
ObjectAnimator animatorX = ObjectAnimator.ofFloat(scanLineImage, "translationX", scanBottomCarImage.getWidth(), 0);
|
||||
ObjectAnimator animatorAl = ObjectAnimator.ofFloat(scanLineImage, "alpha", 0, 1);
|
||||
ObjectAnimator animatorX = ObjectAnimator.ofFloat(scanLineImage, "translationX",
|
||||
scanBottomCarImage.getWidth(), 0);
|
||||
ObjectAnimator animatorAl = ObjectAnimator.ofFloat(scanLineImage, "alpha",
|
||||
0, 1);
|
||||
setAnimation.playTogether(animatorX, animatorAl);
|
||||
setAnimation.setDuration(800);
|
||||
setAnimation.setDuration(DURATION_TIME);
|
||||
setAnimation.start();
|
||||
setAnimation.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
@@ -248,311 +267,6 @@ public class CheckActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* **************************************************************************************版本检测
|
||||
*/
|
||||
public static void versionCheckResult() {
|
||||
ArrayList arrayVer = new ArrayList();
|
||||
//adas 检测指标
|
||||
|
||||
//鹰眼当前版本
|
||||
String verCodeStr = CommonUtils.getVersionName(context, true);
|
||||
Log.d(TAG, "版本检测结果:鹰眼" + verCodeStr);
|
||||
|
||||
//测试数据
|
||||
CheckItemInfo itemInfo = new CheckItemInfo();
|
||||
itemInfo.setViewTitle("版本检测:");
|
||||
itemInfo.setTitle("自动驾驶升级到\n 版本3.1.2.7");
|
||||
if ("不是最新版本" != null) {
|
||||
itemInfo.setUsual(false);
|
||||
itemInfo.setValue("版本升级");
|
||||
} else {
|
||||
itemInfo.setUsual(true);
|
||||
itemInfo.setValue("最新版本 无风险");
|
||||
}
|
||||
arrayVer.add(itemInfo);
|
||||
|
||||
CheckItemInfo yingyan = new CheckItemInfo();
|
||||
UpgradeInfo upgradeInfo = Beta.getUpgradeInfo();
|
||||
if (upgradeInfo == null) {
|
||||
yingyan.setUsual(true);
|
||||
yingyan.setTitle(" 鹰眼 \n版本" + verCodeStr);
|
||||
yingyan.setValue("最新版本 无风险");
|
||||
} else {
|
||||
yingyan.setUsual(false);
|
||||
yingyan.setTitle(" 鹰眼升级到 \n版本" + upgradeInfo.versionName);
|
||||
yingyan.setValue("版本升级");
|
||||
}
|
||||
arrayVer.add(yingyan);
|
||||
dataArrayList.add(arrayVer);
|
||||
}
|
||||
|
||||
/**
|
||||
* **************************************************************************************系统检测
|
||||
*/
|
||||
public static void systemCheckResult() {
|
||||
ArrayList arrSys = new ArrayList();
|
||||
//网络
|
||||
netStatus();
|
||||
//电量
|
||||
float battery = CommonUtils.getBattery(context);
|
||||
//cpu占比
|
||||
double cpu = CommonUtils.getCPU(packageName);
|
||||
//内存占比
|
||||
double memory = CommonUtils.getMemory(packageName);
|
||||
//风险状态
|
||||
CheckItemInfo itemInfo = new CheckItemInfo();
|
||||
itemInfo.setViewTitle("系统检测:");
|
||||
itemInfo.setTitle("自动驾驶系统");
|
||||
itemInfo.setUsual(false);
|
||||
itemInfo.setValue("存在风险");
|
||||
ArrayList list = new ArrayList();
|
||||
//详细指标值
|
||||
CheckItemInfo.DetailItem item = new CheckItemInfo.DetailItem();
|
||||
item.setTitle("工控机链接状态");
|
||||
item.setValue("断开");
|
||||
list.add(item);
|
||||
arrSys.add(itemInfo);
|
||||
|
||||
//鹰眼测试数据
|
||||
CheckItemInfo yingyan = new CheckItemInfo();
|
||||
yingyan.setTitle("鹰眼软件");
|
||||
yingyan.setUsual(false);
|
||||
yingyan.setValue("无风险");
|
||||
|
||||
CheckItemInfo.DetailItem netItem = new CheckItemInfo.DetailItem();
|
||||
netItem.setTitle("网络状态");
|
||||
netItem.setValue(String.valueOf(sNetWorkStatus.getSignalStrength()));
|
||||
list.add(netItem);
|
||||
|
||||
CheckItemInfo.DetailItem batteryItem = new CheckItemInfo.DetailItem();
|
||||
batteryItem.setTitle("电池状态");
|
||||
batteryItem.setValue(String.valueOf(battery));
|
||||
list.add(batteryItem);
|
||||
|
||||
CheckItemInfo.DetailItem cpuItem = new CheckItemInfo.DetailItem();
|
||||
cpuItem.setTitle("CPU占比");
|
||||
cpuItem.setValue(String.valueOf(cpu));
|
||||
list.add(cpuItem);
|
||||
|
||||
CheckItemInfo.DetailItem memoryItem = new CheckItemInfo.DetailItem();
|
||||
memoryItem.setTitle("内存占比");
|
||||
memoryItem.setValue(String.valueOf(memory));
|
||||
list.add(memoryItem);
|
||||
yingyan.setItemList(list);
|
||||
arrSys.add(yingyan);
|
||||
|
||||
dataArrayList.add(arrSys);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 网络
|
||||
*/
|
||||
public static NetworkStatusUtil.NetWorkStatus netStatus() {
|
||||
//网络类型
|
||||
sNetWorkStatus = NetworkStatusUtil.networkState(context);
|
||||
//网络强度
|
||||
if (sNetWorkStatus != null && sNetWorkStatus.getStatus() != null && sNetWorkStatus.getStatus() != "UNKNOWN") {
|
||||
Log.d(TAG, "网络类型:" + sNetWorkStatus.getStatus() + "网络强度:" + sNetWorkStatus.getSignalStrength());
|
||||
if (sNetWorkStatus.getSignalStrength() <= -90) {
|
||||
AIAssist.getInstance(context).speakTTSVoice("网络信号差");
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "网络未连接");
|
||||
AIAssist.getInstance(context).speakTTSVoice("网络未连接");
|
||||
}
|
||||
return sNetWorkStatus;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* **************************************************************************************软件测试
|
||||
* 自动驾驶侧:
|
||||
* 1、车控节点
|
||||
* <p>
|
||||
* 2、轨迹地图加载节点
|
||||
* <p>
|
||||
* 3、轨迹规划节点
|
||||
* <p>
|
||||
* 4、定位转化节点
|
||||
* <p>
|
||||
* 5、融合节点
|
||||
* <p>
|
||||
* 6、yolov5节点(包含红绿灯检测)
|
||||
* <p>
|
||||
* 7、激光雷达渲染节点
|
||||
* <p>
|
||||
* 8、摄像头驱动节点
|
||||
* <p>
|
||||
* 9、gnss定位驱动节点
|
||||
* <p>
|
||||
* 10、中激光驱动节点
|
||||
* <p>
|
||||
* 11、左激光解码节点
|
||||
* <p>
|
||||
* 12、左激光驱动节点
|
||||
* <p>
|
||||
* 13、右激光解码节点
|
||||
* <p>
|
||||
* 14、右激光驱动节点
|
||||
* <p>
|
||||
* 15、监控节点
|
||||
* <p>
|
||||
* 16、通讯交互节点
|
||||
* <p>
|
||||
* 17、轨迹录制节点
|
||||
* <p>
|
||||
* 18、can车辆控制节点
|
||||
* <p>
|
||||
* 数据上报频率 什么数据的上报频率
|
||||
* <p>
|
||||
* 时延 工控机->云 工控机->鹰眼 什么数据的时延
|
||||
*/
|
||||
public static void software() {
|
||||
ArrayList arrSoftware = new ArrayList();
|
||||
CheckItemInfo itemInfo = new CheckItemInfo();
|
||||
itemInfo.setViewTitle("软件检测:");
|
||||
itemInfo.setTitle("自动驾驶系统");
|
||||
itemInfo.setUsual(true);
|
||||
itemInfo.setValue("无风险");
|
||||
arrSoftware.add(itemInfo);
|
||||
|
||||
CheckItemInfo itemY = new CheckItemInfo();
|
||||
itemY.setTitle("鹰眼软件");
|
||||
itemY.setUsual(true);
|
||||
itemY.setValue("无风险");
|
||||
arrSoftware.add(itemY);
|
||||
dataArrayList.add(arrSoftware);
|
||||
|
||||
time();
|
||||
}
|
||||
|
||||
/**
|
||||
* 时延
|
||||
* 需要产品确认哪些指标? 定位+周边识别?
|
||||
*/
|
||||
public static long time() {
|
||||
|
||||
final long start = System.nanoTime();
|
||||
long adasDataTime = TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start));
|
||||
Log.i("ADAS数据延时", "接收数据 -> 发出 cost :" + adasDataTime + "ms");
|
||||
return adasDataTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* **************************************************************************************硬件测试
|
||||
* 1、主激光雷达
|
||||
* <p>
|
||||
* 2、侧激光雷达-2个
|
||||
* <p>
|
||||
* 3、ADAS长焦摄像头-前
|
||||
* <p>
|
||||
* 4、ADAS广角摄像头-前
|
||||
* <p>
|
||||
* 5、ADAS标准摄像头-前
|
||||
* <p>
|
||||
* 6、ADAS广角摄像头-后
|
||||
* <p>
|
||||
* 7、RTK设备
|
||||
* <p>
|
||||
* 8、OBU设备
|
||||
* <p>
|
||||
* 9、路由器
|
||||
*/
|
||||
public static void hardware() {
|
||||
ArrayList arrHardware = new ArrayList();
|
||||
CheckItemInfo itemInfo = new CheckItemInfo();
|
||||
itemInfo.setViewTitle("硬件检测:");
|
||||
itemInfo.setTitle("自动驾驶系统");
|
||||
itemInfo.setUsual(false);
|
||||
|
||||
ArrayList detailItem = new ArrayList();
|
||||
CheckItemInfo.DetailItem padItem = new CheckItemInfo.DetailItem();
|
||||
padItem.setTitle("Pad");
|
||||
padItem.setValue("异常");
|
||||
detailItem.add(padItem);
|
||||
|
||||
CheckItemInfo.DetailItem cameraTop = new CheckItemInfo.DetailItem();
|
||||
cameraTop.setTitle("摄像头_top");
|
||||
cameraTop.setValue("正常");
|
||||
detailItem.add(cameraTop);
|
||||
|
||||
CheckItemInfo.DetailItem cameraMiddle = new CheckItemInfo.DetailItem();
|
||||
cameraMiddle.setTitle("摄像头_Middle");
|
||||
cameraMiddle.setValue("正常");
|
||||
detailItem.add(cameraMiddle);
|
||||
|
||||
CheckItemInfo.DetailItem cameraBottom = new CheckItemInfo.DetailItem();
|
||||
cameraBottom.setTitle("摄像头_Bottom");
|
||||
cameraBottom.setValue("正常");
|
||||
detailItem.add(cameraBottom);
|
||||
|
||||
CheckItemInfo.DetailItem zhuJiGuang = new CheckItemInfo.DetailItem();
|
||||
zhuJiGuang.setTitle("主机光雷达");
|
||||
zhuJiGuang.setValue("异常");
|
||||
detailItem.add(zhuJiGuang);
|
||||
|
||||
|
||||
CheckItemInfo.DetailItem jiGuangLeft = new CheckItemInfo.DetailItem();
|
||||
jiGuangLeft.setTitle("左侧激光雷达");
|
||||
jiGuangLeft.setValue("异常");
|
||||
detailItem.add(jiGuangLeft);
|
||||
|
||||
CheckItemInfo.DetailItem jiGuangRight = new CheckItemInfo.DetailItem();
|
||||
jiGuangRight.setTitle("右侧激光雷达");
|
||||
jiGuangRight.setValue("正常");
|
||||
detailItem.add(jiGuangRight);
|
||||
|
||||
CheckItemInfo.DetailItem changjiao = new CheckItemInfo.DetailItem();
|
||||
changjiao.setTitle("ADAS长焦摄像头");
|
||||
changjiao.setValue("正常");
|
||||
detailItem.add(changjiao);
|
||||
|
||||
CheckItemInfo.DetailItem guangJiaoFront = new CheckItemInfo.DetailItem();
|
||||
guangJiaoFront.setTitle("ADAS广焦摄像头-前");
|
||||
guangJiaoFront.setValue("正常");
|
||||
detailItem.add(guangJiaoFront);
|
||||
|
||||
CheckItemInfo.DetailItem custom = new CheckItemInfo.DetailItem();
|
||||
custom.setTitle("ADAS标准摄像头");
|
||||
custom.setValue("正常");
|
||||
detailItem.add(custom);
|
||||
|
||||
CheckItemInfo.DetailItem guangJiaoBe = new CheckItemInfo.DetailItem();
|
||||
guangJiaoBe.setTitle("ADAS广焦摄像头-后");
|
||||
guangJiaoBe.setValue("正常");
|
||||
detailItem.add(guangJiaoBe);
|
||||
|
||||
CheckItemInfo.DetailItem rtk = new CheckItemInfo.DetailItem();
|
||||
rtk.setTitle("RTK设备");
|
||||
rtk.setValue("正常");
|
||||
detailItem.add(rtk);
|
||||
|
||||
CheckItemInfo.DetailItem obu = new CheckItemInfo.DetailItem();
|
||||
obu.setTitle("OUB设备");
|
||||
obu.setValue("正常");
|
||||
detailItem.add(obu);
|
||||
|
||||
CheckItemInfo.DetailItem luyou = new CheckItemInfo.DetailItem();
|
||||
luyou.setTitle("路由器");
|
||||
luyou.setValue("正常");
|
||||
detailItem.add(luyou);
|
||||
itemInfo.setItemList(detailItem);
|
||||
|
||||
arrHardware.add(itemInfo);
|
||||
dataArrayList.add(arrHardware);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测指标上报
|
||||
*/
|
||||
public void publishCheckDetail() {
|
||||
// MogoApisHandler.getInstance().getApis().getNetworkApi().create(CheckApiServices.class,
|
||||
// HostConst.DEVA_HOST).uploadCheckDetail().
|
||||
}
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent starter = new Intent(context, CheckActivity.class);
|
||||
context.startActivity(starter);
|
||||
@@ -562,14 +276,21 @@ public class CheckActivity extends AppCompatActivity {
|
||||
* 指标异常弹框
|
||||
*/
|
||||
public static void showDialog(Context context) {
|
||||
CheckDialog dialog = new CheckDialog(context, true);
|
||||
dialog.show();
|
||||
try {
|
||||
if (dialog != null) {
|
||||
dialog.cancel();
|
||||
}
|
||||
dialog = new CheckDialog(context, true);
|
||||
dialog.show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
dataArrayList.clear();
|
||||
isFront = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -9,31 +8,34 @@ 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;
|
||||
|
||||
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
|
||||
* @description 检测界面单元格
|
||||
* @description 检测首页单元格
|
||||
* @since: 7/27/21
|
||||
*/
|
||||
public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private static final String TAG = "CheckActivity";
|
||||
LayoutInflater mLayoutInflater;
|
||||
ArrayList dataArrayList;
|
||||
CheckResultData mCheckResultData;
|
||||
private Context mContext;
|
||||
private static CheckInfoListDialog mCheckInfoListDialog;
|
||||
|
||||
public CheckAdapter(@NonNull Context context, @NonNull ArrayList checkArray) {
|
||||
public CheckAdapter(@NonNull Context context, @NonNull CheckResultData checkResult) {
|
||||
mContext = context;
|
||||
mCheckResultData = checkResult;
|
||||
mLayoutInflater = LayoutInflater.from(context);
|
||||
dataArrayList = checkArray;
|
||||
Log.d(TAG, dataArrayList.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,10 +43,8 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
if (position == 0) {
|
||||
return CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_TITLE;
|
||||
|
||||
} else if (position == 1) {
|
||||
return CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_LIST;
|
||||
}
|
||||
return CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_IMAGE;
|
||||
return CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_LIST;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -56,12 +56,6 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
CheckTitleViewHolder holder = new CheckTitleViewHolder(v);
|
||||
return holder;
|
||||
}
|
||||
if (viewType == CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_IMAGE) {
|
||||
View v = mLayoutInflater.inflate(R.layout.check_hardware, parent,
|
||||
false);
|
||||
CheckImage holder = new CheckImage(v);
|
||||
return holder;
|
||||
}
|
||||
View v = mLayoutInflater.inflate(R.layout.check_list, parent,
|
||||
false);
|
||||
CheckListViewHolder holder = new CheckListViewHolder(v);
|
||||
@@ -77,8 +71,8 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
|
||||
public CheckTitleViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
errorImage = itemView.findViewById(R.id.error_tip_image);
|
||||
mTextView = itemView.findViewById(R.id.error_title);
|
||||
errorImage = itemView.findViewById(R.id.check_tip_image);
|
||||
mTextView = itemView.findViewById(R.id.check_title);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,151 +83,81 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
private TextView viewTitle;
|
||||
private TextView iconAutoTitle;
|
||||
private TextView autoRiskState;
|
||||
|
||||
private TextView iconyingTitle;
|
||||
private TextView yingRiskState;
|
||||
private ImageView iconAuto;
|
||||
|
||||
public CheckListViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
viewTitle = itemView.findViewById(R.id.list_item_title);
|
||||
//自动驾驶
|
||||
iconAuto = itemView.findViewById(R.id.icon_auto);
|
||||
iconAutoTitle = itemView.findViewById(R.id.icon_auto_title);
|
||||
autoRiskState = itemView.findViewById(R.id.auto_risk_state);
|
||||
//鹰眼应用
|
||||
iconyingTitle = itemView.findViewById(R.id.icon_ying_title);
|
||||
yingRiskState = itemView.findViewById(R.id.ying_risk_state);
|
||||
itemView.setLongClickable(true);
|
||||
itemView.setOnLongClickListener(v -> {
|
||||
Log.d(TAG, "长按显示状态工具栏");
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("oper", 52);
|
||||
return true;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 硬件检测
|
||||
*/
|
||||
class CheckImage extends RecyclerView.ViewHolder {
|
||||
private ImageView pad;
|
||||
private ImageView jiaoJiGuangTop;
|
||||
private TextView jiaoJiGuangTopText;
|
||||
private ImageView jiaoJiGuangBottom;
|
||||
private TextView jiaoJiGuangBottomText;
|
||||
private ImageView zhuJiGuang;
|
||||
private ImageView rtk;
|
||||
private ImageView cameraTop;
|
||||
private ImageView cameraMiddle;
|
||||
private ImageView cameraBottom;
|
||||
private ImageView cameraBehind;
|
||||
private ImageView luyouqi;
|
||||
private ImageView obu;
|
||||
|
||||
public CheckImage(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
pad = itemView.findViewById(R.id.pad);
|
||||
jiaoJiGuangTop = itemView.findViewById(R.id.jiaoJiGuangTop);
|
||||
jiaoJiGuangTopText = itemView.findViewById(R.id.jiaoJiGuangTop_txt);
|
||||
jiaoJiGuangBottom = itemView.findViewById(R.id.jiaoJiGuangBottom);
|
||||
jiaoJiGuangBottomText = itemView.findViewById(R.id.jiaoJiGuangBottom_txt);
|
||||
zhuJiGuang = itemView.findViewById(R.id.zhujiguang);
|
||||
rtk = itemView.findViewById(R.id.rtk);
|
||||
cameraTop = itemView.findViewById(R.id.top);
|
||||
cameraMiddle = itemView.findViewById(R.id.middle);
|
||||
cameraBottom = itemView.findViewById(R.id.bottom);
|
||||
cameraBehind = itemView.findViewById(R.id.camera_begind);
|
||||
luyouqi = itemView.findViewById(R.id.luyouqi);
|
||||
obu = itemView.findViewById(R.id.obu);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (mCheckResultData == null || mCheckResultData.getData() == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Object list = dataArrayList.get(position);
|
||||
if (position == 0) {
|
||||
if (list instanceof ArrayList && ((ArrayList) list).size() > 0) {
|
||||
CheckItemInfo item = (CheckItemInfo) ((ArrayList) list).get(0);
|
||||
((CheckTitleViewHolder) holder).mTextView.setText(item.getTitle());
|
||||
if (item.isUsual() == true) {
|
||||
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_right);
|
||||
} else {
|
||||
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_wrong);
|
||||
}
|
||||
if (mCheckResultData.getData().getVehicle().getState() == 1) {
|
||||
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_right);
|
||||
((CheckTitleViewHolder) holder).mTextView.setText("车辆自检正常");
|
||||
} else {
|
||||
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_wrong);
|
||||
((CheckTitleViewHolder) holder).mTextView.setText("车辆存在异常项");
|
||||
}
|
||||
} else if (position == dataArrayList.size() - 1) {
|
||||
} else if (position == 1) {
|
||||
((CheckListViewHolder) holder).viewTitle.setText("硬件检测:");
|
||||
if (list instanceof ArrayList) {
|
||||
refreshHardware(holder, (ArrayList) list);
|
||||
if (mCheckResultData.getData().getDeviceState() == 1) {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_little_btn_green)));
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("运行正常");
|
||||
} else {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_icon_error_color)));
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("存在异常项");
|
||||
}
|
||||
} else {
|
||||
if (list instanceof ArrayList && ((ArrayList) list).size() > 1) {
|
||||
CheckItemInfo item = (CheckItemInfo) ((ArrayList) list).get(0);
|
||||
((CheckListViewHolder) holder).viewTitle.setText(item.getViewTitle());
|
||||
//自动驾驶 状态展示
|
||||
((CheckListViewHolder) holder).iconAutoTitle.setText(item.getTitle());
|
||||
((CheckListViewHolder) holder).autoRiskState.setText(item.getValue());
|
||||
if (item.isUsual() == true) {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(mContext.getResources().getColor(R.color.check_little_btn_green));
|
||||
} else {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(mContext.getResources().getColor(R.color.check_tip_error_color));
|
||||
}
|
||||
if (position == 1) {
|
||||
if (item.isUsual() == false) {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(mContext.getResources().getColor(R.color.modules_commons_toast_text_color));
|
||||
((CheckListViewHolder) holder).autoRiskState.setBackground(mContext.getResources().getDrawable(R.drawable.check_detail));
|
||||
((CheckListViewHolder) holder).autoRiskState.setOnClickListener(v -> {
|
||||
Log.d(TAG, "点击自动驾驶升级");
|
||||
});
|
||||
} else {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(mContext.getResources().getColor(R.color.check_little_btn_green));
|
||||
}
|
||||
}
|
||||
//鹰眼 状态展示
|
||||
CheckItemInfo itemForYing = (CheckItemInfo) ((ArrayList) list).get(1);
|
||||
((CheckListViewHolder) holder).iconyingTitle.setText(itemForYing.getTitle());
|
||||
((CheckListViewHolder) holder).yingRiskState.setText(itemForYing.getValue());
|
||||
if (itemForYing.isUsual() == true) {
|
||||
((CheckListViewHolder) holder).yingRiskState.setTextColor(mContext.getResources().getColor(R.color.check_little_btn_green));
|
||||
} else {
|
||||
((CheckListViewHolder) holder).yingRiskState.setTextColor(mContext.getResources().getColor(R.color.check_tip_error_color));
|
||||
}
|
||||
if (position == 1) {
|
||||
if (itemForYing.isUsual() == false) {
|
||||
((CheckListViewHolder) holder).yingRiskState.setTextColor(mContext.getResources().getColor(R.color.modules_commons_toast_text_color));
|
||||
((CheckListViewHolder) holder).yingRiskState.setBackground(mContext.getResources().getDrawable(R.drawable.check_detail));
|
||||
((CheckListViewHolder) holder).yingRiskState.setOnClickListener(v -> {
|
||||
Log.d(TAG, "点击鹰眼升级");
|
||||
});
|
||||
} else {
|
||||
((CheckListViewHolder) holder).yingRiskState.setTextColor(mContext.getResources().getColor(R.color.check_little_btn_green));
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "硬件检测结果:");
|
||||
if (mCheckInfoListDialog != null){
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
mCheckInfoListDialog = new CheckInfoListDialog(mContext, CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_DEVICES, mCheckResultData);
|
||||
mCheckInfoListDialog.show();
|
||||
|
||||
});
|
||||
} else if (position == 2) {
|
||||
((CheckListViewHolder) holder).viewTitle.setText("系统检测:");
|
||||
if (mCheckResultData.getData().getSoftState() == 1) {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_little_btn_green)));
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("运行正常");
|
||||
} else {
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_icon_error_color)));
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("存在异常项");
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "系统检测结果:");
|
||||
if (mCheckInfoListDialog != null){
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
mCheckInfoListDialog = new CheckInfoListDialog(mContext, CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_SOFT, mCheckResultData);
|
||||
mCheckInfoListDialog.show();
|
||||
});
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 硬件检测指标
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
public void refreshHardware(@NonNull RecyclerView.ViewHolder holder, ArrayList list) {
|
||||
if (list.size() > 0) {
|
||||
CheckItemInfo info = (CheckItemInfo) list.get(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataArrayList.size();
|
||||
return 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,26 +1,33 @@
|
||||
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;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager;
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 车辆监控弹框提示
|
||||
* @description 车辆监控弹框提示(长时间未检测或者后台任务检测出现问题的弹框)
|
||||
* 第一版本为添加长时间未检测的提示框,因为逻辑冲突,二期需求与产品确认,UI公用
|
||||
* @since: 7/30/21
|
||||
*/
|
||||
public class CheckDialog extends BaseFloatDialog {
|
||||
|
||||
private ImageView cancel;
|
||||
private boolean showWarning;
|
||||
private TextView checkDetail;
|
||||
private Context mContext;
|
||||
|
||||
public CheckDialog(@NonNull Context context, boolean hasError) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
showWarning = hasError;
|
||||
initView();
|
||||
}
|
||||
@@ -35,6 +42,13 @@ public class CheckDialog extends BaseFloatDialog {
|
||||
cancel.setOnClickListener(v -> {
|
||||
cancel();
|
||||
});
|
||||
checkDetail = findViewById(R.id.check_detail);
|
||||
checkDetail.setOnClickListener(v -> {
|
||||
cancel();
|
||||
if (mContext != null) {
|
||||
CallerCheckManager.startCheckActivity(mContext);
|
||||
}
|
||||
});
|
||||
|
||||
//根据条件显示体检页面/风险提示
|
||||
if (showWarning == true) {
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 点击自动驾驶icon显示各个检测指标结果
|
||||
* @since: 9/23/21
|
||||
*/
|
||||
public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
private static final String TAG = "CheckInfoAdapter";
|
||||
LayoutInflater mLayoutInflater;
|
||||
private Context mContext;
|
||||
private String mStyle;
|
||||
private List<CheckResultData.CheckListItem> showData;
|
||||
|
||||
public CheckInfoAdapter(Context context, String style, List checkResultData) {
|
||||
mContext = context;
|
||||
mStyle = style;
|
||||
showData = checkResultData;
|
||||
mLayoutInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = mLayoutInflater.inflate(R.layout.check_info_adapter, parent,
|
||||
false);
|
||||
CheckInfoAdapter.CheckInfoViewHolder holder = new CheckInfoAdapter.CheckInfoViewHolder(v);
|
||||
return holder;
|
||||
}
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isEven(int position) {
|
||||
if (position % 2 == 0) {
|
||||
System.out.println("偶数");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return showData.size() * 2 + 4;
|
||||
}
|
||||
|
||||
public class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView checkIcon;
|
||||
private TextView mTextView;
|
||||
|
||||
public CheckInfoViewHolder(View v) {
|
||||
super(v);
|
||||
checkIcon = v.findViewById(R.id.info_check_icon);
|
||||
mTextView = v.findViewById(R.id.info_result_tx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
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;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 网格布局网格绘制类
|
||||
* @since: 9/22/21
|
||||
*/
|
||||
public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
|
||||
private String TAG = getClass().getSimpleName();
|
||||
private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
|
||||
private Drawable divider;
|
||||
|
||||
public CheckInfoGridItemDivider(Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS);
|
||||
divider = a.getDrawable(0);
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
public CheckInfoGridItemDivider(Drawable drawable) {
|
||||
divider = drawable;
|
||||
}
|
||||
|
||||
public CheckInfoGridItemDivider(int height, int color) {
|
||||
GradientDrawable shapeDrawable = new GradientDrawable();
|
||||
shapeDrawable.setColor(color);
|
||||
shapeDrawable.setShape(GradientDrawable.RECTANGLE);
|
||||
shapeDrawable.setSize(height, height);
|
||||
divider = shapeDrawable;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
|
||||
drawHorizontal(c, parent);
|
||||
drawVertical(c, parent);
|
||||
|
||||
}
|
||||
|
||||
private int getSpanCount(RecyclerView parent) {
|
||||
// 列数
|
||||
int spanCount = -1;
|
||||
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
|
||||
if (layoutManager instanceof GridLayoutManager) {
|
||||
|
||||
spanCount = ((GridLayoutManager) layoutManager).getSpanCount();
|
||||
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
|
||||
spanCount = ((StaggeredGridLayoutManager) layoutManager)
|
||||
.getSpanCount();
|
||||
}
|
||||
return spanCount;
|
||||
}
|
||||
|
||||
public void drawHorizontal(Canvas c, RecyclerView parent) {
|
||||
int childCount = parent.getChildCount(); //获取可见item的数量
|
||||
int spanCount = getSpanCount(parent);
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
final View child = parent.getChildAt(i);
|
||||
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
|
||||
.getLayoutParams();
|
||||
final int left = child.getLeft() - params.leftMargin;
|
||||
final int right = child.getRight() + params.rightMargin
|
||||
+ divider.getIntrinsicWidth();
|
||||
final int top = child.getBottom() + params.bottomMargin;
|
||||
final int bottom = top + divider.getIntrinsicHeight();
|
||||
divider.setBounds(left, top, right, bottom);
|
||||
divider.draw(c);
|
||||
if (i < spanCount) { //画第一行顶部的分割线
|
||||
drawHorizontalForFirstRow(c, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawHorizontalForFirstRow(Canvas c, View child) {
|
||||
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
|
||||
.getLayoutParams();
|
||||
int left = child.getLeft() - params.leftMargin - divider.getIntrinsicWidth();
|
||||
int top = child.getTop() - params.topMargin - divider.getIntrinsicHeight();
|
||||
int right = child.getRight() + params.rightMargin + divider.getIntrinsicWidth();
|
||||
int bottom = top + divider.getIntrinsicHeight();
|
||||
divider.setBounds(left, top, right, bottom);
|
||||
divider.draw(c);
|
||||
}
|
||||
|
||||
private void drawVerticalForFirstColum(Canvas c, View child) {
|
||||
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
|
||||
.getLayoutParams();//在父布局的
|
||||
int left = child.getLeft() - params.leftMargin - divider.getIntrinsicWidth();
|
||||
int top = child.getTop() - params.topMargin;
|
||||
int right = child.getLeft() - params.leftMargin;
|
||||
int bottom = top + child.getHeight() + divider.getIntrinsicHeight();
|
||||
divider.setBounds(left, top, right, bottom);
|
||||
divider.draw(c);
|
||||
}
|
||||
|
||||
//待修改为右侧
|
||||
private void drawVerticalForLastColum(Canvas c, View child) {
|
||||
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
|
||||
.getLayoutParams();
|
||||
int left = child.getRight() - params.leftMargin - divider.getIntrinsicWidth();
|
||||
int top = child.getTop() - params.topMargin;
|
||||
int right = child.getRight() - params.leftMargin + divider.getIntrinsicWidth();
|
||||
int bottom = top + child.getHeight() + divider.getIntrinsicHeight();
|
||||
divider.setBounds(left, top, right, bottom);
|
||||
divider.draw(c);
|
||||
}
|
||||
|
||||
public void drawVertical(Canvas c, RecyclerView parent) {
|
||||
final int childCount = parent.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
final View child = parent.getChildAt(i);
|
||||
|
||||
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
|
||||
.getLayoutParams();
|
||||
final int top = child.getTop() - params.topMargin;
|
||||
final int bottom = child.getBottom() + params.bottomMargin;
|
||||
final int left = child.getRight() + params.rightMargin;
|
||||
final int right = left + divider.getIntrinsicWidth();
|
||||
divider.setBounds(left, top, right, bottom);
|
||||
divider.draw(c);
|
||||
if (isFirstColum(parent, i, getSpanCount(parent))) { //画第一列左边分割线
|
||||
drawVerticalForFirstColum(c, child);
|
||||
}
|
||||
if (isLastColum(parent, i, getSpanCount(parent), childCount)) {//画最后一列右侧分割线
|
||||
drawVerticalForLastColum(c, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLastColum(RecyclerView parent, int pos, int spanCount,
|
||||
int childCount) {
|
||||
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
|
||||
if (layoutManager instanceof GridLayoutManager) {
|
||||
if ((pos + 1) % spanCount == 0)// 如果是最后一列,则不需要绘制右边
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
|
||||
int orientation = ((StaggeredGridLayoutManager) layoutManager)
|
||||
.getOrientation();
|
||||
if (orientation == StaggeredGridLayoutManager.VERTICAL) {
|
||||
if ((pos + 1) % spanCount == 0)// 如果是最后一列,则不需要绘制右边
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
childCount = childCount - childCount % spanCount;
|
||||
if (pos >= childCount)// 如果是最后一列,则不需要绘制右边
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isLastRaw(RecyclerView parent, int pos, int spanCount,
|
||||
int childCount) {
|
||||
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
|
||||
if (layoutManager instanceof GridLayoutManager) {
|
||||
childCount = childCount - childCount % spanCount;
|
||||
if (pos >= childCount)// 如果是最后一行,则不需要绘制底部
|
||||
return true;
|
||||
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
|
||||
int orientation = ((StaggeredGridLayoutManager) layoutManager)
|
||||
.getOrientation();
|
||||
if (orientation == StaggeredGridLayoutManager.VERTICAL) {
|
||||
childCount = childCount - childCount % spanCount;
|
||||
// 如果是最后一行,则不需要绘制底部
|
||||
if (pos >= childCount)
|
||||
return true;
|
||||
} else {
|
||||
// 如果是最后一行,则不需要绘制底部
|
||||
if ((pos + 1) % spanCount == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//是否为第一列
|
||||
private boolean isFirstColum(RecyclerView parent, int pos, int spanCount) {
|
||||
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
|
||||
if (layoutManager instanceof GridLayoutManager) { //网格布局
|
||||
if ((pos + 1) % spanCount == 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//是否为第一行
|
||||
private boolean isFirstRaw(int pos, int spanCount) {
|
||||
if (pos < spanCount) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, int itemPosition,
|
||||
RecyclerView parent) {
|
||||
int spanCount = getSpanCount(parent); //列数
|
||||
|
||||
if (itemPosition == 0) { //第一行第一个,四边都画
|
||||
outRect.set(divider.getIntrinsicWidth(), divider.getIntrinsicHeight(),
|
||||
divider.getIntrinsicWidth(), divider.getIntrinsicHeight());
|
||||
} else if (isFirstRaw(itemPosition, spanCount)) { //第一行,画上下右三边
|
||||
outRect.set(0, divider.getIntrinsicHeight(), divider.getIntrinsicWidth(), divider.getIntrinsicHeight());
|
||||
} else if (isFirstColum(parent, itemPosition, spanCount)) { //第一列,画左右下三边
|
||||
outRect.set(divider.getIntrinsicWidth(), 0, divider.getIntrinsicWidth(), divider.getIntrinsicHeight());
|
||||
} else { //其他,画右下两边
|
||||
outRect.set(0, 0, divider.getIntrinsicWidth(), divider.getIntrinsicHeight());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
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;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 检测指标详情弹框
|
||||
* @since: 9/22/21
|
||||
*/
|
||||
public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
|
||||
private static final String TAG = "CheckInfoListDialog";
|
||||
private RecyclerView mRecyclerView;
|
||||
private Context mContext;
|
||||
private TextView titleView;
|
||||
private int span;
|
||||
private String mStyle;
|
||||
private CheckResultData mCheckResultData;
|
||||
private List<CheckResultData.CheckListItem> result = new ArrayList<>();
|
||||
|
||||
|
||||
public CheckInfoListDialog(@NonNull Context context, String style, CheckResultData checkResultData) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
mStyle = style;
|
||||
mCheckResultData = checkResultData;
|
||||
initView();
|
||||
}
|
||||
|
||||
public CheckInfoListDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
}
|
||||
|
||||
public void initView() {
|
||||
setContentView(R.layout.check_info_list);
|
||||
mRecyclerView = findViewById(R.id.check_list_recycler);
|
||||
titleView = findViewById(R.id.check_info_title);
|
||||
if (mStyle.equals(CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_DEVICES)) {
|
||||
titleView.setText("硬件自检结果");
|
||||
} else {
|
||||
titleView.setText("系统自检结果");
|
||||
}
|
||||
//网格布局
|
||||
GridLayoutManager layoutManager = new GridLayoutManager(mContext, 4);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
layoutManager.setOrientation(GridLayoutManager.VERTICAL);
|
||||
//网格绘制
|
||||
try {
|
||||
CheckInfoGridItemDivider gridLayoutDivider = new CheckInfoGridItemDivider(1,
|
||||
(mContext.getResources().getColor(R.color.check_info_position_line_color)));
|
||||
mRecyclerView.addItemDecoration(gridLayoutDivider);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
List resultData = showInfoResult();
|
||||
mRecyclerView.setAdapter(new CheckInfoAdapter(mContext, mStyle, resultData));
|
||||
//关闭按钮
|
||||
findViewById(R.id.cancel_info_list_button).setOnClickListener(v -> {
|
||||
cancel();
|
||||
});
|
||||
}
|
||||
|
||||
public List showInfoResult() {
|
||||
if (result.size() > 0) {
|
||||
result.clear();
|
||||
}
|
||||
try {
|
||||
List<CheckResultData.CheckListItem> checkListResult = new ArrayList();
|
||||
try {
|
||||
if (mStyle.equals(CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_DEVICES)) {
|
||||
checkListResult = mCheckResultData.getData().getDevices();
|
||||
} else {
|
||||
checkListResult = mCheckResultData.getData().getSoft();
|
||||
}
|
||||
for (CheckResultData.CheckListItem item : checkListResult) {
|
||||
if (item.getStateValue() != null) {
|
||||
result.addAll(checkListResult);
|
||||
}
|
||||
if (item.getItems() != null) {
|
||||
result.addAll(item.getItems());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.d(TAG, "检测指标结果值===" + result.toString());
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke
|
||||
android:width="3px"
|
||||
android:color="@color/check_info_shape_color" />
|
||||
<padding
|
||||
android:bottom="2px"
|
||||
android:left="2px"
|
||||
android:right="2px"
|
||||
android:top="2px" />
|
||||
</shape>
|
||||
@@ -14,7 +14,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnBack"
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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/dp_405"
|
||||
android:layout_height="@dimen/dp_127">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
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: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:textColor="#fff"
|
||||
android:textSize="@dimen/dp_38"
|
||||
android:layout_marginLeft="@dimen/dp_27"
|
||||
app:layout_constraintLeft_toRightOf="@+id/info_check_icon" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?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="1900px"
|
||||
android:layout_height="1140px"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/check_dialog_back">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cancel_info_list_button"
|
||||
android:layout_width="@dimen/dp_106"
|
||||
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"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/check_info_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_69"
|
||||
android:gravity="center"
|
||||
android:text="自检结果"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/check_list_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
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" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -3,11 +3,11 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="2360px"
|
||||
android:layout_height="@dimen/dp_643"
|
||||
android:layout_height="@dimen/dp_525"
|
||||
android:layout_marginStart="@dimen/dp_100"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_100"
|
||||
android:layout_marginBottom="@dimen/dp_15"
|
||||
android:layout_marginBottom="@dimen/dp_35"
|
||||
android:background="@drawable/check_list_item_back">
|
||||
|
||||
<TextView
|
||||
@@ -17,7 +17,7 @@
|
||||
android:layout_marginStart="@dimen/dp_80"
|
||||
android:layout_marginLeft="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:text="版本检测:(以下 1 项需要优化,版本升级后需要重启设备)"
|
||||
android:text="硬件检测:"
|
||||
android:textColor="@color/module_commons_wm_dialog_text_textColor"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@@ -30,8 +30,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_318"
|
||||
android:layout_marginTop="@dimen/dp_78"
|
||||
android:layout_marginBottom="@dimen/dp_108"
|
||||
android:layout_marginBottom="@dimen/dp_70"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@@ -42,7 +42,8 @@
|
||||
android:layout_width="@dimen/dp_150"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/auto" />
|
||||
android:src="@drawable/auto"
|
||||
android:clickable="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/icon_auto_title"
|
||||
@@ -51,7 +52,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_22"
|
||||
android:maxLines="2"
|
||||
android:text="自动驾驶升级到\n 版本"
|
||||
android:text="自动驾驶"
|
||||
android:textColor="@color/module_commons_wm_dialog_text_textColor"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintTop_toBottomOf="@id/icon_auto" />
|
||||
@@ -59,10 +60,11 @@
|
||||
<TextView
|
||||
android:id="@+id/auto_risk_state"
|
||||
android:layout_width="@dimen/dp_260"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_56"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:gravity="center"
|
||||
android:text="检测中..."
|
||||
android:textColor="@color/check_little_btn_green"
|
||||
android:textSize="@dimen/dp_36"
|
||||
app:layout_constraintTop_toTopOf="@+id/icon_auto_title" />
|
||||
@@ -76,6 +78,7 @@
|
||||
android:layout_marginTop="@dimen/dp_78"
|
||||
android:layout_marginBottom="@dimen/dp_108"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/auto_layout"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title">
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
android:layout_marginBottom="@dimen/dp_15">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/error_tip_image"
|
||||
android:id="@+id/check_tip_image"
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_140"
|
||||
android:layout_marginStart="@dimen/dp_856"
|
||||
@@ -18,14 +18,14 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error_title"
|
||||
android:id="@+id/check_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_65"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:text="自动驾驶车辆存在风险"
|
||||
android:text="自动驾驶车辆体检中,请稍候……"
|
||||
android:textColor="@color/module_commons_wm_dialog_text_textColor"
|
||||
android:textSize="@dimen/dp_64"
|
||||
app:layout_constraintLeft_toRightOf="@+id/error_tip_image"
|
||||
app:layout_constraintTop_toTopOf="@+id/error_tip_image" />
|
||||
app:layout_constraintLeft_toRightOf="@+id/check_tip_image"
|
||||
app:layout_constraintTop_toTopOf="@+id/check_tip_image" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -8,5 +8,9 @@
|
||||
<color name="check_little_btn_solid_green">#997AFF87</color>
|
||||
<color name="check_little_btn_green">#7AFF87</color>
|
||||
<color name="check_list_item_back">#242B59</color>
|
||||
<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>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -6,5 +6,6 @@
|
||||
@android:drawable/progress_indeterminate_horizontal
|
||||
</item>
|
||||
<item name="android:progressDrawable">@drawable/check_progress</item>
|
||||
<item name="android:listDivider">@drawable/check_driver</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -54,12 +54,13 @@ dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
|
||||
} else {
|
||||
api project(':services:mogo-service-api')
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.mogo.eagle.core.function.hmi;
|
||||
* @date 2021/8/3 4:26 下午
|
||||
*/
|
||||
public class WaringConst {
|
||||
public static String MODULE_NAME = "MODULE_LEFT_PANEL";
|
||||
public static String MODULE_NAME = "MODULE_HMI_WARING";
|
||||
|
||||
// V2X 弹窗预警
|
||||
// 是否展示:true-展示,false-关闭
|
||||
|
||||
@@ -17,22 +17,24 @@ import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.android.synthetic.main.fragment_warning.*
|
||||
import kotlinx.android.synthetic.main.fragment_hmi.*
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/8/3 2:40 下午
|
||||
* 预警图层
|
||||
*/
|
||||
class MoGoWarningFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>(),
|
||||
class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>(),
|
||||
MoGoWarningContract.View {
|
||||
|
||||
var mWarningFloat: WarningFloat.Builder? = null
|
||||
|
||||
override fun initViews() {}
|
||||
override fun initViews() {
|
||||
autopilotStatus.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_warning
|
||||
return R.layout.fragment_hmi
|
||||
}
|
||||
|
||||
override fun createPresenter(): WaringPresenter {
|
||||
@@ -0,0 +1,105 @@
|
||||
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.data.autopilot.AdasOCHData
|
||||
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 kotlinx.android.synthetic.main.view_autopilot_status.view.*
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/22 3:59 下午
|
||||
* 自动驾驶状态按钮
|
||||
*/
|
||||
class AutoPilotStatusView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet
|
||||
) : ConstraintLayout(context, attrs), View.OnClickListener, IMogoAdasOCHCallback {
|
||||
|
||||
private val TAG = "AutopilotStatusView"
|
||||
|
||||
private var mAutopilotStatus: Int = 0
|
||||
|
||||
init {
|
||||
initView(context)
|
||||
}
|
||||
|
||||
private fun initView(context: Context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_autopilot_status, this, true)
|
||||
|
||||
val lp = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
|
||||
layoutParams = lp
|
||||
|
||||
// 设置点击监听
|
||||
setOnClickListener(this)
|
||||
// 首次查询自动驾驶状态
|
||||
mAutopilotStatus = MogoApisHandler.getInstance().apis.adasControllerApi.autopilotStatus
|
||||
// 自动驾驶状态监听
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.addAdasOCHCallback(this)
|
||||
|
||||
LogUtils.dTag(TAG, "autopilotStatus: $mAutopilotStatus")
|
||||
setAutoPilotStatus(mAutopilotStatus)
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
when (mAutopilotStatus) {
|
||||
0 -> {// 不可自动驾驶,adas与工控机没有链接,或工控机异常
|
||||
LogUtils.eTag(TAG, "不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查")
|
||||
ToastUtils.showShort("不可自动驾驶,adas与工控机没有链接,或工控机异常,请检查")
|
||||
// TODO 这里临时触发自动驾驶能力,测试功过这里删除
|
||||
CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(true)
|
||||
}
|
||||
1 -> {// 可自动驾驶,目前处于人工干预状态
|
||||
CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(true)
|
||||
}
|
||||
2 -> {// 自动驾驶中
|
||||
CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自动驾驶状态
|
||||
* 0-// 不可自动驾驶,adas与工控机没有链接,或工控机异常
|
||||
* 1-// 可自动驾驶,目前处于人工干预状态
|
||||
* 2-// 自动驾驶中
|
||||
*/
|
||||
private fun setAutoPilotStatus(autopilotStatus: Int) {
|
||||
mAutopilotStatus = autopilotStatus
|
||||
when (autopilotStatus) {
|
||||
0 -> {// 不可自动驾驶,adas与工控机没有链接,或工控机异常
|
||||
clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_disabled_bg)
|
||||
tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_disable))
|
||||
ivStatusIcon.setImageResource(R.drawable.icon_autopilot_status_disabled)
|
||||
}
|
||||
1 -> {// 可自动驾驶,目前处于人工干预状态
|
||||
clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_enable_bg)
|
||||
tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_enable))
|
||||
ivStatusIcon.setImageResource(R.drawable.icon_autopilot_status)
|
||||
}
|
||||
2 -> {// 自动驾驶中
|
||||
clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_checked_bg)
|
||||
tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_enable))
|
||||
ivStatusIcon.setImageResource(R.drawable.icon_autopilot_status)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onArriveAt(data: AdasOCHData?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onStateChanged(state: Int, reason: String?) {
|
||||
setAutoPilotStatus(state)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
package com.mogo.eagle.core.function.hmi.warning;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider;
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener;
|
||||
import com.mogo.eagle.core.function.hmi.WaringConst;
|
||||
import com.mogo.eagle.core.function.hmi.ui.MoGoWarningFragment;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/8/2 5:52 下午
|
||||
* 预警模块
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_V2X_WARNING)
|
||||
public class MoGoWarningProvider implements IMoGoWaringProvider {
|
||||
private String TAG = "MoGoWarningProvider";
|
||||
|
||||
private MoGoWarningFragment mMoGoWarningFragment;
|
||||
private Context mContext;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "初始化蘑菇预警模块 ……");
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment createCoverage(Context context, Bundle data) {
|
||||
Logger.d(TAG, "初始化蘑菇预警模块 Fragment……");
|
||||
mMoGoWarningFragment = new MoGoWarningFragment();
|
||||
return mMoGoWarningFragment;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return WaringConst.MODULE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarningTrafficLight(int checkLightId) {
|
||||
mMoGoWarningFragment.showWarningTrafficLight(checkLightId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableWarningTrafficLight() {
|
||||
mMoGoWarningFragment.disableWarningTrafficLight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLimitingVelocity(int limitingSpeed) {
|
||||
mMoGoWarningFragment.showLimitingVelocity(limitingSpeed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableLimitingVelocity() {
|
||||
mMoGoWarningFragment.disableLimitingVelocity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownRed(int redNum) {
|
||||
mMoGoWarningFragment.changeCountdownRed(redNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownYellow(int yellowNum) {
|
||||
mMoGoWarningFragment.changeCountdownYellow(yellowNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownGreen(int greenNum) {
|
||||
mMoGoWarningFragment.changeCountdownGreen(greenNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownTrafficLightNum(int readNum, int yellowNum, int greenNum) {
|
||||
mMoGoWarningFragment.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarningV2X(int v2xType, @Nullable String alertContent,
|
||||
@Nullable String ttsContent, @Nullable String tag,
|
||||
@Nullable WarningStatusListener listener) {
|
||||
mMoGoWarningFragment.showWarningV2X(v2xType, alertContent, ttsContent, tag, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableWarningV2X(String tag) {
|
||||
mMoGoWarningFragment.disableWarningV2X(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarning(@NonNull WarningDirectionEnum direction) {
|
||||
mMoGoWarningFragment.showWarning(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarning(@NonNull WarningDirectionEnum direction, long closeTime) {
|
||||
mMoGoWarningFragment.showWarning(direction, closeTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
Log.d(TAG, "onDestroy");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.mogo.eagle.core.function.hmi.warning
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
|
||||
import com.mogo.eagle.core.function.hmi.ui.MoGoHmiFragment
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.function.hmi.WaringConst
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/8/2 5:52 下午
|
||||
* 预警模块
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_V2X_WARNING)
|
||||
class MoGoWarningProvider : IMoGoWaringProvider {
|
||||
private val TAG = "MoGoWarningProvider"
|
||||
private var mMoGoHmiFragment: MoGoHmiFragment? = null
|
||||
private var mContext: Context? = null
|
||||
override fun init(context: Context) {
|
||||
Logger.d(TAG, "初始化蘑菇预警模块 ……")
|
||||
mContext = context
|
||||
}
|
||||
|
||||
override fun createCoverage(context: Context?, data: Bundle?): Fragment? {
|
||||
Logger.d(TAG, "初始化蘑菇预警模块 Fragment……")
|
||||
mMoGoHmiFragment = MoGoHmiFragment()
|
||||
return mMoGoHmiFragment
|
||||
}
|
||||
|
||||
override val functionName: String
|
||||
get() = WaringConst.MODULE_NAME
|
||||
|
||||
override fun showWarningTrafficLight(checkLightId: Int) {
|
||||
mMoGoHmiFragment?.showWarningTrafficLight(checkLightId)
|
||||
}
|
||||
|
||||
override fun disableWarningTrafficLight() {
|
||||
mMoGoHmiFragment?.disableWarningTrafficLight()
|
||||
}
|
||||
|
||||
override fun showLimitingVelocity(limitingSpeed: Int) {
|
||||
mMoGoHmiFragment?.showLimitingVelocity(limitingSpeed)
|
||||
}
|
||||
|
||||
override fun disableLimitingVelocity() {
|
||||
mMoGoHmiFragment?.disableLimitingVelocity()
|
||||
}
|
||||
|
||||
override fun changeCountdownRed(redNum: Int) {
|
||||
mMoGoHmiFragment?.changeCountdownRed(redNum)
|
||||
}
|
||||
|
||||
override fun changeCountdownYellow(yellowNum: Int) {
|
||||
mMoGoHmiFragment?.changeCountdownYellow(yellowNum)
|
||||
}
|
||||
|
||||
override fun changeCountdownGreen(greenNum: Int) {
|
||||
mMoGoHmiFragment?.changeCountdownGreen(greenNum)
|
||||
}
|
||||
|
||||
override fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
mMoGoHmiFragment?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
|
||||
}
|
||||
|
||||
override fun showWarningV2X(
|
||||
v2xType: Int, alertContent: String?,
|
||||
ttsContent: String?, tag: String?,
|
||||
listener: WarningStatusListener?
|
||||
) {
|
||||
mMoGoHmiFragment?.showWarningV2X(v2xType, alertContent, ttsContent, tag, listener)
|
||||
}
|
||||
|
||||
override fun disableWarningV2X(tag: String?) {
|
||||
mMoGoHmiFragment?.disableWarningV2X(tag!!)
|
||||
}
|
||||
|
||||
override fun showWarning(direction: WarningDirectionEnum) {
|
||||
mMoGoHmiFragment?.showWarning(direction)
|
||||
}
|
||||
|
||||
override fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
|
||||
mMoGoHmiFragment?.showWarning(direction, closeTime)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
Log.d(TAG, "onDestroy")
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,23 @@
|
||||
android:id="@+id/flSpeedChartView"
|
||||
android:layout_width="@dimen/module_ext_speed_width"
|
||||
android:layout_height="@dimen/module_ext_speed_height"
|
||||
android:layout_marginLeft="@dimen/dp_40"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:layout_marginLeft="@dimen/module_mogo_autopilot_status_margin_left"
|
||||
android:layout_marginTop="@dimen/module_ext_arcView_top"
|
||||
android:elevation="@dimen/dp_10"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.AutoPilotStatusView
|
||||
android:id="@+id/autopilotStatus"
|
||||
android:layout_width="@dimen/module_mogo_autopilot_status_bg_width"
|
||||
android:layout_height="@dimen/module_mogo_autopilot_status_bg_height"
|
||||
android:layout_marginTop="@dimen/module_mogo_autopilot_status_margin_top"
|
||||
android:elevation="@dimen/dp_10"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/flSpeedChartView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/flSpeedChartView"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TrafficLightView
|
||||
android:id="@+id/viewTrafficLightVr"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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="@dimen/module_mogo_autopilot_status_bg_width"
|
||||
android:layout_height="@dimen/module_mogo_autopilot_status_bg_height"
|
||||
android:background="@drawable/module_hmi_autopilot_status_bg">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivStatusIcon"
|
||||
android:layout_width="@dimen/module_mogo_autopilot_status_icon_width"
|
||||
android:layout_height="@dimen/module_mogo_autopilot_status_icon_width"
|
||||
android:layout_marginStart="@dimen/module_mogo_autopilot_status_icon_margin"
|
||||
android:src="@drawable/icon_autopilot_status"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvStatusDes"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_mogo_autopilot_status_text_margin_start"
|
||||
android:text="自动驾驶"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_mogo_autopilot_status_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/ivStatusIcon"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
1
core/function-impl/mogo-core-function-map/.gitignore
vendored
Normal file
1
core/function-impl/mogo-core-function-map/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
67
core/function-impl/mogo-core-function-map/build.gradle
Normal file
67
core/function-impl/mogo-core-function-map/build.gradle
Normal file
@@ -0,0 +1,67 @@
|
||||
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
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
implementation "com.zhidao.support.adas:high:1.2.0.2"
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
|
||||
} else {
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.eagle.core
|
||||
POM_ARTIFACT_ID=function-map
|
||||
VERSION_CODE=1
|
||||
21
core/function-impl/mogo-core-function-map/proguard-rules.pro
vendored
Normal file
21
core/function-impl/mogo-core-function-map/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.map">
|
||||
|
||||
</manifest>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.hmi">
|
||||
package="com.mogo.eagle.core.function.notice">
|
||||
|
||||
</manifest>
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.eagle.core.function.obu.mogo.utils
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.module.common.drawer.bean.TrafficData
|
||||
import com.mogo.module.common.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.zhidao.support.obu.constants.ObuConstants
|
||||
import com.zhidao.support.obu.model.CvxPtcThreatIndInfo
|
||||
import com.zhidao.support.obu.model.CvxRtiThreatIndInfo
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RoutePathConvertUtils {
|
||||
|
||||
|
||||
public List<MogoLatLng> routeList;
|
||||
|
||||
public int ROUTE_LEFT = 1;
|
||||
public int ROUTE_RIGHT = 2;
|
||||
public int ROUTE_STRAIGHT = 0;
|
||||
public int route_direction =-1;
|
||||
public void convert(){
|
||||
for (int i = 0; i <routeList.size()-2 ; i++) {
|
||||
MogoLatLng latLng0 = routeList.get(i);
|
||||
MogoLatLng latLng1 = routeList.get(i+1);
|
||||
MogoLatLng latLng2 = routeList.get(i+2);
|
||||
double v1x = latLng1.lat - latLng0.lat;
|
||||
double v1y = latLng1.lon - latLng0.lon;
|
||||
double v2x = latLng2.lat - latLng1.lat;
|
||||
double v2y = latLng2.lon - latLng2.lon;
|
||||
double r = v1x* v2y - v1y*v2x;
|
||||
if (r > 0.0){
|
||||
route_direction = ROUTE_LEFT;
|
||||
}else {
|
||||
route_direction = ROUTE_RIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -15,26 +15,31 @@ import androidx.annotation.Nullable;
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdate;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.amap.api.maps.UiSettings;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions;
|
||||
import com.amap.api.navi.AMapNavi;
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.amap.api.navi.AMapNaviViewOptions;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.smp.animation.DirectionRotateAnimation;
|
||||
import com.mogo.eagle.core.function.smp.utils.MapAssetStyleUtils;
|
||||
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
|
||||
import com.mogo.eagle.core.view.RoundLayout;
|
||||
import com.mogo.eagle.core.widget.RoundLayout;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ch.hsr.geohash.GeoHash;
|
||||
|
||||
/**
|
||||
* 小地图的方向View
|
||||
*
|
||||
@@ -46,17 +51,20 @@ public class SmallMapDirectionView
|
||||
implements IMogoCarLocationChangedListener2, ISmallMapDirectionView {
|
||||
|
||||
//小地图名称
|
||||
public static final String MODULE_NAME = "SmallMapDirectionView";
|
||||
public static final String MODULE_NAME = "SmallMap";
|
||||
|
||||
private RoundLayout rlSmallMapBorder;
|
||||
private ImageView mIvMapBorder;
|
||||
private DirectionRotateAnimation mRotateAnimation;
|
||||
private int lastAngle = 0;
|
||||
|
||||
private AMapNaviView mAMapNaviView;
|
||||
private TextureMapView mAMapNaviView;
|
||||
private AMap mAMap;
|
||||
private AMapNavi mAMapNavi;
|
||||
private int zoomLevel = 15;
|
||||
private Marker mCarMarker;
|
||||
private Marker mStartMarker;
|
||||
private Marker mEndMarker;
|
||||
|
||||
private int zoomLevel = 13;
|
||||
private List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
private List<MogoLatLng> mCoordinatesLatLngCurrent = new ArrayList<>();
|
||||
private Polyline mPolyline;
|
||||
private CameraUpdate mCameraUpdate;
|
||||
|
||||
public SmallMapDirectionView(Context context) {
|
||||
this(context, null);
|
||||
@@ -76,15 +84,11 @@ public class SmallMapDirectionView
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
mRotateAnimation = new DirectionRotateAnimation(context, null);
|
||||
View smpView = LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
|
||||
|
||||
LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
|
||||
|
||||
mAMapNaviView = AbsMogoApplication.getMapNaviView();
|
||||
mAMapNaviView = (TextureMapView)smpView.findViewById(R.id.aMapNaviView);
|
||||
rlSmallMapBorder = findViewById(R.id.rlSmallMapBorder);
|
||||
rlSmallMapBorder.addView(mAMapNaviView);
|
||||
mIvMapBorder = findViewById(R.id.ivMapBorder);
|
||||
|
||||
|
||||
initAMapView();
|
||||
|
||||
@@ -117,10 +121,7 @@ public class SmallMapDirectionView
|
||||
}
|
||||
|
||||
private void initAMapView() {
|
||||
// 车头朝上
|
||||
mAMapNaviView.setNaviMode(AMapNaviView.CAR_UP_MODE);
|
||||
// 设置电子眼所在路线的可见性
|
||||
mAMapNaviView.setRouteOverlayVisible(false);
|
||||
mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||
mAMap = mAMapNaviView.getMap();
|
||||
// 关闭地图文字标注
|
||||
mAMap.showMapText(false);
|
||||
@@ -128,25 +129,15 @@ public class SmallMapDirectionView
|
||||
mAMap.setMapType(AMap.MAP_TYPE_NIGHT);
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
mAMap.setTrafficEnabled(false);
|
||||
mAMap.setOnCameraChangeListener(new AMap.OnCameraChangeListener() {
|
||||
@Override
|
||||
public void onCameraChange(CameraPosition cameraPosition) {
|
||||
if (cameraPosition != null) {
|
||||
//Log.w("onCameraChange", "cameraPosition=" + cameraPosition.bearing);
|
||||
changeAngle((int) cameraPosition.bearing);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChangeFinish(CameraPosition cameraPosition) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mAMapNavi = AMapNavi.getInstance(getContext());
|
||||
//使用外部GPS数据
|
||||
mAMapNavi.setIsUseExtraGPSData(true);
|
||||
|
||||
// 设置 锚点 图标
|
||||
mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_my_location_logo))
|
||||
.anchor(0.5f, 0.5f));
|
||||
mStartMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_start)));
|
||||
mEndMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_end)));
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
@@ -162,8 +153,7 @@ public class SmallMapDirectionView
|
||||
);
|
||||
|
||||
//设置希望展示的地图缩放级别
|
||||
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||
mAMap.moveCamera(cameraUpdate);
|
||||
mAMap.moveCamera(mCameraUpdate);
|
||||
}).start();
|
||||
|
||||
// 设置地图的样式
|
||||
@@ -172,71 +162,12 @@ public class SmallMapDirectionView
|
||||
uiSettings.setAllGesturesEnabled(false);// 所有手势
|
||||
uiSettings.setMyLocationButtonEnabled(false); // 显示默认的定位按钮
|
||||
uiSettings.setLogoBottomMargin(-150); //设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
|
||||
// 导航地图
|
||||
AMapNaviViewOptions options = mAMapNaviView.getViewOptions();
|
||||
//设置导航界面UI是否显示。
|
||||
if (options != null) {
|
||||
// 设置是否开启自动黑夜模式切换,默认为false,不自动切换
|
||||
options.setAutoNaviViewNightMode(false);
|
||||
// 设置6秒后是否自动锁车
|
||||
options.setAutoLockCar(true);
|
||||
// 设置路线上的摄像头气泡是否显示
|
||||
options.setCameraBubbleShow(false);
|
||||
// 设置路线相关的配置属性,如:路线的路况颜色,路线上是否显示摄像头气泡等。
|
||||
// options.setRouteOverlayOptions( MapStyleUtils.getRouteOverlayOptions() );
|
||||
// 设置自车的图片对象
|
||||
options.setCarBitmap(BitmapFactory.decodeResource(getContext().getResources(),
|
||||
R.drawable.module_small_map_view_my_location_logo));
|
||||
// 设置罗盘位图对象
|
||||
options.setFourCornersBitmap(BitmapFactory.decodeResource(getContext().getResources(),
|
||||
R.drawable.icon_module_small_map_four_corners));
|
||||
// 设置指南针图标否在导航界面显示,默认显示。true,显示;false,隐藏。
|
||||
options.setCompassEnabled(false);
|
||||
//设置路况光柱条是否显示(只适用于驾车导航,需要联网)。
|
||||
options.setTrafficBarEnabled(false);
|
||||
// 设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
options.setTrafficLayerEnabled(false);
|
||||
// 设置导航界面是否显示路线全览按钮。
|
||||
options.setRouteListButtonShow(false);
|
||||
// 设置屏幕是否常亮,默认开启
|
||||
options.setScreenAlwaysBright(false);
|
||||
// 设置交通播报是否打开(只适用于驾车导航,需要联网)。
|
||||
options.setTrafficInfoUpdateEnabled(false);
|
||||
// 设置摄像头播报是否打开(只适用于驾车导航)。
|
||||
options.setCameraInfoUpdateEnabled(false);
|
||||
// 设置菜单按钮是否在导航界面显示。
|
||||
options.setSettingMenuEnabled(false);
|
||||
// 设置是否绘制显示交通路况的线路(彩虹线),拥堵-红色,畅通-绿色,缓慢-黄色,未知-蓝色。默认不绘制彩虹线。
|
||||
options.setTrafficLine(false);
|
||||
// 设置是否绘制牵引线(当前位置到目的地的指引线)。默认不绘制牵引线。
|
||||
options.setLeaderLineEnabled(-1);
|
||||
// 设置导航界面UI是否显示。
|
||||
options.setLayoutVisible(false);
|
||||
// 设置是否自动画路
|
||||
options.setAutoDrawRoute(false);
|
||||
// 设置是否显示路口放大图(实景图)
|
||||
options.setRealCrossDisplayShow(false);
|
||||
// 设置是否显示路口放大图(路口模型图)
|
||||
options.setModeCrossDisplayShow(false);
|
||||
// 设置是否显示道路信息view
|
||||
options.setLaneInfoShow(false);
|
||||
// 设置是否自动改变缩放等级
|
||||
options.setAutoChangeZoom(false);
|
||||
// 设置是否自动全览模式,即在算路成功后自动进入全览模式
|
||||
options.setAutoDisplayOverview(false);
|
||||
// 设置路线转向箭头隐藏和显示
|
||||
options.setNaviArrowVisible(false);
|
||||
// 通过路线是否自动置灰,仅支持驾车导航
|
||||
options.setAfterRouteAutoGray(false);
|
||||
options.setZoom(((int) 10));
|
||||
//options.setPointToCenter(0.7D, 0.5D);
|
||||
// 2D模式
|
||||
options.setTilt(0);
|
||||
// 黑夜模式
|
||||
options.setNaviNight(true);
|
||||
mAMapNaviView.setViewOptions(options);
|
||||
}
|
||||
mAMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth()/2, mAMapNaviView.getHeight()/2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -247,58 +178,106 @@ public class SmallMapDirectionView
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
//Logger.d(MODULE_NAME, "onCarLocationChanged2 latLng:" + latLng);
|
||||
if (mAMapNavi != null) {
|
||||
NumberFormat nf = NumberFormat.getNumberInstance();
|
||||
// 保留两位小数
|
||||
nf.setMaximumFractionDigits(6);
|
||||
// 如果不需要四舍五入,可以使用RoundingMode.DOWN
|
||||
nf.setRoundingMode(RoundingMode.UP);
|
||||
try {
|
||||
latLng.setLatitude(Double.valueOf(nf.format(latLng.getLatitude())));
|
||||
latLng.setLongitude(Double.valueOf(nf.format(latLng.getLongitude())));
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
latLng.setLatitude(latLng.getLatitude());
|
||||
latLng.setLongitude(latLng.getLongitude());
|
||||
Logger.d(MODULE_NAME, "onCarLocationChanged2 latLng:" + latLng);
|
||||
LatLng currentLatLng = new LatLng(latLng.getLatitude(), latLng.getLongitude());
|
||||
|
||||
if (mCarMarker != null) {
|
||||
mCarMarker.setRotateAngle(360 - latLng.getBearing());
|
||||
mCarMarker.setPosition(currentLatLng);
|
||||
mCarMarker.setToTop();
|
||||
}
|
||||
|
||||
|
||||
if (mCoordinatesLatLng.size() > 1) {
|
||||
mCoordinatesLatLngCurrent.clear();
|
||||
for (LatLng lng : mCoordinatesLatLng) {
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(lng.latitude, lng.longitude);
|
||||
mCoordinatesLatLngCurrent.add(mogoLatLng);
|
||||
}
|
||||
mAMapNavi.setExtraGPSData(2, latLng);
|
||||
|
||||
// 结束位置
|
||||
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
||||
// 与结束位置进行 GeoHash 0-12
|
||||
// GeoHash endGeoHash = GeoHash.withCharacterPrecision(endLatLng.latitude, endLatLng.longitude, 7);
|
||||
// GeoHash currentGeoHash = GeoHash.withCharacterPrecision(currentLatLng.latitude, currentLatLng.longitude, 7);
|
||||
// Log.d(MODULE_NAME, "currentGeoHash=" + currentGeoHash);
|
||||
// Log.d(MODULE_NAME, "endGeoHash=" + endGeoHash);
|
||||
|
||||
float calculateDistance = CoordinateUtils.calculateLineDistance(
|
||||
endLatLng.latitude, endLatLng.longitude,
|
||||
currentLatLng.latitude, currentLatLng.longitude
|
||||
);
|
||||
|
||||
Log.d(MODULE_NAME, "calculateDistance=" + calculateDistance);
|
||||
if (calculateDistance <= 20) {
|
||||
clearPolyline();
|
||||
} else {
|
||||
drawablePolyline(mCoordinatesLatLngCurrent);
|
||||
}
|
||||
} else {
|
||||
//设置希望展示的地图缩放级别
|
||||
mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLatLng, zoomLevel));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLatLng latLng) {
|
||||
//Logger.d(MODULE_NAME, "onCarLocationChanged latLng:" + latLng);
|
||||
Logger.d(MODULE_NAME, "onCarLocationChanged latLng:" + latLng);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawablePolyline(List<MogoLatLng> coordinates) {
|
||||
clearPolyline();
|
||||
mCoordinatesLatLng.clear();
|
||||
|
||||
for (MogoLatLng coordinate : coordinates) {
|
||||
mCoordinatesLatLng.add(new LatLng(coordinate.getLat(), coordinate.getLon()));
|
||||
}
|
||||
|
||||
if (mAMap != null) {
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
// 设置开始结束Marker位置
|
||||
mStartMarker.setPosition(mCoordinatesLatLng.get(0));
|
||||
mEndMarker.setPosition(mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1));
|
||||
mStartMarker.setVisible(true);
|
||||
mEndMarker.setVisible(true);
|
||||
|
||||
//存放所有点的经纬度
|
||||
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
|
||||
|
||||
for (int i = 0; i < mCoordinatesLatLng.size(); i++) {
|
||||
//把所有点都include进去(LatLng类型)
|
||||
boundsBuilder.include(mCoordinatesLatLng.get(i));
|
||||
}
|
||||
//第二个参数为四周留空宽度
|
||||
mAMap.animateCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(), 65, 65, 65, 65));
|
||||
|
||||
// 绘制线
|
||||
mPolyline = mAMap.addPolyline(
|
||||
new PolylineOptions()
|
||||
.addAll(mCoordinatesLatLng)
|
||||
.color(Color.argb(255, 31, 127, 255))
|
||||
.width(5));
|
||||
|
||||
} else {
|
||||
//设置希望展示的地图缩放级别
|
||||
mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mCoordinatesLatLng.get(0), zoomLevel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPolyline() {
|
||||
|
||||
mCoordinatesLatLng.clear();
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改角度
|
||||
*
|
||||
* @param angle 角度 0 - 359度旋转,相对于自身中心位置
|
||||
*/
|
||||
public void changeAngle(int angle) {
|
||||
int tempAngle = 360 - angle;
|
||||
mRotateAnimation.setFromDegrees(lastAngle);
|
||||
mRotateAnimation.setToDegrees(tempAngle);
|
||||
|
||||
//设置线性插值,可以解决旋转一圈后卡顿问题
|
||||
mRotateAnimation.setInterpolator(new LinearInterpolator());
|
||||
//设置旋转一圈时间
|
||||
mRotateAnimation.setDuration(300);
|
||||
//控件动画结束时是否保持动画最后的状态
|
||||
mRotateAnimation.setFillAfter(true);
|
||||
mIvMapBorder.startAnimation(mRotateAnimation);
|
||||
// 刷新最后一次角度
|
||||
lastAngle = tempAngle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/module_small_map_view_border" />
|
||||
|
||||
<com.mogo.eagle.core.view.RoundLayout
|
||||
<com.mogo.eagle.core.widget.RoundLayout
|
||||
android:id="@+id/rlSmallMapBorder"
|
||||
android:layout_width="@dimen/module_small_map_view_width"
|
||||
android:layout_height="@dimen/module_small_map_view_width"
|
||||
@@ -20,15 +20,16 @@
|
||||
app:roundLayoutRadius="360dp">
|
||||
|
||||
<!--TODO Hook方案在Pad上有问题,优先 效果,后面在看如何解决-->
|
||||
<!-- <com.amap.api.navi.AMapNaviView
|
||||
<!-- <com.amap.api.navi.AMapNaviView-->
|
||||
<!-- android:id="@+id/aMapNaviView"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent" />-->
|
||||
|
||||
<com.amap.api.maps.TextureMapView
|
||||
android:id="@+id/aMapNaviView"
|
||||
android:layout_width="@dimen/module_small_map_view_width"
|
||||
android:layout_height="@dimen/module_small_map_view_width" />-->
|
||||
<!--<com.amap.api.maps.TextureMapView
|
||||
android:id="@+id/aMapNaviView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />-->
|
||||
</com.mogo.eagle.core.view.RoundLayout>
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</com.mogo.eagle.core.widget.RoundLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivMapBorder"
|
||||
|
||||
1
core/function-impl/mogo-core-function-v2x/.gitignore
vendored
Normal file
1
core/function-impl/mogo-core-function-v2x/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
67
core/function-impl/mogo-core-function-v2x/build.gradle
Normal file
67
core/function-impl/mogo-core-function-v2x/build.gradle
Normal file
@@ -0,0 +1,67 @@
|
||||
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
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
implementation "com.zhidao.support.adas:high:1.2.0.2"
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
|
||||
} else {
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.eagle.core
|
||||
POM_ARTIFACT_ID=function-v2x
|
||||
VERSION_CODE=1
|
||||
21
core/function-impl/mogo-core-function-v2x/proguard-rules.pro
vendored
Normal file
21
core/function-impl/mogo-core-function-v2x/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.v2x">
|
||||
|
||||
</manifest>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.mogo.module.data">
|
||||
package="com.mogo.eagle.core.data">
|
||||
|
||||
</manifest>
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.service.impl.adas;
|
||||
package com.mogo.eagle.core.data.autopilot;
|
||||
|
||||
public
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.service.adas.entity;
|
||||
package com.mogo.eagle.core.data.autopilot;
|
||||
|
||||
public
|
||||
/**
|
||||
@@ -1,18 +1,17 @@
|
||||
package com.mogo.service.adas;
|
||||
package com.mogo.eagle.core.data.autopilot;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/16
|
||||
*
|
||||
* 自动驾驶参数
|
||||
* @author donghongyu
|
||||
* @since 2021/09/22
|
||||
* <p>
|
||||
* 启动自动驾驶参数
|
||||
*/
|
||||
class RemoteControlAutoPilotParameters {
|
||||
public class RemoteControlAutoPilotParameters {
|
||||
|
||||
public AutoPilotLonLat startLatLon;
|
||||
public List< AutoPilotLonLat > wayLatLons;
|
||||
public List<AutoPilotLonLat> wayLatLons;
|
||||
public AutoPilotLonLat endLatLon;
|
||||
public float speedLimit;
|
||||
public int vehicleType;// 运营类型
|
||||
@@ -28,7 +27,7 @@ class RemoteControlAutoPilotParameters {
|
||||
public AutoPilotLonLat() {
|
||||
}
|
||||
|
||||
public AutoPilotLonLat( double lat, double lon ) {
|
||||
public AutoPilotLonLat(double lat, double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.common.enums
|
||||
package com.mogo.eagle.core.data.enums
|
||||
|
||||
import com.mogo.eagle.core.data.R
|
||||
|
||||
import com.mogo.module.common.R
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.mogo.eagle.core.data.model
|
||||
|
||||
/**
|
||||
*@author xiaoyuzhou
|
||||
*@date 2021/9/14 3:51 下午
|
||||
*/
|
||||
class V2XThreatIndInfo {
|
||||
// /**
|
||||
// * RV temperary vehicle ID
|
||||
// */
|
||||
// private val vehicle_id: String? = null
|
||||
// /**
|
||||
// * V2V threat status 0: update 1: add 2: delete
|
||||
// * range(0..2)
|
||||
// * [com.zhidao.support.obu.constants.ObuConstants.STATUS]
|
||||
// */
|
||||
// private val status = 0
|
||||
//
|
||||
// /**
|
||||
// * RV threat information 目前判断RV方向使用的是 ext_info 中的 target_classification 变量
|
||||
// */
|
||||
// private val threat_info: V2vThreat? = null
|
||||
//
|
||||
// /**
|
||||
// * 目前判断RV方向使用的是 ext_info 中的 target_classification 变量
|
||||
// * The extension information of V2V threat
|
||||
// */
|
||||
// private val ext_info: V2vThreatExt? = null
|
||||
//
|
||||
// /**
|
||||
// * RV basic information
|
||||
// */
|
||||
// private val basic_info: MovingObjectInfo? = null
|
||||
// /**
|
||||
// * Wgs84坐标系,线性经纬度轨迹列表
|
||||
// */
|
||||
// private val locus_list: List<com.mogo.eagle.core.data.map.MogoLatLng>? = null
|
||||
//
|
||||
// /**
|
||||
// * 高德坐标系Gcj,线性经纬度轨迹列表
|
||||
// */
|
||||
// private val gd_locus_list: List<com.mogo.eagle.core.data.map.MogoLatLng>? = null
|
||||
|
||||
}
|
||||
@@ -1,69 +1,68 @@
|
||||
package com.mogo.module.common.drawer.bean;
|
||||
package com.mogo.eagle.core.data.traffic
|
||||
|
||||
import com.mogo.module.common.enums.TrafficTypeEnum;
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/8/17 8:41 下午
|
||||
* 交通元素数据,
|
||||
*/
|
||||
public class TrafficData {
|
||||
|
||||
class TrafficData {
|
||||
/**
|
||||
* 交通元素类型, 车、人、摩托、大巴车、卡车、自行车
|
||||
*/
|
||||
public TrafficTypeEnum type;
|
||||
var type: TrafficTypeEnum = TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI
|
||||
|
||||
/**
|
||||
* 识别物体唯一标识
|
||||
*/
|
||||
public String uuid;
|
||||
var uuid: String = ""
|
||||
|
||||
/**
|
||||
* 识别物体的纬度
|
||||
*/
|
||||
public double lat;
|
||||
var lat = 0.0
|
||||
|
||||
/**
|
||||
* 识别物体的经度
|
||||
*/
|
||||
public double lon;
|
||||
var lon = 0.0
|
||||
|
||||
/**
|
||||
* 车头朝向
|
||||
*/
|
||||
public double heading;
|
||||
var heading = 0.0
|
||||
|
||||
/**
|
||||
* 系统时间
|
||||
*/
|
||||
public long systemTime;
|
||||
var systemTime: Long = 0
|
||||
|
||||
/**
|
||||
* 定位卫星时间
|
||||
*/
|
||||
public long satelliteTime;
|
||||
var satelliteTime: Long = 0
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
public double alt;
|
||||
var alt = 0.0
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
public double speed;
|
||||
var speed = 0.0
|
||||
|
||||
/**
|
||||
* 莫顿码
|
||||
*/
|
||||
public long mortonCode;
|
||||
var mortonCode: Long = 0
|
||||
|
||||
/**
|
||||
* 实际距离
|
||||
* 使用distanceX和distanceY计算
|
||||
*/
|
||||
public double distance;
|
||||
var distance = 0.0
|
||||
|
||||
/**
|
||||
* 危险等级
|
||||
@@ -73,5 +72,5 @@ public class TrafficData {
|
||||
* 0x02: 通知 -- 黄
|
||||
* 0x03: 警告 -- 红
|
||||
*/
|
||||
public int threatLevel;
|
||||
}
|
||||
var threatLevel = 0
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.eagle.core.data.v2x
|
||||
|
||||
import androidx.annotation.Keep
|
||||
|
||||
/**
|
||||
* 路口碰撞预警、盲区预警等通用Bean
|
||||
*/
|
||||
@Keep
|
||||
data class AdvanceWarningBean(
|
||||
var objectId: String,
|
||||
var status: Int,
|
||||
var typeId: Int,
|
||||
var time: Long,
|
||||
var level: Int,
|
||||
var position: Position,
|
||||
var heading: Int,
|
||||
var speed: Double,
|
||||
var distance: Double,
|
||||
var roadId: String,
|
||||
var laneId: String,
|
||||
var laneNum: Int,
|
||||
var gdLocusList: List<Position>,
|
||||
var locusList: List<Position>
|
||||
)
|
||||
|
||||
@Keep
|
||||
data class Position(var lat: Double, var lon: Double)
|
||||
@@ -1,11 +1,18 @@
|
||||
### 模块说明
|
||||
本模块定义业务层具备那些功能,不提供具体业务实现;所有具体业务实现均在mogo-core-function-impl模块中
|
||||
|
||||
base
|
||||
IMoGoFunctionProvider--------带界面的功能模块
|
||||
IMoGoFunctionServerProvider--服务类型的功能模块
|
||||
|
||||
adas--域控制器相关
|
||||
chat--车聊聊相关
|
||||
check--车辆检测相关
|
||||
dispatch--车辆调度相关
|
||||
hmi--UI这里承载的是所有鹰眼的UI展示
|
||||
map--地图相关
|
||||
hd--高精地图
|
||||
smp--小地图
|
||||
notice--公告
|
||||
obu--OBU预警逻辑相关
|
||||
tts--语音播报&语音交互相关
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.eagle.core.function.api.autopilot;
|
||||
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/23 11:23 上午
|
||||
* 自动驾驶识别数据监听,回调后做数据可视化呈现
|
||||
*/
|
||||
public interface IMoGoAutoPilotIdentifyListener {
|
||||
|
||||
/**
|
||||
* 识别交通元素数据发生更新
|
||||
*
|
||||
* @param trafficData 交通元素信息列表
|
||||
*/
|
||||
void onIdentifyDataUpdate(List<TrafficData> trafficData);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.mogo.eagle.core.function.api.autopilot;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/22 8:27 下午
|
||||
* 自动驾驶节点
|
||||
*/
|
||||
public interface IMoGoAutoPilotProvider extends IMoGoFunctionServerProvider {
|
||||
|
||||
/**
|
||||
* 开启自动驾驶
|
||||
*
|
||||
* @param result
|
||||
*/
|
||||
void startAutoPilot(RemoteControlAutoPilotParameters result);
|
||||
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
*/
|
||||
void cancelAutoPilot();
|
||||
|
||||
/**
|
||||
* 获取车辆自动驾驶状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getAutopilotStatus();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mogo.eagle.core.function.api.autopilot;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AdasOCHData;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/22 8:59 下午
|
||||
* 自动驾驶状态回调监听
|
||||
*/
|
||||
public interface IMoGoAutoPilotStatusListener {
|
||||
|
||||
/**
|
||||
* 不可自动驾驶,目前场景是刚开机,adas还未和工控机连接
|
||||
*/
|
||||
int STATUS_AUTOPILOT_DISABLE = 0;
|
||||
/**
|
||||
* 可自动驾驶,工控机连接正常,且处于人工干预状态
|
||||
*/
|
||||
int STATUS_AUTOPILOT_ENABLE = 1;
|
||||
/**
|
||||
* 自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人
|
||||
*/
|
||||
int STATUS_AUTOPILOT_RUNNING = 2;
|
||||
|
||||
|
||||
/**
|
||||
* 到站
|
||||
* @param data 所到车站的简单信息
|
||||
*/
|
||||
void onArriveAt( AdasOCHData data );
|
||||
|
||||
/**
|
||||
* 自动驾驶状态发生改变
|
||||
* @param state {@link #STATUS_AUTOPILOT_DISABLE}
|
||||
* @param reason 不能自动驾驶的原因
|
||||
*/
|
||||
void onStateChanged(int state, String reason);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.eagle.core.function.api.hmi.autopilot
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/22 9:26 下午
|
||||
* 自动驾驶控制按钮回调监听
|
||||
*/
|
||||
interface IMoGoCheckAutoPilotBtnListener {
|
||||
fun onCheck(isChecked: Boolean)
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.call.api">
|
||||
package="com.mogo.eagle.core.function.call">
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.mogo.eagle.core.function.call.hmi
|
||||
|
||||
import androidx.annotation.Nullable
|
||||
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/23 10:22 上午
|
||||
* HMI 视图上的监听管理
|
||||
*/
|
||||
object CallerHmiListenerManager : CallerBase() {
|
||||
|
||||
private val TAG = "CallerHmiListenerManager"
|
||||
|
||||
private val checkAutoPilotBtnListeners: HashMap<String, IMoGoCheckAutoPilotBtnListener> =
|
||||
HashMap()
|
||||
|
||||
|
||||
/**
|
||||
* 添加自动驾驶按钮选中监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
fun addCheckAutoPilotBtnListener(
|
||||
@Nullable tag: String,
|
||||
@Nullable listener: IMoGoCheckAutoPilotBtnListener
|
||||
) {
|
||||
checkAutoPilotBtnListeners[tag] = listener
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自动驾驶按钮选中监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
*/
|
||||
fun removeCheckAutoPilotBtnListener(@Nullable tag: String) {
|
||||
checkAutoPilotBtnListeners.remove(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发自动驾驶按钮选中监听
|
||||
* @param isChecked 选中状态
|
||||
*/
|
||||
fun invokeCheckAutoPilotBtnListener(isChecked: Boolean) {
|
||||
LogUtils.dTag(TAG, "isChecked:$isChecked")
|
||||
checkAutoPilotBtnListeners.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
listener.onCheck(isChecked)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.call.hmi
|
||||
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
@@ -41,7 +41,7 @@ android {
|
||||
sourceSets {
|
||||
main {
|
||||
res.srcDirs = [
|
||||
'src/main/function-common-res',
|
||||
'src/main/res',
|
||||
'src/main/function-adas-res',
|
||||
'src/main/function-chat-res',
|
||||
'src/main/function-check-res',
|
||||
@@ -60,6 +60,18 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
|
||||
} else {
|
||||
implementation project(':core:mogo-core-utils')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.call.api">
|
||||
package="com.mogo.eagle.core.widget">
|
||||
|
||||
</manifest>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<declare-styleable name="RoundLayout">
|
||||
<attr name="roundLayoutRadius" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/module_hmi_autopilot_status_checked_bg" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/module_hmi_autopilot_status_enable_bg" android:state_checked="false" android:state_enabled="true" />
|
||||
<item android:drawable="@drawable/module_hmi_autopilot_status_disabled_bg" android:state_checked="false" android:state_enabled="false" />
|
||||
</selector>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:bottomLeftRadius="@dimen/module_hmi_autopilot_status_bg_sm_radius"
|
||||
android:bottomRightRadius="@dimen/module_hmi_autopilot_status_bg_big_radius"
|
||||
android:topLeftRadius="@dimen/module_hmi_autopilot_status_bg_big_radius"
|
||||
android:topRightRadius="@dimen/module_hmi_autopilot_status_bg_sm_radius" />
|
||||
<gradient
|
||||
android:angle="315"
|
||||
android:endColor="#2B6EFF"
|
||||
android:startColor="#2B6EFF" />
|
||||
</shape>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:bottomLeftRadius="@dimen/module_hmi_autopilot_status_bg_sm_radius"
|
||||
android:bottomRightRadius="@dimen/module_hmi_autopilot_status_bg_big_radius"
|
||||
android:topLeftRadius="@dimen/module_hmi_autopilot_status_bg_big_radius"
|
||||
android:topRightRadius="@dimen/module_hmi_autopilot_status_bg_sm_radius" />
|
||||
<gradient
|
||||
android:angle="315"
|
||||
android:endColor="#364071"
|
||||
android:startColor="#364071" />
|
||||
</shape>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:bottomLeftRadius="@dimen/module_hmi_autopilot_status_bg_sm_radius"
|
||||
android:bottomRightRadius="@dimen/module_hmi_autopilot_status_bg_big_radius"
|
||||
android:topLeftRadius="@dimen/module_hmi_autopilot_status_bg_big_radius"
|
||||
android:topRightRadius="@dimen/module_hmi_autopilot_status_bg_sm_radius" />
|
||||
<gradient
|
||||
android:angle="315"
|
||||
android:endColor="#3B4577"
|
||||
android:startColor="#3B4577" />
|
||||
</shape>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
android:endColor="#3B4577"
|
||||
android:startColor="#3B4577" />
|
||||
<corners
|
||||
android:bottomLeftRadius="130px"
|
||||
android:bottomRightRadius="30px"
|
||||
android:topLeftRadius="30px"
|
||||
android:topRightRadius="130px" />
|
||||
android:bottomLeftRadius="@dimen/module_ext_speed_width_big_radius"
|
||||
android:bottomRightRadius="@dimen/module_ext_speed_width_sm_radius"
|
||||
android:topLeftRadius="@dimen/module_ext_speed_width_sm_radius"
|
||||
android:topRightRadius="@dimen/module_ext_speed_width_big_radius" />
|
||||
</shape>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_ext_speed_width">460px</dimen>
|
||||
<dimen name="module_ext_speed_height">460px</dimen>
|
||||
|
||||
<dimen name="module_ext_arcView_width">320px</dimen>
|
||||
<dimen name="module_ext_arcView_height">320px</dimen>
|
||||
<dimen name="module_ext_arcView_stroke_with">20px</dimen>
|
||||
<dimen name="module_ext_arcView_center_text_size">110px</dimen>
|
||||
<dimen name="module_ext_arcView_des_text_size">40px</dimen>
|
||||
</resources>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_ext_speed_width">300px</dimen>
|
||||
<dimen name="module_ext_speed_height">300px</dimen>
|
||||
|
||||
<dimen name="module_ext_arcView_width">200px</dimen>
|
||||
<dimen name="module_ext_arcView_height">200px</dimen>
|
||||
<dimen name="module_ext_arcView_stroke_with">10px</dimen>
|
||||
<dimen name="module_ext_arcView_center_text_size">80px</dimen>
|
||||
<dimen name="module_ext_arcView_des_text_size">28px</dimen>
|
||||
</resources>
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.v2x.view;
|
||||
package com.mogo.eagle.core.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -13,7 +13,8 @@ import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.v2x.utils.ImageUtil;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.ImageUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
@@ -173,7 +174,7 @@ public class AnimationView extends View implements Handler.Callback {
|
||||
if (mAnimDataList != null && mAnimDataList.size() > 0) {
|
||||
mCurAnimPos = 0;
|
||||
AnimData animData = mAnimDataList.get(mCurAnimPos);
|
||||
mCurShowBmp = ImageUtil.getBitmap(getContext(), animData.filePath, mWidth, mHeight);
|
||||
mCurShowBmp = ImageUtils.getBitmap(animData.filePath, mWidth, mHeight);
|
||||
invalidate();
|
||||
if (mListener != null) {
|
||||
mListener.onAnimChange(mCurAnimPos, mCurShowBmp);
|
||||
@@ -296,7 +297,7 @@ public class AnimationView extends View implements Handler.Callback {
|
||||
}
|
||||
|
||||
public static class AnimData {
|
||||
public Object filePath;
|
||||
public String filePath;
|
||||
}
|
||||
|
||||
public static class ProcessAnimThread {
|
||||
@@ -312,7 +313,7 @@ public class AnimationView extends View implements Handler.Callback {
|
||||
|
||||
public ProcessAnimThread(Context context, Handler handler) {
|
||||
mUiHandler = handler;
|
||||
mContext = new WeakReference<Context>(context);
|
||||
mContext = new WeakReference<>(context);
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -333,7 +334,7 @@ public class AnimationView extends View implements Handler.Callback {
|
||||
switch (msg.what) {
|
||||
case PROCESS_DATA: {
|
||||
AnimData animData = (AnimData) msg.obj;
|
||||
Bitmap bitmap = ImageUtil.getBitmap(mContext.get(), animData.filePath, mWidth, mHeight);
|
||||
Bitmap bitmap = ImageUtils.getBitmap(animData.filePath, mWidth, mHeight);
|
||||
if (bitmap != null) {
|
||||
Message finishMsg = Message.obtain();
|
||||
finishMsg.what = PROCESS_ANIM_FINISH;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.common.widget;
|
||||
package com.mogo.eagle.core.widget;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -23,7 +23,6 @@ import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
||||
import com.mogo.module.common.R;
|
||||
|
||||
@SuppressLint("AppCompatCustomView")
|
||||
public class CustomCircleImageView extends ImageView {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.v2x.view;
|
||||
package com.mogo.eagle.core.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
@@ -9,8 +9,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.customview.widget.ViewDragHelper;
|
||||
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -22,6 +21,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
* version: 1.0
|
||||
*/
|
||||
public class GestureTopCloseLayout extends ConstraintLayout {
|
||||
|
||||
private String TAG = "GestureTopCloseLayout";
|
||||
|
||||
private ViewDragHelper mViewDragHelper;
|
||||
|
||||
private ViewCloseListener mViewCloseListener;
|
||||
@@ -77,7 +79,7 @@ public class GestureTopCloseLayout extends ConstraintLayout {
|
||||
@Override
|
||||
public void onViewPositionChanged(@NonNull View changedView, int left, int top, int dx, int dy) {
|
||||
super.onViewPositionChanged(changedView, left, top, dx, dy);
|
||||
Logger.w(V2XConst.MODULE_NAME, "onViewPositionChanged==top=" + top +
|
||||
LogUtils.wTag(TAG, "onViewPositionChanged==top=" + top +
|
||||
" changedView.getHeight()==" + changedView.getHeight());
|
||||
if (top < 0) {
|
||||
mTop = top;
|
||||
@@ -94,7 +96,7 @@ public class GestureTopCloseLayout extends ConstraintLayout {
|
||||
//手指释放的时候回调
|
||||
@Override
|
||||
public void onViewReleased(View releasedChild, float xvel, float yvel) {
|
||||
Logger.w(V2XConst.MODULE_NAME, "onViewReleased==mTop=" + mTop + " getHeight=" + getHeight());
|
||||
LogUtils.wTag(TAG, "onViewReleased==mTop=" + mTop + " getHeight=" + getHeight());
|
||||
if (mTop < 0) {
|
||||
mViewDragHelper.settleCapturedViewAt(0, -getHeight());
|
||||
invalidate();
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.view;
|
||||
package com.mogo.eagle.core.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -8,8 +8,6 @@ import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.mogo.eagle.core.function.call.api.R;
|
||||
|
||||
|
||||
public class LiveRoundLayout extends RelativeLayout {
|
||||
private float roundLayoutRadius = 14f;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.v2x.view;
|
||||
package com.mogo.eagle.core.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -9,7 +9,6 @@ import android.util.AttributeSet;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.module.v2x.R;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.view;
|
||||
package com.mogo.eagle.core.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -10,8 +10,6 @@ import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.mogo.eagle.core.function.call.api.R;
|
||||
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.v2x.view;
|
||||
package com.mogo.eagle.core.widget;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
@@ -33,14 +33,12 @@ import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.MediaController.MediaPlayerControl;
|
||||
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
* Displays a video file. The VideoView class can load images from various
|
||||
@@ -50,15 +48,25 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
*/
|
||||
public class TextureVideoView extends TextureView implements MediaPlayerControl {
|
||||
private String TAG = "V2XModuleProvider";
|
||||
|
||||
public static final int STATE_ERROR = -1;
|
||||
public static final int STATE_IDLE = 0;
|
||||
public static final int STATE_PREPARING = 1;
|
||||
public static final int STATE_PREPARED = 2;
|
||||
public static final int STATE_PLAYING = 3;
|
||||
public static final int STATE_PAUSED = 4;
|
||||
public static final int STATE_PLAYBACK_COMPLETED = 5;
|
||||
public static final int STATE_SEEKING = 6;
|
||||
|
||||
// settable by the client
|
||||
private Uri mUri;
|
||||
private Map<String, String> mHeaders;
|
||||
private int mDuration;
|
||||
|
||||
// all possible internal states
|
||||
private int mCurrentState = V2XConst.STATE_IDLE;
|
||||
private int mCurrentState = STATE_IDLE;
|
||||
private int mTargetState = mCurrentState, mTagetStateBackup = mCurrentState;
|
||||
private int mPrepareState = V2XConst.STATE_PREPARED;
|
||||
private int mPrepareState = STATE_PREPARED;
|
||||
|
||||
// All the stuff we need for playing and showing a video
|
||||
private Surface mSurface = null;
|
||||
@@ -113,8 +121,8 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
setFocusable(true);
|
||||
setFocusableInTouchMode(true);
|
||||
requestFocus();
|
||||
mCurrentState = V2XConst.STATE_IDLE;
|
||||
mTargetState = V2XConst.STATE_IDLE;
|
||||
mCurrentState = STATE_IDLE;
|
||||
mTargetState = STATE_IDLE;
|
||||
}
|
||||
|
||||
public boolean requestAudioFocus() {
|
||||
@@ -131,9 +139,9 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
|
||||
public void setVideoURI(Uri uri, Map<String, String> headers) {
|
||||
if (uri == null) {
|
||||
Logger.i(MODULE_NAME, "setVideoURI--- uri = null");
|
||||
LogUtils.iTag(TAG, "setVideoURI--- uri = null");
|
||||
} else {
|
||||
Logger.i(MODULE_NAME, "setVideoURI--- uri = " + uri.getPath());
|
||||
LogUtils.iTag(TAG, "setVideoURI--- uri = " + uri.getPath());
|
||||
}
|
||||
mUri = uri;
|
||||
mHeaders = headers;
|
||||
@@ -149,21 +157,21 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
mMediaPlayer.stop();
|
||||
mMediaPlayer.release();
|
||||
mMediaPlayer = null;
|
||||
mTargetState = mCurrentState = V2XConst.STATE_IDLE;
|
||||
mTargetState = mCurrentState = STATE_IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void openVideo() {
|
||||
Logger.i(MODULE_NAME, "openVideo");
|
||||
LogUtils.iTag(TAG, "openVideo");
|
||||
if (mUri == null) {
|
||||
Logger.i(MODULE_NAME, "mUri == null ");
|
||||
LogUtils.iTag(TAG, "mUri == null ");
|
||||
}
|
||||
if (mSurface == null) {
|
||||
Logger.i(MODULE_NAME, "mSurface == null ");
|
||||
LogUtils.iTag(TAG, "mSurface == null ");
|
||||
}
|
||||
if (mUri == null || mSurface == null || isSuspendFromActivity) {
|
||||
Logger.i(MODULE_NAME, "isSuspendFromActivity = " + isSuspendFromActivity);
|
||||
LogUtils.iTag(TAG, "isSuspendFromActivity = " + isSuspendFromActivity);
|
||||
return;
|
||||
}
|
||||
release(false);
|
||||
@@ -192,7 +200,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
mMediaPlayer.setScreenOnWhilePlaying(true);
|
||||
mMediaPlayer.setVolume(0, 0);
|
||||
mMediaPlayer.prepare();
|
||||
mPrepareState = mCurrentState = V2XConst.STATE_PREPARING;
|
||||
mPrepareState = mCurrentState = STATE_PREPARING;
|
||||
} catch (IOException | SecurityException | IllegalStateException | IllegalArgumentException ex) {
|
||||
ex.printStackTrace();
|
||||
onError();
|
||||
@@ -200,7 +208,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
}
|
||||
|
||||
private void onError() {
|
||||
mTargetState = mCurrentState = V2XConst.STATE_ERROR;
|
||||
mTargetState = mCurrentState = STATE_ERROR;
|
||||
if (mErrorListener != null)
|
||||
mErrorListener.onError(mMediaPlayer,
|
||||
MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
|
||||
@@ -211,24 +219,24 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
mVideoWidth = mp.getVideoWidth();
|
||||
mVideoHeight = mp.getVideoHeight();
|
||||
if (mVideoWidth != 0 && mVideoHeight != 0) {
|
||||
Logger.d(MODULE_NAME, "OnVideoSizeChangedListener mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight);
|
||||
LogUtils.dTag(TAG, "OnVideoSizeChangedListener mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
MediaPlayer.OnPreparedListener mPreparedListener = new MediaPlayer.OnPreparedListener() {
|
||||
public void onPrepared(MediaPlayer mp) {
|
||||
Logger.i(MODULE_NAME, "MediaPlayer.OnPreparedListener");
|
||||
mPrepareState = mCurrentState = V2XConst.STATE_PREPARED;
|
||||
LogUtils.iTag(TAG, "MediaPlayer.OnPreparedListener");
|
||||
mPrepareState = mCurrentState = STATE_PREPARED;
|
||||
mVideoWidth = mp.getVideoWidth();
|
||||
mVideoHeight = mp.getVideoHeight();
|
||||
|
||||
int seekToPosition = mSeekWhenPrepared;
|
||||
// Logger.i(MODULE_NAME, "seekToPosition = " + seekToPosition);
|
||||
// LogUtils.iTag(TAG, "seekToPosition = " + seekToPosition);
|
||||
if (seekToPosition != 0) {
|
||||
seekTo(seekToPosition);
|
||||
}
|
||||
if (mTargetState == V2XConst.STATE_PLAYING) {
|
||||
if (mTargetState == STATE_PLAYING) {
|
||||
start();
|
||||
}
|
||||
if (mOnPreparedListener != null) {
|
||||
@@ -244,8 +252,8 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
|
||||
private OnCompletionListener mCompletionListener = new OnCompletionListener() {
|
||||
public void onCompletion(MediaPlayer mp) {
|
||||
Logger.i(MODULE_NAME, "MediaPlayer.OnCompletionListener");
|
||||
mTargetState = mCurrentState = V2XConst.STATE_PLAYBACK_COMPLETED;
|
||||
LogUtils.iTag(TAG, "MediaPlayer.OnCompletionListener");
|
||||
mTargetState = mCurrentState = STATE_PLAYBACK_COMPLETED;
|
||||
if (mOnCompletionListener != null) {
|
||||
mOnCompletionListener.onCompletion(mMediaPlayer);
|
||||
}
|
||||
@@ -253,19 +261,19 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
};
|
||||
|
||||
private OnSeekCompleteListener mSeekCompleteListener = mp -> {
|
||||
Logger.i(MODULE_NAME, "MediaPlayer.OnSeekCompleteListener");
|
||||
LogUtils.iTag(TAG, "MediaPlayer.OnSeekCompleteListener");
|
||||
try {
|
||||
mCurrentState = mMediaPlayer.isPlaying() ? V2XConst.STATE_PLAYING : V2XConst.STATE_PAUSED;
|
||||
mCurrentState = mMediaPlayer.isPlaying() ? STATE_PLAYING : STATE_PAUSED;
|
||||
} catch (Exception e) {
|
||||
mCurrentState = V2XConst.STATE_PLAYING;
|
||||
mCurrentState = STATE_PLAYING;
|
||||
e.printStackTrace();
|
||||
}
|
||||
};
|
||||
|
||||
private OnErrorListener mErrorListener = new OnErrorListener() {
|
||||
public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
|
||||
Logger.i(MODULE_NAME, "MediaPlayer.onError");
|
||||
mTargetState = mPrepareState = mCurrentState = V2XConst.STATE_ERROR;
|
||||
LogUtils.iTag(TAG, "MediaPlayer.onError");
|
||||
mTargetState = mPrepareState = mCurrentState = STATE_ERROR;
|
||||
if (mOnErrorListener != null) {
|
||||
mOnErrorListener.onError(mMediaPlayer, framework_err,
|
||||
impl_err);
|
||||
@@ -279,7 +287,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
|
||||
@Override
|
||||
public boolean onInfo(MediaPlayer mp, int what, int extra) {
|
||||
Logger.i(MODULE_NAME, "MediaPlayer.OnInfoListener---what = " + what + ";extra = " + extra);
|
||||
LogUtils.iTag(TAG, "MediaPlayer.OnInfoListener---what = " + what + ";extra = " + extra);
|
||||
int messageId = 0;
|
||||
if (what == MEDIA_INFO_VIDEO_NOT_SUPPORTED) {
|
||||
messageId = R.string.VideoView_info_text_video_not_supported;
|
||||
@@ -298,7 +306,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
|
||||
private MediaPlayer.OnBufferingUpdateListener mBufferingUpdateListener = new MediaPlayer.OnBufferingUpdateListener() {
|
||||
public void onBufferingUpdate(MediaPlayer mp, int percent) {
|
||||
Logger.i(MODULE_NAME, "MediaPlayer.OnBufferingUpdateListener");
|
||||
LogUtils.iTag(TAG, "MediaPlayer.OnBufferingUpdateListener");
|
||||
mCurrentBufferPercentage = percent;
|
||||
}
|
||||
};
|
||||
@@ -341,15 +349,15 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
SurfaceTextureListener mSurfaceTextureListener = new SurfaceTextureListener() {
|
||||
@Override
|
||||
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
|
||||
Logger.i(MODULE_NAME, "onSurfaceTextureAvailable");
|
||||
LogUtils.iTag(TAG, "onSurfaceTextureAvailable");
|
||||
mSurface = new Surface(surface);
|
||||
openVideo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
|
||||
Logger.d(MODULE_NAME, "onSurfaceTextureSizeChanged mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight);
|
||||
boolean isValidState = (mTargetState == V2XConst.STATE_PLAYING);
|
||||
LogUtils.dTag(TAG, "onSurfaceTextureSizeChanged mVideoWidth:" + " mVideoWidth:" + mVideoWidth + " mVideoHeight:" + mVideoHeight);
|
||||
boolean isValidState = (mTargetState == STATE_PLAYING);
|
||||
boolean hasValidSize = (mVideoWidth == width && mVideoHeight == height);
|
||||
if (mMediaPlayer != null && isValidState && hasValidSize) {
|
||||
if (mSeekWhenPrepared != 0) {
|
||||
@@ -366,7 +374,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
|
||||
@Override
|
||||
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
|
||||
Logger.i(MODULE_NAME, "onSurfaceTextureDestroyed");
|
||||
LogUtils.iTag(TAG, "onSurfaceTextureDestroyed");
|
||||
mSurface = null;
|
||||
release(false);
|
||||
return false;
|
||||
@@ -382,11 +390,11 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
* release the media player in any state
|
||||
*/
|
||||
private void release(boolean cleartargetstate) {
|
||||
Logger.i(MODULE_NAME, "release ---cleartargetstate=" + cleartargetstate);
|
||||
mCurrentState = V2XConst.STATE_IDLE;
|
||||
LogUtils.iTag(TAG, "release ---cleartargetstate=" + cleartargetstate);
|
||||
mCurrentState = STATE_IDLE;
|
||||
|
||||
if (cleartargetstate) {
|
||||
mTargetState = V2XConst.STATE_IDLE;
|
||||
mTargetState = STATE_IDLE;
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
@@ -429,40 +437,40 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
}
|
||||
|
||||
public boolean isPrepared() {
|
||||
return mPrepareState == V2XConst.STATE_PREPARED
|
||||
return mPrepareState == STATE_PREPARED
|
||||
|| isSuspendFromActivity;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
Logger.i(MODULE_NAME, "TextureVideoView---start");
|
||||
LogUtils.iTag(TAG, "TextureVideoView---start");
|
||||
if (isFocusLoss) {
|
||||
mTagetStateBackup = V2XConst.STATE_PLAYING;
|
||||
mTagetStateBackup = STATE_PLAYING;
|
||||
return;
|
||||
}
|
||||
//Logger.i(MODULE_NAME, "mCurrentState = " + mCurrentState);
|
||||
//LogUtils.iTag(TAG, "mCurrentState = " + mCurrentState);
|
||||
if (isInPlaybackState()) {
|
||||
Logger.i(MODULE_NAME, "MediaPlayer.start");
|
||||
LogUtils.iTag(TAG, "MediaPlayer.start");
|
||||
mMediaPlayer.start();
|
||||
mCurrentState = V2XConst.STATE_PLAYING;
|
||||
mCurrentState = STATE_PLAYING;
|
||||
}
|
||||
mTargetState = V2XConst.STATE_PLAYING;
|
||||
mTargetState = STATE_PLAYING;
|
||||
}
|
||||
|
||||
public void pause() {
|
||||
Logger.i(MODULE_NAME, "TextureVideoView---pause");
|
||||
Logger.i(MODULE_NAME, "mCurrentState = " + mCurrentState);
|
||||
LogUtils.iTag(TAG, "TextureVideoView---pause");
|
||||
LogUtils.iTag(TAG, "mCurrentState = " + mCurrentState);
|
||||
if (isInPlaybackState()) {
|
||||
if (mMediaPlayer.isPlaying()) {
|
||||
Logger.i(MODULE_NAME, " MediaPlayer.pause");
|
||||
LogUtils.iTag(TAG, " MediaPlayer.pause");
|
||||
mMediaPlayer.pause();
|
||||
mCurrentState = V2XConst.STATE_PAUSED;
|
||||
mCurrentState = STATE_PAUSED;
|
||||
}
|
||||
}
|
||||
mTagetStateBackup = mTargetState = V2XConst.STATE_PAUSED;
|
||||
mTagetStateBackup = mTargetState = STATE_PAUSED;
|
||||
}
|
||||
|
||||
public void suspend() {
|
||||
Logger.i(MODULE_NAME, "TextureVideoView---suspend");
|
||||
LogUtils.iTag(TAG, "TextureVideoView---suspend");
|
||||
if (!isSuspendFromActivity) {
|
||||
isSuspendFromActivity = true;
|
||||
if (mMediaPlayer != null) {
|
||||
@@ -475,20 +483,20 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
}
|
||||
|
||||
public void resume() {
|
||||
Logger.i(MODULE_NAME, "TextureVideoView---resume");
|
||||
LogUtils.iTag(TAG, "TextureVideoView---resume");
|
||||
isSuspendFromActivity = false;
|
||||
openVideo();
|
||||
seekTo(progressWhileSuspend);
|
||||
|
||||
if (mTagetStateBackup == V2XConst.STATE_IDLE)
|
||||
if (mTagetStateBackup == STATE_IDLE)
|
||||
mTagetStateBackup = mTargetState;
|
||||
Logger.i(MODULE_NAME, "isFocusLoss = " + isFocusLoss);
|
||||
Logger.i(MODULE_NAME, "isInPlaybackState() = " + isInPlaybackState());
|
||||
LogUtils.iTag(TAG, "isFocusLoss = " + isFocusLoss);
|
||||
LogUtils.iTag(TAG, "isInPlaybackState() = " + isInPlaybackState());
|
||||
if (isFocusLoss) {
|
||||
if (isInPlaybackState()) {
|
||||
if (mMediaPlayer.isPlaying()) {
|
||||
mMediaPlayer.pause();
|
||||
mCurrentState = V2XConst.STATE_PAUSED;
|
||||
mCurrentState = STATE_PAUSED;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -515,12 +523,12 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
}
|
||||
|
||||
public void seekTo(int msec) {
|
||||
Logger.i(MODULE_NAME, "TextureVideoView---seekTo---msec = " + msec);
|
||||
if (isInPlaybackState() && mCurrentState != V2XConst.STATE_SEEKING
|
||||
LogUtils.iTag(TAG, "TextureVideoView---seekTo---msec = " + msec);
|
||||
if (isInPlaybackState() && mCurrentState != STATE_SEEKING
|
||||
&& msec > 0 && msec < getDuration()) {
|
||||
mCurrentState = V2XConst.STATE_SEEKING;
|
||||
mCurrentState = STATE_SEEKING;
|
||||
|
||||
Logger.i(MODULE_NAME, "MediaPlayer.seekTo(msec) = " + msec);
|
||||
LogUtils.iTag(TAG, "MediaPlayer.seekTo(msec) = " + msec);
|
||||
mMediaPlayer.seekTo(msec);
|
||||
mSeekWhenPrepared = 0;
|
||||
} else {
|
||||
@@ -541,8 +549,8 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
}
|
||||
|
||||
private boolean isInPlaybackState() {
|
||||
return (mMediaPlayer != null && mCurrentState != V2XConst.STATE_ERROR
|
||||
&& mCurrentState != V2XConst.STATE_IDLE && mCurrentState != V2XConst.STATE_PREPARING);
|
||||
return (mMediaPlayer != null && mCurrentState != STATE_ERROR
|
||||
&& mCurrentState != STATE_IDLE && mCurrentState != STATE_PREPARING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -575,7 +583,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
}
|
||||
|
||||
public boolean isPause() {
|
||||
return mTargetState == V2XConst.STATE_PAUSED;
|
||||
return mTargetState == STATE_PAUSED;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -584,7 +592,7 @@ public class TextureVideoView extends TextureView implements MediaPlayerControl
|
||||
}
|
||||
|
||||
public int getCurrentState() {
|
||||
Logger.i(MODULE_NAME, "mCurrentState == " + mCurrentState);
|
||||
LogUtils.iTag(TAG, "mCurrentState == " + mCurrentState);
|
||||
return mCurrentState;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user