[2.13.0-merge]yakun and code style
@@ -1,11 +0,0 @@
|
||||
# 基础框架
|
||||
|
||||
## 基于 WindowManger.addView 方式实现的弹窗
|
||||
|
||||
## 大而全数据定义
|
||||
|
||||
## 地图中心点控制策略
|
||||
|
||||
## 自研车机类型判断
|
||||
|
||||
## 模块加载类
|
||||
@@ -16,7 +16,6 @@ android {
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
@@ -30,7 +29,6 @@ android {
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,10 +49,6 @@ android {
|
||||
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.androidxrecyclerview
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
@@ -89,4 +83,3 @@ dependencies {
|
||||
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#-----CommonModule-----
|
||||
-keep class com.mogo.module.common.machinevision.*{*;}
|
||||
-keep class com.mogo.module.common.constants.*{*;}
|
||||
-keep class com.mogo.module.common.drawer.marker.*{*;}
|
||||
-keep class com.mogo.module.common.entity.*{*;}
|
||||
-keep class com.mogo.module.common.view.*{*;}
|
||||
-keep class com.mogo.module.common.widget.*{*;}
|
||||
-keep class com.mogo.module.common.wm.* {*;}
|
||||
-keep class com.mogo.module.common.MogoModulePaths{*;}
|
||||
-keep class com.mogo.hook.*{*;}
|
||||
26
modules/mogo-module-common/proguard-rules.pro
vendored
@@ -1,26 +0,0 @@
|
||||
# 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
|
||||
|
||||
#-----CommonModule-----
|
||||
-keep class com.mogo.module.common.entity.** {*;}
|
||||
-keep class com.mogo.module.common.wm.** {*;}
|
||||
-keep class com.mogo.module.common.MogoModulePaths
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.module.common;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-13
|
||||
* <p>
|
||||
* 各个卡片模块类型
|
||||
*/
|
||||
public class ModuleNames {
|
||||
/**
|
||||
* 卡片 探路数据
|
||||
*/
|
||||
public static final String CARD_TYPE_ROAD_CONDITION = "CARD_TYPE_ROAD_CONDITION";
|
||||
|
||||
/**
|
||||
* 卡片 用户数据
|
||||
*/
|
||||
public static final String CARD_TYPE_USER_DATA = "CARD_TYPE_USER_DATA";
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.mogo.module.common;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-31
|
||||
* <p>
|
||||
* 模块描述信息
|
||||
*/
|
||||
public class MogoModule {
|
||||
|
||||
/**
|
||||
* 模块加载路径
|
||||
*/
|
||||
private String mPath;
|
||||
|
||||
/**
|
||||
* 模块名称
|
||||
*/
|
||||
private String mName;
|
||||
|
||||
/**
|
||||
* 广播接收者
|
||||
*/
|
||||
private String mBroadcastAction;
|
||||
|
||||
/**
|
||||
* @param path 模块加载路径
|
||||
* @param name 模块名称
|
||||
*/
|
||||
public MogoModule( String path, String name ) {
|
||||
this.mPath = path;
|
||||
this.mName = name;
|
||||
}
|
||||
|
||||
|
||||
public String getPath() {
|
||||
return mPath;
|
||||
}
|
||||
|
||||
public MogoModule setPath( String path ) {
|
||||
this.mPath = path;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
public MogoModule setName( String name ) {
|
||||
this.mName = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBroadcastAction() {
|
||||
return mBroadcastAction;
|
||||
}
|
||||
|
||||
public MogoModule setBroadcastAction( String broadcastAction ) {
|
||||
this.mBroadcastAction = broadcastAction;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.mogo.module.common;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 模块路由路径
|
||||
*/
|
||||
public class MogoModulePaths {
|
||||
|
||||
private static final List<MogoModule> mMogoModules = new ArrayList<>();
|
||||
|
||||
// 不需要启动APP也能运行的模块
|
||||
private static final List<MogoModule> mMogoBaseModules = new ArrayList<>();
|
||||
|
||||
private static final List<MogoModule> mModuleFunctions = new ArrayList<>();
|
||||
|
||||
private static final List<MogoModule> mModuleFunctionServers = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 添加卡片模块
|
||||
*
|
||||
* @param module
|
||||
*/
|
||||
public static void addModule(MogoModule module) {
|
||||
if (module == null || TextUtils.isEmpty(module.getPath().replace(" ", ""))) {
|
||||
throw new IllegalArgumentException("module path can't be empty or null or blank");
|
||||
}
|
||||
mMogoModules.add(module);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加模块功能
|
||||
*
|
||||
* @param module 功能模块
|
||||
*/
|
||||
public static void addModuleFunction(MogoModule module) {
|
||||
if (module == null || TextUtils.isEmpty(module.getPath().replace(" ", ""))) {
|
||||
throw new IllegalArgumentException("module path can't be empty or null or blank");
|
||||
}
|
||||
mModuleFunctions.add(module);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加 功能服务, 不带UI Fragment的
|
||||
*
|
||||
* @param module 功能模块
|
||||
*/
|
||||
public static void addModuleFunctionServer(MogoModule module) {
|
||||
if (module == null || TextUtils.isEmpty(module.getPath().replace(" ", ""))) {
|
||||
throw new IllegalArgumentException("module path can't be empty or null or blank");
|
||||
}
|
||||
mModuleFunctionServers.add(module);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加基础模块
|
||||
*
|
||||
* @param module
|
||||
*/
|
||||
public static void addBaseModule(MogoModule module) {
|
||||
if (module == null || TextUtils.isEmpty(module.getPath().replace(" ", ""))) {
|
||||
throw new IllegalArgumentException("module path can't be empty or null or blank");
|
||||
}
|
||||
mMogoBaseModules.add(module);
|
||||
}
|
||||
|
||||
public static List<MogoModule> getModules() {
|
||||
return mMogoModules;
|
||||
}
|
||||
|
||||
public static List<MogoModule> getBaseModules() {
|
||||
return mMogoBaseModules;
|
||||
}
|
||||
|
||||
public static List<MogoModule> getModuleFunctions() {
|
||||
return mModuleFunctions;
|
||||
}
|
||||
|
||||
public static List<MogoModule> getModuleFunctionServers() {
|
||||
return mModuleFunctionServers;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mogo.module.common.animation;
|
||||
|
||||
interface Animation {
|
||||
|
||||
void start();
|
||||
|
||||
void stop();
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.mogo.module.common.animation;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
public class AnimationManager implements Animation {
|
||||
|
||||
private static final String TAG = "V2XAnimationManager";
|
||||
private ProgressBar targetImageView;
|
||||
private boolean isStarted = false;
|
||||
|
||||
private int mStartIndex = 0;
|
||||
|
||||
private final static int MSG_LOOP = 3004;
|
||||
private long INTERVAL = 100L;
|
||||
|
||||
private Handler mHandler = new Handler(Looper.getMainLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case MSG_LOOP:
|
||||
if (isStarted) {
|
||||
// targetImageView.setImageResource( AnimationResources.loadingRes[mStartIndex++ % AnimationResources.loadingRes.length] );
|
||||
mHandler.sendEmptyMessageDelayed(MSG_LOOP, INTERVAL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void animationWithTarget(ProgressBar imageView, int[] resources, int duration) {
|
||||
targetImageView = imageView;
|
||||
INTERVAL = duration;
|
||||
start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void start() {
|
||||
isStarted = true;
|
||||
mHandler.sendEmptyMessage(MSG_LOOP);
|
||||
if (targetImageView != null) {
|
||||
targetImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void stop() {
|
||||
isStarted = false;
|
||||
mHandler.removeMessages(MSG_LOOP);
|
||||
if (targetImageView != null) {
|
||||
targetImageView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void soptWithError() {
|
||||
stop();
|
||||
if (targetImageView != null) {
|
||||
targetImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void release() {
|
||||
stop();
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.common.animation;
|
||||
|
||||
|
||||
import com.mogo.module.common.R;
|
||||
|
||||
public class AnimationResources {
|
||||
public static final int loadingRes[] = {
|
||||
// R.drawable.v_to_x_loading_car0000,
|
||||
// R.drawable.v_to_x_loading_car0002,
|
||||
// R.drawable.v_to_x_loading_car0004,
|
||||
// R.drawable.v_to_x_loading_car0006,
|
||||
// R.drawable.v_to_x_loading_car0008,
|
||||
// R.drawable.v_to_x_loading_car0010,
|
||||
// R.drawable.v_to_x_loading_car0012,
|
||||
// R.drawable.v_to_x_loading_car0014,
|
||||
// R.drawable.v_to_x_loading_car0016,
|
||||
// R.drawable.v_to_x_loading_car0018,
|
||||
// R.drawable.v_to_x_loading_car0020,
|
||||
// R.drawable.v_to_x_loading_car0022,
|
||||
// R.drawable.v_to_x_loading_car0024,
|
||||
// R.drawable.v_to_x_loading_car0025,
|
||||
// R.drawable.v_to_x_loading_car0027,
|
||||
// R.drawable.v_to_x_loading_car0029,
|
||||
// R.drawable.v_to_x_loading_car0031,
|
||||
// R.drawable.v_to_x_loading_car0033,
|
||||
// R.drawable.v_to_x_loading_car0035,
|
||||
// R.drawable.v_to_x_loading_car0037,
|
||||
// R.drawable.v_to_x_loading_car0039,
|
||||
// R.drawable.v_to_x_loading_car0041,
|
||||
// R.drawable.v_to_x_loading_car0043,
|
||||
// R.drawable.v_to_x_loading_car0045,
|
||||
// R.drawable.v_to_x_loading_car0047,
|
||||
// R.drawable.v_to_x_loading_car0048,
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.mogo.module.common.animation;
|
||||
|
||||
import android.animation.TypeEvaluator;
|
||||
import android.graphics.PointF;
|
||||
|
||||
/**
|
||||
* 贝塞尔曲线估值器:计算动画的执行轨迹
|
||||
*
|
||||
* @params 传入贝塞尔曲线需要的四个点
|
||||
* @return 通过计算返回贝塞尔曲线的坐标
|
||||
*/
|
||||
public class BezierEvaluator implements TypeEvaluator<PointF> {
|
||||
|
||||
private PointF point1;
|
||||
private PointF point2;
|
||||
|
||||
public BezierEvaluator(PointF point1, PointF point2) {
|
||||
this.point1 = point1;
|
||||
this.point2 = point2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointF evaluate(float t, PointF point0, PointF point3) {
|
||||
PointF point = new PointF();
|
||||
//t 取值为 [0,1]
|
||||
|
||||
/**
|
||||
* 三阶贝塞尔公式
|
||||
*
|
||||
* B(t)=(1 - t)^3 P0
|
||||
* + 3 t (1 - t)^2 P1
|
||||
* + 3 t^2 (1 - t) P2
|
||||
* + t^3 P3
|
||||
*/
|
||||
point.x = point0.x * (1 - t) * (1 - t) * (1 - t)
|
||||
+ 3 * point1.x * t * (1 - t) * (1 - t)
|
||||
+ 3 * point2.x * t * t * (1 - t)
|
||||
+ point3.x * t * t * t;
|
||||
|
||||
/**
|
||||
* 三阶贝塞尔公式
|
||||
*
|
||||
* B(t)=(1 - t)^3 P0
|
||||
* + 3 t (1 - t)^2 P1
|
||||
* + 3 t^2 (1 - t) P2
|
||||
* + t^3 P3
|
||||
*/
|
||||
point.y = point0.y * (1 - t) * (1 - t) * (1 - t)
|
||||
+ 3 * point1.y * t * (1 - t) * (1 - t)
|
||||
+ 3 * point2.y * t * t * (1 - t)
|
||||
+ point3.y * t * t * t;
|
||||
|
||||
return point;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.module.common.animation;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.graphics.PointF;
|
||||
import android.view.View;
|
||||
|
||||
public class BezierListener implements ValueAnimator.AnimatorUpdateListener {
|
||||
|
||||
private View target;
|
||||
|
||||
public BezierListener(View target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
//这里获取到贝塞尔曲线计算出来的的x y值 赋值给view 这样就能让爱心随着曲线走啦
|
||||
PointF pointF = (PointF) animation.getAnimatedValue();
|
||||
target.setX(pointF.x);
|
||||
target.setY(pointF.y);
|
||||
// 这里偷个懒,顺便做一个alpha动画,这样alpha渐变也完成啦
|
||||
target.setAlpha(1 - animation.getAnimatedFraction());
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.mogo.module.common.constants;
|
||||
|
||||
public enum AdasRecognizedType {
|
||||
//背景
|
||||
classIdBackground("background", 0),
|
||||
//人
|
||||
classIdPerson("person", 1),
|
||||
//自行车
|
||||
classIdBicycle("bicycle", 2),
|
||||
//小轿车
|
||||
classIdCar("car", 3),
|
||||
//摩托车
|
||||
classIdMoto("moto", 4),
|
||||
//红绿灯
|
||||
classIdTrafficSign("traffic_sign", 5),
|
||||
//bus
|
||||
classIdTrafficBus("traffic_bus", 6),
|
||||
//truck
|
||||
classIdTrafficTruck("traffic_truck", 8),
|
||||
//stopLine
|
||||
classIdStopLine("warning_stop_line", 9),
|
||||
//预警箭头
|
||||
classIdWarningArrows("warning_arrows", 10),
|
||||
|
||||
//未知物体
|
||||
classIdUnKnow("unKnow", 100);
|
||||
|
||||
AdasRecognizedType(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
private String res = "";
|
||||
private int code = -1;
|
||||
|
||||
AdasRecognizedType(String res, int code) {
|
||||
this.res = res;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public static AdasRecognizedType[] VAL = {
|
||||
classIdBackground,//0
|
||||
classIdPerson,
|
||||
classIdBicycle,
|
||||
classIdCar,
|
||||
classIdMoto,
|
||||
classIdTrafficSign,
|
||||
classIdTrafficBus,
|
||||
null,
|
||||
classIdTrafficTruck,
|
||||
classIdStopLine,
|
||||
classIdWarningArrows,
|
||||
classIdUnKnow,
|
||||
};
|
||||
|
||||
public String getRes() {
|
||||
return res;
|
||||
}
|
||||
|
||||
public static AdasRecognizedType valueFrom(int code) {
|
||||
if (code == 100) {
|
||||
return classIdUnKnow;
|
||||
}
|
||||
if (code >= 0 && code < VAL.length) {
|
||||
return VAL[code];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.mogo.module.common.constants;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/28
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class DataTypes {
|
||||
|
||||
/**
|
||||
* 识别感知和云端感知数据,全部标记为Marker融合数据
|
||||
*/
|
||||
public static final String TYPE_MARKER_MERGE = "TYPE_MARKER_MERGE";
|
||||
|
||||
/**
|
||||
* adas识别数据,Mock用
|
||||
*/
|
||||
public static final String TYPE_MARKER_ADAS = "TYPE_MARKER_ADAS";
|
||||
|
||||
/**
|
||||
* 云端下发数据,Mock用
|
||||
*/
|
||||
public static final String TYPE_MARKER_CLOUD_DATA = "TYPE_MARKER_CLOUD_DATA";
|
||||
|
||||
/**
|
||||
* 云端下发识别目标物警告数据
|
||||
*/
|
||||
public static final String TYPE_MARKER_CLOUD_WARN_DATA = "TYPE_MARKER_CLOUD_WARN_DATA";
|
||||
|
||||
/**
|
||||
* 云端下发停止线数据
|
||||
*/
|
||||
public static final String TYPE_MARKER_CLOUD_STOP_LINE_DATA = "TYPE_MARKER_CLOUD_STOP_LINE_DATA";
|
||||
|
||||
/**
|
||||
* Push 事件场景 VR
|
||||
*/
|
||||
public static final String TYPE_MARKER_PUSH_DATA = "TYPE_MARKER_PUSH_DATA";
|
||||
|
||||
/**
|
||||
*OBU 识别的交通元素
|
||||
*/
|
||||
public static final String TYPE_MARKER_OBU_DATA = "TYPE_MARKER_OBU_DATA";
|
||||
|
||||
/**
|
||||
* 道路事件预警 水滴状道路事件类型替换为3D模型
|
||||
*/
|
||||
public static final String TYPE_MARKER_ROAD_WARNING_TYPE = "TYPE_MARKER_ROAD_WARNING_TYPE";
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mogo.module.common.constants;
|
||||
|
||||
/**
|
||||
* 通用接口请求host
|
||||
*
|
||||
* @author tong
|
||||
*/
|
||||
public class HostConst {
|
||||
public static final String DEVA_HOST = "http://dzt-deva.zhidaozhixing.com";
|
||||
public static final String LAUNCHER_SNAPSHOT_HOST = "http://dzt-launcherSnapshot.zhidaozhixing.com";
|
||||
public static final String DATA_SERVICE_HOST = "http://dzt-dataService.zhidaozhixing.com";
|
||||
public static final String REALTIME_LOCATION_HOST = "http://dzt-realtimeLocation.zhidaozhixing.com";
|
||||
public static final String GEOFENCE_HOST = "http://dzt-geoFenceCarService.zhidaozhixing.com";
|
||||
public static final String CARLIFE_HOST = "http://dzt-carlife.zhidaozhixing.com";
|
||||
public static final String STRATEGY_PUSH_HOST = "http://dzt-strategyPush.zhidaozhixing.com";
|
||||
public static final String CAMERA_STREAM_HOST = "http://dzt-smartTransportationAiCloud.zhidaozhixing.com";
|
||||
public static final String OPEN_CAMERA_STREAM_HOST = "http://10.0.16.6:18080";
|
||||
|
||||
public static final String CITY_HOST = "http://dzt-city.zhidaozhixing.com";
|
||||
public static final String SOCKET_CENTER_DOMAIN = "socketRegion";
|
||||
|
||||
// public static final String UPGRADE_APP_HOST_TEST = "http://10.0.200.12:32423?/";
|
||||
public static final String UPGRADE_APP_HOST = "http://eagle-mis.zhidaozhixing.com/";
|
||||
|
||||
public static final String CMDB_HOST = "http://eagle-mis.zhidaozhixing.com/eagleEye-mis/cmdbapi/";
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mogo.module.common.constants;
|
||||
|
||||
/**
|
||||
* 数据库常量
|
||||
*/
|
||||
public class RoomConstants {
|
||||
public static final String DB_NAME_V2X = "MoGoScenario.db";
|
||||
public static final String TB_NAME_SCENARIO = "tb_travel_scenario";
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.mogo.module.common.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.module.common.R;
|
||||
|
||||
/**
|
||||
* 浮在各种wm上面的dialog基类,调用了window.setType
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BaseFloatDialog extends Dialog {
|
||||
|
||||
private static final String TAG = "BaseFloatDialog";
|
||||
|
||||
public BaseFloatDialog(@NonNull Context context) {
|
||||
this(context, R.style.BaseFloatDialogStyle);
|
||||
}
|
||||
|
||||
public BaseFloatDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD) {
|
||||
addFlag();
|
||||
}
|
||||
}
|
||||
|
||||
private void addFlag() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
|
||||
} else {
|
||||
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
||||
}
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
|
||||
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
CallerLogger.INSTANCE.d(TAG, "onShow====");
|
||||
super.show();
|
||||
setWindowSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
CallerLogger.INSTANCE.d( TAG, "onDismiss====");
|
||||
super.dismiss();
|
||||
}
|
||||
private void setWindowSize(){
|
||||
WindowManager.LayoutParams attributes = getWindow().getAttributes();
|
||||
attributes.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
attributes.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
FrameLayout content = (FrameLayout)findViewById(android.R.id.content);
|
||||
if(content!=null){
|
||||
ViewGroup rootView = (ViewGroup) content.getChildAt(0);
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) rootView.getLayoutParams();
|
||||
layoutParams.gravity = Gravity.CENTER;
|
||||
rootView.setLayoutParams(layoutParams);
|
||||
}
|
||||
getWindow().setAttributes(attributes);
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
package com.mogo.module.common.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-24
|
||||
* <p>
|
||||
* 显示在最上层的对话框
|
||||
*/
|
||||
public class WMDialog implements DialogInterface {
|
||||
|
||||
private WMDialogParams mParams;
|
||||
private WindowManagerView mWindowManagerView;
|
||||
|
||||
private WMDialog( WMDialogParams params ) {
|
||||
this.mParams = params;
|
||||
mWindowManagerView = new WindowManagerView.Builder( mParams.mContext ).contentView( R.layout.module_commons_layout_wm_dialog ).build();
|
||||
initViews();
|
||||
}
|
||||
|
||||
public void show() {
|
||||
mWindowManagerView.show();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
TextView ok = mWindowManagerView.findViewById( R.id.module_commons_wm_dialog_button_ok );
|
||||
TextView cancel = mWindowManagerView.findViewById( R.id.module_commons_wm_dialog_button_cancel );
|
||||
TextView content = mWindowManagerView.findViewById( R.id.module_commons_wm_dialog_content );
|
||||
|
||||
ok.setText( mParams.mOkButtonText );
|
||||
if ( mParams.mOnOkButtonClickListener != null ) {
|
||||
ok.setOnClickListener( view -> {
|
||||
if ( mParams.mOnOkButtonClickListener != null ) {
|
||||
mParams.mOnOkButtonClickListener.onClick( WMDialog.this, DialogInterface.BUTTON_POSITIVE );
|
||||
}
|
||||
} );
|
||||
}
|
||||
cancel.setText( mParams.mCancelButtonText );
|
||||
if ( mParams.mOnCancelButtonClickListener != null ) {
|
||||
cancel.setOnClickListener( view -> {
|
||||
if ( mParams.mOnCancelButtonClickListener != null ) {
|
||||
mParams.mOnCancelButtonClickListener.onClick( WMDialog.this, DialogInterface.BUTTON_NEGATIVE );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
content.setText( mParams.mContent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
mWindowManagerView.dismiss();
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
return mWindowManagerView.isShowing();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private Context mContext;
|
||||
private WMDialogParams mParams;
|
||||
|
||||
public Builder( Activity activity ) {
|
||||
this.mContext = activity;
|
||||
mParams = new WMDialogParams();
|
||||
mParams.mContext = activity;
|
||||
}
|
||||
|
||||
public Builder setContent( CharSequence content ) {
|
||||
mParams.mContent = content;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setContent( @StringRes int content ) {
|
||||
mParams.mContent = mContext.getString( content );
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setOkButton( CharSequence buttonText, OnClickListener listener ) {
|
||||
mParams.mOkButtonText = buttonText;
|
||||
mParams.mOnOkButtonClickListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setOkButton( @StringRes int buttonText, OnClickListener listener ) {
|
||||
mParams.mOkButtonText = mContext.getText( buttonText );
|
||||
mParams.mOnOkButtonClickListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCancelButton( CharSequence buttonText, OnClickListener listener ) {
|
||||
mParams.mCancelButtonText = buttonText;
|
||||
mParams.mOnCancelButtonClickListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCancelButton( @StringRes int buttonText, OnClickListener listener ) {
|
||||
mParams.mCancelButtonText = mContext.getText( buttonText );
|
||||
mParams.mOnCancelButtonClickListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setOnDialogDismissListener( OnDismissListener onDialogDismissListener ) {
|
||||
mParams.mOnDialogDismissListener = onDialogDismissListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WMDialog build() {
|
||||
WMDialog dialog = new WMDialog( mParams );
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
|
||||
public static class WMDialogParams {
|
||||
|
||||
// public CharSequence mTitle;
|
||||
public CharSequence mOkButtonText;
|
||||
public CharSequence mCancelButtonText;
|
||||
public CharSequence mContent;
|
||||
public OnClickListener mOnOkButtonClickListener;
|
||||
public OnClickListener mOnCancelButtonClickListener;
|
||||
public OnDismissListener mOnDialogDismissListener;
|
||||
public Context mContext;
|
||||
}
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/30
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class BaseDrawer {
|
||||
|
||||
/**
|
||||
* 移除过期的 marker
|
||||
*/
|
||||
public static final int MSG_REMOVE_DIRTY_MARKERS = 9990;
|
||||
|
||||
/**
|
||||
* 地图内部资源md5缓存,便于资源复用
|
||||
*/
|
||||
protected static final ConcurrentHashMap<String, String> mMarkerCachesResMd5Values = new ConcurrentHashMap<>();
|
||||
|
||||
protected final Context mContext;
|
||||
|
||||
public BaseDrawer() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除无效[为 null 或者 已被销毁]的 marker
|
||||
*/
|
||||
protected void removeUselessMarker(Map<String, IMogoMarker> mMarkersCaches) {
|
||||
if (mMarkersCaches == null || mMarkersCaches.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Iterator<IMogoMarker> iterator = mMarkersCaches.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMarker marker = iterator.next();
|
||||
if (marker != null) {
|
||||
iterator.remove();
|
||||
marker.remove();
|
||||
marker.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
* @param msg 消息类型
|
||||
* @param data 数据体
|
||||
*/
|
||||
public void sendMessage(int msg, Object data) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是绘制内容
|
||||
*
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return render
|
||||
*/
|
||||
public boolean nonRenderType(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
return recognizedType != AdasRecognizedType.classIdCar
|
||||
&& recognizedType != AdasRecognizedType.classIdMoto
|
||||
&& recognizedType != AdasRecognizedType.classIdBicycle
|
||||
&& recognizedType != AdasRecognizedType.classIdPerson
|
||||
&& recognizedType != AdasRecognizedType.classIdTrafficBus
|
||||
&& recognizedType != AdasRecognizedType.classIdTrafficTruck
|
||||
&& recognizedType != AdasRecognizedType.classIdUnKnow;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取3D锚点模型资源
|
||||
*
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return modelRes
|
||||
*/
|
||||
public int getModelRes(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
if (recognizedType == AdasRecognizedType.classIdCar) {
|
||||
return R.raw.traffic_tachexiaoche;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
|
||||
return R.raw.traffic_daba;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdMoto) {
|
||||
return R.raw.traffic_motuoche;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdStopLine) {
|
||||
return R.raw.stopline;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
|
||||
return R.raw.jiantou;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) {
|
||||
return R.raw.special_vehicle;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdBicycle) {
|
||||
return R.raw.traffic_zixingche;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficTruck) {
|
||||
return R.raw.traffic_daba;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdPerson) {
|
||||
return R.raw.traffic_people;
|
||||
}
|
||||
return R.raw.special_vehicle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据数据源判断车辆预警颜色
|
||||
*
|
||||
* @param type 车辆类型
|
||||
* @param fromType 数据来源
|
||||
* @param drawLevel 危险等级
|
||||
* @return 实际车辆颜色
|
||||
*/
|
||||
protected String getModelRenderColor(int type, int fromType, int drawLevel) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
if (recognizedType == AdasRecognizedType.classIdUnKnow) {
|
||||
return Car3DModelColor.Normal.color;
|
||||
}
|
||||
if (fromType == FROM_ADAS) {
|
||||
switch (drawLevel) {
|
||||
case 0:
|
||||
case 1:
|
||||
return Car3DModelColor.Normal.color;
|
||||
case 2:
|
||||
return Car3DModelColor.Warming.color;
|
||||
case 3:
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
default:
|
||||
return Car3DModelColor.Error.color;
|
||||
}
|
||||
}
|
||||
return Car3DModelColor.Normal.color;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前自车经纬度
|
||||
*
|
||||
* @return 0:lon 1:lat
|
||||
*/
|
||||
protected double[] getCurCoordinates() {
|
||||
return new double[]{
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon(),
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat()
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型颜色
|
||||
*/
|
||||
public enum Car3DModelColor {
|
||||
Normal("#D8D8D8FF"),
|
||||
Warming("#FFD53EFF"),
|
||||
Dangerous("#FF3C45FF"),
|
||||
Error("#7fb80e");
|
||||
private final String color;
|
||||
|
||||
Car3DModelColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除markers
|
||||
*
|
||||
* @param dirtyMarkers 缓存marker数据
|
||||
*/
|
||||
protected static void removeDirtyMarkers(Map<String, IMogoMarker> dirtyMarkers) {
|
||||
if (dirtyMarkers == null || dirtyMarkers.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final Collection<IMogoMarker> dirSet = dirtyMarkers.values();
|
||||
for (IMogoMarker value : dirSet) {
|
||||
if (value == null || value.isDestroyed()) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
value.destroy();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
dirtyMarkers.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存绘制 marker 的 id 和 marker 资源缓存的 md5 的关系
|
||||
*
|
||||
* @param id 缓存资源ID
|
||||
* @param marker {@link IMogoMarker}
|
||||
*/
|
||||
protected static void cacheMarkerIconResMd5Val(String id, IMogoMarker marker) {
|
||||
if (marker == null || marker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
String md5 = marker.getMarkerResName();
|
||||
if (TextUtils.isEmpty(md5) || TextUtils.isEmpty(id)) {
|
||||
return;
|
||||
}
|
||||
mMarkerCachesResMd5Values.put(id, md5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用系统时间或卫星时间计算出动画的运动时间,最小值45,防止两个点距离过近设置的最小动画执行时间
|
||||
*
|
||||
* @param lastSatelliteTime 上一个点SNTP时间,精确值
|
||||
* @param curSatelliteTime 当前点SNTP时间,精确值
|
||||
* @return 动画运动时间
|
||||
*/
|
||||
public long computeAnimDuration(long lastSatelliteTime, long curSatelliteTime) {
|
||||
if (lastSatelliteTime == 0 || curSatelliteTime == 0) {
|
||||
return 45;
|
||||
}
|
||||
long interval = curSatelliteTime - lastSatelliteTime;
|
||||
if (interval < 45) {
|
||||
interval = 45;
|
||||
}
|
||||
return interval;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.marker.EmptyMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.IMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
|
||||
import com.mogo.module.common.drawer.marker.OnlineCarMarkerView;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerShareMusic;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/28
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MarkerDrawer {
|
||||
|
||||
public static final int MARKER_Z_INDEX_HIGH = 100;
|
||||
public static final int MARKER_Z_INDEX_LOW = 2;
|
||||
|
||||
private static volatile MarkerDrawer sInstance;
|
||||
|
||||
private MarkerDrawer() {
|
||||
}
|
||||
|
||||
public static MarkerDrawer getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (MarkerDrawer.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MarkerDrawer();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, int zIndex, IMogoMarkerClickListener listener) {
|
||||
return drawMapMarkerImpl(markerShowEntity, false, zIndex, 0, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* add marker, { 如果是需要在3D模式下显示,则需要设置 {@link MogoMarkerOptions icon3DRes 资源id}}
|
||||
*
|
||||
* @param markerShowEntity marker展示数据结构体
|
||||
* @param matchRoadSide 设置是否道路吸附,暂时没用到这个字段
|
||||
* @param zIndex zOrder
|
||||
* @param icon3DRes 3D Res资源
|
||||
* @param listener marker回调
|
||||
* @return {@link IMogoMarker}
|
||||
*/
|
||||
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, int icon3DRes, IMogoMarkerClickListener listener) {
|
||||
if (markerShowEntity == null || markerShowEntity.getMarkerLocation() == null) {
|
||||
return null;
|
||||
}
|
||||
MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes(icon3DRes).set3DMode(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()).matchOnRoadSide(matchRoadSide).owner(markerShowEntity.getMarkerType()).zIndex(zIndex).data(markerShowEntity).latitude(markerShowEntity.getMarkerLocation().getLat()).longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) {
|
||||
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
|
||||
options.icon3DRes(EventTypeEnum.getMarker3DRes(poiType));
|
||||
}
|
||||
|
||||
}
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(AbsMogoApplication.getApp(), markerShowEntity, options);
|
||||
if (markerView instanceof OnlineCarMarkerView) {
|
||||
try {
|
||||
options.icon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
|
||||
} catch (Exception e) {
|
||||
options.icon(markerView.getBitmap(0));
|
||||
}
|
||||
options.anchor(0.5f, 0.5f);
|
||||
} else {
|
||||
options.icon(markerView.getView());
|
||||
}
|
||||
|
||||
if (options.getIcon3DRes() != 0) {
|
||||
options.icon(new EmptyMarkerView(AbsMogoApplication.getApp()));
|
||||
options.icon(markerView.getBitmap(0));
|
||||
}
|
||||
|
||||
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
if (marker != null) {
|
||||
marker.setOwner(markerShowEntity.getMarkerType());
|
||||
markerView.setMarker(marker);
|
||||
marker.setOnMarkerClickListener(listener);
|
||||
markerShowEntity.setMarker(marker);
|
||||
}
|
||||
return marker;
|
||||
}
|
||||
|
||||
private boolean isNewVehicleType(Object object, IMogoMarker marker) {
|
||||
if (object instanceof MarkerOnlineCar
|
||||
&& marker != null
|
||||
&& marker.getObject() instanceof MarkerShowEntity
|
||||
&& ((MarkerShowEntity) marker.getObject()).getBindObj() instanceof MarkerOnlineCar) {
|
||||
try {
|
||||
return ((MarkerOnlineCar) object).getCarInfo().getVehicleType()
|
||||
!= ((MarkerOnlineCar) ((MarkerShowEntity) marker.getObject()).getBindObj()).getCarInfo().getVehicleType();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getPrimaryKeyFromEntity(Object entity) {
|
||||
if (entity instanceof MarkerExploreWay) {
|
||||
String id = ((MarkerExploreWay) entity).getInfoId();
|
||||
if (!TextUtils.isEmpty(id)) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
return getCarSnFromEntity(entity);
|
||||
}
|
||||
|
||||
private String getPrimaryKeyFromMarker(IMogoMarker marker) {
|
||||
if (marker == null || marker.getObject() == null || marker.isDestroyed()) {
|
||||
return null;
|
||||
}
|
||||
if (!(marker.getObject() instanceof MarkerShowEntity)) {
|
||||
return null;
|
||||
}
|
||||
return getPrimaryKeyFromEntity(((MarkerShowEntity) marker.getObject()).getBindObj());
|
||||
}
|
||||
|
||||
private String getCarSnFromEntity(Object entity) {
|
||||
try {
|
||||
if (entity instanceof MarkerOnlineCar) {
|
||||
return ((MarkerOnlineCar) entity).getUserInfo().getSn();
|
||||
} else if (entity instanceof MarkerShareMusic) {
|
||||
return ((MarkerShareMusic) entity).getUserInfo().getSn();
|
||||
} else if (entity instanceof MarkerNoveltyInfo) {
|
||||
return ((MarkerNoveltyInfo) entity).getSn();
|
||||
} else if (entity instanceof MarkerExploreWay) {
|
||||
return ((MarkerExploreWay) entity).getUserInfo().getSn();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 距离半径计算方式
|
||||
*
|
||||
* @param point1 点一坐标
|
||||
* @param point2 点二坐标
|
||||
* @return 两坐标的距离 单位:米(M)
|
||||
*/
|
||||
public static float calculateLineDistance(MogoLatLng point1, MogoLatLng point2) {
|
||||
if (point1 != null && point2 != null) {
|
||||
return calculateLineDistance(point1.lon, point1.lat, point2.lon, point2.lat);
|
||||
} else {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lon1
|
||||
* @param lat1
|
||||
* @param lon2
|
||||
* @param lat2
|
||||
* @return 两坐标的距离 单位:米(M)
|
||||
*/
|
||||
public static float calculateLineDistance(double lon1, double lat1, double lon2, double lat2) {
|
||||
return CoordinateUtils.calculateLineDistance(lon1, lat1, lon2, lat2);
|
||||
}
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
package com.mogo.module.common.drawer
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import android.text.TextUtils
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.data.traffic.threatLevelColor
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
|
||||
import com.mogo.map.MogoMarkerManager
|
||||
import com.mogo.map.marker.IMogoMarker
|
||||
import com.mogo.map.marker.MogoMarkerOptions
|
||||
import com.mogo.module.common.constants.DataTypes
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
* 此类用于obu/v2x预警绘制交通元素 2D\3D绘制
|
||||
* obu:与其进行调试单独展示,与debugview上感知开关相关联
|
||||
* v2x:绘制云端预警marker,不会做感知控制管理,后续根据注解的方式来控制v2x业务
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object TrafficMarkerDrawer {
|
||||
|
||||
private const val TAG = "TrafficMarkerDrawer"
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
// 动画持续时间
|
||||
private const val stepTime = 150L
|
||||
|
||||
// 维护Obu识别的他车集合
|
||||
private val mTrafficMap = ConcurrentHashMap<String, TrafficData>()
|
||||
|
||||
// 地图内部资源md5缓存,便于资源复用
|
||||
private val mMarkerCachesResMd5Values = ConcurrentHashMap<String, String>()
|
||||
|
||||
// 上一帧数据的缓存,用来做移动动画
|
||||
private val mMarkersCaches = ConcurrentHashMap<String, IMogoMarker>()
|
||||
|
||||
// 维护一个线程定时轮询数据进行地图绘制
|
||||
private val mDrawerHandler: Handler =
|
||||
object : Handler(WorkThreadHandler.newInstance("other_traffic_drawer").looper) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
if (FunctionBuildConfig.debugTrackerProvider == 1) {
|
||||
drawerTrafficInfo()
|
||||
}
|
||||
// 延时50毫秒重复发送自己,定时轮询进行车辆绘制,可以及时将已经不存在车辆删除
|
||||
sendEmptyMessageDelayed(0, 50L)
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
mContext = AbsMogoApplication.getApp()
|
||||
mDrawerHandler.sendEmptyMessageDelayed(1, 0L)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新识别数据,V2V预警的时候需要修改车辆颜色
|
||||
*/
|
||||
fun updateITrafficInfo(trafficData: TrafficData) {
|
||||
if (trafficData.uuid != null) {
|
||||
mTrafficMap[trafficData.uuid!!] = trafficData
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新识别数据位置
|
||||
*/
|
||||
fun updateITrafficLocationInfo(trafficData: TrafficData) {
|
||||
if (FunctionBuildConfig.debugTrackerProvider != 1) {
|
||||
return
|
||||
}
|
||||
val tempTraffic = mTrafficMap[trafficData.uuid]
|
||||
if (tempTraffic != null) {
|
||||
tempTraffic.lat = trafficData.lat
|
||||
tempTraffic.lon = trafficData.lon
|
||||
tempTraffic.heading = trafficData.heading
|
||||
if (trafficData.uuid != null) {
|
||||
mTrafficMap[trafficData.uuid!!] = tempTraffic
|
||||
}
|
||||
} else {
|
||||
if (trafficData.uuid != null) {
|
||||
mTrafficMap[trafficData.uuid!!] = trafficData
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新识别数据颜色
|
||||
*/
|
||||
fun updateITrafficThreatLevelInfo(trafficData: TrafficData) {
|
||||
if (FunctionBuildConfig.debugTrackerProvider != 1) {
|
||||
return
|
||||
}
|
||||
if (trafficData != null && !TextUtils.isEmpty(trafficData.uuid)) {
|
||||
val tempTraffic = mTrafficMap[trafficData.uuid]
|
||||
if (tempTraffic != null) {
|
||||
tempTraffic.lat = trafficData.lat
|
||||
tempTraffic.lon = trafficData.lon
|
||||
tempTraffic.heading = trafficData.heading
|
||||
tempTraffic.threatLevel = trafficData.threatLevel
|
||||
if (trafficData.uuid != null) {
|
||||
mTrafficMap[trafficData.uuid!!] = tempTraffic
|
||||
}
|
||||
} else {
|
||||
if (trafficData.uuid != null) {
|
||||
mTrafficMap[trafficData.uuid!!] = trafficData
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除识别的数据
|
||||
*/
|
||||
fun removeCvxRvInfoIndInfo(key: String) {
|
||||
if (mTrafficMap.containsKey(key)) {
|
||||
mTrafficMap.remove(key)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制
|
||||
*/
|
||||
private fun drawerTrafficInfo() {
|
||||
// 数据为空的时候清除所有数据
|
||||
if (mTrafficMap.isEmpty()) {
|
||||
mMarkersCaches.forEach {
|
||||
it.value.remove()
|
||||
}
|
||||
mMarkersCaches.clear()
|
||||
} else {
|
||||
// 循环绘制识别的数据
|
||||
mTrafficMap.forEach {
|
||||
|
||||
// 如果数据已经存在 Marker,取出做动画
|
||||
if (mMarkersCaches[it.key] != null) {
|
||||
mMarkersCaches[it.key]?.let { marker ->
|
||||
changeDynamicMarker(marker, it.value)
|
||||
}
|
||||
}
|
||||
// 不存在的添加Marker绘制
|
||||
else {
|
||||
drawObuRecognizedDataMarker(it.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绘制单条
|
||||
*/
|
||||
private fun drawObuRecognizedDataMarker(trafficData: TrafficData) {
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
|
||||
)
|
||||
if (trafficData.type != null) {
|
||||
val resId: Int = trafficData.type.traffic3DIconId
|
||||
|
||||
val resIdVal = resId.toString() + ""
|
||||
|
||||
val options = MogoMarkerOptions()
|
||||
.owner(DataTypes.TYPE_MARKER_ADAS)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.set3DMode(true)
|
||||
.gps(true)
|
||||
.controlAngle(true)
|
||||
.resName(mMarkerCachesResMd5Values[resIdVal])
|
||||
.icon3DRes(resId)
|
||||
.rotate(trafficData.heading.toFloat())
|
||||
.position(
|
||||
com.mogo.eagle.core.data.map.MogoLatLng(
|
||||
trafficData.lat,
|
||||
trafficData.lon
|
||||
)
|
||||
)
|
||||
|
||||
if (trafficData.type != TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE) {
|
||||
// 修改颜色
|
||||
mMarkersCaches[trafficData.uuid]?.setAnchorColor(trafficData.threatLevelColor())
|
||||
}
|
||||
val marker = MogoMarkerManager.getInstance(mContext)
|
||||
.addMarker(DataTypes.TYPE_MARKER_OBU_DATA, options)
|
||||
|
||||
// 缓存3D资源
|
||||
mMarkerCachesResMd5Values[resIdVal] = marker.markerResName
|
||||
// 缓存数据
|
||||
if (trafficData.uuid != null) {
|
||||
mMarkersCaches[trafficData.uuid!!] = marker
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 带动画的修改Marker
|
||||
*/
|
||||
private fun changeDynamicMarker(
|
||||
marker: IMogoMarker,
|
||||
trafficData: TrafficData
|
||||
) {
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
|
||||
)
|
||||
if (trafficData.type != TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE) {
|
||||
mMarkersCaches[trafficData.uuid]?.setAnchorColor(trafficData.threatLevelColor())
|
||||
}
|
||||
|
||||
try {
|
||||
marker.addDynamicAnchorPosition(
|
||||
com.mogo.eagle.core.data.map.MogoLatLng(
|
||||
trafficData.lat,
|
||||
trafficData.lon
|
||||
),
|
||||
trafficData.heading.toFloat(),
|
||||
stepTime
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
try {
|
||||
drawObuRecognizedDataMarker(trafficData)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.eagle.core.utilcode.util.ViewUtils;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.marker.IMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
|
||||
/**
|
||||
* 云端 预警数据绘制
|
||||
*/
|
||||
public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedListener {
|
||||
|
||||
private static final String TAG = "V2XWarnDataDrawer";
|
||||
private static volatile V2XWarnDataDrawer sInstance;
|
||||
|
||||
private V2XWarnDataDrawer() {
|
||||
super();
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getStatusManagerApi()
|
||||
.registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
|
||||
}
|
||||
|
||||
public static V2XWarnDataDrawer getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (V2XWarnDataDrawer.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new V2XWarnDataDrawer();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
CallerLogger.INSTANCE.d(TAG, descriptor + " , "+ isTrue);
|
||||
}
|
||||
|
||||
public boolean isVrMode() {
|
||||
return mIsVrMode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 识别物移动
|
||||
*
|
||||
*/
|
||||
public void renderWarnData(double lon, double lat, int type, double collisionlat, double collisionLon, double angle, long showTime) {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(lat);
|
||||
location.setLon(lon);
|
||||
location.setAngle(angle);
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||
IMogoMarker marker = drawMarker(markerShowEntity, modeResType(type));
|
||||
// marker.addDynamicAnchorPosition(new MogoLatLng(collisionlat, collisionLon), (float) heading, showTime * 1000);
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
marker.remove();
|
||||
}, showTime * 1000);
|
||||
|
||||
}
|
||||
|
||||
//根据识别物类型 (行人1/自行车2/摩托车4/骑行车辆11)获取3D模型(对应查看getModelRes)
|
||||
private int modeResType(int dataType) {
|
||||
switch (dataType) {
|
||||
case 1:
|
||||
case 11:
|
||||
return 1;
|
||||
case 2:
|
||||
return 2;
|
||||
case 4:
|
||||
return 4;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity, int modeResType) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.data(markerShowEntity)
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon())
|
||||
.controlAngle(true)
|
||||
.rotate((float) markerShowEntity.getMarkerLocation().getAngle())
|
||||
.setGps(true);
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(modeResType)); //TODO
|
||||
options.anchorColor("#FB3C3CFF");
|
||||
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
|
||||
return marker;
|
||||
}
|
||||
|
||||
public void drawerArrowsMarkerWithLocation(MogoLatLng location, String markerType, int type, int rotate) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.latitude(location.getLat())
|
||||
.longitude(location.getLon())
|
||||
.set3DMode(true)
|
||||
.setGps(true)
|
||||
.controlAngle(true)
|
||||
.icon3DRes(getModelRes(type))
|
||||
.anchorColor("#FB3C3CFF")
|
||||
.flat(true);
|
||||
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerType, options);
|
||||
marker.setRotateAngle(rotate);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绘制停止线 marker
|
||||
*
|
||||
*/
|
||||
public void renderStopLineData(double lon, double lat) {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(lat);
|
||||
location.setLon(lon);
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
|
||||
IMogoMarker marker = drawStopLineMarker(markerShowEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止线绘制
|
||||
*/
|
||||
public IMogoMarker drawStopLineMarker(MarkerShowEntity markerShowEntity) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.data(markerShowEntity)
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon())
|
||||
.setGps(false);
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(9));
|
||||
options.anchorColor("#FB3C3CFF");
|
||||
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.mogo.module.common.drawer.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class EmptyMarkerView extends View implements IMarkerView {
|
||||
|
||||
public EmptyMarkerView( Context context ) {
|
||||
this( context, null );
|
||||
}
|
||||
|
||||
public EmptyMarkerView( Context context, @Nullable AttributeSet attrs ) {
|
||||
this( context, attrs, 0 );
|
||||
}
|
||||
|
||||
public EmptyMarkerView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarker( IMogoMarker marker ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec ) {
|
||||
setMeasuredDimension( 1, 1 );
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.module.common.drawer.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-15
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public interface IMarkerView {
|
||||
|
||||
View getView();
|
||||
|
||||
default Bitmap getBitmap( int type ){
|
||||
return null;
|
||||
}
|
||||
|
||||
void setMarker( IMogoMarker marker );
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.mogo.module.common.drawer.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
|
||||
/**
|
||||
* author : 李小鹏
|
||||
* desc : 地图2dMarker 在3d下的展示
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapCameraInfoView extends MapMarkerBaseView {
|
||||
private String TAG = "MapCameraInfoView";
|
||||
|
||||
private ImageView mCameraImage;
|
||||
|
||||
|
||||
public MapCameraInfoView(Context context ) {
|
||||
super( context );
|
||||
}
|
||||
|
||||
public MapCameraInfoView(Context context, @Nullable AttributeSet attrs ) {
|
||||
super( context, attrs );
|
||||
}
|
||||
|
||||
public MapCameraInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
public MapCameraInfoView(Context context, MogoMarkerOptions options ) {
|
||||
super( context );
|
||||
mOptions = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView( Context context ) {
|
||||
LayoutInflater.from( context ).inflate( R.layout.modudle_camera_layout_info, this );
|
||||
mCameraImage = findViewById( R.id.iv_camera_traffic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateView( MarkerShowEntity markerShowEntity ) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.mogo.module.common.drawer.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-1015:55
|
||||
* desc : 地图Marker的适配器
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerAdapter {
|
||||
|
||||
/**
|
||||
* 获取 MarkerShowEntity 填充好的 MarkerView
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param markerShowEntity 要填充的数据
|
||||
* @return MarkerView
|
||||
*/
|
||||
public static IMarkerView getMarkerView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
|
||||
|
||||
if ( TextUtils.equals( markerShowEntity.getMarkerType(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
return OnlineCarMarkerView.getInstance();
|
||||
} else {
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
return new EmptyMarkerView( context );
|
||||
} else {
|
||||
if ( markerShowEntity.isChecked() ) {
|
||||
return new MapMarkerInfoView( context, markerShowEntity, options );
|
||||
} else {
|
||||
return new MapMarkerView( context, markerShowEntity, options );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
package com.mogo.module.common.drawer.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.eagle.core.utilcode.util.ViewUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.WindowUtils;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.service.imageloader.IMogoImageLoaderListener;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-1310:55
|
||||
* desc : 地图上抽离的Marker的共性
|
||||
* version: 1.0
|
||||
*/
|
||||
public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerView {
|
||||
private String TAG = "MapMarkerBaseView";
|
||||
|
||||
protected Context mContext;
|
||||
protected MogoMarkerOptions mOptions;
|
||||
protected MogoImageView ivUserHead;
|
||||
protected MogoImageView ivIcon;
|
||||
protected ImageView ivCar;
|
||||
protected IMogoMarker mMarker;
|
||||
|
||||
public MapMarkerBaseView(Context context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public MapMarkerBaseView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContext = context;
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public MapMarkerBaseView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mContext = context;
|
||||
initView(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarker(IMogoMarker marker) {
|
||||
this.mMarker = marker;
|
||||
}
|
||||
|
||||
protected abstract void initView(Context context);
|
||||
|
||||
public abstract void updateView(MarkerShowEntity markerShowEntity);
|
||||
|
||||
protected void loadImageWithMarker(final MarkerShowEntity markerShowEntity) {
|
||||
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
UiThreadHandler.post(() -> {
|
||||
runOnUiThread(markerShowEntity);
|
||||
});
|
||||
} else {
|
||||
runOnUiThread(markerShowEntity);
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadPoiTypeIcon(String url, int res) {
|
||||
ivIcon.setImageResource(res);
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
UiThreadHandler.post(() -> loadPoiTypeIconInUiThread(url, res));
|
||||
} else {
|
||||
loadPoiTypeIconInUiThread(url, res);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadPoiTypeIconInUiThread(String url, int res) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this));
|
||||
}
|
||||
if (!url.isEmpty()) {
|
||||
ivIcon.setPlaceHolder(res);
|
||||
ivIcon.setFailureHolder(res);
|
||||
MogoApisHandler.getInstance().getApis().getImageLoaderApi().displayImage(url,
|
||||
ivIcon, WindowUtils.dip2px(mContext, 50), WindowUtils.dip2px(mContext, 50),
|
||||
new IMogoImageLoaderListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(Bitmap bitmap) {
|
||||
// 使用view渲染地图marker,刷新纹理的时候,需要重新用view生成纹理,然后在设置
|
||||
if (mMarker != null) {
|
||||
mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void runOnUiThread(final MarkerShowEntity markerShowEntity) {
|
||||
if (!TextUtils.isEmpty(markerShowEntity.getIconUrl())) {
|
||||
MogoApisHandler.getInstance().getApis().getImageLoaderApi().displayImage(markerShowEntity.getIconUrl(),
|
||||
ivUserHead,
|
||||
WindowUtils.dip2px(mContext, 50), WindowUtils.dip2px(mContext, 50),
|
||||
new IMogoImageLoaderListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(Bitmap bitmap) {
|
||||
// 使用view渲染地图marker,刷新纹理的时候,需要重新用view生成纹理,然后在设置
|
||||
if (mMarker != null) {
|
||||
mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
ivUserHead.setBackgroundResource(R.drawable.icon_default_user_head);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
package com.mogo.module.common.drawer.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.marker.PoiWrapper;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-0619:55
|
||||
* desc : 地图Marker图标带文本信息
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerInfoView extends MapMarkerBaseView {
|
||||
private String TAG = "MapMarkerInfoView";
|
||||
|
||||
private TextView tvMarkerContent;
|
||||
private LinearLayout clMarkerContent;
|
||||
private ImageView ivReverseTriangle;
|
||||
|
||||
public MapMarkerInfoView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public MapMarkerInfoView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) {
|
||||
super(context);
|
||||
mOptions = options;
|
||||
try {
|
||||
updateView(markerShowEntity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.modudle_services_marker_layout_info, this);
|
||||
ivUserHead = findViewById(R.id.ivUserHead);
|
||||
// ivIcon = findViewById( R.id.ivIcon );
|
||||
ivIcon = findViewById(R.id.ivIcon);
|
||||
clMarkerContent = findViewById(R.id.clMarkerContent);
|
||||
ivReverseTriangle = findViewById(R.id.ivReverseTriangle);
|
||||
ivCar = findViewById(R.id.ivCar);
|
||||
tvMarkerContent = findViewById(R.id.tvMarkerContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateView(MarkerShowEntity markerShowEntity) {
|
||||
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_yellow_vr);
|
||||
} else {
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_yellow);
|
||||
}
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_yellow_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_yellow);
|
||||
switch (markerShowEntity.getMarkerType()) {
|
||||
case ModuleNames.CARD_TYPE_USER_DATA:
|
||||
ivUserHead.setVisibility(View.VISIBLE);
|
||||
ivIcon.setVisibility(View.INVISIBLE);
|
||||
loadImageWithMarker(markerShowEntity);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_car_gray);
|
||||
//ivCar.setRotation(new Random().nextInt(360));
|
||||
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
|
||||
break;
|
||||
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) {
|
||||
// 根据poiType获取对应的图片
|
||||
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
|
||||
PoiWrapper poiWrapper =
|
||||
CloudPoiManager.getInstance().getWrapperByPoiType(poiType);
|
||||
if (poiWrapper != null) {
|
||||
// 加载图片
|
||||
loadPoiTypeIcon(poiWrapper.getIconInfoUrl(), poiWrapper.getIconInfoRes());
|
||||
} else {
|
||||
CallerLogger.INSTANCE.e(TAG, "未能根据poiType获取对应poi信息,无法渲染info marker====" + poiType);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!TextUtils.isEmpty(markerShowEntity.getTextContent())) {
|
||||
String content;
|
||||
if (markerShowEntity.getTextContent().length() > 8) {
|
||||
content = markerShowEntity.getTextContent().substring(0, 7) + "...";
|
||||
} else {
|
||||
content = markerShowEntity.getTextContent();
|
||||
}
|
||||
tvMarkerContent.setText(content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
package com.mogo.module.common.drawer.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.marker.PoiWrapper;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-0619:55
|
||||
* desc : 地图Marker图标
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerView extends MapMarkerBaseView {
|
||||
private String TAG = "MapMarkerView";
|
||||
|
||||
private FrameLayout clMarkerTopView;
|
||||
private MarkerShowEntity mMarkerShowEntity;
|
||||
|
||||
public MapMarkerView( Context context ) {
|
||||
super( context );
|
||||
}
|
||||
|
||||
public MapMarkerView( Context context, @Nullable AttributeSet attrs ) {
|
||||
super( context, attrs );
|
||||
}
|
||||
|
||||
public MapMarkerView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
public MapMarkerView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
|
||||
super( context );
|
||||
mOptions = options;
|
||||
mMarkerShowEntity = markerShowEntity;
|
||||
try {
|
||||
updateView( markerShowEntity );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView( Context context ) {
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_vr_layout, this );
|
||||
} else {
|
||||
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_layout, this );
|
||||
}
|
||||
clMarkerTopView = findViewById( R.id.clMarkerTopView );
|
||||
ivIcon = findViewById( R.id.ivIcon );
|
||||
ivCar = findViewById( R.id.ivCar );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateView( MarkerShowEntity markerShowEntity ) {
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
switch ( markerShowEntity.getMarkerType() ) {
|
||||
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
|
||||
if ( mMarkerShowEntity != null && mMarkerShowEntity.isChecked() ) {
|
||||
clMarkerTopView.setBackgroundResource( R.drawable.module_services_marker_vr_bkg_checked );
|
||||
}
|
||||
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
|
||||
// 根据poiType获取对应的图片
|
||||
String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType();
|
||||
PoiWrapper poiWrapper =
|
||||
CloudPoiManager.getInstance().getWrapperByPoiType( poiType );
|
||||
if ( poiWrapper != null ) {
|
||||
// 加载图片
|
||||
loadPoiTypeIcon( poiWrapper.getIconUrl(), poiWrapper.getIconRes() );
|
||||
} else {
|
||||
CallerLogger.INSTANCE.e( TAG, "未能根据poiType获取对应poi信息,无法渲染marker====" + poiType );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package com.mogo.module.common.drawer.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.R;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-30
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class OnlineCarMarkerView implements IMarkerView {
|
||||
|
||||
private static Map< Integer, SoftReference< Bitmap > > sRef = new HashMap<>();
|
||||
private static Map< Integer, SoftReference< Bitmap > > sTypedRef = new HashMap<>();
|
||||
|
||||
private OnlineCarMarkerView() {
|
||||
// private constructor
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final OnlineCarMarkerView INSTANCE = new OnlineCarMarkerView();
|
||||
}
|
||||
|
||||
public static OnlineCarMarkerView getInstance() {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap getBitmap( int vehicleType ) {
|
||||
if ( sRef.get( vehicleType ) == null || sRef.get( vehicleType ).get() == null
|
||||
|| sRef.get( vehicleType ).get().isRecycled() ) {
|
||||
switch ( vehicleType ) {
|
||||
case 5:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_taxi ) ) );
|
||||
break;
|
||||
case 6:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_bus ) ) );
|
||||
break;
|
||||
case 1:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_110 ) ) );
|
||||
break;
|
||||
case 2:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_120 ) ) );
|
||||
break;
|
||||
case 7:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_119 ) ) );
|
||||
break;
|
||||
default:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_gray ) ) );
|
||||
}
|
||||
}
|
||||
return sRef.get( vehicleType ).get();
|
||||
}
|
||||
|
||||
public Bitmap getSelectedBitmap( int vehicleType ) {
|
||||
if ( sTypedRef.get( vehicleType ) == null || sTypedRef.get( vehicleType ).get() == null
|
||||
|| sTypedRef.get( vehicleType ).get().isRecycled() ) {
|
||||
switch ( vehicleType ) {
|
||||
case 2:
|
||||
sTypedRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type2 ) ) );
|
||||
break;
|
||||
default:
|
||||
sTypedRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_gray_selected ) ) );
|
||||
}
|
||||
}
|
||||
return sTypedRef.get( vehicleType ).get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarker( IMogoMarker marker ) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerActivitiesScope implements Serializable {
|
||||
|
||||
private String content;
|
||||
private boolean isCheck;
|
||||
|
||||
public String getContent() {
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
return "";
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public boolean getIsCheck() {
|
||||
return isCheck;
|
||||
}
|
||||
|
||||
public void setIsCheck(boolean isCheck) {
|
||||
this.isCheck = isCheck;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerActivitiesScope{" +
|
||||
"content='" + content + '\'' +
|
||||
", isCheck=" + isCheck +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerCarChat implements Serializable {
|
||||
|
||||
private String type;
|
||||
private MarkerLocation location;
|
||||
private MarkerUserInfo userInfo;
|
||||
|
||||
public MarkerLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(MarkerLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public MarkerUserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void setUserInfo(MarkerUserInfo userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerCarChat{" +
|
||||
"location=" + location +
|
||||
", type='" + type + '\'' +
|
||||
", userInfo=" + userInfo +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerCarInfo implements Serializable {
|
||||
|
||||
private String carBrandLogoUrl;
|
||||
private String carTypeName;
|
||||
private int vehicleType;
|
||||
private CarLiveInfo carLiveInfo;
|
||||
|
||||
public String getCarBrandLogoUrl() {
|
||||
if (TextUtils.isEmpty(carBrandLogoUrl)) {
|
||||
return "";
|
||||
}
|
||||
return carBrandLogoUrl;
|
||||
}
|
||||
|
||||
public void setCarBrandLogoUrl(String carBrandLogoUrl) {
|
||||
this.carBrandLogoUrl = carBrandLogoUrl;
|
||||
}
|
||||
|
||||
public String getCarTypeName() {
|
||||
if (TextUtils.isEmpty(carTypeName)) {
|
||||
return "";
|
||||
}
|
||||
return carTypeName;
|
||||
}
|
||||
|
||||
public void setCarTypeName(String carTypeName) {
|
||||
this.carTypeName = carTypeName;
|
||||
}
|
||||
|
||||
public int getVehicleType() {
|
||||
return vehicleType;
|
||||
}
|
||||
|
||||
public void setVehicleType(int vehicleType) {
|
||||
this.vehicleType = vehicleType;
|
||||
}
|
||||
|
||||
public CarLiveInfo getCarLiveInfo() {
|
||||
return carLiveInfo;
|
||||
}
|
||||
|
||||
public void setCarLiveInfo(CarLiveInfo carLiveInfo) {
|
||||
this.carLiveInfo = carLiveInfo;
|
||||
}
|
||||
|
||||
public static class CarLiveInfo implements Serializable {
|
||||
//rtmp视频直播地址rtmp://
|
||||
private String videoUrl;
|
||||
//直播频道【直播心跳接口参数】C_1
|
||||
private String videoChannel;
|
||||
//直播源sn【直播心跳接口参数】XTCBA90740400625
|
||||
private String videoSn;
|
||||
|
||||
public String getVideoUrl() {
|
||||
return videoUrl;
|
||||
}
|
||||
|
||||
public void setVideoUrl(String videoUrl) {
|
||||
this.videoUrl = videoUrl;
|
||||
}
|
||||
|
||||
public String getVideoChannel() {
|
||||
return videoChannel;
|
||||
}
|
||||
|
||||
public void setVideoChannel(String videoChannel) {
|
||||
this.videoChannel = videoChannel;
|
||||
}
|
||||
|
||||
public String getVideoSn() {
|
||||
return videoSn;
|
||||
}
|
||||
|
||||
public void setVideoSn(String videoSn) {
|
||||
this.videoSn = videoSn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CarLiveInfo{" +
|
||||
"videoUrl='" + videoUrl + '\'' +
|
||||
", videoChannel='" + videoChannel + '\'' +
|
||||
", videoSn='" + videoSn + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerCarInfo{" +
|
||||
"carBrandLogoUrl='" + carBrandLogoUrl + '\'' +
|
||||
", carTypeName='" + carTypeName + '\'' +
|
||||
", vehicleType=" + vehicleType +
|
||||
", carLiveInfo=" + carLiveInfo +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by ihoudf on 2020-04-16.
|
||||
**/
|
||||
public class MarkerCarPois {
|
||||
|
||||
private List coordinates;
|
||||
private double angle; // 车头角度
|
||||
private String adcode;
|
||||
|
||||
public List getCoordinates() {
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
public void setCoordinates(List coordinates) {
|
||||
this.coordinates = coordinates;
|
||||
}
|
||||
|
||||
public double getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public void setAngle(double angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public String getAdcode() {
|
||||
return adcode;
|
||||
}
|
||||
|
||||
public void setAdcode(String adcode) {
|
||||
this.adcode = adcode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerCarPois{" + "coordinates=" + coordinates + ", angle=" + angle + ", adcode" +
|
||||
"='" + adcode + '\'' + '}';
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerCardResult extends BaseData {
|
||||
|
||||
private List<String> dataType; // 要查询的类型
|
||||
private List<MarkerCarChat> carChat;
|
||||
private List<MarkerShareMusic> shareMusic;
|
||||
private List<MarkerNoveltyInfo> noveltyInfo;
|
||||
|
||||
private List<MarkerOnlineCar> onlineCar;
|
||||
private List<MarkerExploreWay> exploreWay;
|
||||
private long messageTime;
|
||||
|
||||
public List<MarkerCarChat> getCarChat() {
|
||||
return carChat;
|
||||
}
|
||||
|
||||
public void setCarChat(List<MarkerCarChat> carChat) {
|
||||
this.carChat = carChat;
|
||||
}
|
||||
|
||||
public List<MarkerExploreWay> getExploreWay() {
|
||||
return exploreWay;
|
||||
}
|
||||
|
||||
public void setExploreWay(List<MarkerExploreWay> exploreWay) {
|
||||
this.exploreWay = exploreWay;
|
||||
}
|
||||
|
||||
public List<MarkerOnlineCar> getOnlineCar() {
|
||||
return onlineCar;
|
||||
}
|
||||
|
||||
public void setOnlineCar(List<MarkerOnlineCar> onlineCar) {
|
||||
this.onlineCar = onlineCar;
|
||||
}
|
||||
|
||||
public List<MarkerShareMusic> getShareMusic() {
|
||||
return shareMusic;
|
||||
}
|
||||
|
||||
public void setShareMusic(List<MarkerShareMusic> shareMusic) {
|
||||
this.shareMusic = shareMusic;
|
||||
}
|
||||
|
||||
public List<MarkerNoveltyInfo> getNoveltyInfo() {
|
||||
return noveltyInfo;
|
||||
}
|
||||
|
||||
public void setNoveltyInfo(List<MarkerNoveltyInfo> noveltyInfo) {
|
||||
this.noveltyInfo = noveltyInfo;
|
||||
}
|
||||
|
||||
public List<String> getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(List<String> dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public long getMessageTime() {
|
||||
return messageTime;
|
||||
}
|
||||
|
||||
public void setMessageTime(long messageTime) {
|
||||
this.messageTime = messageTime;
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerDynamicData implements Serializable {
|
||||
//QQ音乐,懒人听书,乐听头条 2 为书籍听书,3 为新闻,1 为qq音乐
|
||||
private int type;
|
||||
private String mediaId;//qq音乐id,书的bookId
|
||||
//qq音乐url 懒人听书为“”
|
||||
private String mediaUrl;
|
||||
//歌曲名 ,当前播放书名,新闻标题内容
|
||||
private String mediaName;
|
||||
//演唱歌手,当前章节,新闻来源
|
||||
private String mediaSinger;
|
||||
//歌曲封面,书籍封面,新闻预览图
|
||||
private String mediaImg;
|
||||
//音乐类别,类似经典 ,流行只有qq特有
|
||||
private String mediaType;
|
||||
private int maxTime;//音频总时长
|
||||
private String bookInfo;//懒人听书json串
|
||||
//当前播放时长,可以不加,播放进度单独独立出来
|
||||
private int curTime;
|
||||
//是否是本地音频,只有qq音乐
|
||||
private boolean isLocalMedia;//本地
|
||||
//播放模式,顺序,单曲循环,随机
|
||||
private int mediaPlayMode;
|
||||
//1 播放 2 缓冲 0 暂停/停止 -1 播放错误
|
||||
private int playState;
|
||||
|
||||
public String getMediaId() {
|
||||
return mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
public String getMediaUrl() {
|
||||
return mediaUrl;
|
||||
}
|
||||
|
||||
public void setMediaUrl(String mediaUrl) {
|
||||
this.mediaUrl = mediaUrl;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getPlayState() {
|
||||
return playState;
|
||||
}
|
||||
|
||||
public void setPlayState(int playState) {
|
||||
this.playState = playState;
|
||||
}
|
||||
|
||||
public String getMediaName() {
|
||||
if (TextUtils.isEmpty(mediaName)) {
|
||||
return "";
|
||||
}
|
||||
return mediaName;
|
||||
}
|
||||
|
||||
public void setMediaName(String mediaName) {
|
||||
this.mediaName = mediaName;
|
||||
}
|
||||
|
||||
public String getMediaSinger() {
|
||||
if (TextUtils.isEmpty(mediaSinger)) {
|
||||
return "";
|
||||
}
|
||||
return mediaSinger;
|
||||
}
|
||||
|
||||
public void setMediaSinger(String mediaSinger) {
|
||||
this.mediaSinger = mediaSinger;
|
||||
}
|
||||
|
||||
public String getMediaImg() {
|
||||
return mediaImg;
|
||||
}
|
||||
|
||||
public void setMediaImg(String mediaImg) {
|
||||
this.mediaImg = mediaImg;
|
||||
}
|
||||
|
||||
public long getMaxTime() {
|
||||
return maxTime;
|
||||
}
|
||||
|
||||
public void setMaxTime(int maxTime) {
|
||||
this.maxTime = maxTime;
|
||||
}
|
||||
|
||||
public long getCurTime() {
|
||||
return curTime;
|
||||
}
|
||||
|
||||
public void setCurTime(int curTime) {
|
||||
this.curTime = curTime;
|
||||
}
|
||||
|
||||
public String getMediaType() {
|
||||
if (TextUtils.isEmpty(mediaType)) {
|
||||
return "";
|
||||
}
|
||||
return mediaType;
|
||||
}
|
||||
|
||||
public void setMediaType(String mediaType) {
|
||||
this.mediaType = mediaType;
|
||||
}
|
||||
|
||||
public boolean isLocalMedia() {
|
||||
return isLocalMedia;
|
||||
}
|
||||
|
||||
public void setLocalMedia(boolean localMedia) {
|
||||
isLocalMedia = localMedia;
|
||||
}
|
||||
|
||||
public int getMediaPlayMode() {
|
||||
return mediaPlayMode;
|
||||
}
|
||||
|
||||
public void setMediaPlayMode(int mediaPlayMode) {
|
||||
this.mediaPlayMode = mediaPlayMode;
|
||||
}
|
||||
|
||||
public String getBookInfo() {
|
||||
return bookInfo;
|
||||
}
|
||||
|
||||
public void setBookInfo(String bookInfo) {
|
||||
this.bookInfo = bookInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerDynamicData{" +
|
||||
"type=" + type +
|
||||
", mediaId='" + mediaId + '\'' +
|
||||
", mediaUrl='" + mediaUrl + '\'' +
|
||||
", mediaName='" + mediaName + '\'' +
|
||||
", mediaSinger='" + mediaSinger + '\'' +
|
||||
", mediaImg='" + mediaImg + '\'' +
|
||||
", mediaType='" + mediaType + '\'' +
|
||||
", maxTime=" + maxTime +
|
||||
", bookInfo='" + bookInfo + '\'' +
|
||||
", curTime=" + curTime +
|
||||
", isLocalMedia=" + isLocalMedia +
|
||||
", mediaPlayMode=" + mediaPlayMode +
|
||||
", playState=" + playState +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,241 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerExploreWay implements Serializable {
|
||||
|
||||
private String infoId;
|
||||
private String type;//卡片类型,
|
||||
/**
|
||||
* @see EventTypeEnum
|
||||
*/
|
||||
private String poiType;
|
||||
private String sn;
|
||||
private MarkerLocation location;//位置信息
|
||||
private int direction;//方位角度
|
||||
private boolean canLive;//是否可直播(1为可直播,0不可直播)
|
||||
private int fileType;//是图片还是视频(1视频,0图片)
|
||||
private String addr;//北京市朝阳区三里屯街道108号
|
||||
private long generateTime;//时间戳
|
||||
private String cityName;//:"城市名称",
|
||||
private double distance;//距离
|
||||
private MarkerUserInfo userInfo;//用户信息
|
||||
private List<MarkerExploreWayItem> items;//视频地址和图片地址
|
||||
//上报类型:1-用户上报,2-后台上报 3-三方上报
|
||||
private String uploadType;
|
||||
|
||||
private boolean fabulous;
|
||||
|
||||
// http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
|
||||
// 1 需要用户判断是否拥堵 进行UGC问答
|
||||
private int infoCheckNode;
|
||||
|
||||
public Map<String, Object> extras = null;
|
||||
|
||||
public String getAddr() {
|
||||
if (TextUtils.isEmpty(addr)) {
|
||||
return "未知道路";
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
public void setAddr(String addr) {
|
||||
this.addr = addr;
|
||||
}
|
||||
|
||||
public boolean getCanLive() {
|
||||
return canLive;
|
||||
}
|
||||
|
||||
public void setCanLive(boolean canLive) {
|
||||
this.canLive = canLive;
|
||||
}
|
||||
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
public void setCityName(String cityName) {
|
||||
this.cityName = cityName;
|
||||
}
|
||||
|
||||
public float getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(int direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(double distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public double getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public void setFileType(int fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
public Long getGenerateTime() {
|
||||
return generateTime;
|
||||
}
|
||||
|
||||
public void setGenerateTime(Long generateTime) {
|
||||
this.generateTime = generateTime;
|
||||
}
|
||||
|
||||
public List<MarkerExploreWayItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<MarkerExploreWayItem> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public MarkerLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(MarkerLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public MarkerUserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void setUserInfo(MarkerUserInfo userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
public String getInfoId() {
|
||||
return infoId;
|
||||
}
|
||||
|
||||
|
||||
public int getInfoIdInt() {
|
||||
try {
|
||||
return Integer.parseInt(infoId);
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void setInfoId(String infoId) {
|
||||
this.infoId = infoId;
|
||||
}
|
||||
|
||||
public String getPoiType() {
|
||||
if (TextUtils.isEmpty(poiType)) {
|
||||
return EventTypeEnum.FOURS_BLOCK_UP.getPoiType();
|
||||
}
|
||||
return poiType;
|
||||
}
|
||||
|
||||
public void setPoiType(String poiType) {
|
||||
this.poiType = poiType;
|
||||
}
|
||||
|
||||
public String getUploadType() {
|
||||
return uploadType;
|
||||
}
|
||||
|
||||
public void setUploadType(String uploadType) {
|
||||
this.uploadType = uploadType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MarkerExploreWay that = (MarkerExploreWay) o;
|
||||
return Objects.equals(infoId, that.infoId) &&
|
||||
Objects.equals(type, that.type) &&
|
||||
Objects.equals(poiType, that.poiType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(infoId, type, poiType);
|
||||
}
|
||||
|
||||
public boolean isCanLive() {
|
||||
return canLive;
|
||||
}
|
||||
|
||||
public void setGenerateTime(long generateTime) {
|
||||
this.generateTime = generateTime;
|
||||
}
|
||||
|
||||
public int getInfoCheckNode() {
|
||||
return infoCheckNode;
|
||||
}
|
||||
|
||||
public void setInfoCheckNode(int infoCheckNode) {
|
||||
this.infoCheckNode = infoCheckNode;
|
||||
}
|
||||
|
||||
public boolean isFabulous() {
|
||||
return fabulous;
|
||||
}
|
||||
|
||||
public void setFabulous(boolean fabulous) {
|
||||
this.fabulous = fabulous;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerExploreWay{" +
|
||||
"infoId='" + infoId + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", poiType='" + poiType + '\'' +
|
||||
", sn='" + sn + '\'' +
|
||||
", location=" + location +
|
||||
", direction=" + direction +
|
||||
", canLive=" + canLive +
|
||||
", fileType=" + fileType +
|
||||
", addr='" + addr + '\'' +
|
||||
", generateTime=" + generateTime +
|
||||
", cityName='" + cityName + '\'' +
|
||||
", distance=" + distance +
|
||||
", userInfo=" + userInfo +
|
||||
", items=" + items +
|
||||
", uploadType='" + uploadType + '\'' +
|
||||
", fabulous=" + fabulous +
|
||||
", infoCheckNode=" + infoCheckNode +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 道路情报,V2X预警,地图道路事件POI,违章停车POI等
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerExploreWayItem implements Serializable {
|
||||
|
||||
private String thumbnail;
|
||||
private String url;
|
||||
private String content;
|
||||
private double illegalCount;
|
||||
|
||||
public String getThumbnail() {
|
||||
if (TextUtils.isEmpty(thumbnail)) {
|
||||
return "";
|
||||
}
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
public void setThumbnail(String thumbnail) {
|
||||
this.thumbnail = thumbnail;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
return "";
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public double getIllegalCount() {
|
||||
return illegalCount;
|
||||
}
|
||||
|
||||
public void setIllegalCount(double illegalCount) {
|
||||
this.illegalCount = illegalCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerExploreWayItem{" +
|
||||
"thumbnail='" + thumbnail + '\'' +
|
||||
", url='" + url + '\'' +
|
||||
", content='" + content + '\'' +
|
||||
", illegalCount='" + illegalCount + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-1615:12
|
||||
* desc : 爱好
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MarkerHobbyDatum implements Serializable {
|
||||
private List<MarkerOnlineTag> singerTop2; // 最喜欢的两位歌手
|
||||
private List<MarkerOnlineTag> songTypeTop2; // 最喜欢的两种音乐类型
|
||||
private List<MarkerOnlineTag> newsType; // 最喜欢的资讯类型
|
||||
private List<MarkerOnlineTag> listenBookTop2; // 最喜欢听的两本书
|
||||
private List<MarkerOnlineTag> ifSociety; // 是否喜爱社交
|
||||
|
||||
|
||||
public List<MarkerOnlineTag> getSingerTop2() {
|
||||
return singerTop2;
|
||||
}
|
||||
|
||||
public void setSingerTop2(List<MarkerOnlineTag> singerTop2) {
|
||||
this.singerTop2 = singerTop2;
|
||||
}
|
||||
|
||||
public List<MarkerOnlineTag> getSongTypeTop2() {
|
||||
return songTypeTop2;
|
||||
}
|
||||
|
||||
public void setSongTypeTop2(List<MarkerOnlineTag> songTypeTop2) {
|
||||
this.songTypeTop2 = songTypeTop2;
|
||||
}
|
||||
|
||||
public List<MarkerOnlineTag> getNewsType() {
|
||||
return newsType;
|
||||
}
|
||||
|
||||
public void setNewsType(List<MarkerOnlineTag> newsType) {
|
||||
this.newsType = newsType;
|
||||
}
|
||||
|
||||
public List<MarkerOnlineTag> getListenBookTop2() {
|
||||
return listenBookTop2;
|
||||
}
|
||||
|
||||
public void setListenBookTop2(List<MarkerOnlineTag> listenBookTop2) {
|
||||
this.listenBookTop2 = listenBookTop2;
|
||||
}
|
||||
|
||||
public List<MarkerOnlineTag> getIfSociety() {
|
||||
return ifSociety;
|
||||
}
|
||||
|
||||
public void setIfSociety(List<MarkerOnlineTag> ifSociety) {
|
||||
this.ifSociety = ifSociety;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerHobbyDatum{" +
|
||||
"singerTop2=" + singerTop2 +
|
||||
", songTypeTop2=" + songTypeTop2 +
|
||||
", newsType=" + newsType +
|
||||
", listenBookTop2=" + listenBookTop2 +
|
||||
", ifSociety=" + ifSociety +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerLocation implements Serializable {
|
||||
|
||||
private double lat;//纬度
|
||||
private double lon;//经度
|
||||
private double angle;//车头角度,可以没有
|
||||
private String address;//具体的位置信息
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public void setAngle(double angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
if (TextUtils.isEmpty(address)) {
|
||||
return "";
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerLocation{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", angle=" + angle +
|
||||
", address='" + address + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,197 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
/**
|
||||
* 新鲜事儿Marker数据
|
||||
*/
|
||||
public class MarkerNoveltyInfo {
|
||||
private String type;
|
||||
private String sn;
|
||||
private MarkerLocation location;
|
||||
/**
|
||||
* @see com.mogo.module.common.enums.EventTypeEnum
|
||||
*/
|
||||
private String poiType;
|
||||
private ContentData contentData;
|
||||
|
||||
public ContentData getContentData() {
|
||||
return contentData;
|
||||
}
|
||||
|
||||
public void setContentData(ContentData contentData) {
|
||||
this.contentData = contentData;
|
||||
}
|
||||
|
||||
public MarkerLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(MarkerLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getPoiType() {
|
||||
return poiType;
|
||||
}
|
||||
|
||||
public void setPoiType(String poiType) {
|
||||
this.poiType = poiType;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public static class ContentData {
|
||||
private String content;
|
||||
private String iconUrl;
|
||||
private String imgUrl;
|
||||
private String infoId;
|
||||
private long likeNum;
|
||||
private String title;
|
||||
private String gasPrices;
|
||||
private boolean displayNavigation;
|
||||
private boolean desplayHost;
|
||||
private boolean fabulous;
|
||||
private String styleType;
|
||||
//上报类型:1-用户上报,2-后台上报 3-三方上报
|
||||
private String uploadType;
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getIconUrl() {
|
||||
return iconUrl;
|
||||
}
|
||||
|
||||
public void setIconUrl(String iconUrl) {
|
||||
this.iconUrl = iconUrl;
|
||||
}
|
||||
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
|
||||
public String getInfoId() {
|
||||
return infoId;
|
||||
}
|
||||
|
||||
public void setInfoId(String infoId) {
|
||||
this.infoId = infoId;
|
||||
}
|
||||
|
||||
public long getLikeNum() {
|
||||
return likeNum;
|
||||
}
|
||||
|
||||
public void setLikeNum(long likeNum) {
|
||||
this.likeNum = likeNum;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public boolean isDisplayNavigation() {
|
||||
return displayNavigation;
|
||||
}
|
||||
|
||||
public void setDisplayNavigation(boolean displayNavigation) {
|
||||
this.displayNavigation = displayNavigation;
|
||||
}
|
||||
|
||||
public String getStyleType() {
|
||||
return styleType;
|
||||
}
|
||||
|
||||
public void setStyleType(String styleType) {
|
||||
this.styleType = styleType;
|
||||
}
|
||||
|
||||
public String getGasPrices() {
|
||||
return gasPrices;
|
||||
}
|
||||
|
||||
public void setGasPrices(String gasPrices) {
|
||||
this.gasPrices = gasPrices;
|
||||
}
|
||||
|
||||
public boolean isDesplayHost() {
|
||||
return desplayHost;
|
||||
}
|
||||
|
||||
public void setDesplayHost(boolean desplayHost) {
|
||||
this.desplayHost = desplayHost;
|
||||
}
|
||||
|
||||
public boolean isFabulous() {
|
||||
return fabulous;
|
||||
}
|
||||
|
||||
public void setFabulous(boolean fabulous) {
|
||||
this.fabulous = fabulous;
|
||||
}
|
||||
|
||||
public String getUploadType() {
|
||||
return uploadType;
|
||||
}
|
||||
|
||||
public void setUploadType(String uploadType) {
|
||||
this.uploadType = uploadType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ContentData{" +
|
||||
"content='" + content + '\'' +
|
||||
", iconUrl='" + iconUrl + '\'' +
|
||||
", imgUrl='" + imgUrl + '\'' +
|
||||
", infoId='" + infoId + '\'' +
|
||||
", likeNum=" + likeNum +
|
||||
", title='" + title + '\'' +
|
||||
", gasPrices='" + gasPrices + '\'' +
|
||||
", displayNavigation=" + displayNavigation +
|
||||
", desplayHost=" + desplayHost +
|
||||
", fabulous=" + fabulous +
|
||||
", styleType='" + styleType + '\'' +
|
||||
", uploadType='" + uploadType + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerNoveltyInfo{" +
|
||||
"type='" + type + '\'' +
|
||||
", sn='" + sn + '\'' +
|
||||
", location=" + location +
|
||||
", poiType='" + poiType + '\'' +
|
||||
", contentData=" + contentData +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MarkerOnlineCar implements Serializable {
|
||||
|
||||
private String type;//卡片类型
|
||||
private MarkerLocation location;//所在位置
|
||||
private Boolean isFocus;//isFocus":"0-未关注,1-关注
|
||||
private MarkerUserInfo userInfo;//用户数据
|
||||
private MarkerCarInfo carInfo;//车辆数据
|
||||
private List<MarkerCarPois> pois;//车辆路线
|
||||
private MarkerDynamicData dynamicData;//动态数据
|
||||
private MarkerHobbyDatum hobbyData;//爱好数据集合
|
||||
private List<MarkerActivitiesScope> activitiesScope;//活动范围数据集合
|
||||
private int compatibility;//匹配度
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public MarkerLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(MarkerLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public Boolean getFocus() {
|
||||
return isFocus;
|
||||
}
|
||||
|
||||
public void setFocus(Boolean focus) {
|
||||
isFocus = focus;
|
||||
}
|
||||
|
||||
public MarkerUserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void setUserInfo(MarkerUserInfo userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
public MarkerCarInfo getCarInfo() {
|
||||
return carInfo;
|
||||
}
|
||||
|
||||
public void setCarInfo(MarkerCarInfo carInfo) {
|
||||
this.carInfo = carInfo;
|
||||
}
|
||||
|
||||
public List<MarkerCarPois> getPois() {
|
||||
return pois;
|
||||
}
|
||||
|
||||
public void setPois(List<MarkerCarPois> pois) {
|
||||
this.pois = pois;
|
||||
}
|
||||
|
||||
public MarkerDynamicData getDynamicData() {
|
||||
return dynamicData;
|
||||
}
|
||||
|
||||
public void setDynamicData(MarkerDynamicData dynamicData) {
|
||||
this.dynamicData = dynamicData;
|
||||
}
|
||||
|
||||
public MarkerHobbyDatum getHobbyData() {
|
||||
return hobbyData;
|
||||
}
|
||||
|
||||
public void setHobbyData(MarkerHobbyDatum hobbyData) {
|
||||
this.hobbyData = hobbyData;
|
||||
}
|
||||
|
||||
public List<MarkerActivitiesScope> getActivitiesScope() {
|
||||
return activitiesScope;
|
||||
}
|
||||
|
||||
public void setActivitiesScope(List<MarkerActivitiesScope> activitiesScope) {
|
||||
this.activitiesScope = activitiesScope;
|
||||
}
|
||||
|
||||
public int getCompatibility() {
|
||||
return compatibility;
|
||||
}
|
||||
|
||||
public void setCompatibility(int compatibility) {
|
||||
this.compatibility = compatibility;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerOnlineCar{" + "type='" + type + '\'' + ", location=" + location + ", " +
|
||||
"isFocus=" + isFocus + ", userInfo=" + userInfo + ", carInfo=" + carInfo + ", " + "pois=" + pois + ", dynamicData=" + dynamicData + ", hobbyData=" + hobbyData + "," + " activitiesScope=" + activitiesScope + ", compatibility=" + compatibility + '}';
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerOnlineTag implements Serializable {
|
||||
|
||||
private String content;
|
||||
private boolean isCheck;
|
||||
|
||||
public String getContent() {
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
return "";
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public boolean getIsCheck() {
|
||||
return isCheck;
|
||||
}
|
||||
|
||||
public void setIsCheck(boolean isCheck) {
|
||||
this.isCheck = isCheck;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerHobbyDatum{" +
|
||||
"content='" + content + '\'' +
|
||||
", isCheck=" + isCheck +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerResponse extends BaseData implements Serializable {
|
||||
|
||||
// private int code;
|
||||
// private String msg;
|
||||
private MarkerCardResult result;
|
||||
private String sign;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public MarkerCardResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public void setResult(MarkerCardResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
public void setSign(String sign) {
|
||||
this.sign = sign;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerResponse{" + "result=" + result + ", sign='" + sign + '\'' + ", code=" + code + ", msg='" + msg + '\'' + '}';
|
||||
}
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerShareMusic implements Serializable {
|
||||
|
||||
private String bookInfo;
|
||||
private int id;
|
||||
private int likeNumber;
|
||||
private MarkerLocation location;
|
||||
private String mediaId;
|
||||
private String mediaImg;
|
||||
private String mediaName;
|
||||
private String mediaSinger;
|
||||
private String mediaUrl;
|
||||
private String shareContentText;
|
||||
private int shareType;
|
||||
private String type;
|
||||
private MarkerUserInfo userInfo;
|
||||
|
||||
public String getBookInfo() {
|
||||
return bookInfo;
|
||||
}
|
||||
|
||||
public void setBookInfo(String bookInfo) {
|
||||
this.bookInfo = bookInfo;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getLikeNumber() {
|
||||
return likeNumber;
|
||||
}
|
||||
|
||||
public void setLikeNumber(int likeNumber) {
|
||||
this.likeNumber = likeNumber;
|
||||
}
|
||||
|
||||
public String getMediaId() {
|
||||
return mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
public String getMediaImg() {
|
||||
if (TextUtils.isEmpty(mediaImg)) {
|
||||
return "";
|
||||
}
|
||||
return mediaImg;
|
||||
}
|
||||
|
||||
public void setMediaImg(String mediaImg) {
|
||||
this.mediaImg = mediaImg;
|
||||
}
|
||||
|
||||
public String getMediaName() {
|
||||
if (TextUtils.isEmpty(mediaName)) {
|
||||
return "";
|
||||
}
|
||||
return mediaName;
|
||||
}
|
||||
|
||||
public void setMediaName(String mediaName) {
|
||||
this.mediaName = mediaName;
|
||||
}
|
||||
|
||||
public String getMediaSinger() {
|
||||
return mediaSinger;
|
||||
}
|
||||
|
||||
public void setMediaSinger(String mediaSinger) {
|
||||
this.mediaSinger = mediaSinger;
|
||||
}
|
||||
|
||||
public String getMediaUrl() {
|
||||
return mediaUrl;
|
||||
}
|
||||
|
||||
public void setMediaUrl(String mediaUrl) {
|
||||
this.mediaUrl = mediaUrl;
|
||||
}
|
||||
|
||||
public String getShareContentText() {
|
||||
return shareContentText;
|
||||
}
|
||||
|
||||
public void setShareContentText(String shareContentText) {
|
||||
this.shareContentText = shareContentText;
|
||||
}
|
||||
|
||||
public int getShareType() {
|
||||
return shareType;
|
||||
}
|
||||
|
||||
public void setShareType(int shareType) {
|
||||
this.shareType = shareType;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public MarkerUserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void setUserInfo(MarkerUserInfo userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
public MarkerLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(MarkerLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerShareMusic{" +
|
||||
"bookInfo='" + bookInfo + '\'' +
|
||||
", id=" + id +
|
||||
", likeNumber=" + likeNumber +
|
||||
", location=" + location +
|
||||
", mediaId='" + mediaId + '\'' +
|
||||
", mediaImg='" + mediaImg + '\'' +
|
||||
", mediaName='" + mediaName + '\'' +
|
||||
", mediaSinger='" + mediaSinger + '\'' +
|
||||
", mediaUrl='" + mediaUrl + '\'' +
|
||||
", shareContentText='" + shareContentText + '\'' +
|
||||
", shareType=" + shareType +
|
||||
", type='" + type + '\'' +
|
||||
", userInfo=" + userInfo +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-1015:47
|
||||
* desc : 用来跟Marker View 绑定使用,内容、状态等设置
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MarkerShowEntity {
|
||||
|
||||
// false - 没选中,true - 选中
|
||||
private boolean isChecked;
|
||||
// false - 非高亮,true - 高亮
|
||||
private boolean isHighlighted;
|
||||
// icon 地址,例如:头像,唱片图片,探路缩略,可能为空展示默认图
|
||||
private String iconUrl;
|
||||
// 要展示的文本
|
||||
private String textContent;
|
||||
// Marker 类型
|
||||
private String markerType;
|
||||
// 绑定 MarkerView 的数据
|
||||
private Object bindObj;
|
||||
//Marker 经纬度位置信息
|
||||
private MarkerLocation markerLocation;
|
||||
private IMogoMarker mMarker;
|
||||
|
||||
public boolean isChecked() {
|
||||
return isChecked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
isChecked = checked;
|
||||
}
|
||||
|
||||
public boolean isHighlighted() {
|
||||
return isHighlighted;
|
||||
}
|
||||
|
||||
public void setHighlighted(boolean highlighted) {
|
||||
isHighlighted = highlighted;
|
||||
}
|
||||
|
||||
public String getIconUrl() {
|
||||
return iconUrl;
|
||||
}
|
||||
|
||||
public void setIconUrl(String iconUrl) {
|
||||
this.iconUrl = iconUrl;
|
||||
}
|
||||
|
||||
public String getTextContent() {
|
||||
if (TextUtils.isEmpty(textContent)) {
|
||||
return "";
|
||||
}
|
||||
return textContent;
|
||||
}
|
||||
|
||||
public void setTextContent(String textContent) {
|
||||
this.textContent = textContent;
|
||||
}
|
||||
|
||||
public String getMarkerType() {
|
||||
return markerType;
|
||||
}
|
||||
|
||||
public void setMarkerType(String markerType) {
|
||||
this.markerType = markerType;
|
||||
}
|
||||
|
||||
public Object getBindObj() {
|
||||
return bindObj;
|
||||
}
|
||||
|
||||
public void setBindObj(Object bindObj) {
|
||||
this.bindObj = bindObj;
|
||||
}
|
||||
|
||||
public MarkerLocation getMarkerLocation() {
|
||||
return markerLocation;
|
||||
}
|
||||
|
||||
public void setMarkerLocation(MarkerLocation markerLocation) {
|
||||
this.markerLocation = markerLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MarkerShowEntity that = (MarkerShowEntity) o;
|
||||
return Objects.equals(iconUrl, that.iconUrl) &&
|
||||
Objects.equals(textContent, that.textContent) &&
|
||||
Objects.equals(markerType, that.markerType) &&
|
||||
Objects.equals(bindObj, that.bindObj) &&
|
||||
Objects.equals(markerLocation, that.markerLocation);
|
||||
}
|
||||
|
||||
public void setMarker( IMogoMarker marker ) {
|
||||
this.mMarker = marker;
|
||||
}
|
||||
|
||||
public IMogoMarker getMarker() {
|
||||
return mMarker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(iconUrl, textContent, markerType, bindObj, markerLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerShowEntity{" +
|
||||
"isChecked=" + isChecked +
|
||||
", isHighlighted=" + isHighlighted +
|
||||
", iconUrl='" + iconUrl + '\'' +
|
||||
", textContent='" + textContent + '\'' +
|
||||
", markerType='" + markerType + '\'' +
|
||||
", bindObj=" + bindObj +
|
||||
", markerLocation=" + markerLocation +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,208 +0,0 @@
|
||||
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Calendar;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MarkerUserInfo implements Serializable {
|
||||
|
||||
private String sn;
|
||||
private long userId;
|
||||
private String userName;//用户昵称
|
||||
private String userHead;//用户头像
|
||||
private String gender;//gender": "男|女|无(也可以0|1|2根据实际库存返回即可)
|
||||
private Integer age;// 年龄段,可以为空,与车聊聊一致
|
||||
|
||||
// TODO V2X临时字段,接口出好后进行修改
|
||||
private String lastActiveweekAvgscore;//末次活跃周驾驶行为平均得分
|
||||
private String safeLabel;//车辆安全标签
|
||||
private int safeLabelType;//1老司机 2安全驾驶 3危险驾驶
|
||||
|
||||
public void setAge(Integer age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public int getAgeNumber() {
|
||||
if (age != null) {
|
||||
return age;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public String getAge() {
|
||||
try {
|
||||
if (getAgeNumber() >= 0) {
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
int year = cal.get(Calendar.YEAR);
|
||||
|
||||
//2020-30=1990
|
||||
double ageDiffer = year - getAgeNumber();
|
||||
String ageStr = "" + ageDiffer;
|
||||
char[] ageChars = ageStr.toCharArray();
|
||||
|
||||
//1990
|
||||
char ageChar = ageChars[2];
|
||||
|
||||
String ageString = "未设置";
|
||||
|
||||
switch (ageChar) {
|
||||
case '0':
|
||||
ageString = "00后";
|
||||
break;
|
||||
case '1':
|
||||
ageString = "10后";
|
||||
break;
|
||||
case '2':
|
||||
ageString = "20后";
|
||||
break;
|
||||
case '3':
|
||||
ageString = "30后";
|
||||
break;
|
||||
case '4':
|
||||
ageString = "40后";
|
||||
break;
|
||||
case '5':
|
||||
ageString = "50后";
|
||||
break;
|
||||
case '6':
|
||||
ageString = "60后";
|
||||
break;
|
||||
case '7':
|
||||
ageString = "70后";
|
||||
break;
|
||||
case '8':
|
||||
ageString = "80后";
|
||||
break;
|
||||
case '9':
|
||||
ageString = "90后";
|
||||
break;
|
||||
}
|
||||
|
||||
return ageString;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public int getGenderValue() {
|
||||
if (!TextUtils.isEmpty(gender)) {
|
||||
if ("男".equals(gender)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
if (TextUtils.isEmpty(gender)) {
|
||||
return "未设置";
|
||||
}
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public void setGender(int gender) {
|
||||
if (gender == 0) {
|
||||
this.gender = "男";
|
||||
} else {
|
||||
this.gender = "女";
|
||||
}
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
if (TextUtils.isEmpty(sn)) {
|
||||
return "";
|
||||
}
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getUserHead() {
|
||||
if (TextUtils.isEmpty(userHead)) {
|
||||
return "";
|
||||
}
|
||||
return userHead;
|
||||
}
|
||||
|
||||
public void setUserHead(String userHead) {
|
||||
this.userHead = userHead;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
if (TextUtils.isEmpty(userName)) {
|
||||
return "用户未设置昵称";
|
||||
}
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public void setUserId(long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getLastActiveweekAvgscore() {
|
||||
return lastActiveweekAvgscore;
|
||||
}
|
||||
|
||||
public void setLastActiveweekAvgscore(String lastActiveweekAvgscore) {
|
||||
this.lastActiveweekAvgscore = lastActiveweekAvgscore;
|
||||
}
|
||||
|
||||
public String getSafeLabel() {
|
||||
return safeLabel;
|
||||
}
|
||||
|
||||
public void setSafeLabel(String safeLabel) {
|
||||
this.safeLabel = safeLabel;
|
||||
}
|
||||
|
||||
public int getSafeLabelType() {
|
||||
return safeLabelType;
|
||||
}
|
||||
|
||||
public void setSafeLabelType(int safeLabelType) {
|
||||
this.safeLabelType = safeLabelType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerUserInfo{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", userId=" + userId +
|
||||
", userName='" + userName + '\'' +
|
||||
", userHead='" + userHead + '\'' +
|
||||
", gender='" + gender + '\'' +
|
||||
", age=" + age +
|
||||
", lastActiveweekAvgscore='" + lastActiveweekAvgscore + '\'' +
|
||||
", safeLabel='" + safeLabel + '\'' +
|
||||
", safeLabelType=" + safeLabelType +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import com.mogo.utils.sqlite.annotation.DbDatabase;
|
||||
import com.mogo.utils.sqlite.annotation.DbField;
|
||||
import com.mogo.utils.sqlite.annotation.DbTable;
|
||||
|
||||
/**
|
||||
* V2X 被点赞的事件
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
@DbDatabase(dbName = "MoGoScenario.db")
|
||||
@DbTable(tableName = "tb_event_zan")
|
||||
public class V2XEventZanData {
|
||||
|
||||
/**
|
||||
* 事件ID
|
||||
*/
|
||||
@DbField(fieldName = "eventId")
|
||||
public String eventId;
|
||||
|
||||
/**
|
||||
* 触发时间
|
||||
*/
|
||||
@DbField(fieldName = "triggerTime")
|
||||
public Long triggerTime;
|
||||
|
||||
public String getEventId() {
|
||||
return eventId;
|
||||
}
|
||||
|
||||
public void setEventId(String eventId) {
|
||||
this.eventId = eventId;
|
||||
}
|
||||
|
||||
public Long getTriggerTime() {
|
||||
return triggerTime;
|
||||
}
|
||||
|
||||
public void setTriggerTime(Long triggerTime) {
|
||||
this.triggerTime = triggerTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XEventZanData{" +
|
||||
"eventId=" + eventId +
|
||||
", triggerTime=" + triggerTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import com.mogo.module.common.constants.RoomConstants;
|
||||
import com.mogo.utils.sqlite.annotation.DbDatabase;
|
||||
import com.mogo.utils.sqlite.annotation.DbField;
|
||||
import com.mogo.utils.sqlite.annotation.DbTable;
|
||||
|
||||
/**
|
||||
* V2X 道路历史事件
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
@DbDatabase(dbName = RoomConstants.DB_NAME_V2X)
|
||||
@DbTable(tableName = RoomConstants.TB_NAME_SCENARIO)
|
||||
public class V2XHistoryScenarioData {
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@DbField(fieldName = "scenarioType")
|
||||
public Integer scenarioType;
|
||||
|
||||
/**
|
||||
* 事件触发时间
|
||||
*/
|
||||
@DbField(fieldName = "triggerTime")
|
||||
public Long triggerTime;
|
||||
|
||||
/**
|
||||
* 事件json
|
||||
*/
|
||||
@DbField(fieldName = "eventJsonData")
|
||||
public String eventJsonData;
|
||||
|
||||
/**
|
||||
* 事件json HashCode
|
||||
* 只取json中的几个代表性字段,表示唯一性,因为图片地址会经常被改变
|
||||
*/
|
||||
@DbField(fieldName = "eventJsonDataHashCode")
|
||||
public Integer eventJsonDataHashCode;
|
||||
|
||||
/**
|
||||
* 事件是否被处理过了,true-处理过了。false-未处理过
|
||||
*/
|
||||
@DbField(fieldName = "isDispose")
|
||||
public Boolean isDispose;
|
||||
|
||||
public Integer getScenarioType() {
|
||||
return scenarioType;
|
||||
}
|
||||
|
||||
public void setScenarioType(Integer scenarioType) {
|
||||
this.scenarioType = scenarioType;
|
||||
}
|
||||
|
||||
public String getEventJsonData() {
|
||||
return eventJsonData;
|
||||
}
|
||||
|
||||
public void setEventJsonData(String eventJsonData) {
|
||||
this.eventJsonData = eventJsonData;
|
||||
}
|
||||
|
||||
public Long getTriggerTime() {
|
||||
return triggerTime;
|
||||
}
|
||||
|
||||
public void setTriggerTime(Long triggerTime) {
|
||||
this.triggerTime = triggerTime;
|
||||
}
|
||||
|
||||
public Boolean isDispose() {
|
||||
return isDispose;
|
||||
}
|
||||
|
||||
public void setDispose(Boolean dispose) {
|
||||
isDispose = dispose;
|
||||
}
|
||||
|
||||
public Integer getEventJsonDataHashCode() {
|
||||
return eventJsonDataHashCode;
|
||||
}
|
||||
|
||||
public void setEventJsonDataHashCode(Integer eventJsonDataHashCode) {
|
||||
this.eventJsonDataHashCode = eventJsonDataHashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V2XHistoryScenarioData clone() {
|
||||
try {
|
||||
return (V2XHistoryScenarioData) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 可直播车机基本信息,再通过 appDataService/integratedServices/app/push/no/livePush/v1
|
||||
* 获取直播信息
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XLiveCarInfoEntity {
|
||||
private String sn;
|
||||
private double lon;
|
||||
private double lat;
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
V2XLiveCarInfoEntity that = (V2XLiveCarInfoEntity) o;
|
||||
return Double.compare(that.lon, lon) == 0 &&
|
||||
Double.compare(that.lat, lat) == 0 &&
|
||||
Objects.equals(sn, that.sn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(sn, lon, lat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XLiveCarEntity{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 4:35 PM
|
||||
* desc : V2X 场景消息聚合
|
||||
* version: 1.0
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XMessageEntity<T> implements Serializable {
|
||||
|
||||
/**
|
||||
* 场景类型
|
||||
*
|
||||
* @see V2XTypeEnum
|
||||
*/
|
||||
@MessageType
|
||||
int type;
|
||||
|
||||
/**
|
||||
* 是否展示对话框
|
||||
* true-展示,false-不展示
|
||||
*/
|
||||
boolean showState;
|
||||
|
||||
/**
|
||||
* 是否需要判断重复事件
|
||||
* true-判断,false-不判断
|
||||
* 默认需要判断
|
||||
*/
|
||||
boolean isNeedCompareSameScenario = true;
|
||||
|
||||
//是否播报tts
|
||||
private boolean onlyShow = false;
|
||||
|
||||
//本机与事件是否连线
|
||||
private boolean needAddLine = true;
|
||||
|
||||
/**
|
||||
* 场景具体的数据内容
|
||||
*/
|
||||
T content;
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(@MessageType int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean isShowState() {
|
||||
return showState;
|
||||
}
|
||||
|
||||
public void setShowState(boolean showState) {
|
||||
this.showState = showState;
|
||||
}
|
||||
|
||||
public boolean isNeedCompareSameScenario() {
|
||||
return isNeedCompareSameScenario;
|
||||
}
|
||||
|
||||
public void setNeedCompareSameScenario(boolean needCompareSameScenario) {
|
||||
isNeedCompareSameScenario = needCompareSameScenario;
|
||||
}
|
||||
|
||||
public T getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(T content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
V2XMessageEntity<?> that = (V2XMessageEntity<?>) o;
|
||||
return type == that.type &&
|
||||
content.equals(that.content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(type, content);
|
||||
}
|
||||
|
||||
public boolean isOnlyShow() {
|
||||
return onlyShow;
|
||||
}
|
||||
|
||||
public void setOnlyShow(boolean onlyShow) {
|
||||
this.onlyShow = onlyShow;
|
||||
}
|
||||
|
||||
public boolean isNeedAddLine() {
|
||||
return needAddLine;
|
||||
}
|
||||
|
||||
public void setNeedAddLine(boolean needAddLine) {
|
||||
this.needAddLine = needAddLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* V2X 场景类型
|
||||
*/
|
||||
public interface V2XTypeEnum {
|
||||
// 默认展示详情
|
||||
int DEFAULT_WINDOW = 0;
|
||||
// 道路事件预警
|
||||
int ALERT_ROAD_WARNING = 1_000;
|
||||
// 他车求助预警
|
||||
int ALERT_SEEK_WARNING = 1_001;
|
||||
// 疲劳驾驶预警
|
||||
int ALERT_FATIGUE_DRIVING = 1_002;
|
||||
// 后台推送展示 Window
|
||||
int ALERT_PUSH_WINDOW_WARNING = 1_003;
|
||||
// 后台推送展示 Toast
|
||||
int ALERT_PUSH_TOAST_WARNING = 1_004;
|
||||
// 后台推送展示 展示的直播
|
||||
int ALERT_PUSH_LIVE_CAR_WARNING = 1_005;
|
||||
// V2X场景动画展示
|
||||
int ALERT_ANIMATION_WARNING = 1_006;
|
||||
// 道路事件直播预警
|
||||
int ALERT_ROAD_LIVE_CAR_WARNING = 1_007;
|
||||
// 道路事件违章停车
|
||||
int ALERT_ILLEGAL_PARK_WARNING = 1_008;
|
||||
// 用户UGC反馈事件准确性弹窗
|
||||
int ALERT_EVENT_UGC_WARNING = 1_009;
|
||||
// 呼叫、请求直播事件
|
||||
int ALERT_VOICE_CALL_FOR_LIVECAR_SHOW = 1_010;
|
||||
// 基于预判目的地道路事件的路线推荐
|
||||
int ALERT_RECOMMEND_ROUTE = 1_011;
|
||||
// 基于预判目的地违章高发停车场推荐
|
||||
int ALERT_RECOMMEND_PARKING = 1_012;
|
||||
// 弱势交通参与者401018
|
||||
int ALERT_THE_FRONT_WEAKNESS = 40_1018;
|
||||
// 关闭红色边框预警
|
||||
int ALERT_THE_FRONT_CRASH_WARNING_NON = 0;
|
||||
// 前方行人碰撞预警
|
||||
int ALERT_THE_FRONT_CRASH_WARNING_TOP = 1;
|
||||
// 后方碰撞预警
|
||||
int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM = 2;
|
||||
// 左前方碰撞预警
|
||||
int ALERT_THE_FRONT_CRASH_WARNING_LEFT = 3;
|
||||
// 右前方碰撞预警
|
||||
int ALERT_THE_FRONT_CRASH_WARNING_RIGHT = 4;
|
||||
// 左后方碰撞预警
|
||||
int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_LEFT = 5;
|
||||
// 右后方碰撞预警
|
||||
int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_RIGHT = 6;
|
||||
|
||||
// 推送VR消息展示
|
||||
int ALERT_PUSH_VR_SHOW = 2_000;
|
||||
// 自车求助
|
||||
int ALERT_CAR_FOR_HELP = 8_000;
|
||||
// obu事件
|
||||
int ALERT_OBU_EVENT = 9_000;
|
||||
}
|
||||
|
||||
@IntDef(value = {
|
||||
V2XTypeEnum.ALERT_ROAD_WARNING,
|
||||
V2XTypeEnum.ALERT_SEEK_WARNING,
|
||||
V2XTypeEnum.ALERT_FATIGUE_DRIVING,
|
||||
V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING,
|
||||
V2XTypeEnum.ALERT_PUSH_TOAST_WARNING,
|
||||
V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING,
|
||||
V2XTypeEnum.ALERT_ANIMATION_WARNING,
|
||||
V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING,
|
||||
V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING,
|
||||
V2XTypeEnum.ALERT_EVENT_UGC_WARNING,
|
||||
V2XTypeEnum.ALERT_CAR_FOR_HELP,
|
||||
V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW,
|
||||
V2XTypeEnum.ALERT_RECOMMEND_ROUTE,
|
||||
V2XTypeEnum.ALERT_RECOMMEND_PARKING,
|
||||
V2XTypeEnum.ALERT_PUSH_VR_SHOW,
|
||||
V2XTypeEnum.ALERT_OBU_EVENT,
|
||||
V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS,
|
||||
})
|
||||
@Target({
|
||||
ElementType.PARAMETER,
|
||||
ElementType.FIELD,
|
||||
ElementType.METHOD,
|
||||
}) //表示注解作用范围,参数注解,成员注解,方法注解
|
||||
@Retention(RetentionPolicy.SOURCE) //表示注解所存活的时间,在运行时,而不会存在 .class 文件中
|
||||
public @interface MessageType { //接口,定义新的注解类型
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XMessageEntity{" +
|
||||
"type=" + type +
|
||||
", showState=" + showState +
|
||||
", isNeedCompareSameScenario=" + isNeedCompareSameScenario +
|
||||
", onlyShow=" + onlyShow +
|
||||
", needAddLine=" + needAddLine +
|
||||
", content=" + content +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/13 11:17 AM
|
||||
* desc : 道路事件的聚合,位置、详情,用于V2X情况下展示
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XRoadEventEntity implements Serializable {
|
||||
/**
|
||||
* @see EventTypeEnum
|
||||
*/
|
||||
// 事件类型
|
||||
private String poiType;
|
||||
// 事件位置
|
||||
private MarkerLocation location;
|
||||
// 具体的信息
|
||||
private MarkerExploreWay noveltyInfo;
|
||||
// tts 提示
|
||||
private String tts;
|
||||
|
||||
// ADAS 展示文案
|
||||
private String alarmContent;
|
||||
// 距离当前车辆的距离
|
||||
private double distance;
|
||||
// 默认展示时间
|
||||
private int expireTime;
|
||||
// 展示Button
|
||||
private boolean isShowEventButton;
|
||||
// 绑定 MarkerView 的数据, 业务需要啥数据就传入啥数据
|
||||
private Object bindObj;
|
||||
|
||||
public MarkerLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(MarkerLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getPoiType() {
|
||||
if (TextUtils.isEmpty(poiType)) {
|
||||
return "";
|
||||
}
|
||||
return poiType;
|
||||
}
|
||||
|
||||
public void setPoiType(String poiType) {
|
||||
this.poiType = poiType;
|
||||
}
|
||||
|
||||
public String getTts(boolean haveLiveCar) {
|
||||
if (EventTypeEnum.GHOST_PROBE.getPoiType().equals(poiType)) {
|
||||
tts = EventTypeEnum.GHOST_PROBE.getTts();
|
||||
return tts;
|
||||
}
|
||||
tts = "前方#" + (int) getDistance() + "米#";
|
||||
tts += EventTypeEnum.getTts(getPoiType());
|
||||
if (haveLiveCar) {
|
||||
tts += ",查看实况请说确定。";
|
||||
setShowEventButton(true);
|
||||
} else {
|
||||
tts += ",请注意躲避。";
|
||||
setShowEventButton(false);
|
||||
}
|
||||
return tts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测到附近#道路施工#,确认该信息是否正确?您可以说“正确”或“错误”帮助其他车友。
|
||||
*/
|
||||
public String getTtsWithFeedback() {
|
||||
tts = "检测到附近";
|
||||
tts += EventTypeEnum.getTtsWithFeedback(getPoiType());
|
||||
tts += ",确认该信息是否正确?您可以说“正确”或“错误”帮助其他车友。";
|
||||
return tts;
|
||||
}
|
||||
|
||||
public String getTts() {
|
||||
return tts;
|
||||
}
|
||||
|
||||
public void setTts(String tts) {
|
||||
this.tts = tts;
|
||||
}
|
||||
|
||||
public boolean isShowEventButton() {
|
||||
return isShowEventButton;
|
||||
}
|
||||
|
||||
public void setShowEventButton(boolean showEventButton) {
|
||||
isShowEventButton = showEventButton;
|
||||
}
|
||||
|
||||
public String getAlarmContent() {
|
||||
alarmContent = EventTypeEnum.getAlarmContent(getPoiType());
|
||||
return alarmContent;
|
||||
}
|
||||
|
||||
public void setAlarmContent(String alarmContent) {
|
||||
this.alarmContent = alarmContent;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(double distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public int getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public void setExpireTime(int expireTime) {
|
||||
this.expireTime = expireTime;
|
||||
}
|
||||
|
||||
public MarkerExploreWay getNoveltyInfo() {
|
||||
return noveltyInfo;
|
||||
}
|
||||
|
||||
public void setNoveltyInfo(MarkerExploreWay noveltyInfo) {
|
||||
this.noveltyInfo = noveltyInfo;
|
||||
}
|
||||
|
||||
public Object getBindObj() {
|
||||
return bindObj;
|
||||
}
|
||||
|
||||
public void setBindObj(Object bindObj) {
|
||||
this.bindObj = bindObj;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
V2XRoadEventEntity that = (V2XRoadEventEntity) o;
|
||||
return Objects.equals(noveltyInfo.getInfoId(), that.noveltyInfo.getInfoId()) &&
|
||||
Objects.equals(poiType, that.poiType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(poiType, noveltyInfo.getInfoId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XRoadEventEntity{" +
|
||||
"poiType='" + poiType + '\'' +
|
||||
", location=" + location +
|
||||
", noveltyInfo=" + noveltyInfo +
|
||||
", tts='" + tts + '\'' +
|
||||
", alarmContent='" + alarmContent + '\'' +
|
||||
", distance=" + distance +
|
||||
", expireTime=" + expireTime +
|
||||
", isShowEventButton=" + isShowEventButton +
|
||||
", bindObj=" + bindObj +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,268 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 预警目标物数据模型
|
||||
* @since: 2021/3/26
|
||||
*/
|
||||
public class V2XWarningEntity implements Serializable {
|
||||
|
||||
//事件类型 行人1/自行车2/摩托车4/骑行车辆11
|
||||
private int type;
|
||||
//目标物位置
|
||||
private double lat;
|
||||
private double lon;
|
||||
//目标物颜色
|
||||
public String targetColor;
|
||||
//目标物距离
|
||||
private double distance;
|
||||
//预测碰撞点位置
|
||||
private double collisionLat;
|
||||
private double collisionLon;
|
||||
//朝向 角度
|
||||
private double angle;
|
||||
//方位 前 后 左 右
|
||||
private int direction;
|
||||
//速度
|
||||
private float speed;
|
||||
//停止线经纬度
|
||||
private List<MogoLatLng> stopLines;
|
||||
//自车到停止线距离
|
||||
private double stopLineDistance;
|
||||
//道路唯一标识
|
||||
public String roadId;
|
||||
//车道唯一标识
|
||||
public String laneId;
|
||||
//识别物体唯一标识
|
||||
public String uuid;
|
||||
//红绿灯颜色
|
||||
public String color;
|
||||
//车ID 暂不使用
|
||||
public String carId;
|
||||
//预警文案
|
||||
private String warningContent;
|
||||
//车头朝向
|
||||
public double heading;
|
||||
//系统时间 暂时没用
|
||||
public long systemTime;
|
||||
//定位卫星时间 暂时没用
|
||||
public long satelliteTime;
|
||||
//预警蒙层等展示时长
|
||||
private long showTime;
|
||||
//设计划线宽度与道路同宽
|
||||
private float roadwidth;
|
||||
|
||||
//自组字段
|
||||
//tts播报
|
||||
private String tts;
|
||||
//自车位置
|
||||
private MogoLatLng carLocation;
|
||||
|
||||
public MogoLatLng getCarLocation() {
|
||||
return carLocation;
|
||||
}
|
||||
|
||||
public void setTts(int type) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
case 11:
|
||||
this.tts = "注意行人";
|
||||
break;
|
||||
case 2:
|
||||
this.tts = "注意自行车";
|
||||
break;
|
||||
case 4:
|
||||
this.tts = "注意摩托车";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setDistance(double distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setCollisionLat(double collisionLat) {
|
||||
this.collisionLat = collisionLat;
|
||||
}
|
||||
|
||||
public void setCollisionLon(double collisionLon) {
|
||||
this.collisionLon = collisionLon;
|
||||
}
|
||||
|
||||
public void setAngle(double angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public void setDirection(int direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public void setTts(String tts) {
|
||||
this.tts = tts;
|
||||
}
|
||||
|
||||
public void setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public long getShowTime() {
|
||||
return showTime;
|
||||
}
|
||||
|
||||
public void setShowTime(long showTime) {
|
||||
this.showTime = showTime;
|
||||
}
|
||||
|
||||
|
||||
public void setStopLineDistance(double stopLineDistance) {
|
||||
this.stopLineDistance = stopLineDistance;
|
||||
}
|
||||
|
||||
public void setWarningContent(String warningContent) {
|
||||
this.warningContent = warningContent;
|
||||
}
|
||||
|
||||
public void setStopLines(List<MogoLatLng> stopLines) {
|
||||
this.stopLines = stopLines;
|
||||
}
|
||||
|
||||
public void setCarLocation(MogoLatLng carLocation) {
|
||||
this.carLocation = carLocation;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getCollisionLat() {
|
||||
return collisionLat;
|
||||
}
|
||||
|
||||
public double getCollisionLon() {
|
||||
return collisionLon;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public double getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public int getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public String getWarningContent() {
|
||||
return warningContent;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public long getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public long getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
|
||||
public String getTts() {
|
||||
if (warningContent == null) {
|
||||
setTts(type);
|
||||
return tts;
|
||||
}
|
||||
return warningContent;
|
||||
}
|
||||
|
||||
public double getStopLineDistance() {
|
||||
return stopLineDistance;
|
||||
}
|
||||
|
||||
public List<MogoLatLng> getStopLines() {
|
||||
return stopLines;
|
||||
}
|
||||
|
||||
public float getRoadwidth() {
|
||||
return roadwidth;
|
||||
}
|
||||
|
||||
public void setRoadwidth(float roadwidth) {
|
||||
this.roadwidth = roadwidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XWarningEntity{" +
|
||||
"type=" + type +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", targetColor='" + targetColor + '\'' +
|
||||
", distance=" + distance +
|
||||
", collisionLat=" + collisionLat +
|
||||
", collisionLon=" + collisionLon +
|
||||
", angle=" + angle +
|
||||
", direction=" + direction +
|
||||
", speed=" + speed +
|
||||
", stopLines=" + stopLines +
|
||||
", stopLineDistance=" + stopLineDistance +
|
||||
", roadId='" + roadId + '\'' +
|
||||
", laneId='" + laneId + '\'' +
|
||||
", uuid='" + uuid + '\'' +
|
||||
", color='" + color + '\'' +
|
||||
", carId='" + carId + '\'' +
|
||||
", warningContent='" + warningContent + '\'' +
|
||||
", heading=" + heading +
|
||||
", systemTime=" + systemTime +
|
||||
", satelliteTime=" + satelliteTime +
|
||||
", showTime=" + showTime +
|
||||
", roadwidth=" + roadwidth +
|
||||
", tts='" + tts + '\'' +
|
||||
", carLocation=" + carLocation +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,843 +0,0 @@
|
||||
package com.mogo.module.common.enums
|
||||
|
||||
import com.mogo.module.common.R
|
||||
import com.mogo.module.common.utils.CloudPoiManager
|
||||
import com.zhidao.support.obu.constants.ObuConstants
|
||||
|
||||
/**
|
||||
* OBU、V2N事件类型枚举类
|
||||
*/
|
||||
enum class EventTypeEnum(
|
||||
val poiType: String, val poiTypeStr: String = "",
|
||||
val poiTypeStrVr: String = "",
|
||||
val poiTypeSrcVr: Int = R.drawable.v2x_icon_live_logo,
|
||||
val content: String = "", val tts: String = ""
|
||||
) {
|
||||
|
||||
//交通检查
|
||||
TRAFFIC_CHECK(
|
||||
"10002", "交通检查", "前方交通检查",
|
||||
R.drawable.v2x_icon_jiaotongjiancha_vr, "前方交通检查", "交通检查"
|
||||
),
|
||||
|
||||
//封路
|
||||
ROAD_CLOSED(
|
||||
"10003", "封路", "前方封路", R.drawable.v2x_icon_fenglu_vr,
|
||||
"前方封路", "道路封路"
|
||||
),
|
||||
|
||||
//施工
|
||||
FOURS_ROAD_WORK(
|
||||
"10006", "道路施工", "道路施工", R.drawable.icon_warning_v2x_road_construction,
|
||||
"道路施工", "道路施工"
|
||||
),
|
||||
|
||||
//施工-AI云下发
|
||||
AI_ROAD_WORK(
|
||||
"100061", "道路施工", "道路施工", R.drawable.icon_warning_v2x_road_construction,
|
||||
"道路施工", "道路施工"
|
||||
),
|
||||
|
||||
//拥堵
|
||||
FOURS_BLOCK_UP(
|
||||
"10007", "道路拥堵", "前方拥堵", R.drawable.icon_warning_v2x_congestion,
|
||||
"前方道路拥堵", "道路拥堵"
|
||||
),
|
||||
|
||||
//积水
|
||||
FOURS_PONDING(
|
||||
"10008", "道路积水", "前方道路积水", R.drawable.v2x_icon_jishui_vr,
|
||||
"前方道路积水", "道路积水"
|
||||
),
|
||||
|
||||
//浓雾
|
||||
FOURS_FOG(
|
||||
"10010", "出现浓雾", "浓雾预警", R.drawable.v2x_icon_nongwu_vr,
|
||||
"前方出现浓雾", "出现浓雾"
|
||||
),
|
||||
|
||||
//结冰
|
||||
FOURS_ICE(
|
||||
"10011", "路面结冰", "路面结冰", R.drawable.v2x_icon_jiebing_vr,
|
||||
"前方路面结冰", "路面结冰"
|
||||
),
|
||||
|
||||
//事故
|
||||
FOURS_ACCIDENT(
|
||||
"10013", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
|
||||
"前方交通事故", "交通事故"
|
||||
),
|
||||
|
||||
//重大事故
|
||||
FOURS_ACCIDENT_01(
|
||||
"1001301", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
|
||||
"前方交通事故", "交通事故"
|
||||
),
|
||||
|
||||
//特大事故
|
||||
FOURS_ACCIDENT_02(
|
||||
"1001302", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
|
||||
"前方交通事故", "交通事故"
|
||||
),
|
||||
|
||||
//较大事故
|
||||
FOURS_ACCIDENT_03(
|
||||
"1001303", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
|
||||
"前方交通事故", "交通事故"
|
||||
),
|
||||
|
||||
//一般事故
|
||||
FOURS_ACCIDENT_04(
|
||||
"1001304", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
|
||||
"前方交通事故", "交通事故"
|
||||
),
|
||||
|
||||
//轻微事故
|
||||
FOURS_ACCIDENT_05(
|
||||
"1001305", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
|
||||
"前方交通事故", "交通事故"
|
||||
),
|
||||
|
||||
//实时路况
|
||||
FOURS_LIVING("10015", "实时路况"),
|
||||
|
||||
//违章停车
|
||||
ILLEGAL_PARK_LIVING("10016"),
|
||||
|
||||
//路面湿滑
|
||||
ROAD_SLIPPERY("10021"),
|
||||
|
||||
//鬼探头类型
|
||||
GHOST_PROBE("10024", "前方盲区行人预警", "前方盲区行人预警", R.drawable.icon_warning_v2x_pedestrian_crossing,
|
||||
"前方盲区行人通行,请注意", "前方盲区即将有行人通过,请减速慢行"),
|
||||
|
||||
//接管
|
||||
TAKE_OVER_EVENT(
|
||||
"20000", "注意周围、立即接管", "注意周围、立即接管", R.drawable.icon_warning_take_over,
|
||||
"注意周围、立即接管", "自动驾驶退出请立即接管"
|
||||
),
|
||||
|
||||
// 前方静止or慢速车辆报警
|
||||
ALERT_FRONT_CAR("99999"),
|
||||
|
||||
// 限行管理
|
||||
ALERT_TRAFFIC_CONTROL("99998"),
|
||||
|
||||
// 红绿灯事件、是建议以多少速度驶过
|
||||
ALERT_TRAFFIC_LIGHT_SUGGEST("99997"),
|
||||
|
||||
// 红绿灯事件、一种是绿灯不足3秒
|
||||
ALERT_TRAFFIC_LIGHT_WARNING("99996"),
|
||||
|
||||
// 故障车辆
|
||||
ALERT_CAR_TROUBLE_WARNING("20007"),
|
||||
|
||||
// 疲劳驾驶
|
||||
ALERT_FATIGUE_DRIVING("99993"),
|
||||
|
||||
// 违章停车
|
||||
ALERT_ILLEGAL_PARK("99992"),
|
||||
|
||||
TYPE_USECASE_ID_EBW(
|
||||
ObuConstants.USE_CASE_ID.EBW.toString(),
|
||||
"紧急制动预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_emergency_brake,
|
||||
content = "前车急刹车",
|
||||
tts = "前车急刹车"
|
||||
),
|
||||
TYPE_USECASE_ID_FCW(
|
||||
ObuConstants.USE_CASE_ID.FCW.toString(),
|
||||
"前向碰撞预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
|
||||
content = "前车碰撞预警",
|
||||
tts = "小心前车"
|
||||
),
|
||||
TYPE_USECASE_ID_ICW(
|
||||
ObuConstants.USE_CASE_ID.ICW.toString(),
|
||||
"交叉路口碰撞预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
|
||||
content = "交叉路口碰撞预警",
|
||||
tts = "注意交叉路口车辆"
|
||||
),
|
||||
TYPE_USECASE_ID_CLW(
|
||||
ObuConstants.USE_CASE_ID.CLW.toString(),
|
||||
"车辆失控预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_vehicle_control,
|
||||
content = "前%s失控预警",
|
||||
tts = "小心%s失控车辆"
|
||||
),
|
||||
TYPE_USECASE_ID_DNPW(
|
||||
ObuConstants.USE_CASE_ID.DNPW.toString(),
|
||||
"逆向超车预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_reverse_overtaking,
|
||||
content = "逆向超车预警",
|
||||
tts = "注意对向来车"
|
||||
),
|
||||
TYPE_USECASE_ID_AVW(
|
||||
ObuConstants.USE_CASE_ID.AVW.toString(),
|
||||
"异常车辆提醒",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
|
||||
content = "%s车异常",
|
||||
tts = "小心%s异常车辆"
|
||||
),
|
||||
TYPE_USECASE_ID_BSW(
|
||||
ObuConstants.USE_CASE_ID.BSW.toString(),
|
||||
"盲区预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_blind_area_collision,
|
||||
content = "%s后盲区预警",
|
||||
tts = "注意%s后车辆"
|
||||
),
|
||||
TYPE_USECASE_ID_LCW(
|
||||
ObuConstants.USE_CASE_ID.LCW.toString(),
|
||||
"变道预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_reverse_overtaking,
|
||||
content = "%s向变道预警",
|
||||
tts = "注意%s后车辆"
|
||||
),//注意左后车辆/注意右后车辆
|
||||
TYPE_USECASE_ID_EVW(
|
||||
ObuConstants.USE_CASE_ID.EVW.toString(),
|
||||
"紧急车辆提醒",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_special_vehicle_access,
|
||||
content = "注意特种车辆通行",
|
||||
tts = "请避让特种车辆"
|
||||
),
|
||||
TYPE_USECASE_ID_VRUCW_PERSON(
|
||||
0X2B0201.toString(),
|
||||
"弱势交通参与者碰撞预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_pedestrian_crossing,
|
||||
content = "注意行人",
|
||||
tts = "注意行人"
|
||||
),//行人/摩托车碰撞预警
|
||||
TYPE_USECASE_ID_VRUCW_MOTORBIKE(
|
||||
0X2B0202.toString(),
|
||||
"弱势交通参与者碰撞预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_motorcycle_collision,
|
||||
content = "注意摩托车",
|
||||
tts = "注意摩托车"
|
||||
),//摩托车碰撞预警
|
||||
TYPE_USECASE_ID_SLW(
|
||||
ObuConstants.USE_CASE_ID.SLW.toString(),
|
||||
"限速预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_over_speed,
|
||||
content = "已超速",
|
||||
tts = "已超速"
|
||||
),
|
||||
TYPE_USECASE_ID_LTA(
|
||||
ObuConstants.USE_CASE_ID.LTA.toString(),
|
||||
"左转辅助",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
|
||||
content = "左转碰撞预警",
|
||||
tts = "注意路口对向来车"
|
||||
),
|
||||
TYPE_USECASE_ID_HLW(
|
||||
ObuConstants.USE_CASE_ID.HLW.toString(),
|
||||
"道路危险情况预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_road_dangerous,
|
||||
content = "道路危险情况预警",
|
||||
tts = "前方路况危险,小心行驶"
|
||||
),//(如果能给出具体的类别,则播报具体危险类别)
|
||||
TYPE_USECASE_OPTIMAL_LANE(
|
||||
ObuConstants.USE_CASE_ID.HLW.toString(),
|
||||
"最优车道",
|
||||
poiTypeSrcVr = R.drawable.v2x_icon_live_logo,
|
||||
content = "最优车道",
|
||||
tts = "最优车道"
|
||||
),
|
||||
TYPE_USECASE_ID_IVS(
|
||||
ObuConstants.USE_CASE_ID.IVS.toString(),
|
||||
"车内标牌",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_road_construction,
|
||||
content = "车内标牌",
|
||||
tts = ""
|
||||
),
|
||||
TYPE_USECASE_ID_TJW(
|
||||
ObuConstants.USE_CASE_ID.TJW.toString(),
|
||||
"前方拥堵提醒",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_congestion,
|
||||
content = "前方%d米道路拥堵",
|
||||
tts = "前方拥堵,减速慢行"
|
||||
),
|
||||
TYPE_USECASE_ID_IVP(
|
||||
ObuConstants.USE_CASE_ID.IVP.toString(),
|
||||
"闯红灯预警",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_red,
|
||||
content = "路口红灯,禁止通行",
|
||||
tts = "路口红灯,禁止通行"
|
||||
),
|
||||
TYPE_USECASE_ID_IVP_GREEN(
|
||||
0x2B091.toString(),
|
||||
"绿波通行",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_green,
|
||||
content = "建议车速 %s KM/H",
|
||||
tts = "建议车速 %s KM/H"
|
||||
),
|
||||
TYPE_USECASE_ID_COC(
|
||||
ObuConstants.USE_CASE_ID.COC.toString(),
|
||||
"预留",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
|
||||
content = "路况预警",
|
||||
tts = "路况预警"
|
||||
),
|
||||
TYPE_USECASE_ID_ROAD_TRAMCAR(
|
||||
0x2C01.toString(),
|
||||
"前方有轨电车提醒",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_tramcar,
|
||||
content = "注意前方有轨电车",
|
||||
tts = "注意前方有轨电车驶过"
|
||||
),
|
||||
TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP(
|
||||
0x2C02.toString(),
|
||||
"前方左转急弯",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_turn_left_sharp,
|
||||
content = "注意前方左转急弯",
|
||||
tts = "前方路口左转急弯,减速慢行",
|
||||
),
|
||||
TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP(
|
||||
0x2C03.toString(),
|
||||
"前方右转急弯",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_turn_right_sharp,
|
||||
content = "注意前方右转急弯",
|
||||
tts = "前方路口右转急弯,减速慢行"
|
||||
),
|
||||
TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING(
|
||||
0x2C04.toString(),
|
||||
"人行横道",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_pedestrian_crossing,
|
||||
content = "注意前方人行横道",
|
||||
tts = "前方人行横道,减速慢行"
|
||||
),
|
||||
TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL(
|
||||
0x2C05.toString(),
|
||||
"学校",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_school,
|
||||
content = "注意前方学校",
|
||||
tts = "前方学校,减速慢行"
|
||||
),
|
||||
TYPE_USECASE_ID_ROAD_COLLISION_WARNING(
|
||||
0x2C06.toString(),
|
||||
"事故易发路段",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
|
||||
content = "注意当前路段事故多发",
|
||||
tts = "当前路段事故多发,请小心驾驶"
|
||||
),
|
||||
TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG(
|
||||
0x2C07.toString(),
|
||||
"环岛行驶",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_roundaboutpng,
|
||||
content = "注意前方驶入环岛",
|
||||
tts = "即将驶入环岛,减速慢行"
|
||||
),
|
||||
TYPE_USECASE_ID_ROAD_TEST_SECTION(
|
||||
0x2C08.toString(),
|
||||
"驾校考试路段",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_test_section,
|
||||
content = "注意前方驾校考试路段",
|
||||
tts = "驾校考试路段,请小心驾驶"
|
||||
),
|
||||
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE(
|
||||
0x2C09.toString(),
|
||||
"驼峰桥",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_hump_bridge,
|
||||
content = "注意前方驼峰桥",
|
||||
tts = "注意即将驶入驼峰桥,请小心驾驶"
|
||||
),
|
||||
TYPE_USECASE_ID_ROAD_NO_PARKING(
|
||||
0x2C10.toString(),
|
||||
"禁止停车",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_no_parking,
|
||||
content = "注意当前路段禁止停车",
|
||||
tts = "当前路段,禁止停车"
|
||||
),
|
||||
TYPE_USECASE_ID_ROAD_GIVE_WAY(
|
||||
0x2C11.toString(),
|
||||
"减速慢行",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_give_way,
|
||||
content = "注意路况复杂,减速慢行",
|
||||
tts = "路况复杂,减速慢行"
|
||||
),
|
||||
TYPE_ERROR(
|
||||
ObuConstants.USE_CASE_ID.ERROR.toString(),
|
||||
"未知/错误/异常",
|
||||
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
|
||||
content = "",
|
||||
tts = ""
|
||||
),
|
||||
|
||||
TYPE_VIP_IDENTIFICATION("10022", "", "", R.drawable.icon_warning_v2x_vip_turn_light, "VIP车辆优先通行", "已为您变灯,请优先通行"),
|
||||
TYPE_VIP_ERROR_IDENTIFICATION("10023", "", "", R.drawable.icon_warning_v2x_vip_turn_light, "请求失败,", "请求失败,请稍后重试"),
|
||||
|
||||
TYPE_OPTIMAL_ROUTE_RECOMMEND("2000", "", "", R.drawable.icon_warning_v2x_optimal_route, "为您推荐最优路线", "已为您选择最优路线");
|
||||
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getPoiTypeStr(poiType: String): String {
|
||||
// 先获取网络配置的poi对应的名称
|
||||
CloudPoiManager.getInstance().getWrapperByPoiType(poiType)?.let {
|
||||
return it.title
|
||||
}
|
||||
// 如果获取不到,那么就用本地默认的
|
||||
return when (poiType) {
|
||||
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeStr
|
||||
ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeStr
|
||||
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStr
|
||||
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeStr
|
||||
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStr
|
||||
FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStr
|
||||
FOURS_FOG.poiType -> FOURS_FOG.poiTypeStr
|
||||
FOURS_ICE.poiType -> FOURS_ICE.poiTypeStr
|
||||
|
||||
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType,
|
||||
FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
|
||||
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeStr
|
||||
|
||||
FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeStr
|
||||
GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeStr
|
||||
else -> "其它道路事件"
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getPoiTypeStrVr(poiType: String): String {
|
||||
return when (poiType) {
|
||||
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeStrVr
|
||||
ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeStrVr
|
||||
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStrVr
|
||||
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeStrVr
|
||||
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStrVr
|
||||
FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStrVr
|
||||
FOURS_FOG.poiType -> FOURS_FOG.poiTypeStrVr
|
||||
FOURS_ICE.poiType -> FOURS_ICE.poiTypeStrVr
|
||||
|
||||
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType,
|
||||
FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
|
||||
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeStrVr
|
||||
|
||||
FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeStrVr
|
||||
GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeStrVr
|
||||
else -> "其它道路事件"
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getPoiTypeSrcVr(poiType: String): Int {
|
||||
return when (poiType) {
|
||||
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeSrcVr
|
||||
ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeSrcVr
|
||||
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeSrcVr
|
||||
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeSrcVr
|
||||
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeSrcVr
|
||||
FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeSrcVr
|
||||
FOURS_FOG.poiType -> FOURS_FOG.poiTypeSrcVr
|
||||
FOURS_ICE.poiType -> FOURS_ICE.poiTypeSrcVr
|
||||
|
||||
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType,
|
||||
FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
|
||||
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeSrcVr
|
||||
|
||||
FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeSrcVr
|
||||
else -> R.drawable.v2x_icon_live_logo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取道路事件的背景色
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getPoiTypeBg(poiType: String, isVrMode: Boolean): Int {
|
||||
return when (poiType) {
|
||||
FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType-> if (isVrMode) R.drawable.bg_v2x_event_type_orange_vr else R.drawable.bg_v2x_event_type_orange
|
||||
TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType,AI_ROAD_WORK.poiType,
|
||||
FOURS_PONDING.poiType, FOURS_FOG.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType,
|
||||
FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
|
||||
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> if (isVrMode) R.drawable.bg_v2x_event_type_red_vr else R.drawable.bg_v2x_event_type_read
|
||||
else -> {
|
||||
if (isVrMode) R.drawable.bg_v2x_event_type_red_vr else R.drawable.bg_v2x_event_type_read
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getPoiTypeBgForShareItem(poiType: String): Int {
|
||||
return when (poiType) {
|
||||
FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType ->
|
||||
R.drawable.bg_v2x_event_type_orange
|
||||
TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType,
|
||||
FOURS_ROAD_WORK.poiType,AI_ROAD_WORK.poiType, FOURS_PONDING.poiType,
|
||||
FOURS_FOG.poiType, FOURS_ICE.poiType,
|
||||
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType,
|
||||
FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
|
||||
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType ->
|
||||
R.drawable.bg_v2x_event_type_read
|
||||
else -> R.drawable.bg_v2x_event_type_read
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是道路预警事件
|
||||
*/
|
||||
@JvmStatic
|
||||
fun isRoadEvent(poiType: String?): Boolean {
|
||||
return when (poiType) {
|
||||
TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType,
|
||||
FOURS_ROAD_WORK.poiType,AI_ROAD_WORK.poiType, FOURS_BLOCK_UP.poiType,
|
||||
FOURS_PONDING.poiType, FOURS_FOG.poiType,
|
||||
FOURS_ICE.poiType, FOURS_ACCIDENT.poiType,
|
||||
FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
|
||||
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType,
|
||||
FOURS_ACCIDENT_05.poiType, GHOST_PROBE.poiType, AI_ROAD_WORK.poiType -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否需要UGC预警
|
||||
*/
|
||||
@JvmStatic
|
||||
fun isNeedRoadEventUgc(poiType: String?): Boolean {
|
||||
return when (poiType) {
|
||||
ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType,AI_ROAD_WORK.poiType,
|
||||
FOURS_BLOCK_UP.poiType, FOURS_ACCIDENT.poiType,
|
||||
FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
|
||||
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType,
|
||||
FOURS_ACCIDENT_05.poiType, GHOST_PROBE.poiType -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun getTts(poiType: String?): String {
|
||||
return when (poiType) {
|
||||
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.tts
|
||||
ROAD_CLOSED.poiType -> ROAD_CLOSED.tts
|
||||
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts
|
||||
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.tts
|
||||
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.tts
|
||||
FOURS_PONDING.poiType -> FOURS_PONDING.tts
|
||||
FOURS_FOG.poiType -> FOURS_FOG.tts
|
||||
FOURS_ICE.poiType -> FOURS_ICE.tts
|
||||
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
|
||||
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.tts
|
||||
else -> "道路事件"
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getTtsWithFeedback(poiType: String?): String {
|
||||
return when (poiType) {
|
||||
TRAFFIC_CHECK.poiType -> "交通检查"
|
||||
ROAD_CLOSED.poiType -> "封路"
|
||||
FOURS_ROAD_WORK.poiType -> "施工"
|
||||
AI_ROAD_WORK.poiType -> "施工"
|
||||
FOURS_BLOCK_UP.poiType -> "道路拥堵"
|
||||
FOURS_PONDING.poiType -> "道路积水"
|
||||
FOURS_FOG.poiType -> "出现浓雾"
|
||||
FOURS_ICE.poiType -> "路面结冰"
|
||||
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
|
||||
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故"
|
||||
else -> "道路事件"
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getAlarmContent(poiType: String?): String {
|
||||
return when (poiType) {
|
||||
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.content
|
||||
ROAD_CLOSED.poiType -> ROAD_CLOSED.content
|
||||
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content
|
||||
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.content
|
||||
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.content
|
||||
FOURS_PONDING.poiType -> FOURS_PONDING.content
|
||||
FOURS_FOG.poiType -> FOURS_FOG.content
|
||||
FOURS_ICE.poiType -> FOURS_ICE.content
|
||||
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
|
||||
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType ->
|
||||
FOURS_ACCIDENT.content
|
||||
GHOST_PROBE.poiType -> GHOST_PROBE.content
|
||||
else -> "道路事件"
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getTypeSmallRes(type: String): Int {
|
||||
return when (type) {
|
||||
TRAFFIC_CHECK.poiType ->
|
||||
R.drawable.mogo_image_jiaotongjiancha_small
|
||||
ROAD_CLOSED.poiType -> R.drawable.mogo_image_fenglu_small
|
||||
FOURS_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_small
|
||||
AI_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_small
|
||||
FOURS_BLOCK_UP.poiType -> R.drawable.mogo_image_yongdu_small
|
||||
FOURS_PONDING.poiType -> R.drawable.mogo_image_jishui_small
|
||||
FOURS_ICE.poiType -> R.drawable.mogo_image_jiebing_small
|
||||
FOURS_FOG.poiType -> R.drawable.mogo_image_nongwu_small
|
||||
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
|
||||
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType ->
|
||||
R.drawable.mogo_image_accident_small
|
||||
else -> R.drawable.mogo_image_shishilukuang_small
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getTypeRes(type: String): Int {
|
||||
return when (type) {
|
||||
TRAFFIC_CHECK.poiType -> R.drawable.mogo_image_jiaotongjiancha_nor
|
||||
ROAD_CLOSED.poiType -> R.drawable.mogo_image_fenglu_nor
|
||||
FOURS_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_nor
|
||||
AI_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_nor
|
||||
FOURS_BLOCK_UP.poiType -> R.drawable.mogo_image_yongdu_nor
|
||||
FOURS_PONDING.poiType -> R.drawable.mogo_image_jishui_nor
|
||||
FOURS_ICE.poiType -> R.drawable.mogo_image_jiebing_nor
|
||||
FOURS_FOG.poiType -> R.drawable.mogo_image_nongwu_nor
|
||||
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
|
||||
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType ->
|
||||
R.drawable.mogo_image_jiaotongshigu_nor
|
||||
else -> R.drawable.mogo_image_shishlukuang_nor
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getTypeName(type: String?): String {
|
||||
return when (type) {
|
||||
ROAD_CLOSED.poiType -> "封路"
|
||||
FOURS_ICE.poiType -> "道路结冰"
|
||||
FOURS_FOG.poiType -> "浓雾"
|
||||
TRAFFIC_CHECK.poiType -> "交通检查"
|
||||
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
|
||||
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故"
|
||||
FOURS_BLOCK_UP.poiType -> "拥堵"
|
||||
FOURS_ROAD_WORK.poiType -> "施工"
|
||||
AI_ROAD_WORK.poiType -> "施工"
|
||||
FOURS_PONDING.poiType -> "道路积水"
|
||||
else -> "实时路况"
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getMarker3DRes(poiType: String?): Int {
|
||||
return when (poiType) {
|
||||
FOURS_BLOCK_UP.poiType -> R.raw.v2x_yongdu
|
||||
FOURS_ACCIDENT.poiType -> R.raw.v2x_shigu
|
||||
FOURS_LIVING.poiType -> R.raw.v2x_shishilukuang
|
||||
FOURS_FOG.poiType -> R.raw.v2x_nongwu
|
||||
TRAFFIC_CHECK.poiType -> R.raw.v2x_jiaotongjiancha
|
||||
FOURS_ROAD_WORK.poiType -> R.raw.v2x_daolushigong
|
||||
AI_ROAD_WORK.poiType -> R.raw.v2x_daolushigong
|
||||
FOURS_ICE.poiType -> R.raw.v2x_daolujiebing
|
||||
FOURS_PONDING.poiType -> R.raw.v2x_daolujishui
|
||||
GHOST_PROBE.poiType -> R.raw.v2x_guzhangqiuzhu
|
||||
else -> 0
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getTypeNameTTS(type: String?): String {
|
||||
return when (type) {
|
||||
ROAD_CLOSED.poiType -> "封路"
|
||||
FOURS_ICE.poiType -> "道路结冰"
|
||||
FOURS_FOG.poiType -> "浓雾"
|
||||
TRAFFIC_CHECK.poiType -> "交通检查"
|
||||
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
|
||||
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故"
|
||||
FOURS_BLOCK_UP.poiType -> "拥堵"
|
||||
FOURS_ROAD_WORK.poiType -> "施工"
|
||||
AI_ROAD_WORK.poiType -> "施工"
|
||||
FOURS_PONDING.poiType -> "道路积水"
|
||||
else -> "实时路况"
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getUpdateIconRes(poiType: String?): Int {
|
||||
return when (poiType) {
|
||||
//交通检查
|
||||
TRAFFIC_CHECK.poiType -> {
|
||||
R.drawable.v_to_x_marker_2
|
||||
}
|
||||
//封路
|
||||
ROAD_CLOSED.poiType -> {
|
||||
R.drawable.v_to_x_marker_16
|
||||
}
|
||||
//施工
|
||||
FOURS_ROAD_WORK.poiType -> {
|
||||
R.drawable.v_to_x_marker_11
|
||||
}
|
||||
//AI施工
|
||||
AI_ROAD_WORK.poiType -> {
|
||||
R.drawable.v_to_x_marker_11
|
||||
}
|
||||
//拥堵
|
||||
FOURS_BLOCK_UP.poiType -> {
|
||||
R.drawable.v_to_x_marker_5
|
||||
}
|
||||
//积水
|
||||
FOURS_PONDING.poiType -> {
|
||||
R.drawable.v_to_x_marker_6
|
||||
}
|
||||
//浓雾
|
||||
FOURS_FOG.poiType -> {
|
||||
R.drawable.v_to_x_marker_9
|
||||
}
|
||||
//结冰
|
||||
FOURS_ICE.poiType -> {
|
||||
R.drawable.v_to_x_marker_8
|
||||
}
|
||||
//事故
|
||||
FOURS_ACCIDENT.poiType -> {
|
||||
R.drawable.v_to_x_marker_7
|
||||
}
|
||||
//事故
|
||||
FOURS_LIVING.poiType -> {
|
||||
R.drawable.v_to_x_marker_1
|
||||
}
|
||||
//红绿灯数据
|
||||
ALERT_TRAFFIC_LIGHT_SUGGEST.poiType -> {
|
||||
R.drawable.v_to_x_marker_3
|
||||
}
|
||||
//红绿灯数据
|
||||
ALERT_TRAFFIC_LIGHT_WARNING.poiType -> {
|
||||
R.drawable.v_to_x_marker_3
|
||||
}
|
||||
//前方静止or慢速车辆报警
|
||||
ALERT_FRONT_CAR.poiType -> {
|
||||
R.drawable.v_to_x_warning_car_red
|
||||
}
|
||||
// 故障车辆
|
||||
ALERT_CAR_TROUBLE_WARNING.poiType -> {
|
||||
R.drawable.icon_car_red
|
||||
}
|
||||
else -> 0
|
||||
}
|
||||
}
|
||||
|
||||
//===================告警类事件===================
|
||||
|
||||
@JvmStatic
|
||||
fun getWarningIcon(poiType: String?): Int {
|
||||
return when (poiType) {
|
||||
TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_HLW.poiType -> TYPE_USECASE_ID_HLW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_IVS.poiType -> TYPE_USECASE_ID_IVS.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_IVP.poiType -> TYPE_USECASE_ID_IVP.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_COC.poiType -> TYPE_USECASE_ID_COC.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ROAD_TRAMCAR.poiType -> TYPE_USECASE_ID_ROAD_TRAMCAR.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType -> TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType -> TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType -> TYPE_USECASE_ID_ROAD_TEST_SECTION.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.poiTypeSrcVr
|
||||
TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.poiTypeSrcVr
|
||||
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.poiTypeSrcVr
|
||||
TYPE_ERROR.poiType -> TYPE_ERROR.poiTypeSrcVr
|
||||
TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.poiTypeSrcVr
|
||||
GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeSrcVr
|
||||
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeSrcVr
|
||||
else -> TYPE_ERROR.poiTypeSrcVr
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getWarningContent(poiType: String?): String {
|
||||
return when (poiType) {
|
||||
TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.content
|
||||
TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.content
|
||||
TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.content
|
||||
TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.content
|
||||
TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.content
|
||||
TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.content
|
||||
TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.content
|
||||
TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.content
|
||||
TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.content
|
||||
TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.content
|
||||
TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.content
|
||||
TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.content
|
||||
TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.content
|
||||
TYPE_USECASE_ID_HLW.poiType -> TYPE_USECASE_ID_HLW.content
|
||||
TYPE_USECASE_ID_IVS.poiType -> TYPE_USECASE_ID_IVS.content
|
||||
TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.content
|
||||
TYPE_USECASE_ID_IVP.poiType -> TYPE_USECASE_ID_IVP.content
|
||||
TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.content
|
||||
TYPE_USECASE_ID_COC.poiType -> TYPE_USECASE_ID_COC.content
|
||||
TYPE_USECASE_ID_ROAD_TRAMCAR.poiType -> TYPE_USECASE_ID_ROAD_TRAMCAR.content
|
||||
TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.content
|
||||
TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.content
|
||||
TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.content
|
||||
TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.content
|
||||
TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType -> TYPE_USECASE_ID_ROAD_COLLISION_WARNING.content
|
||||
TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType -> TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.content
|
||||
TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType -> TYPE_USECASE_ID_ROAD_TEST_SECTION.content
|
||||
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.content
|
||||
TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.content
|
||||
TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.content
|
||||
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.content
|
||||
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content
|
||||
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.content
|
||||
TYPE_ERROR.poiType -> TYPE_ERROR.content
|
||||
TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.content
|
||||
GHOST_PROBE.poiType -> GHOST_PROBE.content
|
||||
else -> TYPE_ERROR.content
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getWarningTts(poiType: String?): String {
|
||||
return when (poiType) {
|
||||
TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.tts
|
||||
TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.tts
|
||||
TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.tts
|
||||
TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.tts
|
||||
TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.tts
|
||||
TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.tts
|
||||
TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.tts
|
||||
TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.tts
|
||||
TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.tts
|
||||
TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.tts
|
||||
TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.tts
|
||||
TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.tts
|
||||
TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.tts
|
||||
TYPE_USECASE_ID_HLW.poiType -> TYPE_USECASE_ID_HLW.tts
|
||||
TYPE_USECASE_ID_IVS.poiType -> TYPE_USECASE_ID_IVS.tts
|
||||
TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.tts
|
||||
TYPE_USECASE_ID_IVP.poiType -> TYPE_USECASE_ID_IVP.tts
|
||||
TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.tts
|
||||
TYPE_USECASE_ID_COC.poiType -> TYPE_USECASE_ID_COC.tts
|
||||
TYPE_USECASE_ID_ROAD_TRAMCAR.poiType -> TYPE_USECASE_ID_ROAD_TRAMCAR.tts
|
||||
TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.tts
|
||||
TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.tts
|
||||
TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.tts
|
||||
TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.tts
|
||||
TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType -> TYPE_USECASE_ID_ROAD_COLLISION_WARNING.tts
|
||||
TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType -> TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.tts
|
||||
TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType -> TYPE_USECASE_ID_ROAD_TEST_SECTION.tts
|
||||
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.tts
|
||||
TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.tts
|
||||
TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.tts
|
||||
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.tts
|
||||
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts
|
||||
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.tts
|
||||
TYPE_ERROR.poiType -> TYPE_ERROR.tts
|
||||
TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.tts
|
||||
GHOST_PROBE.poiType -> GHOST_PROBE.tts
|
||||
else -> TYPE_ERROR.tts
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
package com.mogo.module.common.enums
|
||||
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_AVW
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_BSW
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_CLW
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_DNPW
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_EBW
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_FCW
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_LCW
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_LTA
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_OPT_LINE
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_VRU
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_VRU_RI
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2N
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2V
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.enums.isLeft
|
||||
import com.mogo.eagle.core.data.enums.isRight
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
|
||||
class EventTypeHelper {
|
||||
|
||||
companion object {
|
||||
|
||||
//变道预警
|
||||
@BizConfig(V2V, "", BIZ_LCW)
|
||||
fun getLCW(
|
||||
appId: Int,
|
||||
direction: WarningDirectionEnum,
|
||||
data: ((alert: String, tts: String) -> Unit)
|
||||
) {
|
||||
when {
|
||||
direction.isLeft() -> {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString() + "左"),
|
||||
EventTypeEnum.getWarningTts(appId.toString() + "左")
|
||||
)
|
||||
}
|
||||
direction.isRight() -> {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString() + "右"),
|
||||
EventTypeEnum.getWarningTts(appId.toString() + "右")
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString()),
|
||||
EventTypeEnum.getWarningTts(appId.toString())
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//车辆失控预警
|
||||
@BizConfig(V2V, "", BIZ_CLW)
|
||||
fun getCLW(
|
||||
appId: Int,
|
||||
direction: WarningDirectionEnum,
|
||||
data: ((alert: String, tts: String) -> Unit)
|
||||
) {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString() + direction.desc),
|
||||
EventTypeEnum.getWarningContent(appId.toString() + direction.desc)
|
||||
)
|
||||
}
|
||||
|
||||
//左转辅助
|
||||
@BizConfig(V2V, "", BIZ_LTA)
|
||||
fun getLTA(appId: Int, data: ((alert: String, tts: String) -> Unit)) {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString()),
|
||||
EventTypeEnum.getWarningTts(appId.toString())
|
||||
)
|
||||
}
|
||||
|
||||
//异常车辆提醒
|
||||
@BizConfig(V2V, "", BIZ_AVW)
|
||||
fun getAVW(
|
||||
appId: Int,
|
||||
direction: WarningDirectionEnum,
|
||||
data: ((alert: String, tts: String) -> Unit)
|
||||
) {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString() + direction.desc),
|
||||
EventTypeEnum.getWarningTts(appId.toString() + direction.desc)
|
||||
)
|
||||
}
|
||||
|
||||
//盲区预警
|
||||
@BizConfig(V2V, "", BIZ_BSW)
|
||||
fun getBSW(
|
||||
appId: Int,
|
||||
direction: WarningDirectionEnum,
|
||||
data: ((alert: String, tts: String, visualAngle: Boolean) -> Unit)
|
||||
) {
|
||||
when {
|
||||
direction.isLeft() -> {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString() + "左"),
|
||||
EventTypeEnum.getWarningTts(appId.toString() + "左"),
|
||||
true
|
||||
)
|
||||
}
|
||||
direction.isRight() -> {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString() + "右"),
|
||||
EventTypeEnum.getWarningTts(appId.toString() + "右"),
|
||||
true
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString()),
|
||||
EventTypeEnum.getWarningTts(appId.toString()),
|
||||
false
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//弱势交通碰撞预警
|
||||
@BizConfig(V2N, "", BIZ_VRU)
|
||||
fun getVRU(data: ((appId: Int, tts: String, content: String) -> Unit)) {
|
||||
data.invoke(
|
||||
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt(),
|
||||
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.tts,
|
||||
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.content
|
||||
)
|
||||
}
|
||||
|
||||
//弱势交通逆行预警
|
||||
@BizConfig(V2N, "", BIZ_VRU_RI)
|
||||
fun getVRURI(data: ((appId: Int, tts: String, content: String) -> Unit)) {
|
||||
data.invoke(
|
||||
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt(),
|
||||
"行人逆行预警",
|
||||
"行人逆行预警"
|
||||
)
|
||||
}
|
||||
|
||||
//最优车道
|
||||
@BizConfig(V2N, "", BIZ_OPT_LINE)
|
||||
fun getOptLine(data: ((appId: Int, tts: String, content: String) -> Unit)) {
|
||||
data.invoke(
|
||||
EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.poiType.toInt(),
|
||||
EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.tts,
|
||||
EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.content
|
||||
)
|
||||
}
|
||||
|
||||
//前方道路拥堵预警
|
||||
fun getTJW(data: ((appId: Int, tts: String, content: String) -> Unit)) {
|
||||
data.invoke(
|
||||
EventTypeEnum.FOURS_BLOCK_UP.poiType.toInt(),
|
||||
EventTypeEnum.FOURS_BLOCK_UP.tts,
|
||||
EventTypeEnum.FOURS_BLOCK_UP.content
|
||||
)
|
||||
}
|
||||
|
||||
//前车急刹
|
||||
@BizConfig(V2V, "", BIZ_EBW)
|
||||
fun getEBW(appId: Int, data: ((tts: String, content: String) -> Unit)) {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString()),
|
||||
EventTypeEnum.getWarningTts(appId.toString())
|
||||
)
|
||||
}
|
||||
|
||||
//前向碰撞预警
|
||||
@BizConfig(V2V, "", BIZ_FCW)
|
||||
fun getFCW(appId: Int, data: ((tts: String, content: String) -> Unit)) {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString()),
|
||||
EventTypeEnum.getWarningTts(appId.toString())
|
||||
)
|
||||
}
|
||||
|
||||
//逆向超车预警
|
||||
@BizConfig(V2V, "", BIZ_DNPW)
|
||||
fun getDNPW(appId: Int, data: ((tts: String, content: String) -> Unit)) {
|
||||
data.invoke(
|
||||
EventTypeEnum.getWarningContent(appId.toString()),
|
||||
EventTypeEnum.getWarningTts(appId.toString())
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package com.mogo.module.common.marker;
|
||||
|
||||
/**
|
||||
* poi信息封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class PoiWrapper {
|
||||
private int id;
|
||||
private String poiType;
|
||||
private int iconRes;
|
||||
private int iconInfoRes;
|
||||
private String iconUrl = "";
|
||||
// "https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/VN000012.jpg";
|
||||
private String iconInfoUrl = "";
|
||||
// "http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1596705960869.png";
|
||||
private String title = "拥堵";
|
||||
|
||||
public PoiWrapper(){
|
||||
|
||||
}
|
||||
|
||||
public PoiWrapper(String poiType, int iconRes,int iconInfoRes, String title) {
|
||||
this.poiType = poiType;
|
||||
this.iconRes = iconRes;
|
||||
this.iconInfoRes = iconInfoRes;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPoiType() {
|
||||
return poiType;
|
||||
}
|
||||
|
||||
public void setPoiType(String poiType) {
|
||||
this.poiType = poiType;
|
||||
}
|
||||
|
||||
public int getIconRes() {
|
||||
return iconRes;
|
||||
}
|
||||
|
||||
public void setIconRes(int iconRes) {
|
||||
this.iconRes = iconRes;
|
||||
}
|
||||
|
||||
public String getIconUrl() {
|
||||
return iconUrl;
|
||||
}
|
||||
|
||||
public void setIconUrl(String iconUrl) {
|
||||
this.iconUrl = iconUrl;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getIconInfoRes() {
|
||||
return iconInfoRes;
|
||||
}
|
||||
|
||||
public void setIconInfoRes(int iconInfoRes) {
|
||||
this.iconInfoRes = iconInfoRes;
|
||||
}
|
||||
|
||||
public String getIconInfoUrl() {
|
||||
return iconInfoUrl;
|
||||
}
|
||||
|
||||
public void setIconInfoUrl(String iconInfoUrl) {
|
||||
this.iconInfoUrl = iconInfoUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PoiWrapper{" +
|
||||
"poiType='" + poiType + '\'' +
|
||||
", iconRes=" + iconRes +
|
||||
", iconInfoRes=" + iconInfoRes +
|
||||
", iconUrl='" + iconUrl + '\'' +
|
||||
", iconInfoUrl='" + iconInfoUrl + '\'' +
|
||||
", title='" + title + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
package com.mogo.module.common.utils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-26
|
||||
* <p>
|
||||
* 车机类型
|
||||
*/
|
||||
public class CarSeries {
|
||||
|
||||
private static boolean invokeFlag = false;
|
||||
private static boolean isF8xxSeries = false;
|
||||
|
||||
public static boolean isF8xxSeries() {
|
||||
if ( invokeFlag ) {
|
||||
return isF8xxSeries;
|
||||
}
|
||||
isF8xxSeries = DebugConfig.getProductFlavor().startsWith( "f" );
|
||||
invokeFlag = true;
|
||||
return isF8xxSeries;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_C80X = 10;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_D80X = 20;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_D81X = 21;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_D82X = 22;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_D84X = 23;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_F80X = 30;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_G80X = 40;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_E84X = 50;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_E84XCD = 51;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_E85X = 50;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_E85XCD = 51;
|
||||
@Deprecated
|
||||
public static final int CAR_SERIES_E85XJD = 51;
|
||||
|
||||
@Deprecated
|
||||
public static int CAR_SERIES = 0;
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
* Use {@link DebugConfig#getProductFlavor()} instead.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getSeries() {
|
||||
if ( CAR_SERIES != 0 ) {
|
||||
return CAR_SERIES;
|
||||
}
|
||||
synchronized ( CarSeries.class ) {
|
||||
if ( CAR_SERIES != 0 ) {
|
||||
return CAR_SERIES;
|
||||
}
|
||||
String device = get( "ro.fota.device" );
|
||||
if ( TextUtils.isEmpty( device ) ) {
|
||||
return CAR_SERIES_F80X;
|
||||
}
|
||||
|
||||
if ( "FG166".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_C80X;
|
||||
} else if ( "D801-802".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_D80X;
|
||||
} else if ( "D801B-802B".equals( device ) ) {
|
||||
// 2+16G
|
||||
CAR_SERIES = CAR_SERIES_D80X;
|
||||
} else if ( "D811-812".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_D81X;
|
||||
} else if ( "D821-822".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_D82X;
|
||||
} else if ( "D841-842".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_D84X;
|
||||
} else if ( "G801-802".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_G80X;
|
||||
} else if ( "F801-802".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_F80X;
|
||||
} else if ( "E841-842".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E84X;
|
||||
} else if ( "E84XCD".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E84XCD;
|
||||
} else if ( "E851-852".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E85X;
|
||||
} else if ( "E85XCD".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E85XCD;
|
||||
} else if ( "E85XJD".equals( device ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E85XJD;
|
||||
} else if ( device.startsWith( "E85" ) ) {
|
||||
CAR_SERIES = CAR_SERIES_E85XJD;
|
||||
} else {
|
||||
CAR_SERIES = CAR_SERIES_F80X;
|
||||
}
|
||||
return CAR_SERIES;
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static String get( String key ) {
|
||||
String value = "";
|
||||
try {
|
||||
Class< ? > c = Class.forName( "android.os.SystemProperties" );
|
||||
Method get = c.getMethod( "get", new Class[]{String.class, String.class} );
|
||||
value = ( String ) get.invoke( c, new Object[]{key, "unknown"} );
|
||||
} catch ( Exception e ) {
|
||||
value = "";
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package com.mogo.module.common.utils;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.ArrayMap;
|
||||
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import com.mogo.module.common.marker.PoiWrapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 云端配置poi数据管理公共类
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class CloudPoiManager {
|
||||
private static final String TAG = "CloudPoiManager";
|
||||
|
||||
private final Map<String, PoiWrapper> poiWrapper = new ArrayMap<>();
|
||||
private static CloudPoiManager instance = null;
|
||||
|
||||
public static CloudPoiManager getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (CloudPoiManager.class) {
|
||||
if (instance == null) {
|
||||
instance = new CloudPoiManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void generateDefault() {
|
||||
if (poiWrapper.isEmpty()) {
|
||||
poiWrapper.put(EventTypeEnum.TRAFFIC_CHECK.getPoiType(), new PoiWrapper(EventTypeEnum.TRAFFIC_CHECK.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_road_check2, R.drawable.module_common_icon_map_marker_road_check2_white, "交通检查"));
|
||||
poiWrapper.put(EventTypeEnum.ROAD_CLOSED.getPoiType(), new PoiWrapper(EventTypeEnum.ROAD_CLOSED.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_road_block_off2, R.drawable.module_common_icon_map_marker_road_block_off2_white, "封路"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ROAD_WORK.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ROAD_WORK.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_road_work2, R.drawable.module_common_icon_map_marker_road_work2_white, "施工"));
|
||||
poiWrapper.put(EventTypeEnum.AI_ROAD_WORK.getPoiType(), new PoiWrapper(EventTypeEnum.AI_ROAD_WORK.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_road_work2, R.drawable.module_common_icon_map_marker_road_work2_white, "施工"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_BLOCK_UP.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_BLOCK_UP.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_road_block_up2, R.drawable.module_common_icon_map_marker_road_block_up2_white, "拥堵"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_PONDING.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_PONDING.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_pondingl2, R.drawable.module_common_icon_map_marker_pondingl2_white, "积水"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_FOG.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_FOG.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_dark_frog2, R.drawable.module_common_ic_rc_dark_frog2_white, "浓雾"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ICE.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ICE.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_freeze2, R.drawable.module_common_ic_rc_freeze2_white, "结冰"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_01.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_01.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "重大事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_02.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_02.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "特大事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_03.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_03.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "较大事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_04.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_04.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "一般事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_05.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_05.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "轻微事故"));
|
||||
poiWrapper.put(EventTypeEnum.FOURS_LIVING.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_LIVING.getPoiType(),
|
||||
R.drawable.module_common_icon_map_marker_living, R.drawable.module_common_icon_map_marker_living_white, "实时路况"));
|
||||
poiWrapper.put(EventTypeEnum.ILLEGAL_PARK_LIVING.getPoiType(), new PoiWrapper(EventTypeEnum.ILLEGAL_PARK_LIVING.getPoiType(),
|
||||
R.drawable.module_common_ic_rc_illegal_park, R.drawable.module_common_ic_rc_illegal_park_white, "违章停车"));
|
||||
// 分享里用到的故障求助
|
||||
poiWrapper.put("9999", new PoiWrapper("9999",
|
||||
R.drawable.module_common_icon_seek_help, R.drawable.module_common_icon_seek_help, "故障求助"));
|
||||
}
|
||||
}
|
||||
|
||||
public void updateFromConfig(Context context) {
|
||||
generateDefault();
|
||||
// 从sp中获取config属性,将服务端配置内容合并到本地
|
||||
String config = SharedPrefsMgr.getInstance(context).getString("SHARE_BUTTON_CONFIG", "");
|
||||
if (!config.isEmpty()) {
|
||||
List<PoiWrapper> configWrappers = GsonUtil.arrayFromJson(config, PoiWrapper.class);
|
||||
CallerLogger.INSTANCE.d(TAG, "config: " + configWrappers);
|
||||
if (configWrappers != null) {
|
||||
for (PoiWrapper wrapper : configWrappers) {
|
||||
wrapper.setIconInfoRes(R.drawable.module_common_icon_map_marker_road_block_up2_white);
|
||||
wrapper.setIconRes(R.drawable.module_common_icon_map_marker_road_block_up2);
|
||||
if (poiWrapper.containsKey(wrapper.getPoiType())) {
|
||||
PoiWrapper defWrapper = poiWrapper.get(wrapper.getPoiType());
|
||||
if (defWrapper != null) {
|
||||
wrapper.setIconRes(defWrapper.getIconRes());
|
||||
wrapper.setIconInfoRes(defWrapper.getIconInfoRes());
|
||||
}
|
||||
}
|
||||
CallerLogger.INSTANCE.d(TAG, "put===" + wrapper);
|
||||
poiWrapper.put(wrapper.getPoiType(), wrapper);
|
||||
}
|
||||
} else {
|
||||
CallerLogger.INSTANCE.e(TAG, "解析configWrapper异常: " + config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PoiWrapper getWrapperByPoiType(String poiType) {
|
||||
return poiWrapper.get(poiType);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
package com.mogo.module.common.utils;
|
||||
|
||||
import static java.lang.Math.PI;
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/14 1:02 PM
|
||||
* desc : 计算车辆驾驶方向的工具类
|
||||
* version: 1.0
|
||||
*/
|
||||
public class DrivingDirectionUtils {
|
||||
|
||||
public static long getDegreeOfCar2Poi2(double x1, double y1, double x2, double y2, double x1_angle) {
|
||||
Pair<Double, Double> newPoint = calculateNewPoint(x1, y1, x1_angle, 10);
|
||||
if (newPoint != null) {
|
||||
double angle = getAngle(x1, y1, newPoint.first, newPoint.second, x2, y2);
|
||||
return Math.round(angle + 0.5);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static double distance(double x1, double y1, double x2, double y2) {
|
||||
return Math.sqrt(Math.pow(x1 - x2, 2.0) + Math.pow(y1 - y2, 2.0));
|
||||
}
|
||||
|
||||
public static double getAngle(double sx, double sy, double x1, double y1, double x2, double y2) {
|
||||
x1 = x1 - sx;
|
||||
y1 = y1 - sy;
|
||||
x2 = x2 - sx;
|
||||
y2 = y2 - sy;
|
||||
double product = x1 * x2 + y1 * y2;
|
||||
double radians = Math.acos(product / (Math.sqrt(Math.pow(x1, 2.0) + Math.pow(y1, 2.0)) * Math.sqrt(Math.pow(x2, 2.0) + Math.pow(y2, 2.0))));
|
||||
return Math.toDegrees(radians);
|
||||
}
|
||||
|
||||
public static Pair<Double, Double> calculateNewPoint(double x, double y, double angle, double distance) {
|
||||
if (distance == 0) {
|
||||
return null;
|
||||
}
|
||||
double radian = Math.toRadians(angle);
|
||||
double radianCandle = Math.toRadians(90.0 - angle);
|
||||
double nX = x + distance * Math.sin(radian) / 100000.0;
|
||||
double nY = y + distance * Math.sin(radianCandle) / 100000.0;
|
||||
return Pair.create(nX, nY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算车辆行驶方向 与 poi点到车辆的连线 间的夹角
|
||||
*
|
||||
* @param carLon 车辆位置 lon
|
||||
* @param carLat 车辆位置 lat
|
||||
* @param poiLon poi 位置 lon
|
||||
* @param poiLat poi 位置 lat
|
||||
* @param carAngle 车辆行驶方向
|
||||
* @return
|
||||
*/
|
||||
public static int getDegreeOfCar2Poi(double carLon, double carLat, double poiLon, double poiLat, int carAngle) {
|
||||
int poiAngle = 0;
|
||||
// 以子午线作为y轴 计算两点的余切 再将余切值转化为角度
|
||||
double _angle = Math.atan2(Math.abs(carLon - poiLon), Math.abs(carLat - poiLat)) * (180 / PI);
|
||||
if (poiLon > carLon) {
|
||||
// poi 在 车辆位置的第1象限
|
||||
if (poiLat > carLat) {
|
||||
poiAngle = (int) _angle;
|
||||
}
|
||||
// poi 在 车辆位置的第2象限
|
||||
else {
|
||||
poiAngle = 180 - (int) _angle;
|
||||
}
|
||||
} else {
|
||||
// poi 在 车辆位置的第3象限
|
||||
if (poiLat < carLat) {
|
||||
poiAngle = (int) _angle + 180;
|
||||
}
|
||||
// poi 在 车辆位置的第4象限
|
||||
else {
|
||||
poiAngle = 360 - (int) _angle;
|
||||
}
|
||||
}
|
||||
return calculationAngle(poiAngle, carAngle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个行驶方向间的夹角 计算结果小于180度
|
||||
*
|
||||
* @param angle0
|
||||
* @param angle1
|
||||
* @return
|
||||
*/
|
||||
public static int calculationAngle(int angle0, int angle1) {
|
||||
// 获取两方向间夹角
|
||||
int angle = Math.abs(angle0 - angle1);
|
||||
if (angle > 180) {
|
||||
int minAngle = Math.min(angle0, angle1);
|
||||
int maxAngle = Math.max(angle0, angle1);
|
||||
return 180 - Math.abs(minAngle + 180 - maxAngle);
|
||||
} else {
|
||||
return angle;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算车辆行驶方向角度,起点&终点经纬度
|
||||
*
|
||||
* @param carLat 车辆位置 lat
|
||||
* @param carLon 车辆位置 lon
|
||||
* @param poiLat poi 位置 lat
|
||||
* @param poiLon poi 位置 lon
|
||||
*/
|
||||
public static int getCarAngle(double carLat, double carLon, double poiLat, double poiLon) {
|
||||
int poiAngle = 0;
|
||||
// 以子午线作为y轴 计算两点的余切 再将余切值转化为角度
|
||||
double _angle = Math.atan2(Math.abs(carLon - poiLon), Math.abs(carLat - poiLat)) * (180 / PI);
|
||||
|
||||
if (poiLon > carLon) {
|
||||
// poi 在 车辆位置的第1象限
|
||||
if (poiLat > carLat) {
|
||||
poiAngle = (int) _angle;
|
||||
}
|
||||
// poi 在 车辆位置的第2象限
|
||||
else {
|
||||
poiAngle = 180 - (int) _angle;
|
||||
}
|
||||
} else {
|
||||
// poi 在 车辆位置的第3象限
|
||||
if (poiLat < carLat) {
|
||||
poiAngle = (int) _angle + 180;
|
||||
}
|
||||
// poi 在 车辆位置的第4象限
|
||||
else {
|
||||
poiAngle = 360 - (int) _angle;
|
||||
}
|
||||
}
|
||||
|
||||
if (poiAngle >= 355) {
|
||||
poiAngle = 0;
|
||||
}
|
||||
return poiAngle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算连两个角度差值
|
||||
*
|
||||
* @param angle1 角度1
|
||||
* @param angle2 角度2
|
||||
* @return 差值
|
||||
*/
|
||||
public static double getAngleDiff(double angle1, double angle2) {
|
||||
// 两个角度差值较小
|
||||
return 180 - Math.abs(Math.abs(angle1 - angle2) - 180);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.mogo.module.common.utils;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 2021/4/13
|
||||
*/
|
||||
public class Trigonometric {
|
||||
private final static double radius_b = 6378137;//大半径
|
||||
private final static double radius_s = 6356725;//小半径
|
||||
private static double mRadLo;
|
||||
private static double mRadLa;
|
||||
private static double Ec;
|
||||
private static double Ed;
|
||||
|
||||
/**
|
||||
* 计算两点间的角度
|
||||
*/
|
||||
public static double getAngle(double lon1, double lat1, double lon2,
|
||||
double lat2) {
|
||||
double fLat = Math.PI * (lat1) / 180.0;
|
||||
double fLng = Math.PI * (lon1) / 180.0;
|
||||
double tLat = Math.PI * (lat2) / 180.0;
|
||||
double tLng = Math.PI * (lon2) / 180.0;
|
||||
|
||||
double degree = (Math.atan2(Math.sin(tLng - fLng) * Math.cos(tLat), Math.cos(fLat) * Math.sin(tLat) -
|
||||
Math.sin(fLat) * Math.cos(tLat) * Math.cos(tLng - fLng))) * 180.0 / Math.PI;
|
||||
if (degree >= 0) {
|
||||
return degree;
|
||||
} else {
|
||||
return 360 + degree;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角度获取指定距离点的经纬度
|
||||
*/
|
||||
public static MogoLatLng getNewLocation(double lon, double lat, double distance, double angle) {
|
||||
mRadLo = lon * Math.PI / 180.;
|
||||
mRadLa = lat * Math.PI / 180.;
|
||||
Ec = radius_s + (radius_b - radius_s) * (90. - lat) / 90;
|
||||
Ed = Ec * Math.cos(mRadLa);
|
||||
|
||||
double dx = distance * Math.sin(Math.toRadians(angle));
|
||||
double dy = distance * Math.cos(Math.toRadians(angle));
|
||||
double lon_new = (dx / Ed + mRadLo) * 180. / Math.PI;
|
||||
double lat_new = (dy / Ec + mRadLa) * 180. / Math.PI;
|
||||
return new MogoLatLng(lat_new, lon_new);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,310 +0,0 @@
|
||||
package com.mogo.module.common.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.mogo.module.common.R;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class CustomRatingBar extends LinearLayout {
|
||||
private Context mContext;
|
||||
/*
|
||||
是否可点击
|
||||
* */
|
||||
private boolean mClickable;
|
||||
/*
|
||||
* 单元总数(心形/星星)
|
||||
* */
|
||||
private int elementCount;
|
||||
/*
|
||||
* 单元点击事件
|
||||
* */
|
||||
private OnRatingChangeListener mOnRatingBarChangeListener;
|
||||
/*
|
||||
* 每个单元的大小
|
||||
* */
|
||||
private float elementWidth;
|
||||
|
||||
private float elementHeight;
|
||||
|
||||
public float getElementWidth() {
|
||||
return elementWidth;
|
||||
}
|
||||
|
||||
public void setElementWidth(float elementWidth) {
|
||||
this.elementWidth = elementWidth;
|
||||
}
|
||||
|
||||
public float getElementHeight() {
|
||||
return elementHeight;
|
||||
}
|
||||
|
||||
public void setElementHeight(float elementHeight) {
|
||||
this.elementHeight = elementHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
* 每个单元间的距离
|
||||
* */
|
||||
private float elementPadding;
|
||||
/*
|
||||
*单元的显示数量,支持小数点
|
||||
* */
|
||||
private float elementStep;
|
||||
/*
|
||||
* 空白的默认单元图片
|
||||
* */
|
||||
private Drawable elementEmptyDrawable;
|
||||
/*
|
||||
* 选中后的单元图片
|
||||
* */
|
||||
private Drawable elementFillDrawable;
|
||||
/*
|
||||
* 半颗单元图片
|
||||
* */
|
||||
private Drawable elementHarfDrawable;
|
||||
/*
|
||||
* 每次点击单元所增加的量是半个还是整个
|
||||
* */
|
||||
private StepSize stepSize;
|
||||
|
||||
/*
|
||||
*添加资源(空白心是白色还是灰色自定义属性)
|
||||
* */
|
||||
private boolean otherHeartImg;
|
||||
|
||||
@Override
|
||||
public boolean isClickable() {
|
||||
return mClickable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClickable(boolean clickable) {
|
||||
mClickable = clickable;
|
||||
}
|
||||
|
||||
public int getElementCount() {
|
||||
return elementCount;
|
||||
}
|
||||
|
||||
public void setElementCount(int elementCount) {
|
||||
this.elementCount = elementCount;
|
||||
}
|
||||
|
||||
public OnRatingChangeListener getOnRatingBarChangeListener() {
|
||||
return mOnRatingBarChangeListener;
|
||||
}
|
||||
|
||||
public void setOnRatingChangeListener(OnRatingChangeListener onRatingBarChangeListener) {
|
||||
mOnRatingBarChangeListener = onRatingBarChangeListener;
|
||||
}
|
||||
|
||||
public float getElementPadding() {
|
||||
return elementPadding;
|
||||
}
|
||||
|
||||
public void setElementPadding(float elementPadding) {
|
||||
this.elementPadding = elementPadding;
|
||||
}
|
||||
|
||||
public float getElementStep() {
|
||||
return elementStep;
|
||||
}
|
||||
|
||||
public void setElementStep(float elementStep) {
|
||||
this.elementStep = elementStep;
|
||||
}
|
||||
|
||||
public Drawable getElementEmptyDrawable() {
|
||||
return elementEmptyDrawable;
|
||||
}
|
||||
|
||||
public void setElementEmptyDrawable(Drawable elementEmptyDrawable) {
|
||||
this.elementEmptyDrawable = elementEmptyDrawable;
|
||||
}
|
||||
|
||||
public Drawable getElementFillDrawable() {
|
||||
return elementFillDrawable;
|
||||
}
|
||||
|
||||
public void setElementFillDrawable(Drawable elementFillDrawable) {
|
||||
this.elementFillDrawable = elementFillDrawable;
|
||||
}
|
||||
|
||||
public Drawable getElementHarfDrawable() {
|
||||
return elementHarfDrawable;
|
||||
}
|
||||
|
||||
public void setElementHarfDrawable(Drawable elementHarfDrawable) {
|
||||
this.elementHarfDrawable = elementHarfDrawable;
|
||||
}
|
||||
|
||||
|
||||
public void setStepSize(StepSize stepSize) {
|
||||
this.stepSize = stepSize;
|
||||
}
|
||||
|
||||
public CustomRatingBar(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContext = context;
|
||||
setOrientation(LinearLayout.HORIZONTAL);
|
||||
TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.CustomRatingBar);
|
||||
elementWidth = mTypedArray.getDimension(R.styleable.CustomRatingBar_elenmentWidth,
|
||||
context.getResources().getDimension(R.dimen.heart_ratingbar_width));
|
||||
elementHeight = mTypedArray.getDimension(R.styleable.CustomRatingBar_elenmentHeight,
|
||||
context.getResources().getDimension(R.dimen.heart_ratingbar_height));
|
||||
elementPadding = mTypedArray.getDimension(R.styleable.CustomRatingBar_elenmentPadding,
|
||||
context.getResources().getDimension(R.dimen.ratingbar_padding));
|
||||
/*
|
||||
* 白天模式下 热心指数(白色)和个人中心(灰色)使用不同的资源
|
||||
* 默认灰色
|
||||
* */
|
||||
otherHeartImg = mTypedArray.getBoolean(R.styleable.CustomRatingBar_OtherHeartImg, true);
|
||||
|
||||
elementStep = mTypedArray.getFloat(R.styleable.CustomRatingBar_elenmentStep, 1.0f);
|
||||
stepSize = StepSize.fromStep(mTypedArray.getInt(R.styleable.CustomRatingBar_stepSize, 1));
|
||||
elementCount = mTypedArray.getInteger(R.styleable.CustomRatingBar_elenmentCount, 5);
|
||||
stepSize = StepSize.Half;
|
||||
|
||||
Drawable drawable_empty_default = ContextCompat.getDrawable(context,
|
||||
otherHeartImg == false ? R.drawable.icon_heart_unchoose : R.drawable.icon_heart_unchoose_other);
|
||||
Drawable drawable_half_default = ContextCompat.getDrawable(context,
|
||||
otherHeartImg == false ? R.drawable.icon_heart_second : R.drawable.icon_heart_second_other);
|
||||
Drawable drawable_fill_default = ContextCompat.getDrawable(context, R.drawable.icon_heart_choose);
|
||||
|
||||
Drawable drawable_empty = mTypedArray.getDrawable(R.styleable.CustomRatingBar_elenmentEmpty);
|
||||
Drawable drawable_half = mTypedArray.getDrawable(R.styleable.CustomRatingBar_elenmentHarf);
|
||||
Drawable drawable_fill = mTypedArray.getDrawable(R.styleable.CustomRatingBar_elenmentFill);
|
||||
|
||||
elementEmptyDrawable = drawable_empty != null ? drawable_empty : drawable_empty_default;
|
||||
elementFillDrawable = drawable_half != null ? drawable_half : drawable_fill_default;
|
||||
elementHarfDrawable = drawable_fill != null ? drawable_fill : drawable_half_default;
|
||||
mClickable = mTypedArray.getBoolean(R.styleable.CustomRatingBar_clickable, false);
|
||||
mTypedArray.recycle();
|
||||
for (int i = 0; i < elementCount; ++i) {
|
||||
final ImageView imageView = getElenmentImageView();
|
||||
imageView.setImageDrawable(elementEmptyDrawable);
|
||||
imageView.setOnClickListener(
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mClickable) {
|
||||
//浮点数的整数部分
|
||||
int fint = (int) elementStep;
|
||||
BigDecimal b1 = new BigDecimal(Float.toString(elementStep));
|
||||
BigDecimal b2 = new BigDecimal(Integer.toString(fint));
|
||||
//浮点数的小数部分
|
||||
float fPoint = b1.subtract(b2).floatValue();
|
||||
if (fPoint == 0) {
|
||||
fint -= 1;
|
||||
}
|
||||
|
||||
if (indexOfChild(v) > fint) {
|
||||
setRating(indexOfChild(v) + 1);
|
||||
} else if (indexOfChild(v) == fint) {
|
||||
if (stepSize == StepSize.Full) {//如果是满星 就不考虑半颗星了
|
||||
return;
|
||||
}
|
||||
//点击之后默认每次先增加一颗星,再次点击变为半颗星
|
||||
if (imageView.getDrawable().getCurrent().getConstantState().
|
||||
equals(elementHarfDrawable.getConstantState())) {
|
||||
setRating(indexOfChild(v) + 1);
|
||||
} else {
|
||||
setRating(indexOfChild(v) + 0.5f);
|
||||
}
|
||||
} else {
|
||||
setRating(indexOfChild(v) + 1f);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
addView(imageView);
|
||||
}
|
||||
setRating(elementStep);
|
||||
}
|
||||
|
||||
private ImageView getElenmentImageView() {
|
||||
ImageView imageView = new ImageView(getContext());
|
||||
LayoutParams layout = new LayoutParams(
|
||||
Math.round(mContext.getResources().getDimension(R.dimen.heart_ratingbar_width)),
|
||||
Math.round(mContext.getResources().getDimension(R.dimen.heart_ratingbar_width)));//设置每个单元格在线性布局的大小
|
||||
layout.setMargins(0, 0, Math.round(elementPadding), 0);//设置每颗星星在线性布局的间距
|
||||
imageView.setLayoutParams(layout);
|
||||
imageView.setAdjustViewBounds(true);
|
||||
imageView.setImageDrawable(elementEmptyDrawable);
|
||||
imageView.setMinimumWidth((int) elementWidth);
|
||||
imageView.setMaxWidth((int) elementWidth);
|
||||
imageView.setMinimumHeight((int) elementHeight);
|
||||
imageView.setMaxHeight((int) elementHeight);
|
||||
return imageView;
|
||||
}
|
||||
|
||||
public void setRating(float rating) {
|
||||
if (rating > elementCount)
|
||||
rating = elementCount;
|
||||
|
||||
if (mOnRatingBarChangeListener != null) {
|
||||
mOnRatingBarChangeListener.onRatingChange(rating);
|
||||
}
|
||||
this.elementStep = rating;
|
||||
//浮点数的整数部分
|
||||
int fint = (int) rating;
|
||||
BigDecimal b1 = new BigDecimal(Float.toString(rating));
|
||||
BigDecimal b2 = new BigDecimal(Integer.toString(fint));
|
||||
//浮点数的小数部分
|
||||
float fPoint = b1.subtract(b2).floatValue();
|
||||
|
||||
//设置选中的单元
|
||||
for (int i = 0; i < fint; ++i) {
|
||||
((ImageView) getChildAt(i)).setImageDrawable(elementFillDrawable);
|
||||
}
|
||||
//设置没有选中的单元
|
||||
for (int i = fint; i < elementCount; i++) {
|
||||
((ImageView) getChildAt(i)).setImageDrawable(elementEmptyDrawable);
|
||||
}
|
||||
//小数点默认增加半个
|
||||
if (fPoint > 0) {
|
||||
((ImageView) getChildAt(fint)).setImageDrawable(elementHarfDrawable);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public interface OnRatingChangeListener {
|
||||
void onRatingChange(float ratingCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 每次增加的方式整颗还是半颗,枚举类型
|
||||
* 类似于View.GONE
|
||||
*/
|
||||
public enum StepSize {
|
||||
Half(0), Full(1);
|
||||
int step;
|
||||
|
||||
StepSize(int step) {
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
public static StepSize fromStep(int step) {
|
||||
for (StepSize f : values()) {
|
||||
if (f.step == step) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.mogo.module.common.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 2019-08-22
|
||||
*/
|
||||
public class ImageViewClipBounds extends AppCompatImageView {
|
||||
Rect mClipBounds = null;
|
||||
|
||||
public ImageViewClipBounds(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ImageViewClipBounds(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public ImageViewClipBounds(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (mClipBounds != null) {
|
||||
// clip bounds ignore scroll
|
||||
canvas.clipRect(mClipBounds);
|
||||
}
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
|
||||
public void setClip(Rect clipBounds) {
|
||||
if (clipBounds == mClipBounds || (clipBounds != null && clipBounds.equals(mClipBounds))) {
|
||||
return;
|
||||
}
|
||||
if (clipBounds != null) {
|
||||
if (mClipBounds == null) {
|
||||
mClipBounds = new Rect(clipBounds);
|
||||
} else {
|
||||
mClipBounds.set(clipBounds);
|
||||
}
|
||||
} else {
|
||||
mClipBounds = null;
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
package com.mogo.module.common.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.animation.AnimationResources;
|
||||
import com.mogo.module.common.animation.AnimationManager;
|
||||
|
||||
public class NetworkLoadingView extends RelativeLayout {
|
||||
|
||||
private ProgressBar loadView;
|
||||
private TextView textView;
|
||||
private AnimationManager mAnimationManager;
|
||||
public Button refresButton;
|
||||
private String loadingText = "正在获取信息…";
|
||||
|
||||
public NetworkLoadingView(Context context) {
|
||||
|
||||
super(context);
|
||||
}
|
||||
|
||||
public NetworkLoadingView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
LayoutInflater.from(context).inflate(R.layout.network_loading_item, this);
|
||||
initView();
|
||||
/*
|
||||
添加动画图片资源
|
||||
* */
|
||||
setLoadingImage(AnimationResources.loadingRes);
|
||||
}
|
||||
|
||||
public NetworkLoadingView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public void initView() {
|
||||
mAnimationManager = new AnimationManager();
|
||||
loadView = findViewById(R.id.loading_imageview);
|
||||
textView = findViewById(R.id.loading_text);
|
||||
refresButton = findViewById(R.id.refresh_button);
|
||||
}
|
||||
|
||||
public void setLoadingText(String text) {
|
||||
if (textView != null) {
|
||||
textView.setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLoadingImage(int[] resources) {
|
||||
mAnimationManager.animationWithTarget(loadView, resources, 100);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (mAnimationManager != null) {
|
||||
mAnimationManager.start();
|
||||
this.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (refresButton != null) {
|
||||
refresButton.setVisibility(GONE);
|
||||
}
|
||||
if (textView != null) {
|
||||
textView.setText(loadingText);
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (mAnimationManager != null) {
|
||||
mAnimationManager.stop();
|
||||
this.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopWithError(String errormsg, int showRefreshButton) {
|
||||
if (mAnimationManager != null) {
|
||||
mAnimationManager.soptWithError();
|
||||
}
|
||||
if (textView != null) {
|
||||
textView.setText(errormsg);
|
||||
}
|
||||
if (refresButton != null) {
|
||||
refresButton.setVisibility(showRefreshButton);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.mogo.module.common.view;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/25
|
||||
*
|
||||
* 防止短时间内多次点击
|
||||
*/
|
||||
abstract class OnPreventFastClickListener implements View.OnClickListener {
|
||||
|
||||
public static final long INTERVAL = 1_000L;
|
||||
|
||||
private long mInterval;
|
||||
private long mLastClickTime = 0L;
|
||||
|
||||
public OnPreventFastClickListener() {
|
||||
this( INTERVAL );
|
||||
}
|
||||
|
||||
public OnPreventFastClickListener( long interval ) {
|
||||
if ( interval < 0L ) {
|
||||
interval = INTERVAL;
|
||||
}
|
||||
this.mInterval = interval;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onClick( View v ) {
|
||||
if ( System.currentTimeMillis() - mLastClickTime > mInterval ) {
|
||||
onClickImpl( v );
|
||||
mLastClickTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void onClickImpl( View v );
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.mogo.module.common.view;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* 这是LinearLayoutManager设置Item间距的的一个辅助类
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private int space;
|
||||
|
||||
public SpacesItemDecoration(int space) {
|
||||
this.space = space;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view,
|
||||
RecyclerView parent, RecyclerView.State state) {
|
||||
outRect.bottom = space;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package com.mogo.module.common.wm;
|
||||
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
|
||||
/**
|
||||
* 采用Dialog实现接口
|
||||
*/
|
||||
class DialogImpl implements IWindowManagerView {
|
||||
private Dialog dialog;
|
||||
private View contentView;
|
||||
|
||||
@Override
|
||||
public void init(WindowManagerView.WMViewParams params) {
|
||||
dialog = new BaseFloatDialog(params.mContext);
|
||||
contentView = params.mContentView;
|
||||
dialog.setContentView(contentView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowing() {
|
||||
return dialog.isShowing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTouchEvent(OnViewClickListener listener) {
|
||||
// do nothings.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(WindowManagerView.WMViewParams params) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
/*
|
||||
* 取得view的父组件,然后移除view
|
||||
*/
|
||||
if (contentView != null) {
|
||||
((ViewGroup) contentView.getParent()).removeView(contentView);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.mogo.module.common.wm;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public interface IWindowManagerView {
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @param params contentView包装类
|
||||
*/
|
||||
void init( WindowManagerView.WMViewParams params );
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*
|
||||
* @return true - 显示中
|
||||
*/
|
||||
boolean isShowing();
|
||||
|
||||
/**
|
||||
* 支持手势拖动,该操作只支持触发点击操作
|
||||
*/
|
||||
void handleTouchEvent(OnViewClickListener listener);
|
||||
|
||||
/**
|
||||
* 显示
|
||||
*/
|
||||
void show();
|
||||
|
||||
/**
|
||||
* 更新界面位置或大小
|
||||
* @param params 具体参数
|
||||
*/
|
||||
void update(WindowManagerView.WMViewParams params);
|
||||
|
||||
/**
|
||||
* 刷新
|
||||
*/
|
||||
void update();
|
||||
|
||||
/**
|
||||
* 隐藏
|
||||
*/
|
||||
void hide();
|
||||
|
||||
public interface OnViewClickListener {
|
||||
void onClick( View view, float xPos, float yPos );
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
package com.mogo.module.common.wm;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
* 采用windowManager实现接口
|
||||
*/
|
||||
class WindowManagerImpl implements IWindowManagerView {
|
||||
|
||||
private WindowManager mWindowManager;
|
||||
private WindowManager.LayoutParams mLayoutParams;
|
||||
private WindowManagerView.WMViewParams mParams;
|
||||
private boolean isShowing;
|
||||
|
||||
private View rootView;
|
||||
|
||||
private float mLastX, mLastY;
|
||||
private int mOldOffsetX, mOldOffsetY;
|
||||
|
||||
@Override
|
||||
public void init( WindowManagerView.WMViewParams params ) {
|
||||
mParams = params;
|
||||
mWindowManager = ( WindowManager ) mParams.mContext.getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
generateLayoutParams();
|
||||
}
|
||||
|
||||
private void generateLayoutParams(){
|
||||
mLayoutParams = new WindowManager.LayoutParams();
|
||||
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ) {
|
||||
mLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
} else {
|
||||
mLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
|
||||
}
|
||||
mLayoutParams.format = PixelFormat.TRANSLUCENT;
|
||||
mLayoutParams.gravity = mParams.mGravity;
|
||||
mLayoutParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
|
||||
mLayoutParams.width = mParams.mWidth;
|
||||
mLayoutParams.height = mParams.mHeight;
|
||||
mOldOffsetX = mLayoutParams.x = mParams.mX;
|
||||
mOldOffsetY = mLayoutParams.y = mParams.mY;
|
||||
mLayoutParams.dimAmount = 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowing() {
|
||||
return isShowing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTouchEvent(OnViewClickListener listener) {
|
||||
mParams.mContentView.setOnTouchListener( ( v, event ) -> {
|
||||
final int action = event.getAction();
|
||||
float x = event.getX();
|
||||
float y = event.getY();
|
||||
if ( action == MotionEvent.ACTION_DOWN ) {
|
||||
mLastX = x;
|
||||
mLastY = y;
|
||||
} else if ( action == MotionEvent.ACTION_MOVE ) {
|
||||
mLayoutParams.x += ( int ) ( x - mLastX ) / 3; // 减小偏移量,防止过度抖动
|
||||
mLayoutParams.y += ( int ) ( y - mLastY ) / 3; // 减小偏移量,防止过度抖动
|
||||
mWindowManager.updateViewLayout( mParams.mContentView, mLayoutParams );
|
||||
} else if ( action == MotionEvent.ACTION_UP ) {
|
||||
int newOffsetX = mLayoutParams.x;
|
||||
int newOffsetY = mLayoutParams.y;
|
||||
// 只要按钮一动位置不是很大,就认为是点击事件
|
||||
if ( Math.abs( mOldOffsetX - newOffsetX ) <= 20
|
||||
&& Math.abs( mOldOffsetY - newOffsetY ) <= 20 ) {
|
||||
if ( listener != null ) {
|
||||
listener.onClick( mParams.mContentView, x, y );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
mOldOffsetX = newOffsetX;
|
||||
mOldOffsetY = newOffsetY;
|
||||
}
|
||||
return true;
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if ( !isShowing ) {
|
||||
isShowing = true;
|
||||
rootView = mParams.mContentView;
|
||||
mWindowManager.addView( mParams.mContentView, mLayoutParams );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(WindowManagerView.WMViewParams params) {
|
||||
if (isShowing) {
|
||||
mParams = params;
|
||||
generateLayoutParams();
|
||||
mWindowManager.updateViewLayout(rootView,mLayoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if ( isShowing ) {
|
||||
mWindowManager.updateViewLayout(rootView,mLayoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
if ( isShowing && mParams != null ) {
|
||||
mWindowManager.removeView( mParams.mContentView );
|
||||
isShowing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
package com.mogo.module.common.wm;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.LayoutRes;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-05-21
|
||||
* <p>
|
||||
* 往 window manager 添加view
|
||||
*/
|
||||
public class WindowManagerView {
|
||||
|
||||
private WMViewParams mParams;
|
||||
|
||||
private IWindowManagerView mManagerView;
|
||||
|
||||
private WindowManagerView( WMViewParams params, IWindowManagerView view ) {
|
||||
this.mParams = params;
|
||||
mManagerView = view;
|
||||
view.init( params );
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
return mManagerView.isShowing();
|
||||
}
|
||||
|
||||
public < T extends View > T findViewById( @IdRes int id ) {
|
||||
return mParams.mContentView.findViewById( id );
|
||||
}
|
||||
|
||||
public void attachTouchEvent( IWindowManagerView.OnViewClickListener listener ) {
|
||||
mManagerView.handleTouchEvent(listener);
|
||||
}
|
||||
|
||||
public void show() {
|
||||
mManagerView.show();
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
mManagerView.hide();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private WMViewParams mParams = null;
|
||||
|
||||
public Builder( Context context ) {
|
||||
mParams = new WMViewParams();
|
||||
mParams.mContext = context;
|
||||
}
|
||||
|
||||
public Builder contentView( View contentView ) {
|
||||
mParams.mContentView = contentView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder contentView( @LayoutRes int contentViewId ) {
|
||||
mParams.mContentView = LayoutInflater.from( mParams.mContext ).inflate( contentViewId, null );
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder size( int width, int height ) {
|
||||
mParams.mWidth = width;
|
||||
mParams.mHeight = height;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder position( int x, int y ) {
|
||||
mParams.mX = x;
|
||||
mParams.mY = y;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder gravity( int gravity ) {
|
||||
mParams.mGravity = gravity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认dialog实现
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public WindowManagerView build() {
|
||||
return showInDialog();
|
||||
}
|
||||
|
||||
public WindowManagerView showInDialog() {
|
||||
if ( mParams.mContentView == null ) {
|
||||
throw new NullPointerException( "WMViewParams#mContentView must not be null." );
|
||||
}
|
||||
return new WindowManagerView( mParams, new DialogImpl() );
|
||||
}
|
||||
|
||||
public WindowManagerView showInWindowManager() {
|
||||
if ( mParams.mContentView == null ) {
|
||||
throw new NullPointerException( "WMViewParams#mContentView must not be null." );
|
||||
}
|
||||
return new WindowManagerView( mParams, new WindowManagerImpl() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class WMViewParams {
|
||||
|
||||
public View mContentView;
|
||||
public Context mContext;
|
||||
public int mWidth;
|
||||
public int mHeight;
|
||||
public int mX;
|
||||
public int mY;
|
||||
public int mGravity;
|
||||
}
|
||||
|
||||
public void exchangeSizeAndPosition(int width, int height, int x, int y) {
|
||||
if (isShowing()) {
|
||||
mParams.mX = x;
|
||||
mParams.mY = y;
|
||||
mParams.mWidth = width;
|
||||
mParams.mHeight = height;
|
||||
mManagerView.update(mParams);
|
||||
}
|
||||
}
|
||||
|
||||
public void update(){
|
||||
if ( mManagerView != null) {
|
||||
mManagerView.update();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 839 B |
|
Before Width: | Height: | Size: 107 KiB |
|
Before Width: | Height: | Size: 787 B |
|
Before Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 859 B |
|
Before Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 818 B |
|
Before Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 977 B |
|
Before Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 908 B |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 499 B |
|
Before Width: | Height: | Size: 749 B |
|
Before Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 126 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |