new#基于目的地预判的道路事件提醒、路线推荐

This commit is contained in:
wujifei
2020-12-25 14:44:44 +08:00
parent bddb1b68e7
commit 7acc8d3df8
8 changed files with 191 additions and 57 deletions

View File

@@ -14,6 +14,7 @@ import androidx.fragment.app.Fragment;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.network.Utils;
import com.mogo.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
@@ -146,7 +147,7 @@ public class V2XModuleProvider implements
// obu数据转发初始化
V2XObuManager.getInstance().init(context);
V2XServiceManager.getV2XRefreshModel().queryRoadData();
V2XServiceManager.getV2XRefreshModel().queryRoadData(Utils.getSn());
}
private void initBiz(Context context) {

View File

@@ -672,10 +672,10 @@ public class V2XRefreshModel {
}
public void queryRoadData() {
public void queryRoadData(String sn) {
if (mV2XApiService != null) {
Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
map.put("sn", Utils.getSn());
map.put("sn", sn);
mV2XApiService.queryRoadDataOfVehiclesRecommend(map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -1,54 +0,0 @@
package com.mogo.module.v2x.scenario.scene.destination;
import androidx.annotation.Nullable;
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/24 15:45
* describe:基于目的地预判的道路事件场景
*/
public class V2XPrejectedRoadEventScenario extends AbsV2XScenario<V2XPrejectedRoadEventEntity> {
@Override
public void init(@Nullable V2XMessageEntity<V2XPrejectedRoadEventEntity> v2XMessageEntity) {
}
@Override
public void show() {
}
@Override
public void showWindow() {
}
@Override
public void closeWindow() {
}
@Override
public void showButton() {
}
@Override
public void closeButton() {
}
@Override
public void drawPOI() {
}
@Override
public void clearPOI() {
}
}

View File

@@ -0,0 +1,64 @@
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")
}
}

View File

@@ -0,0 +1,71 @@
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")
}
}

View File

@@ -57,6 +57,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
private Button mBtnTriggerCallUserInfo;
private Button mBtnTriggerEventUgc;
private Button mBtnTriggerTrafficSearch;
private Button mBtnTriggerPrejectedRoadEvent;
private Button nBtnTriggerVR;
private Button btnTriggerRearVIPCarTip,
@@ -117,6 +118,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
mBtnTriggerEventUgc = findViewById(R.id.btnTriggerEventUgc);
mBtnTriggerCallUserInfo = findViewById(R.id.btnTriggerCallUserInfo);
mBtnTriggerTrafficSearch = findViewById(R.id.btnTriggerTrafficSearch);
mBtnTriggerPrejectedRoadEvent = findViewById(R.id.btnTriggerPrejectedRoadEvent);
nBtnTriggerVR = findViewById(R.id.btnTriggerVR);
switch (showType) {
@@ -277,6 +279,9 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
mBtnTriggerTrafficSearch.setOnClickListener(v -> V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus());
mBtnTriggerPrejectedRoadEvent.setOnClickListener(view -> {
V2XServiceManager.getV2XRefreshModel().queryRoadData("XTCAA83540301871");
});
/*
*后方VIP车辆提示

View File

@@ -0,0 +1,33 @@
<?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">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvPrejectedRoadEventList"
android:layout_width="match_parent"
android:layout_height="@dimen/module_v2x_event_window_height"
android:minHeight="@dimen/module_v2x_event_window_height"
android:orientation="horizontal"
android:overScrollMode="never"
android:padding="@dimen/module_v2x_widow_top_gaps"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/item_v2x_event_detail" />
<ImageView
android:id="@+id/btnCloseWindow"
android:layout_width="@dimen/dp_88"
android:layout_height="@dimen/dp_88"
android:layout_marginEnd="@dimen/dp_32"
android:layout_marginBottom="@dimen/dp_40"
android:background="@drawable/module_common_close_selector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -209,6 +209,20 @@
android:textSize="@dimen/dp_22"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnTriggerPrejectedRoadEvent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:background="#3100E2"
android:padding="@dimen/dp_10"
android:text="触发基于目的地预测的道路事件"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_22"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</com.google.android.flexbox.FlexboxLayout>