diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventWindow.java index 88917a149d..e9a5059911 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/push/V2XPushEventWindow.java @@ -36,7 +36,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME; * e-mail : 1358506549@qq.com * date : 2020/4/14 2:37 PM * desc : - * TODO 目前睡前瞻推送使用的消息都在这里展示 + * TODO 目前前瞻推送使用的消息都在这里展示 * version: 1.0 */ public class V2XPushEventWindow extends V2XBasWindow implements IV2XWindow { diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java index e3541d261b..120088508a 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java @@ -1,11 +1,7 @@ package com.mogo.module.v2x.scenario.scene.pushVR; -import android.graphics.Color; - -import com.mogo.map.marker.IMogoMarker; import com.mogo.map.overlay.IMogoPolyline; import com.mogo.map.overlay.MogoPolylineOptions; -import com.mogo.module.common.drawer.PushRoadConditionDrawer; import com.mogo.module.common.entity.V2XPushMessageEntity; import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; @@ -27,7 +23,6 @@ public class V2XPushVREventMarker implements IV2XMarker { private final String TAG = "V2XPushVREventMarker"; private static IMogoPolyline mMogoPolyline; - private static IMogoMarker mAlarmInfoMarker; @Override public void drawPOI(V2XPushMessageEntity entity) { @@ -42,39 +37,12 @@ public class V2XPushVREventMarker implements IV2XMarker { mMogoPolyline.remove(); } // 绘制引导线 - drawablePloyLine(entity); drawableRecommendPolyline(entity); } catch (Exception e) { e.printStackTrace(); } } - /** - * 绘制引导线 - * - * @param entity - */ - void drawablePloyLine(V2XPushMessageEntity entity) { - // 连接线参数 - MogoPolylineOptions options = new MogoPolylineOptions(); - - // 渐变色 - List colors = new ArrayList<>(); - colors.add(0xFFFA8C34); - colors.add(0xFFBD6D36); - colors.add(0xFFFA8C34); - - // 线条粗细,渐变,渐变色值 - options.width(300).useGradient(false).color(Color.argb(255, 255, 0, 0)); - - for (double[] doubles : entity.getPolyline()) { - options.add(doubles[0], doubles[1]); - } - - // 绘制线的对象 - mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); - } - /** * 绘制推荐引导线 * @@ -91,7 +59,7 @@ public class V2XPushVREventMarker implements IV2XMarker { colors.add(0xFFCB253A); // 线条粗细,渐变,渐变色值 - options.width(15).useGradient(true).color(0xFFEF3A3A); + options.width(15).useGradient(true).color(0xFFF95959); for (double[] doubles : entity.getRecommendPolyline()) { options.add(doubles[0], doubles[1]); @@ -107,18 +75,10 @@ public class V2XPushVREventMarker implements IV2XMarker { MarkerUtils.resetMapZoom(16); // 移除线 clearLine(); - // 移除事件POI - clearAlarmPOI(); // 绘制上次的数据 V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI(); } - void clearAlarmPOI() { - if (mAlarmInfoMarker != null) { - mAlarmInfoMarker.remove(); - } - } - public void clearLine() { if (mMogoPolyline != null) { mMogoPolyline.remove(); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventScenario.java index 31770af166..59c29c99ff 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventScenario.java @@ -1,14 +1,17 @@ package com.mogo.module.v2x.scenario.scene.pushVR; import android.view.View; +import android.view.ViewGroup; import androidx.annotation.Nullable; import com.mogo.module.common.entity.V2XMessageEntity; import com.mogo.module.common.entity.V2XPushMessageEntity; +import com.mogo.module.v2x.R; import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.scenario.impl.AbsV2XScenario; +import com.mogo.module.v2x.utils.V2XUtils; import com.mogo.service.windowview.IMogoTopViewStatusListener; import com.mogo.utils.logger.Logger; import com.mogo.utils.network.utils.GsonUtil; @@ -32,7 +35,7 @@ public class V2XPushVREventScenario @Override public void init(@Nullable V2XMessageEntity v2XMessageEntity) { - Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR场景:" + GsonUtil.jsonFromObject(v2XMessageEntity)); + Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR:" + GsonUtil.jsonFromObject(v2XMessageEntity)); if (!isSameScenario(v2XMessageEntity) && V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) { @@ -58,7 +61,15 @@ public class V2XPushVREventScenario @Override public void showWindow() { if (getV2XWindow() != null) { + ViewGroup.LayoutParams layoutParams = + new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + (int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height_ground)); + V2XServiceManager + .getMogoTopViewManager() + .addView(getV2XWindow().getView(), layoutParams, this); getV2XWindow().show(getV2XMessageEntity().getContent()); + V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, true); } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventWindow.java index 3efb61a229..d41e60a714 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventWindow.java @@ -1,14 +1,17 @@ package com.mogo.module.v2x.scenario.scene.pushVR; +import android.content.Context; import android.os.Handler; +import android.util.AttributeSet; +import android.view.LayoutInflater; import android.view.View; import com.mogo.module.common.entity.V2XPushMessageEntity; import com.mogo.module.v2x.R; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.listener.V2XWindowStatusListener; +import com.mogo.module.v2x.scenario.scene.V2XBasWindow; import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.service.entrance.IMogoEntranceButtonController; import com.mogo.utils.logger.Logger; import static com.mogo.module.v2x.V2XConst.MODULE_NAME; @@ -21,7 +24,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME; * TODO 只有VR演示场景使用 * version: 1.0 */ -public class V2XPushVREventWindow implements IV2XWindow { +public class V2XPushVREventWindow extends V2XBasWindow implements IV2XWindow { private String TAG = "V2XPushVREventWindow"; // 处理道路事件,30秒倒计时 @@ -29,6 +32,26 @@ public class V2XPushVREventWindow implements IV2XWindow { private Runnable runnableV2XEvent; private int mExpireTime = 30000; + public V2XPushVREventWindow() { + this(V2XServiceManager.getContext()); + } + + public V2XPushVREventWindow(Context context) { + this(context, null); + } + + public V2XPushVREventWindow(Context context, AttributeSet attrs) { + this(V2XServiceManager.getContext(), null, 0); + } + + public V2XPushVREventWindow(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + // 填充布局 + LayoutInflater.from(context).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ? + R.layout.window_road_event_detail_vr : R.layout.window_road_event_detail, this); + + } + /** * 展示道路事件详情Windows */ @@ -36,13 +59,7 @@ public class V2XPushVREventWindow implements IV2XWindow { public void show(V2XPushMessageEntity entity) { Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=推送消息:展示 Window=\n" + entity); - V2XServiceManager - .getMogoEntranceButtonController() - .showLeftNoticeByType( - IMogoEntranceButtonController.NOTICE_TYPE_CONGESTION_RECOMMENDED, - R.drawable.module_v2x_left_notice_seek_help, - entity.getAlarmContent()); - //countDownV2XEvent(); + countDownV2XEvent(); } /** @@ -51,21 +68,22 @@ public class V2XPushVREventWindow implements IV2XWindow { @Override public void close() { Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=关闭Window"); - V2XServiceManager - .getMogoEntranceButtonController() - .hideLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_CONGESTION_RECOMMENDED); - // 停止倒计时 if (handlerV2XEvent != null && runnableV2XEvent != null) { handlerV2XEvent.removeCallbacks(runnableV2XEvent); runnableV2XEvent = null; } + //移除窗体 + V2XServiceManager + .getMogoTopViewManager() + .removeView(this); + } @Override public View getView() { - return null; + return this; } @Override diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java index bd0e95de1e..1084029093 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java @@ -427,7 +427,7 @@ public class TestOnLineCarUtils { try { InputStream inputStream = V2XUtils.getApp() .getResources() - .openRawResource(R.raw.scenario_push_vr_event_data_yongdu); + .openRawResource(R.raw.scenario_push_vr_event_data_yongdu_gongsi); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int len = -1; byte[] buffer = new byte[1024]; diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json index 58209f8d88..457560116b 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json @@ -575,171 +575,5 @@ 116.72509, 40.195228 ] - ], - "moveTrack": [ - [ - 116.731239, - 40.196264 - ], - [ - 116.731082, - 40.19622 - ], - [ - 116.730919, - 40.196173 - ], - [ - 116.730762, - 40.196125 - ], - [ - 116.730596, - 40.196069 - ], - [ - 116.730437, - 40.196013 - ], - [ - 116.730296, - 40.195959 - ], - [ - 116.730122, - 40.19589 - ], - [ - 116.729956, - 40.195823 - ], - [ - 116.729841, - 40.195777 - ], - [ - 116.729797, - 40.195759 - ], - [ - 116.729696, - 40.195721 - ], - [ - 116.729624, - 40.195695 - ], - [ - 116.729498, - 40.195649 - ], - [ - 116.729464, - 40.195637 - ], - [ - 116.729366, - 40.195604 - ], - [ - 116.729294, - 40.195583 - ], - [ - 116.729122, - 40.195533 - ], - [ - 116.728954, - 40.195489 - ], - [ - 116.728781, - 40.195448 - ], - [ - 116.728616, - 40.195412 - ], - [ - 116.728442, - 40.195376 - ], - [ - 116.728269, - 40.195341 - ], - [ - 116.728087, - 40.195311 - ], - [ - 116.727909, - 40.195283 - ], - [ - 116.727746, - 40.195263 - ], - [ - 116.727561, - 40.195242 - ], - [ - 116.727386, - 40.195226 - ], - [ - 116.727213, - 40.195217 - ], - [ - 116.727036, - 40.19521 - ], - [ - 116.726865, - 40.195206 - ], - [ - 116.72669, - 40.195206 - ], - [ - 116.726512, - 40.195207 - ], - [ - 116.726333, - 40.195209 - ], - [ - 116.726144, - 40.195211 - ], - [ - 116.725959, - 40.195214 - ], - [ - 116.725771, - 40.195217 - ], - [ - 116.725588, - 40.195221 - ], - [ - 116.725411, - 40.195225 - ], - [ - 116.725201, - 40.195228 - ], - [ - 116.72509, - 40.195228 - ] ] } \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu_gongsi.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu_gongsi.json new file mode 100644 index 0000000000..b466e96184 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu_gongsi.json @@ -0,0 +1,95 @@ +{ + "sceneId": "200008", + "alarmContent": "拥堵路线推荐", + "expireTime": 20000, + "sceneCategory": 0, + "sceneDescription": "拥堵路线推荐", + "sceneName": "拥堵路线推荐", + "sceneLevel": 0, + "videoUrl": "", + "videoChannel": "", + "videoSn": "", + "tts": "发现前方拥堵,最优路线快6分钟", + "zoom": false, + "zoomScale": 15, + "userHead": "", + "msgImgUrl": "", + "lat":39.969088, + "lon":116.41808, + "polyline": [ + [ + 116.408012,39.968598 + ], + [ + 116.408784,39.968688 + ], + [ + 116.409632,39.968688 + ], + [ + 116.410168,39.968688 + ], + [ + 116.410898,39.968795 + ], + [ + 116.412143,39.968812 + ], + [ + 116.414481,39.968919 + ], + [ + 116.41681,39.969025 + ], + [ + 116.417947,39.96905 + ], + [ + 116.418011,39.968179 + ], + [ + 116.418033,39.967644 + ], + [ + 116.417947,39.967225 + ] + ], + "recommendPolyline": [ + [ + 116.408012,39.968598 + ], + [ + 116.408784,39.968688 + ], + [ + 116.409632,39.968688 + ], + [ + 116.410168,39.968688 + ], + [ + 116.410898,39.968795 + ], + [ + 116.412143,39.968812 + ], + [ + 116.414481,39.968919 + ], + [ + 116.41681,39.969025 + ], + [ + 116.417947,39.96905 + ], + [ + 116.418011,39.968179 + ], + [ + 116.418033,39.967644 + ], + [ + 116.417947,39.967225 + ] + ] +} \ No newline at end of file