Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk
This commit is contained in:
@@ -145,7 +145,7 @@ MOGO_OCH_TAXI_VERSION=1.0.0
|
||||
|
||||
######## 外部依赖引用
|
||||
# 车聊聊
|
||||
CARCHATTING_VERSION=2.2.77
|
||||
CARCHATTING_VERSION=2.2.311
|
||||
# 车聊聊接口
|
||||
CARCHATTINGPROVIDER_VERSION=1.1.11
|
||||
# websocket
|
||||
|
||||
@@ -301,9 +301,9 @@ public class ShareControl implements IMogoShareManager, Handler.Callback {
|
||||
}
|
||||
break;
|
||||
case VOICE_CMD_PUB_TROUBLE_HELP:
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
return;
|
||||
}
|
||||
// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
// return;
|
||||
// }
|
||||
if (needAuth()) {
|
||||
goAuth(STEP_AFTER_AUTH_TYPE_SEEK_HELP, TYPE_DENSE_FOG, false);
|
||||
} else {
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.mogo.module.v2x.scenario.scene.help;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.CountDownTimer;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -11,6 +13,7 @@ import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpWindow;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceConstants;
|
||||
@@ -44,6 +47,7 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> 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);
|
||||
@@ -57,6 +61,14 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
|
||||
}
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
Boolean isShow = getV2XMessageEntity().getContent();
|
||||
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
|
||||
if (isShow) {
|
||||
showWindow();
|
||||
} else {
|
||||
closeWindow();
|
||||
}
|
||||
// return;
|
||||
}
|
||||
if (isShow) {
|
||||
showButton();
|
||||
mySeekHelpCountDownTimerCancel();
|
||||
@@ -84,12 +96,20 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
//无window
|
||||
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() {
|
||||
//无window
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
}
|
||||
|
||||
private V2XVoiceCallbackListener cancelCb = null;
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
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<Boolean> {
|
||||
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<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData result) {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已取消", null);
|
||||
//移除窗体
|
||||
V2XServiceManager.getMogoTopViewManager().removeView(V2XCarForHelpWindow.this);
|
||||
V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String msg) {
|
||||
Toast.makeText(V2XServiceManager.getContext(), msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,9 @@ import java.util.List;
|
||||
*/
|
||||
public class V2XWarningMarker implements IV2XMarker {
|
||||
private V2XWarningEntity mMarkerEntity;
|
||||
private MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
private Context mContext = V2XServiceManager.getContext();
|
||||
List fillPoints = new ArrayList();//停止线经纬度合集
|
||||
|
||||
@Override
|
||||
public void drawPOI(Object entity) {
|
||||
@@ -39,32 +41,43 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
location.setLat(mMarkerEntity.getLat());
|
||||
location.setLon(mMarkerEntity.getLon());
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(V2XConst.V2X_FRONT_WARNING_MARKER);
|
||||
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
// drawLineAndSmooth();
|
||||
pointsBetween();
|
||||
//绘制停止线
|
||||
drawStopLines(fillPoints);
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
clearPOI();
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
IMogoMarker marker = drawMarkerAndReturn(markerShowEntity);
|
||||
//如果有预警碰撞点,识别物与预警碰撞点之间连线,并执行平移动画
|
||||
if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() != 0) {
|
||||
drawLine();
|
||||
smooth(marker);
|
||||
}
|
||||
}, 0);
|
||||
}, 6_000);
|
||||
//绘制安全距离
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void drawLineAndSmooth() {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
clearPOI();
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
IMogoMarker marker = drawMarkerAndReturn(markerShowEntity);
|
||||
//如果有预警碰撞点,识别物与预警碰撞点之间连线,并执行平移动画
|
||||
if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() != 0) {
|
||||
drawLine();
|
||||
smooth(marker);
|
||||
}
|
||||
}, 0);
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//补点后的停止线经纬度合集
|
||||
public void pointsBetween() {
|
||||
try {
|
||||
fillPoints.clear();
|
||||
List stopLines = mMarkerEntity.getStopLines();
|
||||
if (stopLines.size() > 1) {
|
||||
MogoLatLng x = mMarkerEntity.getStopLines().get(0);
|
||||
@@ -75,11 +88,12 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
//两点间的角度
|
||||
double angle = LocationUtils.getAngle(x.lon, x.lat, y.lon, y.lat);
|
||||
//根据距离和角度获取下个点的经纬度
|
||||
List replenish = new ArrayList();
|
||||
fillPoints.add(x);
|
||||
for (int i = 1; i < 3; i++) {
|
||||
MogoLatLng newLocation = LocationUtils.getNewLocation(x, average * i, angle);
|
||||
replenish.add(newLocation);
|
||||
fillPoints.add(newLocation);
|
||||
}
|
||||
fillPoints.add(y);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -87,7 +101,29 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
|
||||
}
|
||||
|
||||
//绘制marker
|
||||
private void drawStopLines(List points) {
|
||||
clearPOI();
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
MogoLatLng latLng = (MogoLatLng) points.get(i);
|
||||
drawMarkerWithLocation(latLng);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawMarkerWithLocation(MogoLatLng latLng) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
.latitude(latLng.lat)
|
||||
.longitude(latLng.lon);
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(com.mogo.module.service.R.raw.people);
|
||||
options.anchor(0.5f, 0.5f);
|
||||
options.anchorColor("#FF4040");
|
||||
IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(V2XConst.V2X_FRONT_WARNING_MARKER, options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
}
|
||||
|
||||
//绘制并返回marker
|
||||
public IMogoMarker drawMarkerAndReturn(MarkerShowEntity markerShowEntity) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
@@ -96,7 +132,7 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(com.mogo.module.service.R.raw.people);
|
||||
options.anchorColor("#FF4040");
|
||||
IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
|
||||
IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(V2XConst.V2X_FRONT_WARNING_MARKER, options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
return marker;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1,55 @@
|
||||
<?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"
|
||||
android:layout_width="@dimen/dp_640"
|
||||
android:layout_height="@dimen/dp_140"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:background="@drawable/bg_v2x_event_bg">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_event"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/icon_car_for_help"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_event"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="@dimen/dp_480"
|
||||
android:paddingLeft="@dimen/dp_40"
|
||||
android:paddingRight="@dimen/dp_40"
|
||||
android:textColor="@color/v2x_white"
|
||||
android:textSize="@dimen/dp_32"
|
||||
android:text="正在为您发起求助"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_event"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="@dimen/dp_0_5"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:background="@color/v2x_white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_cancel"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cancel"
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_140"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_40"
|
||||
android:paddingRight="@dimen/dp_40"
|
||||
android:text="取消"
|
||||
android:textColor="@color/v2x_car_for_help_cancel"
|
||||
android:textSize="@dimen/dp_30"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -246,7 +246,7 @@
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#FF0606"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="前车碰撞预警"
|
||||
android:text="前方碰撞预警"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
"type": 2,
|
||||
"lat": 39.977148,
|
||||
"lon": 116.417478,
|
||||
"distance": 2.22,
|
||||
"distance": 2,
|
||||
"collisionLat": 39.977094,
|
||||
"collisionLon": 116.417634,
|
||||
"stopLines":[
|
||||
{
|
||||
"lat": 39.977082,
|
||||
"lon": 116.417553
|
||||
"lat": 39.976858,
|
||||
"lon": 116.417651
|
||||
},
|
||||
{
|
||||
"lat": 39.977078,
|
||||
"lon": 116.417666
|
||||
"lat": 39.976874,
|
||||
"lon": 116.417757
|
||||
}
|
||||
],
|
||||
"from": 1,
|
||||
|
||||
@@ -20,4 +20,6 @@
|
||||
<color name="v2x_event_play_text">#4C83FF</color>
|
||||
|
||||
<color name="v2x_FF3036">#FF3036</color>
|
||||
|
||||
<color name="v2x_car_for_help_cancel">#F63A35</color>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user