完成了UGC场景基础UI
1
.idea/gradle.xml
generated
@@ -79,6 +79,7 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
2
.idea/misc.xml
generated
@@ -4,7 +4,7 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -30,6 +30,10 @@ public class MarkerExploreWay implements Serializable {
|
||||
//上报类型:1-用户上报,2-后台上报 3-三方上报
|
||||
private String uploadType;
|
||||
|
||||
// http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
|
||||
// 1 需要用户判断是否拥堵 进行UGC问答
|
||||
private int infoCheckNode;
|
||||
|
||||
public String getAddr() {
|
||||
if (TextUtils.isEmpty(addr)) {
|
||||
return "未知道路";
|
||||
@@ -171,11 +175,27 @@ public class MarkerExploreWay implements Serializable {
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerExploreWay{" +
|
||||
"type='" + type + '\'' +
|
||||
", infoId='" + infoId + '\'' +
|
||||
"infoId='" + infoId + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", poiType='" + poiType + '\'' +
|
||||
", sn='" + sn + '\'' +
|
||||
", location=" + location +
|
||||
@@ -189,6 +209,7 @@ public class MarkerExploreWay implements Serializable {
|
||||
", userInfo=" + userInfo +
|
||||
", items=" + items +
|
||||
", uploadType='" + uploadType + '\'' +
|
||||
", infoCheckNode=" + infoCheckNode +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,8 @@ public class V2XMessageEntity<T> implements Serializable {
|
||||
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_CAR_FOR_HELP = 8_000;
|
||||
}
|
||||
@@ -151,6 +153,7 @@ public class V2XMessageEntity<T> implements Serializable {
|
||||
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,
|
||||
})
|
||||
@Target({
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XEventUgcVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XFatigueDrivingVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XIllegalParkVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XLiveVideoVH;
|
||||
@@ -34,7 +35,7 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
RecyclerView.ViewHolder holder;
|
||||
RecyclerView.ViewHolder holder = null;
|
||||
switch (viewType) {
|
||||
// 直播
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING:
|
||||
@@ -60,8 +61,10 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
|
||||
holder = new V2XOtherSeekHelpVH(parent);
|
||||
break;
|
||||
default:
|
||||
holder = new V2XPushEventVH(parent);
|
||||
//道路事件UGC
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
|
||||
holder = new V2XEventUgcVH(parent);
|
||||
break;
|
||||
}
|
||||
return holder;
|
||||
}
|
||||
@@ -83,6 +86,9 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
if (holder instanceof V2XFatigueDrivingVH) {
|
||||
((V2XFatigueDrivingVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
if (holder instanceof V2XEventUgcVH) {
|
||||
((V2XEventUgcVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
if (holder instanceof V2XOtherSeekHelpVH) {
|
||||
((V2XOtherSeekHelpVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
|
||||
|
||||
/**
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/11 4:35 PM
|
||||
* desc : 道路事件UGC
|
||||
* 需求地址
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XEventUgcVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
|
||||
public V2XEventUgcVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_v2x_event_ugc, viewGroup, false));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 延迟关闭窗体
|
||||
*/
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
itemView.postDelayed(() -> V2XFatigueDrivingScenario.getInstance().close(), 1000);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.push.V2XPushEventScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.ugc.V2XEventUgcScenario;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -95,6 +96,9 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
|
||||
mV2XScenario = V2XIllegalParkScenario.getInstance();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
|
||||
mV2XScenario = V2XEventUgcScenario.getInstance();
|
||||
break;
|
||||
default:
|
||||
Logger.e(MODULE_NAME, "当前V2X消息类型未定义。");
|
||||
TipToast.tip("当前V2X消息类型未定义");
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
@@ -48,6 +49,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private Button mBtnTriggerFatigueDrivingEvent;
|
||||
private Button mBtnTriggerSeekHelpEvent;
|
||||
private Button mBtnTriggerParkEvent;
|
||||
private Button mBtnTriggerEventUgc;
|
||||
private Button mBtnTriggerCallUserInfo;
|
||||
|
||||
public static V2XTestConsoleWindow getInstance(Context context) {
|
||||
@@ -87,6 +89,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
mBtnTriggerFatigueDrivingEvent = findViewById(R.id.btnTriggerFatigueDrivingEvent);
|
||||
mBtnTriggerSeekHelpEvent = findViewById(R.id.btnTriggerSeekHelpEvent);
|
||||
mBtnTriggerParkEvent = findViewById(R.id.btnTriggerParkEvent);
|
||||
mBtnTriggerEventUgc = findViewById(R.id.btnTriggerEventUgc);
|
||||
mBtnTriggerCallUserInfo = findViewById(R.id.btnTriggerCallUserInfo);
|
||||
|
||||
mBtnTriggerCallUserInfo.setOnClickListener(v -> {
|
||||
@@ -96,7 +99,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
mogoDriverInfo.setSn("12345678");
|
||||
mogoDriverInfo.setUserName("测试");
|
||||
mogoDriverInfo.setUserHead("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600872867592&di=994e371880ca6ae2814f553e0d0e4139&imgtype=0&src=http%3A%2F%2Fp3.ssl.cdn.btime.com%2Ft014c5d8a1e5cef12ba.jpg%3Fsize%3D506x543");
|
||||
V2XServiceManager.getCarsChattingProvider().showUserWindow("CAR_CALL_USER_TO_" + V2XConst.MODULE_NAME,mogoDriverInfo,context);
|
||||
V2XServiceManager.getCarsChattingProvider().showUserWindow("CAR_CALL_USER_TO_" + V2XConst.MODULE_NAME, mogoDriverInfo, context);
|
||||
});
|
||||
|
||||
mBtnTriggerOpen.setOnClickListener(v ->
|
||||
@@ -165,6 +168,17 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||
});
|
||||
|
||||
mBtnTriggerEventUgc.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity =
|
||||
TestOnLineCarUtils.getV2XScenarioRoadEventUGCData();
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
|
||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||
}
|
||||
});
|
||||
|
||||
mBtnTriggerParkEvent.setOnClickListener(v -> {
|
||||
V2XMessageEntity<List<MarkerExploreWay>> v2XMessageEntity =
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.mogo.module.v2x.scenario.scene.ugc;
|
||||
|
||||
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.V2XRoadEventEntity;
|
||||
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 static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 道路事件UGC
|
||||
* 需求地址
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XEventUgcScenario extends AbsV2XScenario<V2XRoadEventEntity> implements IMogoTopViewStatusListener {
|
||||
|
||||
private static V2XEventUgcScenario mV2XTiredScenario;
|
||||
|
||||
private V2XEventUgcScenario() {
|
||||
}
|
||||
|
||||
public static V2XEventUgcScenario getInstance() {
|
||||
if (mV2XTiredScenario == null) {
|
||||
synchronized (V2XEventUgcScenario.class) {
|
||||
if (mV2XTiredScenario == null) {
|
||||
mV2XTiredScenario = new V2XEventUgcScenario();
|
||||
mV2XTiredScenario.setV2XWindow(new V2XEventUgcWindow());
|
||||
}
|
||||
}
|
||||
}
|
||||
return mV2XTiredScenario;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity) {
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
if (v2XMessageEntity != null) {
|
||||
if (v2XMessageEntity.isShowState()
|
||||
&& V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
|
||||
show();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
Logger.w(V2XConst.MODULE_NAME, "疲劳驾驶场景,要处理的场景已经存在,丢弃这次初始化");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
showWindow();
|
||||
}
|
||||
|
||||
@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_fatigue_driving_window_height_ground));
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setFatigueDrivingWindowShow(TAG, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(MODULE_NAME, "疲劳驾驶场景 展示 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
Logger.d(MODULE_NAME, "疲劳驾驶场景 关闭 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
Logger.d(MODULE_NAME, "疲劳驾驶场景 展示 Window 开始");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
Logger.d(MODULE_NAME, "疲劳驾驶场景 关闭 Window 开始");
|
||||
// 重置场景提示的消息
|
||||
setV2XMessageEntity(null);
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setFatigueDrivingWindowShow(TAG, false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.mogo.module.v2x.scenario.scene.ugc;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
|
||||
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/24 11:34 AM
|
||||
* desc : 道路事件UGC
|
||||
* 需求地址
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XEventUgcWindow extends RelativeLayout
|
||||
implements IV2XWindow<V2XRoadEventEntity> {
|
||||
// 展示列表
|
||||
private RecyclerView mRecyclerView;
|
||||
// 列表数据适配器
|
||||
private V2XRoadEventAdapter mV2XRoadEventAdapter;
|
||||
// 列表展示
|
||||
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
|
||||
|
||||
// 直播30秒自动关闭
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
|
||||
//
|
||||
private V2XRoadEventEntity mV2XRoadEventEntity;
|
||||
|
||||
public V2XEventUgcWindow() {
|
||||
this(V2XServiceManager.getContext(), null);
|
||||
}
|
||||
|
||||
public V2XEventUgcWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XEventUgcWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XEventUgcWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public void initView(Context context) {
|
||||
Logger.w(MODULE_NAME, "V2X-初始化疲劳驾驶");
|
||||
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
|
||||
// 详情列表
|
||||
mRecyclerView = findViewById(R.id.rvRoadEventList);
|
||||
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
|
||||
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
|
||||
// 设置切换样式
|
||||
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
|
||||
// 配置列表朝向
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (recyclerView.getChildCount() > 0) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
// 用户处于交互的时候延后隐藏时间
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(V2XRoadEventEntity entity) {
|
||||
if (entity != null) {
|
||||
mV2XRoadEventEntity = entity;
|
||||
// 清空数据
|
||||
mItemList.clear();
|
||||
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setV2XRoadEventEntity(mV2XRoadEventEntity);
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter.notifyDataSetChanged();
|
||||
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
.removeView(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent() {
|
||||
if (mV2XRoadEventEntity != null) {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
|
||||
// 移出Window详细信息
|
||||
close();
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
int expireTime = mV2XRoadEventEntity.getExpireTime();
|
||||
Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,40 @@ public class TestOnLineCarUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 模拟道路事件UGC测试数据
|
||||
*/
|
||||
public static V2XMessageEntity<V2XRoadEventEntity> getV2XScenarioRoadEventUGCData() {
|
||||
try {
|
||||
InputStream inputStream = V2XUtils.getApp()
|
||||
.getResources()
|
||||
.openRawResource(R.raw.scenario_road_event_data);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
int len = -1;
|
||||
byte[] buffer = new byte[1024];
|
||||
while ((len = inputStream.read(buffer)) != -1) {
|
||||
baos.write(buffer, 0, len);
|
||||
}
|
||||
inputStream.close();
|
||||
|
||||
// 加载数据源
|
||||
V2XRoadEventEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XRoadEventEntity.class);
|
||||
|
||||
V2XMessageEntity<V2XRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2xRoadEventEntity);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
return v2xMessageEntity;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟H5推送数据
|
||||
*/
|
||||
@@ -224,7 +258,7 @@ public class TestOnLineCarUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟 疲劳驾驶
|
||||
* 模拟 道路求助
|
||||
*/
|
||||
public static V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> getV2XScenarioSeekHelpData() {
|
||||
try {
|
||||
|
||||
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/v2x_alert_window_bg"
|
||||
android:paddingEnd="@dimen/dp_62">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivFaultHelpHead"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="@dimen/dp_31"
|
||||
android:src="@drawable/v_to_x_event_ugc_fenglu"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFaultHelpName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_50"
|
||||
android:textColor="@color/v2x_FFF_333"
|
||||
android:textSize="@dimen/module_v2x_event_help_title_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivFaultHelpHead"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivEventReportTrue"
|
||||
app:layout_constraintStart_toEndOf="@id/ivFaultHelpHead"
|
||||
app:layout_constraintTop_toTopOf="@+id/ivFaultHelpHead"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="你刚路过的路段堵不堵?您可以直接对我说拥赌、或者不堵。" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivEventReportTrue"
|
||||
android:layout_width="@dimen/module_v2x_event_button_size"
|
||||
android:layout_height="@dimen/module_v2x_event_button_size"
|
||||
android:layout_marginEnd="@dimen/dp_40"
|
||||
android:src="@drawable/icon_report_true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/ivEventReportErr"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivEventReportErr"
|
||||
android:layout_width="@dimen/module_v2x_event_button_size"
|
||||
android:layout_height="@dimen/module_v2x_event_button_size"
|
||||
android:src="@drawable/icon_report_err"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -24,9 +24,11 @@
|
||||
android:id="@+id/btnTriggerOpen"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#FFF"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="隐藏测试按钮面板"
|
||||
android:background="#FFF"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -36,6 +38,8 @@
|
||||
android:id="@+id/btnClearRoadEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#6BCF23"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="清除缓存播报"
|
||||
@@ -48,6 +52,8 @@
|
||||
android:id="@+id/btnTriggerRoadEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#673AB7"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="触发道路事件"
|
||||
@@ -60,6 +66,8 @@
|
||||
android:id="@+id/btnTriggerPushEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#1EBD85"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="触发H5推送事件"
|
||||
@@ -72,6 +80,8 @@
|
||||
android:id="@+id/btnTriggerPushLiveCarEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#5E096C"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="触发H5推送直播事件"
|
||||
@@ -84,6 +94,8 @@
|
||||
android:id="@+id/btnTriggerAnimationEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#C6BE2C"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="触发V2X动画"
|
||||
@@ -95,7 +107,9 @@
|
||||
<Button
|
||||
android:id="@+id/btnTriggerFatigueDrivingEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#DF4019"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="触发疲劳驾驶"
|
||||
@@ -108,6 +122,8 @@
|
||||
android:id="@+id/btnTriggerSeekHelpEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#C712E6"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="触发他人发起道路求助事件"
|
||||
@@ -120,6 +136,8 @@
|
||||
android:id="@+id/btnTriggerParkEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#2651A6"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="触发违章停车事件"
|
||||
@@ -128,10 +146,26 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTriggerEventUgc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#58FF5F"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="触发事件UGC"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTriggerCallUserInfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#E91451"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="打开用户信息"
|
||||
|
||||
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |