完成弹窗的修改

This commit is contained in:
董宏宇
2021-03-26 18:32:25 +08:00
parent c5b2840e1b
commit dcbf5a66a2
7 changed files with 142 additions and 224 deletions

View File

@@ -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<V2XPushMessageEntity> {

View File

@@ -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<V2XPushMessageEntity> {
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<V2XPushMessageEntity> {
mMogoPolyline.remove();
}
// 绘制引导线
drawablePloyLine(entity);
drawableRecommendPolyline(entity);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 绘制引导线
*
* @param entity
*/
void drawablePloyLine(V2XPushMessageEntity entity) {
// 连接线参数
MogoPolylineOptions options = new MogoPolylineOptions();
// 渐变色
List<Integer> 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<V2XPushMessageEntity> {
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<V2XPushMessageEntity> {
MarkerUtils.resetMapZoom(16);
// 移除线
clearLine();
// 移除事件POI
clearAlarmPOI();
// 绘制上次的数据
V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI();
}
void clearAlarmPOI() {
if (mAlarmInfoMarker != null) {
mAlarmInfoMarker.remove();
}
}
public void clearLine() {
if (mMogoPolyline != null) {
mMogoPolyline.remove();

View File

@@ -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<V2XPushMessageEntity> 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);
}
}

View File

@@ -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<V2XPushMessageEntity> {
public class V2XPushVREventWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
private String TAG = "V2XPushVREventWindow";
// 处理道路事件30秒倒计时
@@ -29,6 +32,26 @@ public class V2XPushVREventWindow implements IV2XWindow<V2XPushMessageEntity> {
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<V2XPushMessageEntity> {
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<V2XPushMessageEntity> {
@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

View File

@@ -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];

View File

@@ -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
]
]
}

View File

@@ -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
]
]
}