Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wujifei
2020-11-25 17:09:39 +08:00
26 changed files with 197 additions and 174 deletions

View File

@@ -385,6 +385,9 @@ dependencies {
debugImplementation rootProject.ext.dependencies.debugleakcanary
releaseImplementation rootProject.ext.dependencies.releaseleakcanary
implementation rootProject.ext.dependencies.callchatprovider
implementation rootProject.ext.dependencies.callchat
implementation rootProject.ext.dependencies.mogologlib
compileOnly rootProject.ext.dependencies.adasapi
compileOnly rootProject.ext.dependencies.adasconfigapi
@@ -430,7 +433,6 @@ dependencies {
apply from: "./functions/tts.gradle"
apply from: "./functions/backwidget.gradle"
apply from: "./functions/mediaui.gradle"
apply from: "./functions/bizcallchat.gradle"
apply from: "./functions/bizguide.gradle"
// implementation group: "com.tencent.matrix", name: "matrix-android-lib", version: '0.6.6', changing: true

View File

@@ -1,20 +0,0 @@
// 引导模块:部分机型暂不需要引导模块
project.dependencies {
bydautoImplementation rootProject.ext.dependencies.callchat
bydautoImplementation rootProject.ext.dependencies.callchatprovider
d8xxImplementation rootProject.ext.dependencies.callchat
d8xxImplementation rootProject.ext.dependencies.callchatprovider
d80xImplementation rootProject.ext.dependencies.callchat
d80xImplementation rootProject.ext.dependencies.callchatprovider
em4Implementation rootProject.ext.dependencies.callchat
em4Implementation rootProject.ext.dependencies.callchatprovider
e8xxImplementation rootProject.ext.dependencies.callchat
e8xxImplementation rootProject.ext.dependencies.callchatprovider
f8xxImplementation rootProject.ext.dependencies.callchat
f8xxImplementation rootProject.ext.dependencies.callchatprovider
f80xImplementation rootProject.ext.dependencies.callchat
f80xImplementation rootProject.ext.dependencies.callchatprovider
em3Implementation rootProject.ext.dependencies.callchat
em3Implementation rootProject.ext.dependencies.callchatprovider
}

View File

@@ -129,7 +129,7 @@ TTS_NOOP_VERSION=2.0.7
######## 外部依赖引用
# 车聊聊
CARCHATTING_VERSION=1.6.5-SNAPSHOT
CARCHATTING_VERSION=1.6.7-SNAPSHOT
# 车聊聊接口
CARCHATTINGPROVIDER_VERSION=1.1.7
# loglib

View File

@@ -28,8 +28,8 @@
<dimen name="module_event_fragment_container_padding">20px</dimen>
<dimen name="module_main_apps_fragment_container_paddingTop">20px</dimen>
<dimen name="module_main_event_panel_fragment_paddingTop">18px</dimen>
<dimen name="module_main_event_panel_fragment_paddingBottom">18px</dimen>
<dimen name="module_main_event_panel_fragment_paddingLeft">18px</dimen>
<dimen name="module_main_event_panel_fragment_paddingRight">18px</dimen>
<dimen name="module_main_event_panel_fragment_paddingTop">15px</dimen>
<dimen name="module_main_event_panel_fragment_paddingBottom">15px</dimen>
<dimen name="module_main_event_panel_fragment_paddingLeft">15px</dimen>
<dimen name="module_main_event_panel_fragment_paddingRight">15px</dimen>
</resources>

View File

@@ -31,8 +31,8 @@
<dimen name="module_ext_top_view_max_width">1920px</dimen>
<dimen name="module_main_panel_margin_right">0px</dimen>
<!--事件面板-->
<dimen name="module_main_event_panel_fragment_paddingTop">0px</dimen>
<dimen name="module_main_event_panel_fragment_paddingBottom">0px</dimen>
<dimen name="module_main_event_panel_fragment_paddingLeft">0px</dimen>
<dimen name="module_main_event_panel_fragment_paddingRight">0px</dimen>
<dimen name="module_main_event_panel_fragment_paddingTop">2px</dimen>
<dimen name="module_main_event_panel_fragment_paddingBottom">2px</dimen>
<dimen name="module_main_event_panel_fragment_paddingLeft">6px</dimen>
<dimen name="module_main_event_panel_fragment_paddingRight">6px</dimen>
</resources>

View File

@@ -129,7 +129,7 @@ class OnlineCarPanelAdapter extends RecyclerView.Adapter<OnlineCarPanelAdapter.V
}
float distance = Utils.calculateLineDistance(location.getLon(), location.getLat(), lon, lat);
if (distance >= 1000) {
return String.format("%.1f千米", distance / 1000);
return String.format("%.1f公里", distance / 1000);
} else {
return String.format("%.1f米", distance);
}

View File

@@ -2,8 +2,8 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#1F2131"/>
<corners android:radius="@dimen/module_services_panel_item_corner"/>
<solid android:color="#1F2131" />
<corners android:radius="@dimen/module_services_panel_item_corner" />
</shape>
</item>
</selector>

View File

@@ -16,7 +16,7 @@
android:id="@+id/module_services_id_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_services_online_car_panel_close_margin_top"
android:layout_marginTop="@dimen/module_services_online_car_panel_title_margin_top"
android:textStyle="bold"
android:text="@string/module_services_online_car_panel_title"
android:textColor="@color/module_services_online_car_panel_title_textColor"

View File

@@ -6,13 +6,14 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/module_services_panel_item_marginBottom"
android:background="@drawable/module_services_panel_item_bkg"
android:padding="@dimen/module_services_panel_item_padding">
android:paddingTop="@dimen/module_services_panel_item_padding"
android:paddingStart="@dimen/module_services_panel_item_start"
android:paddingBottom="@dimen/module_services_panel_item_padding">
<com.mogo.module.common.widget.CustomCircleImageView
android:id="@+id/module_services_id_panel_item_avatar"
android:layout_width="@dimen/module_services_panel_item_avatar_size"
android:layout_height="@dimen/module_services_panel_item_avatar_size"
android:layout_marginStart="@dimen/dp_25"
android:src="@drawable/module_common_default_user_head"
app:civ_border_color="@color/module_services_id_panel_item_avatar_border_color"
app:civ_border_width="@dimen/module_services_id_panel_item_avatar_border_width"
@@ -81,7 +82,7 @@
android:textStyle="bold"
android:textColor="@color/module_services_panel_item_detail_textColor"
android:textSize="@dimen/module_services_panel_item_detail_textSize"
android:layout_marginRight="@dimen/dp_30"
android:layout_marginRight="@dimen/module_services_panel_item_start"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -48,7 +48,7 @@
<dimen name="module_services_id_panel_item_avatar_border_width">5px</dimen>
<dimen name="module_services_panel_item_padding">20px</dimen>
<dimen name="module_services_panel_item_nickname_marginLeft">13px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">42px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">10px</dimen>
<dimen name="module_services_panel_item_detail_bkg_corner">8.89px</dimen>
<dimen name="module_services_panel_item_detail_padding">13px</dimen>
<dimen name="module_services_panel_item_marginBottom">16px</dimen>
@@ -62,4 +62,5 @@
<dimen name="module_services_panel_item_corner">12.5px</dimen>
<dimen name="module_services_panel_item_nickname_marginTop">3px</dimen>
<dimen name="module_services_panel_item_distance_tag_marginBottom">3px</dimen>
<dimen name="module_services_panel_item_start">20px</dimen>
</resources>

View File

@@ -45,9 +45,9 @@
<dimen name="module_services_panel_item_distance_textSize">16px</dimen>
<dimen name="module_services_panel_item_nickname_textSize">18px</dimen>
<dimen name="module_services_id_panel_item_avatar_border_width">5px</dimen>
<dimen name="module_services_panel_item_padding">20px</dimen>
<dimen name="module_services_panel_item_padding">28px</dimen>
<dimen name="module_services_panel_item_nickname_marginLeft">13px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">42px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">10px</dimen>
<dimen name="module_services_panel_item_detail_bkg_corner">8.89px</dimen>
<dimen name="module_services_panel_item_detail_padding">13px</dimen>
<dimen name="module_services_panel_item_marginBottom">16px</dimen>
@@ -61,4 +61,5 @@
<dimen name="module_services_panel_item_corner">12.5px</dimen>
<dimen name="module_services_panel_item_nickname_marginTop">3px</dimen>
<dimen name="module_services_panel_item_distance_tag_marginBottom">3px</dimen>
<dimen name="module_services_panel_item_start">20px</dimen>
</resources>

View File

@@ -34,7 +34,7 @@
<dimen name="module_services_online_car_panel_paddingLeft">50px</dimen>
<dimen name="module_services_online_car_panel_paddingBottom">28px</dimen>
<dimen name="module_services_online_car_panel_close_margin_top">36px</dimen>
<dimen name="module_services_online_car_panel_close_margin_top">55px</dimen>
<dimen name="module_services_online_car_panel_title_margin_top">50px</dimen>
<dimen name="module_services_online_car_panel_title_text_size">36px</dimen>
<dimen name="module_services_online_car_panel_recycler_view_margin_top">151px</dimen>
@@ -46,7 +46,7 @@
<dimen name="module_services_id_panel_item_avatar_border_width">9px</dimen>
<dimen name="module_services_panel_item_padding">40px</dimen>
<dimen name="module_services_panel_item_nickname_marginLeft">20px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">70px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">20px</dimen>
<dimen name="module_services_panel_item_detail_bkg_corner">16px</dimen>
<dimen name="module_services_panel_item_detail_padding">21px</dimen>
<dimen name="module_services_panel_item_marginBottom">28px</dimen>

View File

@@ -23,19 +23,18 @@
<dimen name="module_service_content_minWidth">120px</dimen>
<dimen name="module_service_id_marker_content_paddingRight_widthoutCall">20px</dimen>
<dimen name="module_services_online_car_panel_marginTop">20px</dimen>
<dimen name="module_services_online_car_panel_marginBottom">20px</dimen>
<dimen name="module_services_online_car_panel_marginRight">20px</dimen>
<dimen name="module_services_online_car_panel_paddingLeft">50px</dimen>
<dimen name="module_services_online_car_panel_marginTop">13px</dimen>
<dimen name="module_services_online_car_panel_marginBottom">13px</dimen>
<dimen name="module_services_online_car_panel_marginRight">13px</dimen>
<dimen name="module_services_online_car_panel_paddingLeft">43px</dimen>
<dimen name="module_services_online_car_panel_paddingBottom">28px</dimen>
<dimen name="modle_car_panel_call">98px</dimen>
<dimen name="modle_car_panel_call_margin">46px</dimen>
<dimen name="modle_car_panel_call_margin_left">40px</dimen>
<dimen name="module_services_online_car_panel_close_margin_top">36px</dimen>
<dimen name="module_services_online_car_panel_title_margin_top">50px</dimen>
<dimen name="module_services_online_car_panel_close_margin_top">40px</dimen>
<dimen name="module_services_online_car_panel_title_margin_top">55px</dimen>
<dimen name="module_services_online_car_panel_title_text_size">36px</dimen>
<dimen name="module_services_online_car_panel_recycler_view_margin_top">151px</dimen>
<dimen name="module_services_load_strategy_textSize">33px</dimen>
@@ -46,7 +45,7 @@
<dimen name="module_services_id_panel_item_avatar_border_width">9px</dimen>
<dimen name="module_services_panel_item_padding">40px</dimen>
<dimen name="module_services_panel_item_nickname_marginLeft">20px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">70px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">20px</dimen>
<dimen name="module_services_panel_item_detail_bkg_corner">16px</dimen>
<dimen name="module_services_panel_item_detail_padding">21px</dimen>
<dimen name="module_services_panel_item_marginBottom">28px</dimen>
@@ -60,4 +59,5 @@
<dimen name="module_services_panel_item_corner">22.5px</dimen>
<dimen name="module_services_panel_item_nickname_marginTop">6px</dimen>
<dimen name="module_services_panel_item_distance_tag_marginBottom">6px</dimen>
</resources>
<dimen name="module_services_panel_item_start">40px</dimen>
</resources>

View File

@@ -46,7 +46,7 @@
<dimen name="module_services_id_panel_item_avatar_border_width">5px</dimen>
<dimen name="module_services_panel_item_padding">20px</dimen>
<dimen name="module_services_panel_item_nickname_marginLeft">13px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">42px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">10px</dimen>
<dimen name="module_services_panel_item_detail_bkg_corner">8.89px</dimen>
<dimen name="module_services_panel_item_detail_padding">13px</dimen>
<dimen name="module_services_panel_item_marginBottom">16px</dimen>
@@ -60,4 +60,6 @@
<dimen name="module_services_panel_item_corner">12.5px</dimen>
<dimen name="module_services_panel_item_nickname_marginTop">3px</dimen>
<dimen name="module_services_panel_item_distance_tag_marginBottom">3px</dimen>
<dimen name="module_services_panel_item_start">24px</dimen>
¬
</resources>

View File

@@ -6,7 +6,7 @@
<string name="module_service_open_app_tip">亲,建议您使用蘑菇出行</string>
<string name="module_services_str_20Km_radius">扩大到20公里半径</string>
<string name="module_services_str_40Km_radius">扩大到40公里半径</string>
<string name="module_services_panel_item_distance_tag_text">距离导航目的地</string>
<string name="module_services_panel_item_distance_tag_text">距离目的地</string>
<string name="module_services_panel_item_detail_text">查看车友信息</string>
<string name="module_services_panel_item_call">电话</string>
<string name="module_services_online_car_panel_empty_tmpl">很抱歉,目的地%d公里内未找到车友</string>

View File

@@ -76,78 +76,94 @@ public class V2XAlarmServer {
// 检测道路事件是否需UGC问答
V2XEarlyWarningServer.roadEventUgcCheck(currentLocation);
}
// Logger.w(MODULE_NAME, "V2X预警--车辆状态:" + currentLocation);
// Logger.w(MODULE_NAME, "V2X预警--车辆速度:" + currentLocation.getSpeed());
// Logger.w(MODULE_NAME, "V2X预警--v2XRoadEventEntityList" + GsonUtil.jsonFromObject(v2XRoadEventEntityList));
// 60(km/h)
if (currentLocation != null && v2XRoadEventEntityList != null) {
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) {
// 先计算当前车辆的车头朝向是否与事件方向相同这里采用的是区间值只要在20度上下即可使用
// 道路事件必须有朝向,角度>=0;
//Logger.w(MODULE_NAME,
// "V2X预警--车辆与事件信息:" +
// "\n事件名称" + markerNoveltyInfo.getNoveltyInfo().getContentData().getTitle() +
// "\n事件角度" + markerNoveltyInfo.getLocation().getAngle() +
// "\n车头角度" + currentLocation.getAngle() +
// "\n角度差值" + Math.abs(currentLocation.getAngle() - markerNoveltyInfo.getLocation().getAngle()));
// 0、道路事件必须有朝向角度>=0;
if (v2XRoadEventEntity.getLocation().getAngle() >= 0) {
// 计算车辆距离指定气泡的距离
MarkerLocation eventLocation = v2XRoadEventEntity.getLocation();
// 判断是否到达了触发距离,20 ~ 500,
// 1、判断是否到达了触发距离,20 ~ 500,
if (v2XRoadEventEntity.getDistance() <= 500) {
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
currentLocation.getLongitude(),
currentLocation.getLatitude(),
eventLocation.getLon(),
eventLocation.getLat(),
(int) currentLocation.getBearing()
);
if (0 <= eventAngle && eventAngle <= 20) {
// 判断是否已经提示过道路事件
boolean isAlreadyAlert = false;
String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity);
if (!TextUtils.isEmpty(lastTime)) {
long timeSpan = TimeUtils.getTimeSpanByNow(lastTime, TimeConstants.MIN);
// 2、道路事件方向与当前行驶方向角度偏差《20度以内
double carBearing = currentLocation.getBearing();
double eventBearing = eventLocation.getAngle();
double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing);
if (diffAngle < 20) {
// 3、计算当前车辆行驶方向与事件位置之间夹角《20度保证道路事件在车辆前方
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
currentLocation.getLongitude(),
currentLocation.getLatitude(),
eventLocation.getLon(),
eventLocation.getLat(),
(int) currentLocation.getBearing()
);
if (0 <= eventAngle && eventAngle <= 20) {
// 判断是否已经提示过道路事件
boolean isAlreadyAlert = false;
String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity);
if (!TextUtils.isEmpty(lastTime)) {
long timeSpan = TimeUtils.getTimeSpanByNow(lastTime, TimeConstants.MIN);
// Logger.w(MODULE_NAME,
// "V2X预警--事件ID" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
// "\n上一次预警时间" + lastTime +
// "\n距离当前时间" + timeSpan);
// 5分钟内不重复提醒
if (timeSpan < 5) {
isAlreadyAlert = true;
// 5分钟内不重复提醒
if (timeSpan < 5) {
isAlreadyAlert = true;
}
}
// 进行提醒
if (!isAlreadyAlert) {
Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
"\n事件详情ID" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
"\n事件详情" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo()) +
"\n距离" + v2XRoadEventEntity.getDistance() + "" +
"\n是否已经提醒" + isAlreadyAlert +
"\n当前车辆-经度:" + currentLocation.getLongitude() +
"\n当前车辆-经度:" + currentLocation.getLatitude() +
"\n当前车辆-角度:" + currentLocation.getBearing() +
"\n道路事件-经度:" + eventLocation.getLon() +
"\n道路事件-经度:" + eventLocation.getLat() +
"\n道路事件-角度:" + eventLocation.getAngle() +
"\n夹角角度" + eventAngle + ""
);
mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
return v2XRoadEventEntity;
}
return null;
} else {
// Logger.w(MODULE_NAME, "V2X预警--事件与车头角度夹角过大:" +
// "\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
// "\n当前车辆-经度:" + currentLocation.getLongitude() +
// "\n当前车辆-经度:" + currentLocation.getLatitude() +
// "\n当前车辆-角度:" + currentLocation.getBearing() +
// "\n道路事件-经度:" + eventLocation.getLon() +
// "\n道路事件-经度:" + eventLocation.getLat() +
// "\n道路事件-角度:" + eventLocation.getAngle() +
// "\n夹角角度" + eventAngle + " 度"
// );
}
Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
"\n距离" + v2XRoadEventEntity.getDistance() + "" +
"\n是否已经提醒" + isAlreadyAlert +
"\n事件ID" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
"\n事件详情" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo())
);
// 进行提醒
if (!isAlreadyAlert) {
mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
return v2XRoadEventEntity;
}
return null;
} else {
Logger.w(MODULE_NAME, "V2X预警--事件与车头角度夹角过大:" +
"\n角度" + eventAngle + "" +
"\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
Logger.w(MODULE_NAME,
"V2X预警--车头方向与事件方向角度不一致:" +
"\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
"\n车头方向 " + carBearing +
"\n事件方向" + eventBearing +
"\n角度差值" + diffAngle
);
}
} else {
Logger.w(MODULE_NAME, "V2X预警--车辆距离事件距离大于500米了" +
"\n距离" + v2XRoadEventEntity.getDistance() + "" +
"\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
);
// Logger.w(MODULE_NAME, "V2X预警--车辆距离事件距离大于500米了" +
// "\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
// "\n距离" + v2XRoadEventEntity.getDistance() + "米"
// );
}
} else {
Logger.w(MODULE_NAME,
"V2X预警--车头方向与事件方向角度不一致:" +
"\n车头方向: " + currentLocation.getBearing() +
"\n事件方向" + v2XRoadEventEntity.getLocation().getAngle()
Logger.e(MODULE_NAME,
"V2X预警--道路事件没有角度信息" +
"\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
);
}
}
@@ -189,11 +205,11 @@ public class V2XAlarmServer {
switch (levelListBean.getLevel()) {
//正常
case "NORMAL":
Logger.d(MODULE_NAME, "驾驶疲劳程度: 正常");
//Logger.d(MODULE_NAME, "驾驶疲劳程度: 正常");
break;
//轻度
case "SLIGHT":
Logger.w(MODULE_NAME, "驾驶疲劳程度: 轻度");
//Logger.w(MODULE_NAME, "驾驶疲劳程度: 轻度");
if (!mV2XFatigueDrivingEventLevel.contains("SLIGHT")) {
mV2XFatigueDrivingEventLevel.add("SLIGHT");
drivingShowEntity.setShowWindow(false);
@@ -208,15 +224,15 @@ public class V2XAlarmServer {
break;
//中度
case "MODERATE":
Logger.e(MODULE_NAME, "驾驶疲劳程度: 中度");
//Logger.e(MODULE_NAME, "驾驶疲劳程度: 中度");
warningParkPoi(location, onFatigueDrivingListener, drivingShowEntity, levelListBean);
break;
//重度
case "SEVERE":
Logger.e(MODULE_NAME, "驾驶疲劳程度: 重度");
//Logger.e(MODULE_NAME, "驾驶疲劳程度: 重度");
break;
default:
Logger.e(MODULE_NAME, "驾驶疲劳程度: 超出定义范围");
//Logger.e(MODULE_NAME, "驾驶疲劳程度: 超出定义范围");
break;
}
}
@@ -238,7 +254,7 @@ public class V2XAlarmServer {
LocationUtils.geoCodeSearch(location, new IMogoGeoSearchListener() {
@Override
public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
Logger.i(MODULE_NAME, "根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress());
//Logger.i(MODULE_NAME, "根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress());
String keyword = "停车场";
boolean isHighWay = false;
// 如果当前位置是高速则推荐服务区

View File

@@ -4,22 +4,18 @@ import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.utils.DrivingDirectionUtils;
import com.mogo.module.v2x.utils.EventTypeUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.share.IMogoTanluProvider;
import com.mogo.service.share.TanluUploadParams;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -30,7 +26,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
public class V2XEarlyWarningServer {
private static final String TAG = "V2XEarlyWarningServer";
private static List<String> alertMessageId = new ArrayList<>();
private static ArrayList<String> alertMessageId = new ArrayList<>();
/**
* 对提醒过的道路事件进行UGC检测
@@ -54,37 +50,49 @@ public class V2XEarlyWarningServer {
(int) currentLocation.getBearing()
);
// 判断车辆行驶角度是否与事件相反,相反的话表示已经行驶过去了
if (90 <= eventAngle && !alertMessageId.contains(v2XRoadEventEntity.getNoveltyInfo().getInfoId())) {
// 封路、施工、拥堵、拥堵 才会有UGC提示
if (EventTypeUtils.isNeedRoadEventUgc(v2XRoadEventEntity.getPoiType())) {
double carBearing = currentLocation.getBearing();
String roadInfoId = v2XRoadEventEntity.getNoveltyInfo().getInfoId();
Logger.w(MODULE_NAME + "_" + TAG, "V2X预警UGC--事件与车头角度夹角过大:" +
"\n角度" + eventAngle + "" +
"\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
"\n库存事件" + V2XAlarmServer.mAlertRoadEventList.size()
);
// 封路、施工、拥堵、拥堵 才会有UGC提示
if (EventTypeUtils.isNeedRoadEventUgc(v2XRoadEventEntity.getPoiType())) {
Logger.w(MODULE_NAME,
"V2X预警--UGC检测" +
"\n事件详情" + roadInfoId +
"\n事件详情" + EventTypeUtils.getPoiTypeStr(v2XRoadEventEntity.getPoiType()) +
"\n车头方向 " + carBearing +
"\n车与事件夹角" + eventAngle +
"\n已经UGC的事件" + GsonUtil.jsonFromObject(alertMessageId)
);
// 判断是否预警过了
if (!alertMessageId.contains(roadInfoId)) {
// 判断车辆行驶角度是否与事件相反,相反的话表示已经行驶过去了
if (80 <= eventAngle) {
Logger.w(MODULE_NAME + "_" + TAG, "V2X预警UGC--事件与车头角度夹角过大:" +
"\n角度" + eventAngle + "" +
"\n事件详情" + roadInfoId +
"\n库存事件" + V2XAlarmServer.mAlertRoadEventList.size()
);
// 记录已经 UGC 提醒过的数据
alertMessageId.add(v2XRoadEventEntity.getNoveltyInfo().getInfoId());
// 记录已经 UGC 提醒过的数据
alertMessageId.add(roadInfoId);
// 加载数据源
V2XMessageEntity<V2XRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2XRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
// 弹出UGC
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
// 加载数据源
V2XMessageEntity<V2XRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2XRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
// 弹出UGC
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
}
// 移出已经预警的事件列表
//V2XAlarmServer.mAlertRoadEventList.remove(v2XRoadEventEntity);
}
// 移出已经预警的事件列表
//V2XAlarmServer.mAlertRoadEventList.remove(v2XRoadEventEntity);
}
}
}

View File

@@ -154,11 +154,11 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
V2XServiceManager.getV2XStatusManager().getLocation());
// 距离是否大于10米 && 消息是否不为空
if (v2XRoadEventEntity != null && v2XRoadEventEntity.getDistance() >= 5) {
Logger.w(MODULE_NAME,
//"\nV2X预警--当前导航状态:" + V2XServiceManager.getNavi().isNaviing() +
//"\nV2X预警--roadEventIsNullCount:" + roadEventIsNullCount +
"\nV2X预警--当前预警事件:" + v2XRoadEventEntity
);
// Logger.w(MODULE_NAME,
// //"\nV2X预警--当前导航状态:" + V2XServiceManager.getNavi().isNaviing() +
// //"\nV2X预警--roadEventIsNullCount:" + roadEventIsNullCount +
// "\nV2X预警--当前预警事件:" + v2XRoadEventEntity
// );
// Logger.w(MODULE_NAME, "V2X预警--前方数据距离:" + v2XRoadEventEntity.getDistance());
// 触发展示操作
TrackUtils.trackV2xRoadProduceEvent(1);
@@ -229,7 +229,7 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
LocationUtils.geoCodeSearch(location, new IMogoGeoSearchListener() {
@Override
public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
Logger.i(MODULE_NAME, " 根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress());
//Logger.i(MODULE_NAME, " 根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress());
location.setAddress(regeocodeResult.getRegeocodeAddress().getFormatAddress());
// 如果有 "高速"、"环线"、"快速路"等字眼的,视为封闭式道路,流程结束;
if (regeocodeResult.getRegeocodeAddress().getFormatAddress().contains("高速")
@@ -257,7 +257,7 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
.queryIllegalPark(new V2XRefreshCallback<MarkerResponse>() {
@Override
public void onSuccess(MarkerResponse result) {
Logger.i(MODULE_NAME, "搜索附近的违章停车点 成功:" + GsonUtil.jsonFromObject(result));
//Logger.i(MODULE_NAME, "搜索附近的违章停车点 成功:" + GsonUtil.jsonFromObject(result));
if (result != null) {
if (result.getResult().getExploreWay().size() > 0) {
V2XMessageEntity<List<MarkerExploreWay>> entity = new V2XMessageEntity<>();

View File

@@ -60,7 +60,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
@Override
public void drawableLastAllPOI() {
Logger.w(MODULE_NAME, "V2X---绘制上一次的POI回调给Launcher底层逻辑让其进行绘制");
//Logger.w(MODULE_NAME, "V2X---绘制上一次的POI回调给Launcher底层逻辑让其进行绘制");
// 清除连接线
V2XServiceManager.getMoGoV2XPolylineManager().clearLine();
clearAlarmPOI();
@@ -521,7 +521,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
try {
V2XServiceManager.getMapUIController().changeMapMode(EnumMapUI.NorthUP_2D);
V2XServiceManager.getMoGoV2XStatusManager().setRoadEventPOIShow(TAG, true);
Logger.i(MODULE_NAME, "绘制道路事件====drawableAlarmPOI");
//Logger.i(MODULE_NAME, "绘制道路事件====drawableAlarmPOI");
// 清除原来的大而全的新鲜事儿
clearALLPOI();
if (roadEventEntity.getLocation() != null) {

View File

@@ -23,7 +23,7 @@ public class SceneBroadcastReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
try {
V2XMessageEntity v2XMessageEntity = (V2XMessageEntity) intent.getSerializableExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY);
Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
//Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
} catch (Exception e) {
e.printStackTrace();

View File

@@ -55,7 +55,7 @@ public class V2XScenarioManager implements IV2XScenarioManager {
@Override
public void handlerMessage(V2XMessageEntity v2XMessageEntity) {
Logger.d(MODULE_NAME, "处理V2X场景" + GsonUtil.jsonFromObject(v2XMessageEntity));
//Logger.d(MODULE_NAME, "处理V2X场景" + GsonUtil.jsonFromObject(v2XMessageEntity));
synchronized (V2XScenarioManager.class) {
// 展示
V2XUtils.runOnUiThread(() -> {

View File

@@ -1,5 +1,7 @@
package com.mogo.module.v2x.utils;
import static java.lang.Math.PI;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
@@ -22,8 +24,8 @@ public class DrivingDirectionUtils {
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 / Math.PI);
double _angle = Math.atan2(Math.abs(carLon - poiLon), Math.abs(carLat - poiLat)) * (180 / PI);
//Log.w(MODULE_NAME, "getDegreeOfCar2Poi_计算车辆行驶方向 与 poi点到车辆的连线 间的夹角_angle===" + _angle);
if (poiLon > carLon) {
// poi 在 车辆位置的第1象限
if (poiLat > carLat) {
@@ -46,9 +48,27 @@ public class DrivingDirectionUtils {
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;
}
}
/**
* 计算车辆行驶方向 与 poi点到车辆的连线 间的夹角
* 计算车辆行驶方向角度,起点&终点经纬度
*
* @param carLat 车辆位置 lat
* @param carLon 车辆位置 lon
@@ -58,7 +78,7 @@ public class DrivingDirectionUtils {
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 / Math.PI);
double _angle = Math.atan2(Math.abs(carLon - poiLon), Math.abs(carLat - poiLat)) * (180 / PI);
if (poiLon > carLon) {
// poi 在 车辆位置的第1象限
@@ -87,23 +107,15 @@ public class DrivingDirectionUtils {
}
/**
* 计算两个行驶方向间的夹角 计算结果小于180度
* 计算两个角度差值
*
* @param angle0
* @param angle1
* @return
* @param angle1 角度1
* @param angle2 角度2
* @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;
}
public static double getAngleDiff(double angle1, double angle2) {
// 两个角度差值较小
return 180 - Math.abs(Math.abs(angle1 - angle2) - 180);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#DDDDDD"/>
<solid android:color="#E5E5E5"/>
<corners android:radius="@dimen/module_services_panel_item_corner"/>
</shape>
</item>