diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XRecommendRouteEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XRecommendRouteEntity.java index d95387b5f2..9523dbfd4f 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XRecommendRouteEntity.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XRecommendRouteEntity.java @@ -1,9 +1,19 @@ package com.mogo.module.common.entity; +import java.util.List; + /** * created by wujifei on 2020/12/24 15:33 * describe:基于目的地预判的道路事件 */ public class V2XRecommendRouteEntity { + private List toPoint; + public List getToPoint() { + return toPoint; + } + + public void setToPoint(List toPoint) { + this.toPoint = toPoint; + } } diff --git a/modules/mogo-module-v2x/build.gradle b/modules/mogo-module-v2x/build.gradle index 47ab18a430..2eaadb3a28 100644 --- a/modules/mogo-module-v2x/build.gradle +++ b/modules/mogo-module-v2x/build.gradle @@ -60,6 +60,9 @@ dependencies { implementation rootProject.ext.dependencies.androidxviewpager2 implementation rootProject.ext.dependencies.localbroadcastmanager + implementation rootProject.ext.dependencies.coroutinescore + implementation rootProject.ext.dependencies.coroutinesandroid + implementation rootProject.ext.dependencies.videoarmv7 implementation rootProject.ext.dependencies.videoarm64 implementation rootProject.ext.dependencies.videojava diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadEventAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadEventAdapter.java index b4a68452b2..26c35201d5 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadEventAdapter.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadEventAdapter.java @@ -102,6 +102,9 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter { - private TextView mTvAddress, mTvAddressDistance; +public class V2XRecommendRouteVH extends V2XBaseViewHolder { + private TextView mTvAddress; private ImageView mIvToNav, mIvClose; + private MarkerExploreWay mNoveltyInfo; public V2XRecommendRouteVH(ViewGroup viewGroup, IV2XWindow v2XWindow) { - super(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_fatigue_driving, viewGroup, false), v2XWindow); + super(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_recommend_route, 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); + mIvToNav.setOnClickListener(v -> triggerStartNavi(mNoveltyInfo)); + mIvClose.setOnClickListener(v -> delayedCloseWindow()); } @Override - public void initView(V2XRecommendRouteEntity viewData) { + public void initView(V2XEventShowEntity v2XEventShowEntity) { + MarkerLocation markerLocation = new MarkerLocation(); + markerLocation.setLon(v2XEventShowEntity.getV2XRecommendRouteEntity().getToPoint().get(0)); + markerLocation.setLat(v2XEventShowEntity.getV2XRecommendRouteEntity().getToPoint().get(1)); + mNoveltyInfo = new MarkerExploreWay(); + mNoveltyInfo.setLocation(markerLocation); + MogoLocation mogoLocation = new MogoLocation(); + mogoLocation.setLongitude(v2XEventShowEntity.getV2XRecommendRouteEntity().getToPoint().get(0)); + mogoLocation.setLatitude(v2XEventShowEntity.getV2XRecommendRouteEntity().getToPoint().get(1)); + getLocationInfo(mogoLocation); } + + /** + * 获取定位相关信息 + */ + private void getLocationInfo(MogoLocation location) { + // 定位当前位置是否是高速 + LocationUtils.geoCodeSearch(location, new IMogoGeoSearchListener() { + @Override + public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) { + mTvAddress.setText("前往 " + regeocodeResult.getRegeocodeAddress().getFormatAddress()); + } + + @Override + public void onGeocodeSearched(MogoGeocodeResult geocodeResult) { + } + }); + } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java index e1ea631bc9..575f4aa97a 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java @@ -676,12 +676,12 @@ public class V2XRefreshModel { @Override public void onNext(V2XRoadDataRes v2XRoadDataRes) { super.onNext(v2XRoadDataRes); - Logger.d("queryRoadData:onSuccess", v2XRoadDataRes.toString()); if (v2XRoadDataRes == null || v2XRoadDataRes.getResult() == null) { return; } if (v2XRoadDataRes.getResult().getPoiData() != null && v2XRoadDataRes.getResult().getPoiData().size() > 0) { V2XRecommendRouteEntity v2XRecommendRouteEntity = new V2XRecommendRouteEntity(); + v2XRecommendRouteEntity.setToPoint(v2XRoadDataRes.getResult().getTopPoint()); V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); // 控制类型 v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE); @@ -694,15 +694,9 @@ public class V2XRefreshModel { 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) { - + // TODO: 2020/12/30 } } - - @Override - public void onError(Throwable e) { - super.onError(e); - Logger.d("queryRoadData:onError", e.toString()); - } }); } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/destination/V2XRecommendRouteScenario.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/destination/V2XRecommendRouteScenario.kt index e14165cb62..23f795f105 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/destination/V2XRecommendRouteScenario.kt +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/destination/V2XRecommendRouteScenario.kt @@ -9,6 +9,10 @@ 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 kotlinx.coroutines.MainScope +import kotlinx.coroutines.cancel +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch /** * created by wujifei on 2020/12/29 17:57 @@ -48,7 +52,7 @@ class V2XRecommendRouteScenario : AbsV2XScenario() { 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) + V2XServiceManager.getMogoTopViewManager().addView(it.view, layoutParams,mogoTopViewStatusListener) it.show(v2XMessageEntity.content) } @@ -77,20 +81,24 @@ class V2XRecommendRouteScenario : AbsV2XScenario() { } val mogoTopViewStatusListener: IMogoTopViewStatusListener = object : IMogoTopViewStatusListener { + private val mainScope = MainScope() override fun onViewAdded(view: View?) { - TODO("Not yet implemented") + mainScope.launch { + delay(1000 * 20) + closeWindow() + } } override fun onViewRemoved(view: View?) { - TODO("Not yet implemented") + mainScope.cancel() } override fun beforeViewAddAnim(view: View?) { - TODO("Not yet implemented") + } override fun beforeViewRemoveAnim(view: View?) { - TODO("Not yet implemented") + } } diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_route.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_route.png new file mode 100644 index 0000000000..bff6a53df5 Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_icon_route.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_nomal.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_nomal.png new file mode 100644 index 0000000000..d89535c229 Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_nomal.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_pressed.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_pressed.png new file mode 100644 index 0000000000..2a4abd712c Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/v2x_to_nav_pressed.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_route.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_route.png new file mode 100644 index 0000000000..bff6a53df5 Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_icon_route.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_nomal.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_nomal.png new file mode 100644 index 0000000000..d89535c229 Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_nomal.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_pressed.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_pressed.png new file mode 100644 index 0000000000..2a4abd712c Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi-1920x1000/v2x_to_nav_pressed.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_route.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_route.png new file mode 100644 index 0000000000..bff6a53df5 Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_icon_route.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_nomal.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_nomal.png new file mode 100644 index 0000000000..d89535c229 Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_nomal.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_pressed.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_pressed.png new file mode 100644 index 0000000000..2a4abd712c Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_to_nav_pressed.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_to_nav.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_to_nav.xml new file mode 100644 index 0000000000..bc3c6b0bc9 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/drawable/v2x_to_nav.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fatigue_driving.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fatigue_driving.xml index e6ffe54e9d..2eecb6d0f8 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fatigue_driving.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fatigue_driving.xml @@ -30,7 +30,7 @@ android:layout_marginTop="@dimen/dp_20" android:background="@drawable/bg_fatigue_driving" android:gravity="center" - android:text="@string/recommended_route" + android:text="@string/recommended_Parking" android:textColor="@color/v2x_item_white" android:textSize="@dimen/v2x_recommond_route_size" app:layout_constraintBottom_toTopOf="@+id/tvAddress" diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_recommend_route.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_recommend_route.xml index e6ffe54e9d..047100fa04 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_recommend_route.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_recommend_route.xml @@ -6,18 +6,15 @@ 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"> @@ -27,7 +24,7 @@ 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:layout_marginTop="@dimen/dp_56" android:background="@drawable/bg_fatigue_driving" android:gravity="center" android:text="@string/recommended_route" @@ -43,36 +40,23 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_15" android:layout_marginEnd="@dimen/dp_30" - android:layout_marginBottom="@dimen/dp_20" + android:layout_marginBottom="@dimen/dp_56" 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_constraintEnd_toStartOf="@+id/ivToNav" app:layout_constraintStart_toStartOf="@+id/tagEventType" app:layout_constraintTop_toBottomOf="@+id/tagEventType" - tools:text="停车场|服务区地址" /> + tools:text="前往 xxx" /> - @@ -81,6 +65,7 @@ android:id="@+id/ivClose" android:layout_width="@dimen/module_v2x_event_button_size" android:layout_height="@dimen/module_v2x_event_button_size" + android:layout_marginEnd="@dimen/dp_62" android:src="@drawable/v2x_selector_icon_report_err" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml index 34662993f3..6936631ec6 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml @@ -218,7 +218,7 @@ android:layout_marginBottom="@dimen/dp_10" android:background="#3100E2" android:padding="@dimen/dp_10" - android:text="触发基于目的地预测的道路事件" + android:text="触发基于目的地预测的线路推荐" android:textColor="#FFFFFF" android:textSize="@dimen/dp_22" app:layout_constraintBottom_toBottomOf="parent" diff --git a/modules/mogo-module-v2x/src/main/res/values/strings.xml b/modules/mogo-module-v2x/src/main/res/values/strings.xml index 4a6f565066..386b36333a 100644 --- a/modules/mogo-module-v2x/src/main/res/values/strings.xml +++ b/modules/mogo-module-v2x/src/main/res/values/strings.xml @@ -13,7 +13,8 @@ 诶呀呀,没有查到前方车辆直播视屏,过一会再试试吧 已为您打开路口直播实况 诶呀呀,周围没有可用路口实况直播 - 停车场推荐 + 停车场推荐 + 线路推荐 26px