new#基于目的地预判的道路事件提醒、路线推荐
This commit is contained in:
@@ -35,6 +35,9 @@ public class V2XEventShowEntity implements Serializable {
|
||||
// 违章停车
|
||||
private MarkerExploreWay v2XIllegalPark;
|
||||
|
||||
// 基于目的地道路推荐详情
|
||||
private V2XRecommendRouteEntity v2XRecommendRouteEntity;
|
||||
|
||||
public int getViewType() {
|
||||
return viewType;
|
||||
}
|
||||
@@ -83,6 +86,14 @@ public class V2XEventShowEntity implements Serializable {
|
||||
this.v2XIllegalPark = v2XIllegalPark;
|
||||
}
|
||||
|
||||
public V2XRecommendRouteEntity getV2XRecommendRouteEntity() {
|
||||
return v2XRecommendRouteEntity;
|
||||
}
|
||||
|
||||
public void setV2XRecommendRouteEntity(V2XRecommendRouteEntity v2XRecommendRouteEntity) {
|
||||
this.v2XRecommendRouteEntity = v2XRecommendRouteEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@@ -97,14 +108,15 @@ public class V2XEventShowEntity implements Serializable {
|
||||
Objects.equals(v2XLiveCarInfoRes, that.v2XLiveCarInfoRes) &&
|
||||
Objects.equals(v2XLiveCarList, that.v2XLiveCarList) &&
|
||||
Objects.equals(v2XPushMessageEntity, that.v2XPushMessageEntity) &&
|
||||
Objects.equals(v2XIllegalPark, that.v2XIllegalPark);
|
||||
Objects.equals(v2XIllegalPark, that.v2XIllegalPark) &&
|
||||
Objects.equals(v2XRecommendRouteEntity, that.v2XRecommendRouteEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(viewType, v2XRoadEventEntity,
|
||||
v2XLiveCarInfoRes, v2XLiveCarList,
|
||||
v2XPushMessageEntity, v2XIllegalPark);
|
||||
v2XPushMessageEntity, v2XIllegalPark, v2XRecommendRouteEntity);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +131,7 @@ public class V2XEventShowEntity implements Serializable {
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE,
|
||||
})
|
||||
@Target({
|
||||
ElementType.PARAMETER,
|
||||
|
||||
@@ -141,8 +141,8 @@ public class V2XMessageEntity<T> implements Serializable {
|
||||
int ALERT_EVENT_UGC_WARNING = 1_009;
|
||||
// 呼叫、请求直播事件
|
||||
int ALERT_VOICE_CALL_FOR_LIVECAR_SHOW = 1_010;
|
||||
// 基于目的地预判的道路事件
|
||||
int ALERT_PREJECTED_ROAD_WARNING = 1_011;
|
||||
// 基于预判目的地道路事件的路线推荐
|
||||
int ALERT_RECOMMEND_ROUTE = 1_011;
|
||||
// 推送VR消息展示
|
||||
int ALERT_PUSH_VR_SHOW = 2_000;
|
||||
// 自车求助
|
||||
@@ -164,7 +164,7 @@ public class V2XMessageEntity<T> implements Serializable {
|
||||
V2XTypeEnum.ALERT_EVENT_UGC_WARNING,
|
||||
V2XTypeEnum.ALERT_CAR_FOR_HELP,
|
||||
V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW,
|
||||
V2XTypeEnum.ALERT_PREJECTED_ROAD_WARNING,
|
||||
V2XTypeEnum.ALERT_RECOMMEND_ROUTE,
|
||||
V2XTypeEnum.ALERT_PUSH_VR_SHOW,
|
||||
V2XTypeEnum.ALERT_OBU_EVENT,
|
||||
})
|
||||
|
||||
@@ -4,6 +4,6 @@ package com.mogo.module.common.entity;
|
||||
* created by wujifei on 2020/12/24 15:33
|
||||
* describe:基于目的地预判的道路事件
|
||||
*/
|
||||
public class V2XPrejectedRoadEventEntity {
|
||||
public class V2XRecommendRouteEntity {
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import com.mogo.module.v2x.adapter.holder.V2XIllegalParkVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XLiveVideoVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XOtherSeekHelpVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XPushEventVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XRecommendRouteVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XRoadEventVH;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
|
||||
@@ -70,6 +71,10 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
|
||||
holder = new V2XEventUgcVH(parent, mV2XWindow);
|
||||
break;
|
||||
//线路推荐
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE:
|
||||
holder = new V2XRecommendRouteVH(parent, mV2XWindow);
|
||||
break;
|
||||
}
|
||||
return holder;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XRecommendRouteEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/29 20:39
|
||||
* describe:线路推荐
|
||||
*/
|
||||
public class V2XRecommendRouteVH extends V2XBaseViewHolder<V2XRecommendRouteEntity> {
|
||||
private TextView mTvAddress, mTvAddressDistance;
|
||||
private ImageView mIvToNav, mIvClose;
|
||||
|
||||
public V2XRecommendRouteVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
|
||||
super(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_fatigue_driving, viewGroup, false), v2XWindow);
|
||||
mTvAddress = itemView.findViewById(R.id.tvAddress);
|
||||
mTvAddressDistance = itemView.findViewById(R.id.tvAddressDistance);
|
||||
mIvToNav = itemView.findViewById(R.id.ivToNav);
|
||||
mIvClose = itemView.findViewById(R.id.ivClose);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XRecommendRouteEntity viewData) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,11 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPrejectedRoadEventEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.entity.V2XRecommendRouteEntity;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshBody;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.alarm.V2XAlarmServer;
|
||||
import com.mogo.module.v2x.entity.net.V2XDemoUserInfoRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XLiveCarBroadcastReq;
|
||||
import com.mogo.module.v2x.entity.net.V2XLiveCarRes;
|
||||
@@ -32,7 +30,6 @@ import com.mogo.module.v2x.entity.net.V2XRoadDataRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
|
||||
import com.mogo.module.v2x.utils.TimeUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
@@ -42,15 +39,10 @@ import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
|
||||
/**
|
||||
* 数据接口API
|
||||
@@ -689,18 +681,20 @@ public class V2XRefreshModel {
|
||||
return;
|
||||
}
|
||||
if (v2XRoadDataRes.getResult().getPoiData() != null && v2XRoadDataRes.getResult().getPoiData().size() > 0) {
|
||||
V2XPrejectedRoadEventEntity v2XPrejectedRoadEventEntity = new V2XPrejectedRoadEventEntity();
|
||||
V2XMessageEntity<V2XPrejectedRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
V2XRecommendRouteEntity v2XRecommendRouteEntity = new V2XRecommendRouteEntity();
|
||||
V2XMessageEntity<V2XRecommendRouteEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PREJECTED_ROAD_WARNING);
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2XPrejectedRoadEventEntity);
|
||||
v2xMessageEntity.setContent(v2XRecommendRouteEntity);
|
||||
// 控制展示状态
|
||||
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 if (v2XRoadDataRes.getResult().getIllegalParkingData() != null && v2XRoadDataRes.getResult().getIllegalParkingData().size() > 0) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.IV2XScenarioManager;
|
||||
import com.mogo.module.v2x.scenario.scene.animation.V2XAnimationScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.destination.V2XPrejectedRoadEventScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.destination.V2XRecommendRouteScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.help.V2XCarForHelpScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.livecar.V2XPushLiveCarScenario;
|
||||
@@ -97,8 +97,8 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW:
|
||||
mV2XScenario = new V2XVoiceCallLiveScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PREJECTED_ROAD_WARNING:
|
||||
mV2XScenario = new V2XPrejectedRoadEventScenario();
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE:
|
||||
mV2XScenario = new V2XRecommendRouteScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
|
||||
mV2XScenario = new V2XPushVREventScenario();
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.mogo.module.v2x.scenario.scene.destination
|
||||
|
||||
import com.mogo.module.common.entity.V2XMessageEntity
|
||||
import com.mogo.module.common.entity.V2XPrejectedRoadEventEntity
|
||||
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/25 14:15
|
||||
* describe:基于目的地预判的道路事件场景
|
||||
*/
|
||||
class V2XPrejectedRoadEventScenario : AbsV2XScenario<V2XPrejectedRoadEventEntity>() {
|
||||
|
||||
init {
|
||||
v2XWindow = V2XPrejectedRoadEventWindow()
|
||||
}
|
||||
|
||||
override fun init(v2XMessageEntity: V2XMessageEntity<V2XPrejectedRoadEventEntity>?) {
|
||||
v2XMessageEntity?.content.let {
|
||||
if (v2XMessageEntity!!.isShowState) {
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
// 更新要提醒的数据
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
show()
|
||||
} else {
|
||||
// 更新要提醒的数据
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
}
|
||||
} else {
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun show() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun showWindow() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun closeWindow() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun showButton() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun closeButton() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun drawPOI() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun clearPOI() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.mogo.module.v2x.scenario.scene.destination
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
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.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.scene.V2XBasWindow
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/25 11:45
|
||||
* describe:基于目的地预判的道路事件场景弹窗
|
||||
*/
|
||||
class V2XPrejectedRoadEventWindow @JvmOverloads constructor(
|
||||
context: Context = V2XServiceManager.getContext(),
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0) : V2XBasWindow(context, attrs, defStyleAttr), IV2XWindow<V2XRoadEventEntity?> {
|
||||
private var rvPrejectedRoadEventList: RecyclerView? = null
|
||||
private var btnCloseWindow: ImageView? = null
|
||||
|
||||
// 列表展示
|
||||
private val mItemList: List<V2XEventShowEntity> = ArrayList()
|
||||
private var mV2XRoadEventAdapter: V2XRoadEventAdapter? = null
|
||||
|
||||
init {
|
||||
initView(context)
|
||||
}
|
||||
|
||||
private fun initView(context: Context) {
|
||||
// 填充布局
|
||||
LayoutInflater.from(context).inflate(R.layout.window_prejected_road_event_detail, this)
|
||||
rvPrejectedRoadEventList = findViewById<View>(R.id.rvPrejectedRoadEventList) as RecyclerView
|
||||
btnCloseWindow = findViewById<View>(R.id.btnCloseWindow) as ImageView
|
||||
btnCloseWindow!!.setOnClickListener { close() }
|
||||
mV2XRoadEventAdapter = V2XRoadEventAdapter(mItemList, this)
|
||||
rvPrejectedRoadEventList!!.adapter = mV2XRoadEventAdapter
|
||||
// 设置切换样式
|
||||
PagerSnapHelper().attachToRecyclerView(rvPrejectedRoadEventList)
|
||||
// 配置列表朝向
|
||||
val layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||
rvPrejectedRoadEventList!!.layoutManager = layoutManager
|
||||
}
|
||||
|
||||
|
||||
override fun close() {
|
||||
//移除窗体
|
||||
V2XServiceManager.getMogoTopViewManager().removeView(this)
|
||||
}
|
||||
|
||||
override fun getView(): View {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun setWindowStatusListener(listener: V2XWindowStatusListener) {}
|
||||
|
||||
|
||||
override fun show(entity: V2XRoadEventEntity?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.mogo.module.v2x.scenario.scene.destination
|
||||
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.mogo.module.common.entity.V2XMessageEntity
|
||||
import com.mogo.module.common.entity.V2XRecommendRouteEntity
|
||||
import com.mogo.module.v2x.R
|
||||
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
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/29 17:57
|
||||
* describe:基于目的地预判的道路事件提醒、路线推荐
|
||||
*/
|
||||
class V2XRecommendRouteScenario : AbsV2XScenario<V2XRecommendRouteEntity>() {
|
||||
|
||||
init {
|
||||
v2XWindow = V2XRecommendRouteWindow()
|
||||
}
|
||||
|
||||
override fun init(v2XMessageEntity: V2XMessageEntity<V2XRecommendRouteEntity>?) {
|
||||
v2XMessageEntity?.content?.let {
|
||||
if (v2XMessageEntity!!.isShowState) {
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
// 更新要提醒的数据
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
show()
|
||||
} else {
|
||||
// 更新要提醒的数据
|
||||
setV2XMessageEntity(v2XMessageEntity)
|
||||
}
|
||||
} else {
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun show() {
|
||||
if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume) {
|
||||
showWindow()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showWindow() {
|
||||
v2XWindow?.let {
|
||||
val layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
V2XUtils.getApp().resources.getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground).toInt())
|
||||
V2XServiceManager.getMogoTopViewManager().addView(it.view, layoutParams)
|
||||
it.show(v2XMessageEntity.content)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun closeWindow() {
|
||||
v2XWindow?.let {
|
||||
it.close()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showButton() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun closeButton() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun drawPOI() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun clearPOI() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
val mogoTopViewStatusListener: IMogoTopViewStatusListener = object : IMogoTopViewStatusListener {
|
||||
override fun onViewAdded(view: View?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onViewRemoved(view: View?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun beforeViewAddAnim(view: View?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun beforeViewRemoveAnim(view: View?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.mogo.module.v2x.scenario.scene.destination
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
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.V2XRecommendRouteEntity
|
||||
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.scene.V2XBasWindow
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow
|
||||
|
||||
/**
|
||||
* created by wujifei on 2020/12/25 11:45
|
||||
* describe:基于目的地预判的道路事件场景弹窗
|
||||
*/
|
||||
class V2XRecommendRouteWindow @JvmOverloads constructor(
|
||||
context: Context = V2XServiceManager.getContext(),
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0) : V2XBasWindow(context, attrs, defStyleAttr), IV2XWindow<V2XRecommendRouteEntity?> {
|
||||
|
||||
private var rvRoadEventList: RecyclerView? = null
|
||||
private var mV2XRoadEventAdapter: V2XRoadEventAdapter? = null
|
||||
|
||||
// 列表展示
|
||||
private val mItemList = mutableListOf<V2XEventShowEntity>()
|
||||
|
||||
init {
|
||||
initView(context)
|
||||
}
|
||||
|
||||
private fun initView(context: Context) {
|
||||
// 填充布局
|
||||
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this)
|
||||
rvRoadEventList = findViewById(R.id.rvRoadEventList);
|
||||
mV2XRoadEventAdapter = V2XRoadEventAdapter(mItemList, this)
|
||||
rvRoadEventList?.setAdapter(mV2XRoadEventAdapter)
|
||||
// 设置切换样式
|
||||
PagerSnapHelper().attachToRecyclerView(rvRoadEventList)
|
||||
// 配置列表朝向
|
||||
val layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||
rvRoadEventList?.setLayoutManager(layoutManager)
|
||||
rvRoadEventList?.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
||||
super.onScrollStateChanged(recyclerView, newState)
|
||||
if (recyclerView.childCount > 0) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
// 用户处于交互的时候延后隐藏时间
|
||||
// countDownV2XEvent()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
override fun close() {
|
||||
//移除窗体
|
||||
V2XServiceManager.getMogoTopViewManager().removeView(this)
|
||||
}
|
||||
|
||||
override fun getView(): View {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun setWindowStatusListener(listener: V2XWindowStatusListener) {}
|
||||
|
||||
override fun show(entity: V2XRecommendRouteEntity?) {
|
||||
entity.let {
|
||||
// 清空数据
|
||||
mItemList.clear()
|
||||
val v2XEventShowEntity = V2XEventShowEntity()
|
||||
v2XEventShowEntity.v2XRecommendRouteEntity = entity
|
||||
v2XEventShowEntity.viewType = V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE
|
||||
mItemList.add(v2XEventShowEntity)
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,7 +280,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
mBtnTriggerTrafficSearch.setOnClickListener(v -> V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus());
|
||||
|
||||
mBtnTriggerPrejectedRoadEvent.setOnClickListener(view -> {
|
||||
V2XServiceManager.getV2XRefreshModel().queryRoadData("XTCAA83540301871");
|
||||
V2XServiceManager.getV2XRefreshModel().queryRoadData("ZD802C1938L10797");
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
<?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:id="@+id/rlContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/v2x_alert_window_bg"
|
||||
android:paddingStart="@dimen/dp_62"
|
||||
android:paddingTop="@dimen/dp_42"
|
||||
android:paddingEnd="@dimen/dp_62"
|
||||
android:paddingBottom="@dimen/dp_42"
|
||||
app:roundLayoutRadius="@dimen/dp_40"
|
||||
tools:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivIconP"
|
||||
android:layout_width="@dimen/module_v2x_event_icon_size"
|
||||
android:layout_height="@dimen/module_v2x_event_icon_size"
|
||||
android:src="@drawable/icon_parking_p"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tagEventType"
|
||||
android:layout_width="@dimen/v2x_driving_width"
|
||||
android:layout_height="@dimen/v2x_driving_heigt"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:background="@drawable/bg_fatigue_driving"
|
||||
android:gravity="center"
|
||||
android:text="@string/recommended_route"
|
||||
android:textColor="@color/v2x_item_white"
|
||||
android:textSize="@dimen/v2x_recommond_route_size"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvAddress"
|
||||
app:layout_constraintStart_toEndOf="@+id/ivIconP"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAddress"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:textColor="@color/v2x_FFF_333"
|
||||
android:textSize="@dimen/module_v2x_event_parking_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tvAddressDistance"
|
||||
app:layout_constraintStart_toStartOf="@+id/tagEventType"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tagEventType"
|
||||
tools:text="停车场|服务区地址" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAddressDistance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/v2x_FFF_333"
|
||||
android:textSize="@dimen/module_v2x_event_help_distance_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivToNav"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivToNav"
|
||||
app:layout_constraintTop_toTopOf="@+id/ivToNav"
|
||||
tools:text="300m" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivToNav"
|
||||
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/selector_nav_btn"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivClose"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivClose"
|
||||
android:layout_width="@dimen/module_v2x_event_button_size"
|
||||
android:layout_height="@dimen/module_v2x_event_button_size"
|
||||
android:src="@drawable/v2x_selector_icon_report_err"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user