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

This commit is contained in:
wujifei
2020-12-30 17:47:33 +08:00
parent cac40cbaa7
commit f80af8c3cf
20 changed files with 92 additions and 46 deletions

View File

@@ -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<Double> toPoint;
public List<Double> getToPoint() {
return toPoint;
}
public void setToPoint(List<Double> toPoint) {
this.toPoint = toPoint;
}
}

View File

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

View File

@@ -102,6 +102,9 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
if (holder instanceof V2XOtherSeekHelpVH) {
((V2XOtherSeekHelpVH) holder).initView(itemList.get(position));
}
if (holder instanceof V2XRecommendRouteVH) {
((V2XRecommendRouteVH) holder).initView(itemList.get(position));
}
}
@Override

View File

@@ -1,5 +1,6 @@
package com.mogo.module.v2x.adapter.holder;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -8,29 +9,64 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.search.geo.IMogoGeoSearchListener;
import com.mogo.map.search.geo.MogoGeocodeResult;
import com.mogo.map.search.geo.MogoRegeocodeResult;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
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;
import com.mogo.module.v2x.utils.LocationUtils;
/**
* created by wujifei on 2020/12/29 20:39
* describe:线路推荐
*/
public class V2XRecommendRouteVH extends V2XBaseViewHolder<V2XRecommendRouteEntity> {
private TextView mTvAddress, mTvAddressDistance;
public class V2XRecommendRouteVH extends V2XBaseViewHolder<V2XEventShowEntity> {
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) {
}
});
}
}

View File

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

View File

@@ -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<V2XRecommendRouteEntity>() {
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<V2XRecommendRouteEntity>() {
}
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")
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/v2x_to_nav_pressed" android:state_pressed="true" />
<item android:drawable="@drawable/v2x_to_nav_nomal" android:state_pressed="false" />
<item android:drawable="@drawable/v2x_to_nav_nomal" />
</selector>

View File

@@ -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"

View File

@@ -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">
<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"
android:layout_width="@dimen/module_v2x_fatigue_driving_window_height_ground"
android:layout_height="@dimen/module_v2x_fatigue_driving_window_height_ground"
android:src="@drawable/v2x_icon_route"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -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" />
<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"
android:src="@drawable/v2x_to_nav"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/ivClose"
app:layout_constraintTop_toTopOf="parent" />
@@ -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"

View File

@@ -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"

View File

@@ -13,7 +13,8 @@
<string name="v2x_voice_see_front_car_live_error">诶呀呀,没有查到前方车辆直播视屏,过一会再试试吧</string>
<string name="v2x_voice_see_crossroad_live">已为您打开路口直播实况</string>
<string name="v2x_voice_see_crossroad_live_error">诶呀呀,周围没有可用路口实况直播</string>
<string name="recommended_route">停车场推荐</string>
<string name="recommended_Parking">停车场推荐</string>
<string name="recommended_route">线路推荐</string>
<string name="v2x_recommond_route_size">26px</string>
</resources>