diff --git a/gradle.properties b/gradle.properties index 3d9c247180..3275b61624 100644 --- a/gradle.properties +++ b/gradle.properties @@ -145,7 +145,7 @@ MOGO_OCH_TAXI_VERSION=1.0.0 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.311 +CARCHATTING_VERSION=2.2.318 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.11 # websocket diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/DataTypes.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/DataTypes.java index 07dfb1fbb2..85c7794f0e 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/DataTypes.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/DataTypes.java @@ -19,10 +19,15 @@ class DataTypes { public static final String TYPE_MARKER_CLOUD_DATA = "TYPE_MARKER_CLOUD_DATA"; /** - * 云端下发数据 + * 云端下发警告数据 */ public static final String TYPE_MARKER_CLOUD_WARN_DATA = "TYPE_MARKER_CLOUD_WARN_DATA"; + /** + * 云端下发停止线数据 + */ + public static final String TYPE_MARKER_CLOUD_STOP_LINE_DATA = "TYPE_MARKER_CLOUD_STOP_LINE_DATA"; + /** * Push 事件场景 VR */ diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java index d86d0213d8..0eba5d780f 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java @@ -14,9 +14,9 @@ import com.mogo.module.common.entity.V2XWarningEntity; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; import com.mogo.utils.UiThreadHandler; -import com.mogo.utils.WorkThreadHandler; import com.mogo.utils.logger.Logger; +import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA; import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA; @@ -65,7 +65,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL /** - * 绘制行人和二轮车 + * 绘制行人和二轮车,前方和左右 * * @param data */ @@ -79,7 +79,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA); IMogoMarker marker = drawMarker(markerShowEntity); - Log.d("liyz", "renderWarnData marker != null "); + Log.d("liyz", "renderWarnData marker != null direction = " + data.getDirection()); marker.addDynamicAnchorPosition(new MogoLatLng( data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(), data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000); @@ -109,7 +109,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL } /** - * 绘制停止线 + * 绘制停止线 marker * * @param data */ @@ -120,7 +120,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL MarkerShowEntity markerShowEntity = new MarkerShowEntity(); markerShowEntity.setMarkerLocation(location); - markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA); + markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_STOP_LINE_DATA); IMogoMarker marker = drawStopLineMarker(markerShowEntity); diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/CarIconDisplayStrategy.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/CarIconDisplayStrategy.java index 8513281d10..3c9ba2bab3 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/CarIconDisplayStrategy.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/CarIconDisplayStrategy.java @@ -198,7 +198,7 @@ public class CarIconDisplayStrategy { new MogoMarkerOptions() .icons(mBitmapFrames) .period(1) - .zIndex(1000) + .zIndex(0) .autoManager(false) .anchor(0.5f, 0.5f) .position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2())); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java index 66bc31e67d..1f736ccfcd 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java @@ -166,6 +166,7 @@ public class V2XWaringManager { // } ); // //adas自车定位 +// MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient().getLastKnowLocation() // double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(); // double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(); } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java index d3499534cb..47d87c5107 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java @@ -108,8 +108,9 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog for (int i = 0; i < fillPoints.size(); i++) { V2XWarningEntity entity = new V2XWarningEntity(); MogoLatLng latLng = (MogoLatLng) fillPoints.get(i); + Log.d("liyz", "handleStopLine lat = " + latLng.lat + "--lon =" + latLng.lon); entity.setLat(latLng.lat); - entity.setLat(latLng.lon); + entity.setLon(latLng.lon); entity.setCollisionLat(mCloundWarningInfo.getCollisionLat()); entity.setCollisionLon(mCloundWarningInfo.getCollisionLon()); entity.heading = mCloundWarningInfo.heading; @@ -194,7 +195,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog public void onCarLocationChanged2(Location latLng) { // Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear); //当行人经纬度交点 经纬度不为空,开始画线,否则清理 - //自车只需要关注移动 if (!isSelfLineClear) { IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline(); if (mCloundWarningInfo != null) { @@ -258,4 +258,10 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } + private MogoLatLng getMogoLat(MogoLatLng latlng) { + MogoLatLng newLocation = LocationUtils.getNewLocation(latlng, mCloundWarningInfo.getDistance(), mCloundWarningInfo.getDirection()); + + return newLocation; + } + } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java index 09fa98f8ee..52a0802733 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java @@ -47,10 +47,10 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM private V2XSeekHelpButton mV2XSeekHelpButton; public V2XCarForHelpScenario() { - setV2XWindow(new V2XCarForHelpWindow(V2XServiceManager.getContext())); mV2XSeekHelpButton = new V2XSeekHelpButton(); setV2XButton(mV2XSeekHelpButton); V2XServiceManager.getMoGoStatusManager().registerStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this); + V2XServiceManager.getMoGoStatusManager().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this); } @Override @@ -61,14 +61,6 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM } setV2XMessageEntity(v2XMessageEntity); Boolean isShow = getV2XMessageEntity().getContent(); - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - if (isShow) { - showWindow(); - } else { - closeWindow(); - } - return; - } if (isShow) { showButton(); mySeekHelpCountDownTimerCancel(); @@ -96,20 +88,10 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM @Override public void showWindow() { - if (getV2XWindow() != null) { - ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_140)); - V2XServiceManager.getMogoTopViewManager().addView(getV2XWindow().getView(), layoutParams); - getV2XWindow().show(getV2XMessageEntity().getContent()); - } } @Override public void closeWindow() { -// if (getV2XWindow() != null) { -// getV2XWindow().close(); -// } } private V2XVoiceCallbackListener cancelCb = null; @@ -122,7 +104,7 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM if (getV2XButton() != null) { getV2XButton().setOnActionListener(this::showDialog); getV2XButton().show(); - V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP, R.drawable.module_v2x_left_notice_seek_help, "正在发起求助..."); + // V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP, R.drawable.module_v2x_left_notice_seek_help, "正在发起求助..."); } }); } @@ -241,6 +223,18 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM entity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP); entity.setContent(isTrue); init(entity); + } else if (descriptor == StatusDescriptor.VR_MODE) { + if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) { + if (isTrue) { + ((V2XSeekHelpButton) getV2XButton()).showTopView(); + V2XServiceManager.getMogoEntranceButtonController() + .getButton(ButtonIndex.BUTTON2).setVisibility(View.GONE); + } else { + ((V2XSeekHelpButton) getV2XButton()).closeTopView(); + V2XServiceManager.getMogoEntranceButtonController() + .getButton(ButtonIndex.BUTTON2).setVisibility(View.VISIBLE); + } + } } } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java deleted file mode 100644 index 00ecfd0077..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.help; - -import android.content.Context; -import android.content.Intent; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.TextView; -import android.widget.Toast; - -import com.mogo.commons.data.BaseData; -import com.mogo.commons.voice.AIAssist; -import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.v2x.R; -import com.mogo.module.v2x.V2XConst; -import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.network.V2XRefreshCallback; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -import com.mogo.module.v2x.utils.V2XUtils; -import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; -import com.mogo.module.v2x.voice.V2XVoiceConstants; -import com.mogo.module.v2x.voice.V2XVoiceManager; -import com.mogo.utils.storage.SharedPrefsMgr; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * created by wujifei on 2021/4/1 16:04 - * describe: - */ -public class V2XCarForHelpWindow extends V2XBasWindow implements IV2XWindow { - private static final String TAG = MODULE_NAME + "_" + V2XCarForHelpScenario.class.getSimpleName(); - private TextView tvCancel; - private V2XVoiceCallbackListener cancelCb = (String command, Intent intent) -> { - close(); - }; - - - public V2XCarForHelpWindow(Context context) { - this(context, null); - } - - public V2XCarForHelpWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XCarForHelpWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - private void initView(Context context) { - LayoutInflater.from(context).inflate(R.layout.window_carforhelp_detail, this); - tvCancel = (TextView) findViewById(R.id.tv_cancel); - tvCancel.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - close(); - } - }); - } - - @Override - public void show(Boolean entity) { - V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP, cancelCb); - } - - @Override - public void close() { - if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) { - V2XServiceManager.getMoGoStatusManager().setSeekHelping(TAG, false); - SharedPrefsMgr.getInstance(V2XUtils.getApp()).putLong(V2XConst.SEEK_HELP_TIME, 0); - V2XServiceManager.getV2XRefreshModel().cancelHelpSignal(new V2XRefreshCallback() { - @Override - public void onSuccess(BaseData result) { - //移除窗体 - V2XServiceManager.getMogoTopViewManager().removeView(V2XCarForHelpWindow.this); - } - - @Override - public void onFail(String msg) { - Toast.makeText(V2XServiceManager.getContext(), msg, Toast.LENGTH_SHORT).show(); - } - }); - - } - AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已取消", null); - //移除窗体 - V2XServiceManager.getMogoTopViewManager().removeView(V2XCarForHelpWindow.this); - V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP); - - if (V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpPOIShow()) { - // 移除线 - V2XServiceManager.getMoGoV2XPolylineManager().clearLine(); - // 移除事件POI - V2XServiceManager.getMoGoV2XMarkerManager().clearSpecialCarPOI(); - // 绘制上次的数据 - V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI(); - } - - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java index 7f8854db08..ac18174fed 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java @@ -1,7 +1,9 @@ package com.mogo.module.v2x.scenario.scene.help; import android.content.Intent; +import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import android.widget.TextView; import com.mogo.commons.data.BaseData; @@ -35,6 +37,8 @@ public class V2XSeekHelpButton implements IV2XButton { private V2XVoiceCallbackListener cancelCb = (String command, Intent intent) -> { doAction(); }; + private View topView; + private void doAction() { if (mListener != null) { @@ -53,31 +57,57 @@ public class V2XSeekHelpButton implements IV2XButton { try { tv = V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON2); tv.setText("取消\n求助"); - tv.setVisibility(View.VISIBLE); tv.setOnClickListener(v -> { //调用取消求助接口 // TODO: 2020/5/18 回调,显示对话框 doAction(); }); + + if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { + showTopView(); + tv.setVisibility(View.GONE); + } else { + closeTopView(); + tv.setVisibility(View.VISIBLE); + } + } catch (Exception e) { e.printStackTrace(); } } + public void showTopView() { + topView = View.inflate(V2XServiceManager.getContext(), R.layout.window_carforhelp_detail, null); + TextView tvCancel = topView.findViewById(R.id.tv_cancel); + tvCancel.setOnClickListener(v -> { + doAction(); + }); + ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + (int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_140)); + V2XServiceManager.getMogoTopViewManager().addView(topView, layoutParams); + } + + public void closeTopView() { + V2XServiceManager.getMogoTopViewManager().removeView(topView); + } + @Override public void close() { if (tv != null) { AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已取消", null); tv.setVisibility(View.GONE); + closeTopView(); V2XServiceManager.getV2XRefreshModel().cancelHelpSignal(new V2XRefreshCallback() { @Override public void onSuccess(BaseData result) { tv.setVisibility(View.GONE); + closeTopView(); } @Override public void onFail(String msg) { tv.setVisibility(View.VISIBLE); + showTopView(); } }); mListener = null; diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml index ae2ab6d8bb..2d0db2ebb2 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml @@ -262,9 +262,10 @@ android:id="@+id/iv_play" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:paddingLeft="@dimen/dp_40" - android:visibility="gone" - android:src="@drawable/icon_play" /> + android:layout_marginTop="@dimen/dp_6" + android:paddingLeft="@dimen/dp_42" + android:src="@drawable/icon_play" + android:visibility="gone" /> diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json index a01111e3c1..e6197fd863 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json @@ -20,7 +20,7 @@ "direction": 1, "speed": 11.108121, "targetColor": "#FF4040", - "stopLineDistance": 30, + "stopLineDistance": 15, "warningContent": "小心行人", "heading": 0, "showTime": 3000,