Merge branch 'dev' into dev_1.1
# Conflicts: # gradle.properties
This commit is contained in:
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -11,11 +12,14 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
@@ -53,7 +57,8 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
@Route(path = V2XConst.PATH_V2X_UI)
|
||||
public class V2XModuleProvider implements
|
||||
IMogoModuleProvider,
|
||||
IMogoStatusChangedListener {
|
||||
IMogoStatusChangedListener,
|
||||
IMogoMapListener {
|
||||
private final String TAG = "V2XMocduleProvider";
|
||||
|
||||
private Context mContext;
|
||||
@@ -125,6 +130,9 @@ public class V2XModuleProvider implements
|
||||
handleAdas();
|
||||
initData();
|
||||
|
||||
|
||||
V2XServiceManager.getMogoRegisterCenter().registerMogoMapListener(V2XConst.MODULE_NAME, this);
|
||||
|
||||
// 注册广播接收场景弹窗使用的
|
||||
SceneBroadcastReceiver localReceiver = new SceneBroadcastReceiver();
|
||||
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context);
|
||||
@@ -145,16 +153,12 @@ public class V2XModuleProvider implements
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
//初始化获得自车求助状态
|
||||
initCarForHelpStatus();
|
||||
|
||||
try {
|
||||
// 查询ACC状态
|
||||
SharedPrefsMgr.getInstance(V2XUtils.getApp()).putBoolean("descriptor_ACC_STATUS", isAccOn());
|
||||
if (isAccOn()) {
|
||||
// 记录开机时间
|
||||
FatigueDrivingUtils.refreshAccOnTime();
|
||||
initCarForHelpStatus();
|
||||
// 刷新配置文件
|
||||
refreshStrategyConfig();
|
||||
} else {
|
||||
@@ -293,4 +297,40 @@ public class V2XModuleProvider implements
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
//初始化获得自车求助状态
|
||||
initCarForHelpStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouch(MotionEvent motionEvent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPOIClick(MogoPoi poi) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick(MogoLatLng latLng) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap(boolean isLock) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged(EnumMapUI ui) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged(MogoLatLng latLng, float zoom, float tilt, float bearing) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
V2XServiceManager.getMoGoV2XPolylineManager().clearLine();
|
||||
clearAlarmPOI();
|
||||
clearSpecialCarPOI();
|
||||
// 锁车
|
||||
V2XServiceManager.getMapUIController().recoverLockMode();
|
||||
// 开启主Launcher刷新
|
||||
V2XServiceManager.getIMogoRefreshStrategyController().restartAutoRefreshAtTime(500);
|
||||
}
|
||||
@@ -220,7 +222,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
@Override
|
||||
public void drawableSpecialCarPOI(Context context, V2XMarkerEntity v2XMarkerEntity, IMogoMarkerClickListener clickListener) {
|
||||
try {
|
||||
MarkerUtils.resetMapZoom(15);
|
||||
V2XServiceManager.getMapUIController().changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setOtherSeekHelpPOIShow(TAG, true);
|
||||
|
||||
@@ -256,11 +257,13 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
|
||||
// 当前Marker设置为最上面
|
||||
mAlarmInfoMarker.setToTop();
|
||||
// if (clickListener != null) {
|
||||
// mAlarmInfoMarker.setOnMarkerClickListener(clickListener);
|
||||
// }
|
||||
// 绘制连接线
|
||||
V2XServiceManager.getMoGoV2XPolylineManager().drawablePolyline(context, roadEventEntity);
|
||||
// 缩放地图
|
||||
MarkerUtils.zoomMap(
|
||||
new MogoLatLng(roadEventEntity.getLocation().getLat(),
|
||||
roadEventEntity.getLocation().getLon()
|
||||
), context);
|
||||
} else {
|
||||
Logger.e(MODULE_NAME, "Location 必须进行初始化!!!!!");
|
||||
}
|
||||
@@ -512,7 +515,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
@Override
|
||||
public void drawableAlarmPOI(Context context, V2XRoadEventEntity roadEventEntity, IMogoMarkerClickListener clickListener) {
|
||||
try {
|
||||
MarkerUtils.resetMapZoom(15);
|
||||
V2XServiceManager.getMapUIController().changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setRoadEventPOIShow(TAG, true);
|
||||
//Logger.i(MODULE_NAME, "绘制道路事件====drawableAlarmPOI:");
|
||||
@@ -532,11 +534,13 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
|
||||
// 当前Marker设置为最上面
|
||||
mAlarmInfoMarker.setToTop();
|
||||
// if (clickListener != null) {
|
||||
// mAlarmInfoMarker.setOnMarkerClickListener(clickListener);
|
||||
// }
|
||||
// 绘制连接线
|
||||
V2XServiceManager.getMoGoV2XPolylineManager().drawablePolyline(context, roadEventEntity);
|
||||
// 缩放地图
|
||||
MarkerUtils.zoomMap(
|
||||
new MogoLatLng(roadEventEntity.getLocation().getLat(),
|
||||
roadEventEntity.getLocation().getLon()
|
||||
), context);
|
||||
} else {
|
||||
Logger.e(MODULE_NAME, "Location 必须进行初始化!!!!!");
|
||||
}
|
||||
|
||||
@@ -218,7 +218,6 @@ public class V2XRoadLiveCarWindow extends RelativeLayout
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
|
||||
// 移出Window详细信息
|
||||
mTvEventStubClose.setText((countDownTime--) + "s");
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, 1000);
|
||||
|
||||
@@ -8,8 +8,6 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XMarker;
|
||||
@@ -83,16 +81,12 @@ public class V2XIllegalParkMarker implements IV2XMarker<List<MarkerExploreWay>>
|
||||
|
||||
countDownV2XEvent();
|
||||
} catch (Exception e) {
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
MarkerUtils.resetMapZoom(16);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
// 移动回原来的中心点
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(V2XServiceManager.getMapUIController(), Scene.AIMLESS);
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
MarkerUtils.resetMapZoom(16);
|
||||
// 移除违章停车点
|
||||
|
||||
@@ -3,12 +3,10 @@ package com.mogo.module.v2x.scenario.scene.push;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerExploreWayItem;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.listener.V2XMarkerClickListener;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XMarker;
|
||||
import com.mogo.module.v2x.utils.MarkerUtils;
|
||||
@@ -62,16 +60,12 @@ public class V2XPushEventMarker implements IV2XMarker<V2XPushMessageEntity> {
|
||||
V2XMarkerClickListener.getInstance());
|
||||
|
||||
} catch (Exception e) {
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
MarkerUtils.resetMapZoom(16);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
// 移动回原来的中心点
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(V2XServiceManager.getMapUIController(), Scene.AIMLESS);
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
MarkerUtils.resetMapZoom(16);
|
||||
// 移除线
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.mogo.module.v2x.scenario.scene.road;
|
||||
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XMarker;
|
||||
import com.mogo.module.v2x.utils.MarkerUtils;
|
||||
|
||||
@@ -31,16 +29,12 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
|
||||
.drawableAlarmPOI(V2XServiceManager.getContext(), entity, null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
MarkerUtils.resetMapZoom(16);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
// 移动回原来的中心点
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(V2XServiceManager.getMapUIController(), Scene.AIMLESS);
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
MarkerUtils.resetMapZoom(16);
|
||||
// 移除线
|
||||
|
||||
@@ -86,7 +86,6 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
V2XServiceManager.getContext(),
|
||||
mV2XMessageEntity.getContent());
|
||||
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
|
||||
drawPOI();
|
||||
showWindow();
|
||||
}
|
||||
}
|
||||
@@ -183,6 +182,9 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(MODULE_NAME, "展示 Window 动画结束");
|
||||
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
|
||||
drawPOI();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,15 +50,19 @@ public class V2XSeekHelpButton implements IV2XButton {
|
||||
@Override
|
||||
public void show() {
|
||||
registerVoice();
|
||||
tv = V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON2);
|
||||
tv.setText("取消\n求助");
|
||||
tv.setVisibility(View.VISIBLE);
|
||||
tv.setBackgroundResource(R.drawable.bg_v2x_event_live_show);
|
||||
tv.setOnClickListener(v -> {
|
||||
//调用取消求助接口
|
||||
// TODO: 2020/5/18 回调,显示对话框
|
||||
doAction();
|
||||
});
|
||||
try {
|
||||
tv = V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON2);
|
||||
tv.setText("取消\n求助");
|
||||
tv.setVisibility(View.VISIBLE);
|
||||
tv.setBackgroundResource(R.drawable.bg_v2x_event_live_show);
|
||||
tv.setOnClickListener(v -> {
|
||||
//调用取消求助接口
|
||||
// TODO: 2020/5/18 回调,显示对话框
|
||||
doAction();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,24 +2,22 @@ package com.mogo.module.v2x.scenario.scene.seek;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
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.WindowUtils;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -81,35 +79,24 @@ public class V2XSeekHelpDialog extends ConstraintLayout implements View.OnClickL
|
||||
void onClickRight();
|
||||
}
|
||||
|
||||
boolean isShown;
|
||||
WindowManager windowManager;
|
||||
private boolean isShown;
|
||||
private WindowManagerView windowManager;
|
||||
|
||||
public void show() {
|
||||
Logger.d(TAG, "使用windowManager实现");
|
||||
if (!isShown) {
|
||||
windowManager = (WindowManager) mContext.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
|
||||
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
} else {
|
||||
layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
|
||||
try {
|
||||
Logger.d(TAG, "使用windowManager实现");
|
||||
if (!isShown) {
|
||||
windowManager = new WindowManagerView.Builder(
|
||||
V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON2).getContext()
|
||||
).contentView(this).build();
|
||||
windowManager.show();
|
||||
isShown = true;
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("确定要解除求助状态吗");
|
||||
unRegisterVoiceCmd();
|
||||
registerVoiceCmd();
|
||||
}
|
||||
layoutParams.format = PixelFormat.TRANSLUCENT;
|
||||
layoutParams.gravity = Gravity.START | Gravity.TOP;
|
||||
// mWindowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
// FLAG_LAYOUT_IN_SCREEN:将window放置在整个屏幕之内,无视其他的装饰(比如状态栏); FLAG_NOT_TOUCH_MODAL:不阻塞事件传递到后面的窗口
|
||||
layoutParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
layoutParams.width = WindowUtils.getScreenWidth(mContext);
|
||||
layoutParams.height = WindowUtils.getScreenHeight(mContext);
|
||||
//后面变暗区域透明...
|
||||
layoutParams.dimAmount = 0;
|
||||
layoutParams.x = 0;
|
||||
layoutParams.y = 0;
|
||||
windowManager.addView(this, layoutParams);
|
||||
isShown = true;
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("确定要解除求助状态吗");
|
||||
unRegisterVoiceCmd();
|
||||
registerVoiceCmd();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,19 +112,16 @@ public class V2XSeekHelpDialog extends ConstraintLayout implements View.OnClickL
|
||||
|
||||
public void dismiss() {
|
||||
if (isShown && windowManager != null) {
|
||||
windowManager.removeViewImmediate(this);
|
||||
windowManager = null;
|
||||
windowManager.dismiss();
|
||||
isShown = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//放弃求助
|
||||
private void handleLeft() {
|
||||
if (mListener != null) {
|
||||
mListener.onClickLeft();
|
||||
}
|
||||
|
||||
unRegisterVoiceCmd();
|
||||
}
|
||||
|
||||
@@ -147,7 +131,6 @@ public class V2XSeekHelpDialog extends ConstraintLayout implements View.OnClickL
|
||||
mListener.onClickRight();
|
||||
}
|
||||
unRegisterVoiceCmd();
|
||||
|
||||
}
|
||||
|
||||
private void registerVoiceCmd() {
|
||||
|
||||
@@ -7,12 +7,12 @@ import android.view.ViewGroup;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
|
||||
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.module.v2x.utils.ADASUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
@@ -79,7 +79,6 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
|
||||
@Override
|
||||
public void show() {
|
||||
showWindow();
|
||||
drawPOI();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -145,7 +144,7 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
|
||||
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground));
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
.addView(mV2XWindow.getView(), layoutParams,this);
|
||||
.addView(mV2XWindow.getView(), layoutParams, this);
|
||||
mV2XWindow.show(mMarkerEntity);
|
||||
} else {
|
||||
blockingQueue.offer(mMarkerEntity);
|
||||
@@ -197,6 +196,7 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(MODULE_NAME, "展示 Window 动画结束");
|
||||
drawPOI();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -213,5 +213,8 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
Logger.d(MODULE_NAME, "关闭 Window 开始");
|
||||
// 重置场景提示的消息
|
||||
setV2XMessageEntity(null);
|
||||
clearPOI();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,13 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
|
||||
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@@ -75,12 +74,12 @@ public class MarkerUtils {
|
||||
final int paddingRight;
|
||||
final int paddingLeft;
|
||||
if (CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X) {
|
||||
paddingTop = WindowUtils.dip2px(context, 150);
|
||||
paddingTop = WindowUtils.dip2px(context, 250);
|
||||
paddingBottom = WindowUtils.dip2px(context, 100);
|
||||
paddingRight = WindowUtils.dip2px(context, 100);
|
||||
paddingLeft = WindowUtils.dip2px(context, 475);
|
||||
} else {
|
||||
paddingTop = WindowUtils.dip2px(context, 170);
|
||||
paddingTop = WindowUtils.dip2px(context, 370);
|
||||
paddingBottom = WindowUtils.dip2px(context, 100);
|
||||
paddingRight = WindowUtils.dip2px(context, 100);
|
||||
paddingLeft = WindowUtils.dip2px(context, 575);
|
||||
@@ -110,32 +109,10 @@ public class MarkerUtils {
|
||||
* @param zoomScale 缩放级别
|
||||
*/
|
||||
public static void resetMapZoom(float zoomScale) {
|
||||
V2XServiceManager.getMapUIController().changeZoom(zoomScale);
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
V2XServiceManager.getMapUIController().setLockZoom((int) zoomScale);
|
||||
V2XServiceManager.getMapUIController().recoverLockMode();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据距离调整地图的缩放比例
|
||||
*
|
||||
* @param distance 距离
|
||||
*/
|
||||
public static void changeMapZoomWithDistance(double distance) {
|
||||
Logger.d(V2XConst.MODULE_NAME, "根据距离调整地图的缩放比例:" + distance);
|
||||
if (distance <= 500 && distance > 400) {
|
||||
resetMapZoom(15);
|
||||
} else if (distance <= 400 && distance > 300) {
|
||||
resetMapZoom(16);
|
||||
} else if (distance <= 300 && distance > 200) {
|
||||
resetMapZoom(16.5f);
|
||||
} else if (distance <= 200 && distance > 100) {
|
||||
resetMapZoom(17f);
|
||||
} else if (distance <= 100 && distance >= 0) {
|
||||
resetMapZoom(17.5f);
|
||||
} else if (distance >= 500) {
|
||||
resetMapZoom(12);
|
||||
}
|
||||
// V2XServiceManager.getMapUIController().changeZoom(zoomScale);
|
||||
// // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
// V2XServiceManager.getMapUIController().setLockZoom((int) zoomScale);
|
||||
V2XServiceManager.getMapUIController().loseLockMode();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,8 +25,10 @@ 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.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.tencent.rtmp.ITXLivePlayListener;
|
||||
import com.tencent.rtmp.TXLiveConstants;
|
||||
import com.tencent.rtmp.TXLivePlayConfig;
|
||||
import com.tencent.rtmp.TXLivePlayer;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
|
||||
@@ -53,6 +55,7 @@ public class V2XLiveGSYVideoView extends RoundLayout {
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackRefreshListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
//startHeartLive(mCarLiveInfo);
|
||||
mLoading.setVisibility(VISIBLE);
|
||||
mClLoadError.setVisibility(GONE);
|
||||
if (mCarLiveInfo != null) {
|
||||
@@ -84,6 +87,12 @@ public class V2XLiveGSYVideoView extends RoundLayout {
|
||||
//关键 player 对象与界面 view
|
||||
mLivePlayer.setPlayerView(mTxcVideoView);
|
||||
mLivePlayer.setMute(true);
|
||||
|
||||
TXLivePlayConfig txLivePlayConfig = new TXLivePlayConfig();
|
||||
// 增加重试次数
|
||||
txLivePlayConfig.setConnectRetryCount(30);
|
||||
mLivePlayer.setConfig(txLivePlayConfig);
|
||||
|
||||
mLivePlayer.enableHardwareDecode(true);
|
||||
|
||||
mLoading = findViewById(R.id.loading);
|
||||
@@ -130,6 +139,7 @@ public class V2XLiveGSYVideoView extends RoundLayout {
|
||||
.livePush(new V2XRefreshCallback<V2XLivePushVoRes>() {
|
||||
@Override
|
||||
public void onSuccess(V2XLivePushVoRes result) {
|
||||
Logger.e(MODULE_NAME, "从服务端获取最新直播信息:" + GsonUtil.jsonFromObject(result));
|
||||
mClLoadError.setVisibility(GONE);
|
||||
mClLoadError.setVisibility(GONE);
|
||||
try {
|
||||
@@ -159,45 +169,58 @@ public class V2XLiveGSYVideoView extends RoundLayout {
|
||||
* 播放直播流,且开始心跳
|
||||
*/
|
||||
private void playLiveVideo(MarkerCarInfo.CarLiveInfo carLiveInfo) {
|
||||
startHeartLive(carLiveInfo);
|
||||
if (mLivePlayer != null) {
|
||||
mLivePlayer.startPlay(carLiveInfo.getVideoUrl(), TXLivePlayer.PLAY_TYPE_LIVE_RTMP);
|
||||
mLivePlayer.setPlayListener(new ITXLivePlayListener() {
|
||||
@Override
|
||||
public void onPlayEvent(int event, Bundle bundle) {
|
||||
Logger.w(MODULE_NAME, "播放器:onPlayEvent==" + event + "===bundle===" + bundle);
|
||||
if (event == TXLiveConstants.PLAY_EVT_PLAY_LOADING) {
|
||||
mLoading.setVisibility(VISIBLE);
|
||||
mClLoadError.setVisibility(GONE);
|
||||
} else if (event == TXLiveConstants.PLAY_EVT_PLAY_BEGIN) {
|
||||
mLoading.setVisibility(GONE);
|
||||
mClLoadError.setVisibility(GONE);
|
||||
} else if (event < 0) {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("直播获取识别,可以对我说重试", null);
|
||||
stopLive(mCarLiveInfo);
|
||||
mLoading.setVisibility(GONE);
|
||||
mClLoadError.setVisibility(VISIBLE);
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE,
|
||||
v2XVoiceCallbackRefreshListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP,
|
||||
v2XVoiceCallbackRefreshListener);
|
||||
try {
|
||||
if (mLivePlayer != null) {
|
||||
mLivePlayer.startPlay(carLiveInfo.getVideoUrl(), TXLivePlayer.PLAY_TYPE_LIVE_RTMP);
|
||||
mLivePlayer.setPlayListener(new ITXLivePlayListener() {
|
||||
@Override
|
||||
public void onPlayEvent(int event, Bundle bundle) {
|
||||
Logger.w(MODULE_NAME,
|
||||
"直播信息= " + GsonUtil.jsonFromObject(carLiveInfo) +
|
||||
"\n播放器:onPlayEvent==" + event +
|
||||
"\nbundle===" + bundle);
|
||||
if (event == TXLiveConstants.PLAY_EVT_PLAY_LOADING) {
|
||||
mLoading.setVisibility(VISIBLE);
|
||||
mClLoadError.setVisibility(GONE);
|
||||
} else if (event == TXLiveConstants.PLAY_EVT_PLAY_BEGIN) {
|
||||
mLoading.setVisibility(GONE);
|
||||
mClLoadError.setVisibility(GONE);
|
||||
} else if (event < 0) {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("直播获取失败,可以对我说重试", null);
|
||||
stopLive(mCarLiveInfo);
|
||||
mLoading.setVisibility(GONE);
|
||||
mClLoadError.setVisibility(VISIBLE);
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE,
|
||||
v2XVoiceCallbackRefreshListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP,
|
||||
v2XVoiceCallbackRefreshListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetStatus(Bundle bundle) {
|
||||
//Logger.w(MODULE_NAME, "播放器:onNetStatus===bundle===" + bundle);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onNetStatus(Bundle bundle) {
|
||||
Logger.w(MODULE_NAME, "播放器:onNetStatus===bundle===" + bundle);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mLoading.setVisibility(GONE);
|
||||
mClLoadError.setVisibility(VISIBLE);
|
||||
Logger.e(MODULE_NAME, "直播发生异常:carLiveInfo= " + GsonUtil.jsonFromObject(carLiveInfo));
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新直播心跳
|
||||
/**
|
||||
* 刷新直播心跳
|
||||
*
|
||||
* @param carLiveInfo
|
||||
*/
|
||||
private void startHeartLive(MarkerCarInfo.CarLiveInfo carLiveInfo) {
|
||||
try {
|
||||
if (!TextUtils.isEmpty(carLiveInfo.getVideoSn())
|
||||
if (carLiveInfo != null && !TextUtils.isEmpty(carLiveInfo.getVideoSn())
|
||||
&& !TextUtils.isEmpty(carLiveInfo.getVideoChannel())) {
|
||||
V2XServiceManager
|
||||
.getV2XRefreshModel()
|
||||
|
||||
Reference in New Issue
Block a user