From 256c06f36b908d1f0e542384e22a6fa2dcf6ca71 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 6 Aug 2020 09:46:38 +0800 Subject: [PATCH 1/6] close the proguard --- app/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0ef830f124..eaaa292644 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -44,9 +44,9 @@ android { signingConfig signingConfigs.release } release { - minifyEnabled true - zipAlignEnabled true - shrinkResources true + minifyEnabled false + zipAlignEnabled false + shrinkResources false signingConfig signingConfigs.release proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } From 78d4d1d58fba0c430b730d4c856384f33901fac7 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Thu, 6 Aug 2020 11:02:18 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=A6=96=E6=AC=A1?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=97=A0=E6=B3=95=E5=88=B7=E6=96=B0=E9=81=93?= =?UTF-8?q?=E8=B7=AF=E4=BA=8B=E4=BB=B6=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/module/service/MogoServices.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java index 3b184598cb..1cd37bc275 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java @@ -364,6 +364,7 @@ public class MogoServices implements IMogoMapListener, if ( msg.obj instanceof RefreshObject ) { RefreshObject ro = ( ( RefreshObject ) msg.obj ); if ( ro.mLonLat == null ) { + invokeAutoRefreshStrategy(); return; } mRefreshModel.refreshData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback ); @@ -617,9 +618,7 @@ public class MogoServices implements IMogoMapListener, // 自动刷新触发 final MogoLatLng point = new MogoLatLng( location.getLatitude(), location.getLongitude() ); if ( mLastAutoRefreshLocation == null ) { - mLastAutoRefreshLocation = point; - mLoopRequest = true; - notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback ); + startFirstLocationRequest( point ); return; } float distance = Utils.calculateLineDistance( mLastAutoRefreshLocation, point ); @@ -633,8 +632,27 @@ public class MogoServices implements IMogoMapListener, } } + /** + * 首次定位成功后,执行道路事件的刷新 + * + * @param point + */ + private void startFirstLocationRequest( MogoLatLng point ) { + mLastAutoRefreshLocation = point; + mLoopRequest = true; + notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback ); + } + @Override public void onCarLocationChanged2( Location latLng ) { + if ( latLng == null ) { + return; + } + // poi 定位无法获取时,使用该定位 + if ( mLastAutoRefreshLocation == null ) { + MogoLatLng point = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() ); + startFirstLocationRequest( point ); + } } @Override From e50a3cc973fb09d3a75398ed3b01dae3970a3b12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Thu, 6 Aug 2020 17:10:03 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E8=BD=A6=E8=BE=86=E4=BD=8D=E7=BD=AE=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=8B=BF=E5=88=B0=E7=9A=84=E6=97=B6=E5=80=99=E8=B7=9D=E7=A6=BB?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2x/listener/V2XMessageListener_401012.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java index 38b9fab0a3..9d5d6d6e40 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java @@ -52,10 +52,15 @@ public class V2XMessageListener_401012 implements IMogoOnMessageListener Date: Thu, 6 Aug 2020 17:21:49 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E8=BD=A6=E8=BE=86=E4=BD=8D=E7=BD=AE=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=8B=BF=E5=88=B0=E7=9A=84=E6=97=B6=E5=80=99=E8=B7=9D=E7=A6=BB?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/common/entity/MarkerCardResult.java | 17 +++++++---------- .../v2x/listener/V2XMessageListener_401012.java | 7 +++---- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java index 3896ae58c4..61e425aaba 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java @@ -16,6 +16,7 @@ public class MarkerCardResult extends BaseData { private List onlineCar; private List exploreWay; + private long messageTime; public List getCarChat() { return carChat; @@ -65,15 +66,11 @@ public class MarkerCardResult extends BaseData { this.dataType = dataType; } - @Override - public String toString() { - return "MarkerCardResult{" + - "dataType=" + dataType + - ", carChat=" + carChat + - ", exploreWay=" + exploreWay + - ", onlineCar=" + onlineCar + - ", shareMusic=" + shareMusic + - ", noveltyInfo=" + noveltyInfo + - '}'; + public long getMessageTime() { + return messageTime; + } + + public void setMessageTime(long messageTime) { + this.messageTime = messageTime; } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java index 9d5d6d6e40..34ada8b9c1 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java @@ -53,15 +53,14 @@ public class V2XMessageListener_401012 implements IMogoOnMessageListener Date: Thu, 6 Aug 2020 17:32:14 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E8=BD=A6=E8=BE=86=E4=BD=8D=E7=BD=AE=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=8B=BF=E5=88=B0=E7=9A=84=E6=97=B6=E5=80=99=E8=B7=9D=E7=A6=BB?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mogo/module/v2x/V2XStatusManager.java | 2 ++ .../mogo/module/v2x/listener/V2XMessageListener_401012.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XStatusManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XStatusManager.java index 12396a786e..1dfdf64b5a 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XStatusManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XStatusManager.java @@ -3,6 +3,7 @@ package com.mogo.module.v2x; import com.mogo.map.MogoLatLng; import com.mogo.map.location.MogoLocation; import com.mogo.module.common.entity.V2XRoadEventEntity; +import com.mogo.utils.logger.Logger; /** * author : donghongyu @@ -53,6 +54,7 @@ public class V2XStatusManager { if (mLocation == null) { mLocation = new MogoLocation(); } + Logger.d(V2XConst.MODULE_NAME, "当前车辆位置:" + mLocation.toString()); return mLocation; } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java index 34ada8b9c1..3716e804b7 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java @@ -53,14 +53,14 @@ public class V2XMessageListener_401012 implements IMogoOnMessageListener 0 || currentLocation.getLongitude() > 0) { calculateDistance = Utils.calculateLineDistance( new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()), new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude()) ); markerExploreWay.setDistance(calculateDistance); } - v2XRoadEventEntity.setDistance(markerExploreWay.getDirection()); + v2XRoadEventEntity.setDistance(markerExploreWay.getDistance()); v2XRoadEventEntity.setNoveltyInfo(markerExploreWay); v2XRoadEventEntity.setExpireTime(20000); From 55c37faf061f833e2ce4dd2d0ed3c09e29b9830c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Thu, 6 Aug 2020 18:22:50 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E9=92=88?= =?UTF-8?q?=E5=AF=B9=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE=E7=9A=84=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=EF=BC=8C=E4=B8=89=E5=88=86=E9=92=9F=E5=86=85=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=98=AF=E5=8F=AF=E4=BB=A5=E8=A2=AB=E6=B6=88?= =?UTF-8?q?=E8=B4=B9=E6=8E=89=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../listener/V2XMessageListener_401012.java | 77 ++++++++++--------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java index 3716e804b7..2c794c6e75 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401012.java @@ -15,6 +15,7 @@ import com.mogo.module.service.Utils; import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.alarm.V2XAlarmServer; +import com.mogo.module.v2x.utils.TimeConstants; import com.mogo.module.v2x.utils.TimeUtils; import com.mogo.module.v2x.utils.V2XUtils; import com.mogo.service.connection.IMogoOnMessageListener; @@ -42,42 +43,48 @@ public class V2XMessageListener_401012 implements IMogoOnMessageListener 0) { - MarkerExploreWay markerExploreWay = response.getExploreWay().get(0); - MarkerLocation markerLocation = markerExploreWay.getLocation(); - // 记录道路事件 - V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity(); - v2XRoadEventEntity.setLocation(markerLocation); - // 探路目前只有上报拥堵 - v2XRoadEventEntity.setPoiType(markerExploreWay.getPoiType()); - // 当前车辆数据 - MogoLocation currentLocation = V2XServiceManager.getV2XStatusManager().getLocation(); - float calculateDistance; - if (currentLocation.getLatitude() > 0 || currentLocation.getLongitude() > 0) { - calculateDistance = Utils.calculateLineDistance( - new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()), - new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude()) - ); - markerExploreWay.setDistance(calculateDistance); + long timeSpan = TimeUtils.getTimeSpan(TimeUtils.getNowMills(), response.getMessageTime(), TimeConstants.MIN); + // 三分钟以内的消息才会提示用户 + if (timeSpan <= 3) { + if (response.getExploreWay() != null && response.getExploreWay().size() > 0) { + MarkerExploreWay markerExploreWay = response.getExploreWay().get(0); + MarkerLocation markerLocation = markerExploreWay.getLocation(); + // 记录道路事件 + V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity(); + v2XRoadEventEntity.setLocation(markerLocation); + // 探路目前只有上报拥堵 + v2XRoadEventEntity.setPoiType(markerExploreWay.getPoiType()); + // 当前车辆数据 + MogoLocation currentLocation = V2XServiceManager.getV2XStatusManager().getLocation(); + float calculateDistance; + if (currentLocation.getLatitude() > 0 || currentLocation.getLongitude() > 0) { + calculateDistance = Utils.calculateLineDistance( + new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()), + new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude()) + ); + markerExploreWay.setDistance(calculateDistance); + } + v2XRoadEventEntity.setDistance(markerExploreWay.getDistance()); + v2XRoadEventEntity.setNoveltyInfo(markerExploreWay); + v2XRoadEventEntity.setExpireTime(20000); + + // 记录播报过的道路事件 + V2XAlarmServer.mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString()); + + V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); + // 控制类型 + v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING); + // 设置数据 + v2xMessageEntity.setContent(v2XRoadEventEntity); + // 控制展示状态 + v2xMessageEntity.setShowState(true); + + Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); + intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity); + LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent); } - v2XRoadEventEntity.setDistance(markerExploreWay.getDistance()); - v2XRoadEventEntity.setNoveltyInfo(markerExploreWay); - v2XRoadEventEntity.setExpireTime(20000); - - // 记录播报过的道路事件 - V2XAlarmServer.mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString()); - - V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); - // 控制类型 - v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING); - // 设置数据 - v2xMessageEntity.setContent(v2XRoadEventEntity); - // 控制展示状态 - v2xMessageEntity.setShowState(true); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity); - LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent); + } else { + Logger.e(MODULE_NAME, "V2XMessageListener_401012==V2X服务端下发:消息已过期,大于3分钟了不进行消费"); } } catch (Exception e) { e.printStackTrace();