Merge branch 'dev_robotaxi-d-app-module_2120_221017_2.12.0' into dev_robotaxi-d-app-module_2120_yyk_2.12.0
# Conflicts: # OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java
@@ -56,8 +56,10 @@ import com.mogo.och.common.module.biz.provider.LoginService;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper;
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
@@ -605,10 +607,14 @@ public class BusOrderModel {
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
}else {
|
||||
ToastUtils.showShort(failMsg);
|
||||
isArrivedStation = false;
|
||||
isGoingToNextStation = true;
|
||||
if (ToastUtilsOch.isCustomFastClick(5000)){
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
}else {
|
||||
ToastUtils.showShort(failMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -855,10 +861,30 @@ public class BusOrderModel {
|
||||
return;
|
||||
}
|
||||
|
||||
//MAP 280 每隔100ms左右返回一次到站, 导致在到达中间站后再次滑动出发后会有时间差,收到一次到站,出现问题
|
||||
//此处比对 自驾告诉的到站站点坐标和本地应到站站点坐标, 一致时才能到站
|
||||
if (data != null && data.getEndLocation() != null){
|
||||
|
||||
String latitude = NumberFormatUtil.cutOutNumber(data.getEndLocation().getLatitude(),5); //wgs
|
||||
String longitude = NumberFormatUtil.cutOutNumber(data.getEndLocation().getLongitude(),5);
|
||||
|
||||
int arrivedStationIndex = backgroundCurrentStationIndex + 1;
|
||||
BusStationBean arriveStation = stationList.get(arrivedStationIndex);
|
||||
String arriveLat = NumberFormatUtil.cutOutNumber(arriveStation.getLat(),5);
|
||||
String arriveLon = NumberFormatUtil.cutOutNumber(arriveStation.getLon(),5);
|
||||
|
||||
if (!latitude.equals(arriveLat) || !longitude.equals(arriveLon)){
|
||||
CallerLogger.INSTANCE.e( M_BUS + TAG, "行程日志-到站拦截,到站坐标不一致" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (isArrivedStation) return;
|
||||
isArrivedStation = true;
|
||||
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "行程日志-到站==backgroundCurrentStationIndex=" + backgroundCurrentStationIndex);
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "行程日志-当前==backgroundCurrentStationIndex="
|
||||
+ backgroundCurrentStationIndex);
|
||||
|
||||
isGoingToNextStation = false;
|
||||
|
||||
arriveSiteStation();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.model;
|
||||
package com.mogo.och.common.module.map;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
@@ -25,8 +25,7 @@ import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.och.taxi.callback.ITaxiNaviChangedCallback;
|
||||
import com.mogo.och.taxi.utils.PermissionUtil;
|
||||
import com.mogo.och.common.module.utils.PermissionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -36,24 +35,27 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/12/6
|
||||
*/
|
||||
public class NaviToDestinationModel implements AMapNaviListener {
|
||||
public class AmapNaviToDestinationModel implements AMapNaviListener {
|
||||
|
||||
public static final String TAG = "NaviToDestinationModel";
|
||||
|
||||
private static Context mContext;
|
||||
private AMapNavi mAMapNavi = null;
|
||||
protected final List<NaviLatLng> sList = new ArrayList<NaviLatLng>();
|
||||
protected final List<NaviLatLng> eList = new ArrayList<NaviLatLng>();
|
||||
protected List<NaviLatLng> mWayPointList = new ArrayList<NaviLatLng>();
|
||||
private ITaxiNaviChangedCallback mNaviChangedCallback;
|
||||
private ICommonNaviChangedCallback mNaviChangedCallback;
|
||||
private AtomicInteger errorCount = new AtomicInteger(0);
|
||||
private boolean isPlay;
|
||||
public static NaviToDestinationModel getInstance(Context context) {
|
||||
public static AmapNaviToDestinationModel getInstance(Context context) {
|
||||
mContext = context;
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final NaviToDestinationModel INSTANCE = new NaviToDestinationModel();
|
||||
private static final AmapNaviToDestinationModel INSTANCE = new AmapNaviToDestinationModel();
|
||||
}
|
||||
private NaviToDestinationModel(){
|
||||
private AmapNaviToDestinationModel(){
|
||||
}
|
||||
public void initAMapNavi(NaviLatLng startLatLng,NaviLatLng endLatLng) {
|
||||
try {
|
||||
@@ -90,7 +92,7 @@ public class NaviToDestinationModel implements AMapNaviListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void setOCHTaciNaviChangedCallback(ITaxiNaviChangedCallback callback){
|
||||
public void setOCHTaciNaviChangedCallback(ICommonNaviChangedCallback callback){
|
||||
this.mNaviChangedCallback = callback;
|
||||
}
|
||||
@Override
|
||||
@@ -132,6 +134,7 @@ public class NaviToDestinationModel implements AMapNaviListener {
|
||||
public void onNaviInfoUpdate(NaviInfo naviinfo) {
|
||||
//导航过程中的信息更新,请看NaviInfo的具体说明
|
||||
if (null != mNaviChangedCallback){
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "距离=" + naviinfo.getPathRetainDistance() + ", 剩余时间 " + naviinfo.getPathRetainTime());
|
||||
mNaviChangedCallback.onCurrentNaviDistAndTimeChanged(naviinfo.getPathRetainDistance(),naviinfo.getPathRetainTime());// 米、秒
|
||||
}
|
||||
}
|
||||
@@ -165,13 +168,9 @@ public class NaviToDestinationModel implements AMapNaviListener {
|
||||
}
|
||||
return;
|
||||
}
|
||||
// if (result.getErrorCode() == 3){
|
||||
// ToastUtils.showShort("车辆当前坐标错误");
|
||||
// }else if (result.getErrorCode() == 6){
|
||||
// ToastUtils.showShort("终点坐标错误");
|
||||
// }
|
||||
CallerLogger.INSTANCE.i(M_TAXI + "dm", "路线计算失败:错误码=" + result.getErrorCode() + ",Error Message= " + result.getErrorDetail());
|
||||
CallerLogger.INSTANCE.i(M_TAXI + "dm", "错误码详细链接见:http://lbs.amap.com/api/android-navi-sdk/guide/tools/errorcode/");
|
||||
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "路线计算失败:错误码=" + result.getErrorCode() + ",Error Message= " + result.getErrorDetail());
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "错误码详细链接见:http://lbs.amap.com/api/android-navi-sdk/guide/tools/errorcode/");
|
||||
}
|
||||
@Override
|
||||
public void onStartNavi(int type) {
|
||||
@@ -341,88 +340,4 @@ public class NaviToDestinationModel implements AMapNaviListener {
|
||||
public void onPlayRing(int i) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 车道信息说明:
|
||||
* <p>
|
||||
* 0xFF, 无对应车道
|
||||
* 0, 直行
|
||||
* 1, 左转
|
||||
* 2, 直行+左转
|
||||
* 3, 右转
|
||||
* 4, 直行+右转
|
||||
* 5, 左掉头
|
||||
* 6, 左转+右转
|
||||
* 7, 直行+左转+右转
|
||||
* 8, 右掉头
|
||||
* 9, 直行+左掉头
|
||||
* 10, 直行+右掉头
|
||||
* 11, 左转+左掉头
|
||||
* 12, 右转+右掉头
|
||||
* 13, 直行+扩展
|
||||
* 14, 左转+左掉头+扩展
|
||||
* 15, 保留
|
||||
* 16, 直行+左转+左掉头
|
||||
* 17, 右转+左掉头
|
||||
* 18, 左转+右转+左掉头
|
||||
* 19, 直行+右转+左掉头
|
||||
* 20, 左转+右掉头
|
||||
* 21, 公交车道
|
||||
* 22, 空车道
|
||||
* 23 可变车道
|
||||
*/
|
||||
|
||||
String[] array = {
|
||||
"直行车道"
|
||||
, "左转车道"
|
||||
, "左转或直行车道"
|
||||
, "右转车道"
|
||||
, "右转或直行车道"
|
||||
, "左掉头车道"
|
||||
, "左转或者右转车道"
|
||||
, " 左转或右转或直行车道"
|
||||
, "右转掉头车道"
|
||||
, "直行或左转掉头车道"
|
||||
, "直行或右转掉头车道"
|
||||
, "左转或左掉头车道"
|
||||
, "右转或右掉头车道"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择该车道"
|
||||
, "直行+左转+左掉头车道"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
|
||||
String[] actions = {
|
||||
"直行"
|
||||
, "左转"
|
||||
, "左转或直行"
|
||||
, "右转"
|
||||
, "右转或这行"
|
||||
, "左掉头"
|
||||
, "左转或者右转"
|
||||
, " 左转或右转或直行"
|
||||
, "右转掉头"
|
||||
, "直行或左转掉头"
|
||||
, "直行或右转掉头"
|
||||
, "左转或左掉头"
|
||||
, "右转或右掉头"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择"
|
||||
, "直行+左转+左掉头"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
package com.mogo.och.common.module.map
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.RelativeLayout
|
||||
import com.amap.api.maps.AMap
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions
|
||||
import com.amap.api.navi.AMapNaviView
|
||||
import com.amap.api.navi.AMapNaviViewListener
|
||||
import com.amap.api.navi.AMapNaviViewOptions
|
||||
import com.amap.api.navi.model.RouteOverlayOptions
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.R
|
||||
import kotlinx.android.synthetic.main.taxi_common_amap_navi_view.view.*
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/10/23
|
||||
*/
|
||||
class CommonAmapNaviVIew @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0)
|
||||
: RelativeLayout(context,attrs,defStyleAttr), AMapNaviViewListener {
|
||||
|
||||
private val TAG : String = "TaxiAmapNaviVIew"
|
||||
|
||||
var aMap : AMap? = null
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.taxi_common_amap_navi_view,this,true)
|
||||
initMapView()
|
||||
}
|
||||
|
||||
private fun initMapView(){
|
||||
|
||||
amapNaviView.setAMapNaviViewListener(this)
|
||||
//车头向上模式
|
||||
amapNaviView.naviMode = AMapNaviView.CAR_UP_MODE
|
||||
aMap = amapNaviView.map
|
||||
//关闭地图文字显示
|
||||
aMap!!.showMapText(false)
|
||||
// 设置导航地图模式,aMap是地图控制器对象。
|
||||
aMap!!.mapType = AMap.MAP_TYPE_NIGHT
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
aMap!!.isTrafficEnabled = false
|
||||
setMapViewOptions()
|
||||
|
||||
thread(start = true){
|
||||
try {
|
||||
Thread.sleep(1000L)
|
||||
} catch (e : InterruptedException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
if (null == context){
|
||||
return@thread
|
||||
}
|
||||
|
||||
aMap!!.setCustomMapStyle(
|
||||
CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(MapAssetStyleUtils.getAssetsStyle(context, "over_view_style.data"))
|
||||
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(context, "over_view_style_extra.data"))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setMapViewOptions() {
|
||||
|
||||
val options = AMapNaviViewOptions()
|
||||
options.tilt = 0 //设置 2D 模式
|
||||
|
||||
options.isLayoutVisible = false //设置导航界面UI是否显示。
|
||||
|
||||
options.isTrafficBarEnabled = false //设置路况光柱条是否显示(只适用于驾车导航,需要联网)。
|
||||
|
||||
options.isAutoLockCar = true //设置6秒后是否自动锁车
|
||||
|
||||
options.isAutoDisplayOverview = true //设置是否自动全览模式,即在算路成功后自动进入全览模式
|
||||
|
||||
options.isTrafficLine = false
|
||||
options.setModeCrossDisplayShow(true) //设置是否显示路口放大图(路口模型图)
|
||||
|
||||
options.isAutoChangeZoom = true //自动缩放级别
|
||||
|
||||
options.carBitmap =
|
||||
BitmapFactory.decodeResource(context.resources, R.drawable.taxi_navi_arrow_icon)
|
||||
options.fourCornersBitmap =
|
||||
BitmapFactory.decodeResource(this.resources, R.drawable.taxi_navi_direction_icon)
|
||||
options.isAutoChangeZoom = true //设置是否开启动态比例尺 (锁车态下自动进行地图缩放变化)
|
||||
|
||||
// options.setZoom(18);//14-18
|
||||
// options.setTrafficInfoUpdateEnabled(false);
|
||||
// options.setTrafficLayerEnabled(false);//设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
// options.setCameraInfoUpdateEnabled(false);
|
||||
// options.setCompassEnabled(false);//设置指南针图标否在导航界面显示,默认显示。
|
||||
// options.setLaneInfoShow(false);// 设置是否显示道路信息view
|
||||
// options.setNaviArrowVisible(false);//设置路线转向箭头隐藏和显示
|
||||
// options.setRealCrossDisplayShow(false);//设置是否显示路口放大图(实景图)
|
||||
// options.setRouteListButtonShow(true);//设置导航界面是否显示路线全览按钮。
|
||||
// options.setSettingMenuEnabled(false);//设置菜单按钮是否在导航界面显示。
|
||||
|
||||
// options.setZoom(18);//14-18
|
||||
// options.setTrafficInfoUpdateEnabled(false);
|
||||
// options.setTrafficLayerEnabled(false);//设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
// options.setCameraInfoUpdateEnabled(false);
|
||||
// options.setCompassEnabled(false);//设置指南针图标否在导航界面显示,默认显示。
|
||||
// options.setLaneInfoShow(false);// 设置是否显示道路信息view
|
||||
// options.setNaviArrowVisible(false);//设置路线转向箭头隐藏和显示
|
||||
// options.setRealCrossDisplayShow(false);//设置是否显示路口放大图(实景图)
|
||||
// options.setRouteListButtonShow(true);//设置导航界面是否显示路线全览按钮。
|
||||
// options.setSettingMenuEnabled(false);//设置菜单按钮是否在导航界面显示。
|
||||
val routeOverlayOptions = RouteOverlayOptions()
|
||||
|
||||
// routeOverlayOptions.setArrowOnTrafficRoute(BitmapFactory.decodeResource(getResources(),R.drawable.custtexture_aolr));
|
||||
|
||||
// routeOverlayOptions.setArrowOnTrafficRoute(BitmapFactory.decodeResource(getResources(),R.drawable.custtexture_aolr));
|
||||
routeOverlayOptions.normalRoute =
|
||||
BitmapFactory.decodeResource(resources, R.drawable.taxi_navi_line_icon)
|
||||
options.routeOverlayOptions = routeOverlayOptions
|
||||
|
||||
amapNaviView.viewOptions = options
|
||||
}
|
||||
|
||||
override fun onNaviSetting() {
|
||||
//底部导航设置点击回调
|
||||
}
|
||||
|
||||
override fun onNaviCancel() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onNaviBackClick(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onNaviMapMode(p0: Int) {
|
||||
//导航态车头模式,0:车头朝上状态;1:正北朝上模式。
|
||||
}
|
||||
|
||||
override fun onNaviTurnClick() {
|
||||
//转弯view的点击回调
|
||||
}
|
||||
|
||||
override fun onNextRoadClick() {
|
||||
//下一个道路View点击回调
|
||||
}
|
||||
|
||||
override fun onScanViewButtonClick() {
|
||||
//全览按钮点击回调
|
||||
}
|
||||
|
||||
override fun onLockMap(p0: Boolean) {
|
||||
//锁地图状态发生变化时回调
|
||||
}
|
||||
|
||||
override fun onNaviViewLoaded() {
|
||||
d(SceneConstant.M_TAXI + TAG, "导航页面加载成功")
|
||||
d(
|
||||
SceneConstant.M_TAXI + TAG,
|
||||
"请不要使用AMapNaviView.getMap().setOnMapLoadedListener();会overwrite导航SDK内部画线逻辑"
|
||||
)
|
||||
}
|
||||
|
||||
override fun onMapTypeChanged(p0: Int) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onNaviViewShowMode(p0: Int) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
fun onCreate(savedInstanceState : Bundle?){
|
||||
amapNaviView.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
fun onResume(){
|
||||
amapNaviView.onResume()
|
||||
}
|
||||
|
||||
fun onPause(){
|
||||
amapNaviView.onPause()
|
||||
}
|
||||
|
||||
fun onDestroy(){
|
||||
amapNaviView.onDestroy()
|
||||
}
|
||||
|
||||
var array = arrayOf(
|
||||
"直行车道",
|
||||
"左转车道",
|
||||
"左转或直行车道",
|
||||
"右转车道",
|
||||
"右转或直行车道",
|
||||
"左掉头车道",
|
||||
"左转或者右转车道",
|
||||
" 左转或右转或直行车道",
|
||||
"右转掉头车道",
|
||||
"直行或左转掉头车道",
|
||||
"直行或右转掉头车道",
|
||||
"左转或左掉头车道",
|
||||
"右转或右掉头车道",
|
||||
"直行并且车道扩展",
|
||||
"左转+左掉头+扩展",
|
||||
"不可以选择该车道",
|
||||
"直行+左转+左掉头车道",
|
||||
"右转+左掉头",
|
||||
"左转+右转+左掉头",
|
||||
"直行+右转+左掉头",
|
||||
"左转+右掉头",
|
||||
"公交车道",
|
||||
"空车道",
|
||||
"可变车道"
|
||||
)
|
||||
|
||||
var actions = arrayOf(
|
||||
"直行",
|
||||
"左转",
|
||||
"左转或直行",
|
||||
"右转",
|
||||
"右转或这行",
|
||||
"左掉头",
|
||||
"左转或者右转",
|
||||
" 左转或右转或直行",
|
||||
"右转掉头",
|
||||
"直行或左转掉头",
|
||||
"直行或右转掉头",
|
||||
"左转或左掉头",
|
||||
"右转或右掉头",
|
||||
"直行并且车道扩展",
|
||||
"左转+左掉头+扩展",
|
||||
"不可以选择",
|
||||
"直行+左转+左掉头",
|
||||
"右转+左掉头",
|
||||
"左转+右转+左掉头",
|
||||
"直行+右转+左掉头",
|
||||
"左转+右掉头",
|
||||
"公交车道",
|
||||
"空车道",
|
||||
"可变车道"
|
||||
)
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
package com.mogo.och.common.module.map;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/12/3
|
||||
*/
|
||||
public interface ITaxiNaviChangedCallback {
|
||||
public interface ICommonNaviChangedCallback {
|
||||
// 当前位置距离上车点的距离(米)、预估时间(秒)
|
||||
void onCurrentNaviDistAndTimeChanged(int meters, long timeInSecond);
|
||||
void reInitNaviAmap(boolean isPlay,boolean isRestart);
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,20 @@ public class NumberFormatUtil {
|
||||
}
|
||||
return String.valueOf(num);
|
||||
}
|
||||
|
||||
/**
|
||||
* 截取小数点后cutNum位, 不进行四舍五入
|
||||
* @param num
|
||||
* @param cutNum
|
||||
* @return
|
||||
*/
|
||||
public static String cutOutNumber(double num,int cutNum){
|
||||
try{
|
||||
BigDecimal bg = new BigDecimal(num).setScale(cutNum, RoundingMode.DOWN);
|
||||
return String.valueOf(bg.doubleValue());
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mogo.och.common.module.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.LocationManager;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/12/7
|
||||
*/
|
||||
public class PermissionUtil {
|
||||
|
||||
public static boolean checkPermission(Context context,String... permissons) {
|
||||
|
||||
for (String permisson : permissons) {
|
||||
if ((ContextCompat.checkSelfPermission(context,
|
||||
permisson) != PackageManager.PERMISSION_GRANTED)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isLocServiceEnable(Context context) {
|
||||
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
boolean gps = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
|
||||
boolean network = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
|
||||
if (gps || network) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,11 @@ import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
|
||||
public class ToastUtilsOch {
|
||||
|
||||
private static long lastClickTime;
|
||||
// 两次点击按钮之间的点击间隔不能少于1000毫秒
|
||||
private static int MIN_CLICK_DELAY_TIME = 1000;
|
||||
|
||||
public static void showWithCodeMessage(int code,String message){
|
||||
if(message==null){
|
||||
return;
|
||||
@@ -14,4 +19,15 @@ public class ToastUtilsOch {
|
||||
ToastUtils.showShort(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCustomFastClick(int customCLickDelayTime) {
|
||||
MIN_CLICK_DELAY_TIME = customCLickDelayTime;
|
||||
boolean flag = false;
|
||||
long curClickTime = System.currentTimeMillis();
|
||||
if ((curClickTime - lastClickTime) >= MIN_CLICK_DELAY_TIME) {
|
||||
flag = true;
|
||||
}
|
||||
lastClickTime = curClickTime;
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 542 B |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.amap.api.navi.AMapNaviView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/amapNaviView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
@@ -11,6 +11,7 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.elegant.utils.UiThreadHandler;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
@@ -159,6 +160,7 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V
|
||||
}
|
||||
|
||||
public void updateStartAutopilotBtnStatus(boolean isClickable){
|
||||
if (mContext == null) return;
|
||||
if (isClickable){
|
||||
mStartAutopilotBtn.setTextColor(
|
||||
mContext.getResources().getColor(R.color.taxi_p_start_autopilot_txt_color));
|
||||
@@ -259,6 +261,7 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V
|
||||
}
|
||||
|
||||
private void updateStatusCountDownOver() {
|
||||
if (mContext == null) return;
|
||||
isStarting = false;
|
||||
startingCarBgAnimatorDrawable(false);
|
||||
mStartAutopilotBtn.setText(
|
||||
@@ -273,4 +276,14 @@ public class TaxiPassengerStartAutopilotView extends RelativeLayout implements V
|
||||
mContext = null;
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
try {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
OCH/mogo-och-taxi/src/main/assets/map_style.data
Normal file
BIN
OCH/mogo-och-taxi/src/main/assets/map_style_extra.data
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/1
|
||||
*/
|
||||
public interface IOCHTaxiAutopilotPlanningCallback {
|
||||
void setLineMarker(List<LatLng> models);
|
||||
void routeResult(List<LatLng> models, int haveArrivedIndex);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/1
|
||||
*/
|
||||
public interface ITaxiAutopilotPlanningCallback {
|
||||
void routeResult(List<MessagePad.Location> models);
|
||||
}
|
||||
@@ -48,4 +48,11 @@ public interface ITaxiOrderStatusCallback {
|
||||
|
||||
// 司机已确认开启自动驾驶环境
|
||||
void onDriverHasCheckedPilotCondition(boolean isSafe);
|
||||
|
||||
/**
|
||||
* 导航到目的地
|
||||
* @param isAmap 是否是高德导航
|
||||
* @param isVoicePlay 是否播报声音
|
||||
*/
|
||||
void onNaviToEnd(boolean isAmap, boolean isVoicePlay);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.biz.provider.LoginService;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch;
|
||||
@@ -55,6 +56,7 @@ import com.mogo.och.taxi.bean.OrdersNewBookingQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.QueryOrderRouteResp;
|
||||
import com.mogo.och.taxi.bean.TaxiDataBaseRespBean;
|
||||
import com.mogo.och.taxi.bean.TaxiOrPassengerReadyReqBean;
|
||||
import com.mogo.och.taxi.callback.IOCHTaxiAutopilotPlanningCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiADASStatusCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiCarStatusCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiControllerStatusCallback;
|
||||
@@ -117,6 +119,7 @@ public class TaxiModel {
|
||||
private ITaxiCarStatusCallback mCarStatusCallback; //Model->Presenter:接单状态、登录状态和司机今日接单状态
|
||||
private ITaxiControllerStatusCallback mControllerStatusCallback; //Model->Presenter:VR mode等
|
||||
private ITaxiOrderStatusCallback mOrderStatusCallback; //Model->Presenter:订单变更
|
||||
private IOCHTaxiAutopilotPlanningCallback mAutopilotPlanningCallback;
|
||||
|
||||
private volatile boolean isRestartAutopilot = false;
|
||||
|
||||
@@ -129,6 +132,11 @@ public class TaxiModel {
|
||||
private TaxiModel() {
|
||||
}
|
||||
|
||||
public void setMoGoAutopilotPlanningListener(IOCHTaxiAutopilotPlanningCallback
|
||||
moGoAutopilotPlanningCallback) {
|
||||
this.mAutopilotPlanningCallback = moGoAutopilotPlanningCallback;
|
||||
}
|
||||
|
||||
public void setADASStatusCallback(ITaxiADASStatusCallback callback) {
|
||||
this.mADASStatusCallback = callback;
|
||||
}
|
||||
@@ -1243,12 +1251,25 @@ public class TaxiModel {
|
||||
}
|
||||
if (null != routeList && routeList.getWayPointsList().size() > 0) {
|
||||
updateOrderRoute(routeList.getWayPointsList());
|
||||
setRouteLineMarker(routeList.getWayPointsList());
|
||||
updateOrderRouteInfo(routeList.getWayPointsList());
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置路径规划起终点
|
||||
* @param models
|
||||
*/
|
||||
private void setRouteLineMarker(List<MessagePad.Location> models) {
|
||||
List<LatLng> latLngModels = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterWgsToGcjListCommon(mContext,models);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.setLineMarker(latLngModels);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报订单全路径规划数据
|
||||
*
|
||||
@@ -1319,6 +1340,7 @@ public class TaxiModel {
|
||||
}
|
||||
//开启实时计算剩余距离,剩余时间,预计时间
|
||||
startOrStopCalculateRouteInfo(true);
|
||||
AmapNaviToDestinationModel.getInstance(mContext).destroyAmaNavi();
|
||||
}
|
||||
|
||||
private void reportTotalDisAndTime() {
|
||||
@@ -1360,6 +1382,18 @@ public class TaxiModel {
|
||||
}
|
||||
|
||||
reportOrderRemain((long) lastSumLength, (long) lastTime);
|
||||
|
||||
routeAndWipe();
|
||||
}
|
||||
}
|
||||
|
||||
private void routeAndWipe() {
|
||||
if (mRoutePoints != null && mRoutePoints.size() > 0){
|
||||
int haveArrivedIndex = CoordinateCalculateRouteUtil
|
||||
.getArrivedPointIndex(mRoutePoints,mLongitude,mLatitude);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.routeResult(mRoutePoints,haveArrivedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1407,12 +1441,12 @@ public class TaxiModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报订单剩余里程和时间 单位:KM, M, 单位:分钟
|
||||
* 上报订单剩余里程和时间 单位:KM, M, 单位:秒
|
||||
*
|
||||
* @param lastSumLength
|
||||
* @param duration
|
||||
*/
|
||||
private void reportOrderRemain(long lastSumLength, long duration) {// 米/分钟
|
||||
public void reportOrderRemain(long lastSumLength, long duration) {// 米/秒
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
TaxiServiceManager.reportOrderRemain(mContext, mCurrentOCHOrder.orderNo
|
||||
, lastSumLength, duration, new OchCommonServiceCallback<BaseData>() {
|
||||
@@ -1530,9 +1564,6 @@ public class TaxiModel {
|
||||
, new OchCommonServiceCallback<TaxiDataBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiDataBaseRespBean data) {
|
||||
// if (null != data && 0 == data.code){
|
||||
// updateOrderStatus(TaxiOrderStatusEnum.JourneyCompleted);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1546,4 +1577,17 @@ public class TaxiModel {
|
||||
public void logout() {
|
||||
loginService.loginOut(mLatitude,mLongitude);
|
||||
}
|
||||
|
||||
//导航去订单终点目的地
|
||||
public void startNaviToEndStation(boolean isVoicePlay){
|
||||
if (mRoutePoints.size() > 0 ){ //使用自驾轨迹
|
||||
if (mOrderStatusCallback != null){
|
||||
mOrderStatusCallback.onNaviToEnd(false,isVoicePlay);
|
||||
}
|
||||
}else {//使用高的导航
|
||||
if (mOrderStatusCallback != null){
|
||||
mOrderStatusCallback.onNaviToEnd(true,isVoicePlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.mogo.och.taxi.presenter;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.callback.IOCHTaxiAutopilotPlanningCallback;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.ui.TaxiRottingNaviFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
public class NaviPresenter extends Presenter<TaxiRottingNaviFragment> implements IOCHTaxiAutopilotPlanningCallback {
|
||||
|
||||
private static final String TAG = NaviPresenter.class.getSimpleName();
|
||||
|
||||
public NaviPresenter(TaxiRottingNaviFragment view) {
|
||||
super(view);
|
||||
TaxiModel.getInstance().init(AbsMogoApplication.getApp());
|
||||
initListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
CallerLogger.INSTANCE.d( M_TAXI + TAG, " onCreate" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
|
||||
releaseListeners();
|
||||
TaxiModel.getInstance().release();
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
TaxiModel.getInstance().setMoGoAutopilotPlanningListener(this);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
TaxiModel.getInstance().setMoGoAutopilotPlanningListener(null);
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLineMarker(List<LatLng> models) {
|
||||
if (models == null) return;
|
||||
runOnUIThread(() -> mView.setLineMarker(models));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeResult(List<LatLng> models, int haveArrivedIndex) {
|
||||
mView.routeResult(models,haveArrivedIndex);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
@@ -19,6 +20,7 @@ import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.callback.ILoginCallback;
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.taxi.callback.IOCHTaxiAutopilotPlanningCallback;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
import com.mogo.och.taxi.constant.TaxiDriverRoleEnum;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
@@ -75,7 +77,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiModel.getInstance().setCarStatusCallback(this);
|
||||
TaxiModel.getInstance().setControllerStatusCallback(this);
|
||||
TaxiModel.getInstance().setOrderStatusCallback(this);
|
||||
OCHAdasAbilityManager.getInstance().release();
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
@@ -83,6 +84,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiModel.getInstance().setCarStatusCallback(null);
|
||||
TaxiModel.getInstance().setControllerStatusCallback(null);
|
||||
TaxiModel.getInstance().setOrderStatusCallback(null);
|
||||
OCHAdasAbilityManager.getInstance().release();
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
@@ -180,6 +182,14 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiModel.getInstance().logout();
|
||||
}
|
||||
|
||||
//导航去订单目的地
|
||||
public void startNaviToEndStation(boolean isVoicePlay){
|
||||
TaxiModel.getInstance().startNaviToEndStation(isVoicePlay);
|
||||
}
|
||||
|
||||
public void reportToEndDisAndTime(long lastSumLength, long duration){//米/秒
|
||||
TaxiModel.getInstance().reportOrderRemain(lastSumLength,duration);
|
||||
}
|
||||
@Override
|
||||
public void onAutopilotArriveEnd() {
|
||||
|
||||
@@ -268,7 +278,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderDistToStartChanged(long meters, long timeInSecond) {
|
||||
runOnUIThread(() -> mView.onCurrentOrderDistToStartChanged(meters,timeInSecond));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -306,6 +315,11 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
runOnUIThread(() -> mView.onCheckPilotConditionSafe(isSafe));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviToEnd(boolean isAmap, boolean isVoicePlay) {
|
||||
runOnUIThread( () -> mView.onNaviToEnd(isAmap,isVoicePlay));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVRModeChanged(boolean isVRMode) {
|
||||
runOnUIThread(() -> mView.switchVRFlatMode(isVRMode));
|
||||
|
||||
@@ -21,7 +21,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
@@ -34,19 +33,15 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.view.OnPreventFastClickListener;
|
||||
import com.mogo.och.common.module.utils.AnimatorDrawableUtil;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -81,7 +76,8 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
protected RelativeLayout mSettingBtn;
|
||||
protected LinearLayout mBadcaseBtn;
|
||||
protected LinearLayout mAICollectBtn;
|
||||
protected TaxiNaviFragment ochNaviFragment = null;
|
||||
protected TaxiAmapNaviFragment ochAmapNaviFragment = null;
|
||||
protected TaxiRottingNaviFragment taxiRottingNaviFragment = null;
|
||||
// protected TaxiTrafficLightView mTrafficLightView;
|
||||
|
||||
private Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
@@ -294,7 +290,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
onChangeOperationStatus();
|
||||
});
|
||||
mCloseNaviIcon.setOnClickListener(v -> {
|
||||
showNaviToStartStationFragment(false);
|
||||
showAmapNaviToStationFragment(false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -567,30 +563,75 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
//todo ui 切换
|
||||
}
|
||||
|
||||
protected void showNaviToStartStationFragment(boolean isShow) {
|
||||
protected void showAmapNaviToStationFragment(boolean isShow) {
|
||||
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
if (isShow) {
|
||||
closeRouteViewIFHadeAdd();
|
||||
// if (ochNaviFragment == null){
|
||||
ochNaviFragment = TaxiNaviFragment.newInstance();
|
||||
ochAmapNaviFragment = TaxiAmapNaviFragment.newInstance();
|
||||
// }
|
||||
if (ochNaviFragment.isAdded()) {
|
||||
if (ochAmapNaviFragment.isAdded()) {
|
||||
return;
|
||||
}
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container, ochNaviFragment).show(ochNaviFragment);
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container, ochAmapNaviFragment).show(ochAmapNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
mCloseNaviIcon.setVisibility(View.VISIBLE);
|
||||
flNaviPanelContainer.setVisibility(View.VISIBLE);
|
||||
CallerSmpManager.hidePanel();//隐藏小地图
|
||||
} else {
|
||||
if (ochNaviFragment != null) {
|
||||
ochNaviFragment.onDestroy();
|
||||
transaction.remove(ochNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
ochNaviFragment = null;
|
||||
}
|
||||
closeAmapViewIFHadeAdd();
|
||||
mCloseNaviIcon.setVisibility(View.GONE);
|
||||
flNaviPanelContainer.setVisibility(View.GONE);
|
||||
CallerSmpManager.showPanel();//显示小地图
|
||||
}
|
||||
}
|
||||
|
||||
private void closeAmapViewIFHadeAdd(){
|
||||
if (ochAmapNaviFragment != null) {
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
ochAmapNaviFragment.onDestroy();
|
||||
transaction.remove(ochAmapNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
ochAmapNaviFragment = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void closeRouteViewIFHadeAdd(){
|
||||
if (taxiRottingNaviFragment != null) {
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
taxiRottingNaviFragment.onDestroy();
|
||||
transaction.remove(taxiRottingNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
taxiRottingNaviFragment = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void showRottingToStationFragment(boolean isShow) {
|
||||
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
if (isShow) {
|
||||
closeAmapViewIFHadeAdd();
|
||||
// if (ochNaviFragment == null){
|
||||
taxiRottingNaviFragment = TaxiRottingNaviFragment.newInstance();
|
||||
// }
|
||||
if (taxiRottingNaviFragment.isAdded()) {
|
||||
return;
|
||||
}
|
||||
transaction.add(R.id.module_mogo_och_navi_panel_container, taxiRottingNaviFragment).show(taxiRottingNaviFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
mCloseNaviIcon.setVisibility(View.VISIBLE);
|
||||
flNaviPanelContainer.setVisibility(View.VISIBLE);
|
||||
CallerSmpManager.hidePanel();//隐藏小地图
|
||||
} else {
|
||||
closeRouteViewIFHadeAdd();
|
||||
mCloseNaviIcon.setVisibility(View.GONE);
|
||||
flNaviPanelContainer.setVisibility(View.GONE);
|
||||
CallerSmpManager.showPanel();//显示小地图
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public abstract void startNaviToEndStation(boolean isVoicePlay);
|
||||
}
|
||||
|
||||
@@ -29,17 +29,17 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
|
||||
import com.mogo.och.common.module.map.ICommonNaviChangedCallback;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
|
||||
import com.mogo.och.taxi.callback.ITaxiNaviChangedCallback;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.model.NaviToDestinationModel;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
@@ -49,14 +49,13 @@ import java.util.List;
|
||||
* @since 2021/1/18
|
||||
* 正在进行中订单
|
||||
*/
|
||||
public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implements View.OnClickListener, ITaxiNaviChangedCallback {
|
||||
public class CommonBeingServerdOrdersFragment extends BaseTaxiUIFragment
|
||||
implements View.OnClickListener, ICommonNaviChangedCallback {
|
||||
|
||||
public static final String TAG = "OCHTaxiBeingServerd";
|
||||
private static Activity mActivity;
|
||||
private static TaxiFragment mTaxiFragment;
|
||||
private String mOrderNo;
|
||||
private double mOrderStartStationLat = 0;
|
||||
private double mOrderStartStationLng = 0;
|
||||
private volatile int mTtsLessThan200Tip = 0;//离终点200米提示播报
|
||||
private OrderQueryRespBean.Result mCurrentOrder = null;
|
||||
private boolean isFirstStartAutopilotDone = true;
|
||||
@@ -81,12 +80,13 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
|
||||
private LinearLayout mContentModule31;
|
||||
private TextView mStationTv31;
|
||||
private LinearLayout mContentModule32;
|
||||
private ConstraintLayout mContentModule32;
|
||||
private TextView mStationTv32;
|
||||
private TextView mArrivedStationTitleTv32;
|
||||
private TextView mGoAheadStationTitleTv31;
|
||||
private TextView mCatchStationTitleTv31;
|
||||
private ImageView mNaviIcon;
|
||||
private ImageView mNaviStartIcon;
|
||||
private ImageView mNaviToEndIcon;
|
||||
private TextView mPassengerNum;
|
||||
private TextView mPassengerPhone;
|
||||
private ConstraintLayout mPassengerInfoLayout;
|
||||
@@ -97,12 +97,12 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
|
||||
private volatile int saveOrderState = -1;
|
||||
|
||||
public static TaxiBeingServerdOrdersFragment newInstance(Activity activity, TaxiFragment taxiFragment) {
|
||||
public static CommonBeingServerdOrdersFragment newInstance(Activity activity, TaxiFragment taxiFragment) {
|
||||
mActivity = activity;
|
||||
mTaxiFragment = taxiFragment;
|
||||
Bundle args = new Bundle();
|
||||
|
||||
TaxiBeingServerdOrdersFragment fragment = new TaxiBeingServerdOrdersFragment();
|
||||
CommonBeingServerdOrdersFragment fragment = new CommonBeingServerdOrdersFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
@@ -169,8 +169,12 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
}
|
||||
|
||||
private void initNaviView(View view) {
|
||||
mNaviIcon = view.findViewById(R.id.module_och_taxi_navi_iv);
|
||||
mNaviIcon.setOnClickListener(this);
|
||||
mNaviStartIcon = view.findViewById(R.id.module_och_taxi_navi_iv);
|
||||
mNaviStartIcon.setOnClickListener(this);
|
||||
|
||||
mNaviToEndIcon = view.findViewById(R.id.module_och_taxi_navi_end_iv);
|
||||
mNaviToEndIcon.setOnClickListener(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,8 +325,6 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
+ "<font color=\"#CAD6FF\"> 用车</font>";
|
||||
}
|
||||
mOrderOtherContent3.setText(Html.fromHtml(strHtml1));
|
||||
mOrderStartStationLat = order.startSiteGcjPoint.get(1);
|
||||
mOrderStartStationLng = order.startSiteGcjPoint.get(0);
|
||||
}
|
||||
}catch (NullPointerException e){ //可能会出现订单信息已经轮询回来,但进行中页面控件还未初始化完成的情况
|
||||
TaxiModel.getInstance().clearCurrentOCHOrder();
|
||||
@@ -339,21 +341,22 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
}
|
||||
}
|
||||
|
||||
private void startNaviToStartStation(boolean isShow, double orderStartStationLat, double orderStartStationLng) {
|
||||
NaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
private void startNaviToStation(boolean isVoicePlay, double stationLat, double stationLng) {
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "currentLatLng=" + mTaxiFragment.mCurLatitude + " " + mTaxiFragment.mCurLongitude);
|
||||
NaviLatLng startNaviLatLng = new NaviLatLng(mTaxiFragment.mCurLatitude, mTaxiFragment.mCurLongitude);
|
||||
NaviLatLng endNaviLatLng = new NaviLatLng(orderStartStationLat, orderStartStationLng);
|
||||
NaviToDestinationModel.getInstance(getContext()).initAMapNavi(startNaviLatLng, endNaviLatLng);
|
||||
NaviToDestinationModel.getInstance(getContext()).setVoiceIsMute(isShow);
|
||||
NaviToDestinationModel.getInstance(getContext()).setOCHTaciNaviChangedCallback(this);
|
||||
NaviLatLng endNaviLatLng = new NaviLatLng(stationLat, stationLng);
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).initAMapNavi(startNaviLatLng, endNaviLatLng);
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).setVoiceIsMute(isVoicePlay);
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).setOCHTaciNaviChangedCallback(this);
|
||||
}
|
||||
|
||||
private void showOrHideNavi(boolean isShow) {
|
||||
if (!isShow) {
|
||||
mNaviIcon.setVisibility(View.GONE);
|
||||
NaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
mTaxiFragment.showNaviToStartStationFragment(false);
|
||||
mNaviStartIcon.setVisibility(View.GONE);
|
||||
mNaviToEndIcon.setVisibility(View.GONE);
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
mTaxiFragment.showAmapNaviToStationFragment(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,11 +382,18 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
String strHtml2 = "<font color=\"#CAD6FF\">里程 </font>" + "<b><font color=\"#FFFFFF\">" + dis + "</font></b>" + "<font color=\"#CAD6FF\"> "+disUnit+"</font>"
|
||||
+ "<font color=\"#CAD6FF\">,剩余 </font>" + "<b><font color=\"#FFFFFF\">" + min + "</font></b>" + "<font color=\"#CAD6FF\"> 分钟</font>";
|
||||
|
||||
if (mContentModule3 != null && mContentModule3.getVisibility() == View.VISIBLE) { //前往上车点
|
||||
if (mCurrentOrder != null && mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.getCode()) { //前往上车点
|
||||
|
||||
mDistanceAndTime3.setText(Html.fromHtml(strHtml2));
|
||||
mNaviIcon.setVisibility(View.VISIBLE);
|
||||
} else if (mContentModule2 != null && mContentModule2.getVisibility() == View.VISIBLE) { //前往终点 时间单位是分钟
|
||||
if (mNaviStartIcon.getVisibility() == View.GONE){
|
||||
mNaviStartIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
} else if (mCurrentOrder != null && mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.getCode()) { //前往终点 时间单位是分钟
|
||||
if (mNaviToEndIcon.getVisibility() == View.GONE){
|
||||
mNaviToEndIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (mTtsLessThan200Tip < 1 && meters <= 250 && meters > 150){
|
||||
speekVoice200mTipsOnce();
|
||||
}
|
||||
@@ -427,7 +437,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
NaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
}
|
||||
|
||||
private void startOrEndService() {
|
||||
@@ -463,8 +473,9 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
showNotice(mActivity.getString(R.string.module_och_taxi_new_order));
|
||||
mTtsLessThan200Tip = 0;
|
||||
isFirstStartAutopilotDone = true;
|
||||
startNaviToStartStation(false, mOrderStartStationLat, mOrderStartStationLng);
|
||||
showOrHideNavi(true);
|
||||
double orderStartStationLat = order.startSiteGcjPoint.get(1);
|
||||
double orderStartStationLng = order.startSiteGcjPoint.get(0);
|
||||
startNaviToStation(false, orderStartStationLat, orderStartStationLng);
|
||||
setOrRemoveMapMaker(true, TaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint,R.raw.star_marker);
|
||||
setOrRemoveMapMaker(true, TaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.raw.end_marker);
|
||||
break;
|
||||
@@ -496,7 +507,12 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
case OnTheWayToEnd:
|
||||
// showNotice("欢迎使用蘑菇智行");
|
||||
mOrderCancel.setVisibility(View.VISIBLE);
|
||||
showOrHideNavi(false);
|
||||
// double orderEndStationLat = order.endSiteGcjPoint.get(1);
|
||||
// double orderEndStationLng = order.endSiteGcjPoint.get(0);
|
||||
// startNaviToStation(false, orderEndStationLat, orderEndStationLng);
|
||||
if (mTaxiFragment != null) {
|
||||
showNaviToEndStationFragment(false);
|
||||
}
|
||||
setOrRemoveMapMaker(false, TaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint,R.raw.star_marker);
|
||||
setOrRemoveMapMaker(true, TaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.raw.end_marker);
|
||||
break;
|
||||
@@ -556,11 +572,15 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
} else if (v.getId() == R.id.module_och_taxi_order_cancel_iv) {
|
||||
new TaxiOrderCancelDialog(mTaxiFragment, mActivity, mOrderNo, saveOrderState).show();
|
||||
} else if (v.getId() == R.id.module_och_taxi_navi_iv) {
|
||||
// TODO: 2021/11/30 打开去往乘客上车点的导航页面
|
||||
if (mTaxiFragment != null) {
|
||||
showNaviToStartStationFragment(true);
|
||||
}
|
||||
} else if (v.getId() == R.id.taxi_start_by_auto){//自驾模式
|
||||
} else if (v.getId() == R.id.module_och_taxi_navi_end_iv){
|
||||
// TODO: 2021/11/30 打开去往乘客下车点的导航页面
|
||||
if (mTaxiFragment != null) {
|
||||
showNaviToEndStationFragment(true);
|
||||
}
|
||||
}else if (v.getId() == R.id.taxi_start_by_auto){//自驾模式
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "自驾模式");
|
||||
mOrderStartModeBtn.setTag(0);
|
||||
startOrEndService();
|
||||
@@ -577,8 +597,23 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
* @param isShow
|
||||
*/
|
||||
private void showNaviToStartStationFragment(boolean isShow) {
|
||||
mTaxiFragment.showNaviToStartStationFragment(isShow);
|
||||
startNaviToStartStation(isShow, mOrderStartStationLat, mOrderStartStationLng);
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.getCode()){
|
||||
double orderStartStationLat = mCurrentOrder.startSiteGcjPoint.get(1);
|
||||
double orderStartStationLng = mCurrentOrder.startSiteGcjPoint.get(0);
|
||||
mTaxiFragment.showAmapNaviToStationFragment(isShow);
|
||||
startNaviToStation(isShow, orderStartStationLat, orderStartStationLng);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示/隐藏 前往乘客目的地的导航
|
||||
*
|
||||
* @param isShow
|
||||
*/
|
||||
private void showNaviToEndStationFragment(boolean isShow) {
|
||||
mTaxiFragment.showAmapNaviToStationFragment(isShow);
|
||||
mTaxiFragment.startNaviToEndStation(isShow);
|
||||
}
|
||||
|
||||
|
||||
@@ -619,37 +654,59 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
@Override
|
||||
public void onCurrentNaviDistAndTimeChanged(int meters, long timeInSecond) {
|
||||
updateDistanceAndTime(meters, timeInSecond);
|
||||
if (mCurrentOrder != null
|
||||
&& mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.getCode()){
|
||||
mTaxiFragment.reportToEndDisAndTime(meters, timeInSecond);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reInitNaviAmap(boolean isPlay, boolean isRestart) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "isPlay = " + isPlay + ", isRestart=" + isRestart);
|
||||
if (!isRestart) {
|
||||
mTaxiFragment.showNaviToStartStationFragment(false);
|
||||
mTaxiFragment.showAmapNaviToStationFragment(false);
|
||||
return;
|
||||
}
|
||||
mTaxiFragment.showNaviToStartStationFragment(false);
|
||||
mTaxiFragment.showAmapNaviToStationFragment(false);
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (saveOrderState == TaxiOrderStatusEnum.OnTheWayToStart.getCode()) {
|
||||
startNaviToStartStation(false, mOrderStartStationLat, mOrderStartStationLng);
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.getCode()) {
|
||||
double orderStartStationLat = mCurrentOrder.startSiteGcjPoint.get(1);
|
||||
double orderStartStationLng = mCurrentOrder.startSiteGcjPoint.get(0);
|
||||
startNaviToStation(false, orderStartStationLat, orderStartStationLng);
|
||||
}
|
||||
}
|
||||
}, 2000);
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (saveOrderState == TaxiOrderStatusEnum.OnTheWayToStart.getCode()) {
|
||||
if (mNaviIcon.getVisibility() == View.GONE) {
|
||||
mNaviIcon.setVisibility(View.VISIBLE);
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.getCode()) {
|
||||
if (mNaviStartIcon.getVisibility() == View.GONE) {
|
||||
mNaviStartIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.getCode()){
|
||||
if (mNaviToEndIcon.getVisibility() == View.GONE) {
|
||||
mNaviToEndIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
public void onNaviToEndAmap(boolean isVoicePlay) {
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.getCode()){
|
||||
double orderEndStationLat = mCurrentOrder.endSiteGcjPoint.get(1);
|
||||
double orderEndStationLng = mCurrentOrder.endSiteGcjPoint.get(0);
|
||||
startNaviToStation(isVoicePlay,orderEndStationLat,orderEndStationLng);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制地图起点终点
|
||||
* @param isAdd
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/6/24 11:33 上午
|
||||
*/
|
||||
public interface ITaxiMapDirectionView {
|
||||
|
||||
/**
|
||||
* 绘制路径线
|
||||
*/
|
||||
void drawablePolyline();
|
||||
|
||||
/**
|
||||
* 清除路径线
|
||||
*/
|
||||
void clearPolyline();
|
||||
|
||||
/**
|
||||
* 设置路径中起终点marker
|
||||
*/
|
||||
void setLineMarker();
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.amap.api.navi.AMapNaviViewListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
|
||||
import com.mogo.och.common.module.map.ICommonNaviChangedCallback;
|
||||
import com.mogo.och.common.module.map.CommonAmapNaviVIew;
|
||||
import com.mogo.och.taxi.R;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/30
|
||||
*/
|
||||
public class TaxiAmapNaviFragment extends BaseTaxiUIFragment implements AMapNaviViewListener {
|
||||
|
||||
private CommonAmapNaviVIew mAMapNaviView;
|
||||
private ICommonNaviChangedCallback mNaviToStartInfoCallback;
|
||||
public static TaxiAmapNaviFragment newInstance() {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
||||
TaxiAmapNaviFragment fragment = new TaxiAmapNaviFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.taxi_amap_navi_view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(View view) {
|
||||
mAMapNaviView = view.findViewById(R.id.navi_view);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
if (mAMapNaviView != null)
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (mAMapNaviView != null)
|
||||
mAMapNaviView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (mAMapNaviView != null)
|
||||
mAMapNaviView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).setVoiceIsMute(false);
|
||||
if (mAMapNaviView != null){
|
||||
mAMapNaviView.onDestroy();
|
||||
}
|
||||
|
||||
if (mNaviToStartInfoCallback != null){
|
||||
mNaviToStartInfoCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviSetting() {
|
||||
//底部导航设置点击回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviCancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviMapMode(int naviMode) {
|
||||
//导航态车头模式,0:车头朝上状态;1:正北朝上模式。
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviTurnClick() {
|
||||
//转弯view的点击回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNextRoadClick() {
|
||||
//下一个道路View点击回调
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onScanViewButtonClick() {
|
||||
//全览按钮点击回调
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLockMap(boolean isLock) {
|
||||
//锁地图状态发生变化时回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviViewLoaded() {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + "wlx", "导航页面加载成功");
|
||||
CallerLogger.INSTANCE.d(M_TAXI + "wlx", "请不要使用AMapNaviView.getMap().setOnMapLoadedListener();会overwrite导航SDK内部画线逻辑");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapTypeChanged(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviViewShowMode(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNaviBackClick() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车道信息说明:
|
||||
* <p>
|
||||
* 0xFF, 无对应车道
|
||||
* 0, 直行
|
||||
* 1, 左转
|
||||
* 2, 直行+左转
|
||||
* 3, 右转
|
||||
* 4, 直行+右转
|
||||
* 5, 左掉头
|
||||
* 6, 左转+右转
|
||||
* 7, 直行+左转+右转
|
||||
* 8, 右掉头
|
||||
* 9, 直行+左掉头
|
||||
* 10, 直行+右掉头
|
||||
* 11, 左转+左掉头
|
||||
* 12, 右转+右掉头
|
||||
* 13, 直行+扩展
|
||||
* 14, 左转+左掉头+扩展
|
||||
* 15, 保留
|
||||
* 16, 直行+左转+左掉头
|
||||
* 17, 右转+左掉头
|
||||
* 18, 左转+右转+左掉头
|
||||
* 19, 直行+右转+左掉头
|
||||
* 20, 左转+右掉头
|
||||
* 21, 公交车道
|
||||
* 22, 空车道
|
||||
* 23 可变车道
|
||||
*/
|
||||
|
||||
String[] array = {
|
||||
"直行车道"
|
||||
, "左转车道"
|
||||
, "左转或直行车道"
|
||||
, "右转车道"
|
||||
, "右转或直行车道"
|
||||
, "左掉头车道"
|
||||
, "左转或者右转车道"
|
||||
, " 左转或右转或直行车道"
|
||||
, "右转掉头车道"
|
||||
, "直行或左转掉头车道"
|
||||
, "直行或右转掉头车道"
|
||||
, "左转或左掉头车道"
|
||||
, "右转或右掉头车道"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择该车道"
|
||||
, "直行+左转+左掉头车道"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
|
||||
String[] actions = {
|
||||
"直行"
|
||||
, "左转"
|
||||
, "左转或直行"
|
||||
, "右转"
|
||||
, "右转或这行"
|
||||
, "左掉头"
|
||||
, "左转或者右转"
|
||||
, " 左转或右转或直行"
|
||||
, "右转掉头"
|
||||
, "直行或左转掉头"
|
||||
, "直行或右转掉头"
|
||||
, "左转或左掉头"
|
||||
, "右转或右掉头"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择"
|
||||
, "直行+左转+左掉头"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
}
|
||||
@@ -94,6 +94,11 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startNaviToEndStation(boolean isVoicePlay) {
|
||||
mPresenter.startNaviToEndStation(isVoicePlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return "TaxiFragment";
|
||||
@@ -306,6 +311,25 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
grabOrderFragment.onGrabOrderFailed();
|
||||
}
|
||||
|
||||
public void onNaviToEnd(boolean isAmap , boolean isVoicePlay){
|
||||
if (isAmap){
|
||||
if (null == serverOrdersFragment) return;
|
||||
serverOrdersFragment.onNaviToEndAmap(isVoicePlay);
|
||||
}else { //使用rotting数据
|
||||
showRottingToStationFragment(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 高德计算出来的到达目的地的剩余里程和时间
|
||||
* @param meters
|
||||
* @param timeInSecond
|
||||
*/
|
||||
public void reportToEndDisAndTime(int meters, long timeInSecond){ //米/秒
|
||||
mPresenter.reportToEndDisAndTime(Long.parseLong(String.valueOf(meters)),timeInSecond);
|
||||
}
|
||||
|
||||
|
||||
public void onOrdersWaitServiceChanged(List<OrderQueryRespBean.Result> waitServiceList) {
|
||||
if (null == waitServiceList) return;
|
||||
if (null == serverOrdersFragment) return;
|
||||
@@ -341,11 +365,6 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
serverOrdersFragment.onCurrentOrderRouteInfoGot(routeInfo);
|
||||
}
|
||||
|
||||
public void onCurrentOrderDistToStartChanged(long meters, long timeInSecond) {
|
||||
// if (null == serverOrdersFragment) return;
|
||||
// serverOrdersFragment.onCurrentOrderDistToStartChanged(meters,timeInSecond);
|
||||
}
|
||||
|
||||
public void onCurrentOrderDistToEndChanged(long meters, long timeInSecond) {
|
||||
if (null == serverOrdersFragment) return;
|
||||
serverOrdersFragment.onCurrentOrderDistToEndChanged(meters, timeInSecond);
|
||||
@@ -375,6 +394,9 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
}
|
||||
TaxiModel.getInstance().setOnTheWayToEndStation();
|
||||
});
|
||||
findViewById(R.id.test_bar_route).setOnClickListener(v -> {
|
||||
testRouteInfoUpload();
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
|
||||
@@ -0,0 +1,367 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdate;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.amap.api.maps.UiSettings;
|
||||
import com.amap.api.maps.model.BitmapDescriptor;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.utils.TaxiMapAssetStyleUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* taxi司机端前往目的地小地图导航
|
||||
*/
|
||||
public class TaxiMapDirectionView
|
||||
extends RelativeLayout
|
||||
implements IMoGoMapLocationListener, ITaxiMapDirectionView, AMap.OnCameraChangeListener {
|
||||
|
||||
//小地图名称
|
||||
public static final String TAG = "TPMapDirectionView";
|
||||
|
||||
private TextureMapView mAMapNaviView;
|
||||
private AMap mAMap;
|
||||
private Marker mCarMarker;
|
||||
private Marker mStartMarker;
|
||||
private Marker mEndMarker;
|
||||
|
||||
private int zoomLevel = 13;
|
||||
private List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
private Polyline mPolyline;
|
||||
private CameraUpdate mCameraUpdate;
|
||||
private Context mContext;
|
||||
private int mHaveArrivedIndex;
|
||||
|
||||
List<BitmapDescriptor> textureList = new ArrayList<>();
|
||||
List<Integer> texIndexList = new ArrayList<>();
|
||||
|
||||
private BitmapDescriptor mArrivedRes;
|
||||
private BitmapDescriptor mUnArrivedRes;
|
||||
|
||||
public TaxiMapDirectionView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public TaxiMapDirectionView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public TaxiMapDirectionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
try {
|
||||
initView(context);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initView(Context context) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "initView");
|
||||
|
||||
mContext = context;
|
||||
|
||||
View smpView = LayoutInflater.from(context).inflate(R.layout.taxi_map_view, this);
|
||||
|
||||
mAMapNaviView = (TextureMapView) smpView.findViewById(R.id.taxi_amap_view);
|
||||
|
||||
initAMapView();
|
||||
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false);
|
||||
}
|
||||
|
||||
private void initAMapView() {
|
||||
mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||
mAMap = mAMapNaviView.getMap();
|
||||
// 设置导航地图模式,aMap是地图控制器对象。
|
||||
mAMap.setMapType(AMap.MAP_TYPE_NIGHT);
|
||||
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
mAMap.setTrafficEnabled(false);
|
||||
|
||||
// 设置 锚点 图标
|
||||
mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_car))
|
||||
.anchor(0.5f, 0.5f));
|
||||
mStartMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_view_dir_start)));
|
||||
mEndMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_view_dir_end)));
|
||||
|
||||
mArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_arrow_arrived);
|
||||
mUnArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_arrow_un_arrive);
|
||||
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(TaxiMapAssetStyleUtil.getAssetsStyle(getContext(),"map_style.data"))
|
||||
.setStyleExtraData(TaxiMapAssetStyleUtil.getAssetsExtraStyle(getContext(),"map_style_extra.data"));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
|
||||
//设置希望展示的地图缩放级别
|
||||
mAMap.moveCamera(mCameraUpdate);
|
||||
|
||||
// 设置地图的样式
|
||||
UiSettings uiSettings = mAMap.getUiSettings();
|
||||
uiSettings.setZoomControlsEnabled(false);// 地图缩放级别的交换按钮
|
||||
uiSettings.setAllGesturesEnabled(false);// 所有手势
|
||||
uiSettings.setMyLocationButtonEnabled(false); // 显示默认的定位按钮
|
||||
uiSettings.setLogoBottomMargin(-150); //设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
|
||||
mAMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "smp---onMapLoaded");
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(TaxiMapAssetStyleUtil.getAssetsStyle(getContext(),"map_style.data"))
|
||||
.setStyleExtraData(TaxiMapAssetStyleUtil.getAssetsExtraStyle(getContext(),"map_style_extra.data"));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth() / 2, mAMapNaviView.getHeight() / 2);
|
||||
}
|
||||
});
|
||||
|
||||
//设置地图状态的监听接口
|
||||
mAMap.setOnCameraChangeListener(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
|
||||
if (location == null){
|
||||
return;
|
||||
}
|
||||
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
|
||||
if (mCoordinatesLatLng.size() > 1) {
|
||||
//圈定地图显示范围
|
||||
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
||||
//存放经纬度
|
||||
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
|
||||
boundsBuilder.include(currentLatLng);
|
||||
boundsBuilder.include(endLatLng);
|
||||
//第二个参数为四周留空宽度
|
||||
mAMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(), 100,100,100,100));
|
||||
// CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "onCarLocationChanged2--moveCamera :" + location.getLatitude()+", "+location.getLongitude());
|
||||
|
||||
} else {
|
||||
//设置希望展示的地图缩放级别
|
||||
CameraPosition cameraPosition = new CameraPosition.Builder()
|
||||
.target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build();
|
||||
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
}
|
||||
//更新车辆位置
|
||||
if (mCarMarker != null) {
|
||||
// CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "location.getBearing() = " + location.getBearing());
|
||||
mCarMarker.setRotateAngle(360 - location.getBearing());
|
||||
mCarMarker.setPosition(currentLatLng);
|
||||
// CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "onCarLocationChanged2--loacation :" + location.getLatitude()+", "+location.getLongitude());
|
||||
mCarMarker.setToTop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLineMarker() {
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
// 设置开始结束Marker位置
|
||||
LatLng startLatLng = mCoordinatesLatLng.get(0);
|
||||
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
||||
|
||||
mStartMarker.setPosition(startLatLng);
|
||||
mEndMarker.setPosition(endLatLng);
|
||||
mStartMarker.setVisible(true);
|
||||
mEndMarker.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawablePolyline() {
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mAMap != null) {
|
||||
|
||||
addRouteColorList();
|
||||
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
//设置线段纹理
|
||||
PolylineOptions polylineOptions = new PolylineOptions();
|
||||
polylineOptions.addAll(mCoordinatesLatLng);
|
||||
polylineOptions.setUseTexture(true);
|
||||
polylineOptions.width(15);
|
||||
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
|
||||
polylineOptions.setCustomTextureList(textureList);
|
||||
polylineOptions.setCustomTextureIndex(texIndexList);
|
||||
// polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow_un_arrive));
|
||||
|
||||
// 绘制线
|
||||
mPolyline = mAMap.addPolyline(polylineOptions);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加画线颜色值
|
||||
*/
|
||||
private void addRouteColorList() {
|
||||
textureList.clear();
|
||||
texIndexList.clear();
|
||||
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
|
||||
if (i <= mHaveArrivedIndex){
|
||||
textureList.add(mArrivedRes);
|
||||
}else {
|
||||
textureList.add(mUnArrivedRes);
|
||||
}
|
||||
texIndexList.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public LatLng CoordinateConverterFrom84(Context mContext, MogoLatLng mogoLatLng) {
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(mogoLatLng.lat, mogoLatLng.lon));
|
||||
LatLng latLng = mCoordinateConverter.convert();
|
||||
return latLng;
|
||||
}
|
||||
|
||||
public List<LatLng> CoordinateConverterFrom84ForList(Context mContext, List<MogoLatLng> mogoLatLngList) {
|
||||
List<LatLng> list = new ArrayList<>();
|
||||
for (MogoLatLng m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateConverterFrom84(mContext, m);
|
||||
list.add(mogoLatLng);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPolyline() {
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetPolyine() {
|
||||
mCoordinatesLatLng.clear();
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void onCreateView(Bundle savedInstanceState) {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void convert(List<MogoLatLng> coordinates) {
|
||||
mCoordinatesLatLng.clear();
|
||||
List<LatLng> latLngs = CoordinateConverterFrom84ForList(mContext, coordinates);
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
}
|
||||
|
||||
public void setCoordinatesLatLng(List<LatLng> latLngs){
|
||||
mCoordinatesLatLng.clear();
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
}
|
||||
|
||||
public void setCoordinatesLatLng(List<LatLng> latLngs, int haveArrivedIndex){
|
||||
mCoordinatesLatLng.clear();
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
mHaveArrivedIndex = haveArrivedIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChange(CameraPosition cameraPosition) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChangeFinish(CameraPosition cameraPosition) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,310 +0,0 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions;
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.amap.api.navi.AMapNaviViewListener;
|
||||
import com.amap.api.navi.AMapNaviViewOptions;
|
||||
import com.amap.api.navi.model.RouteOverlayOptions;
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.callback.ITaxiNaviChangedCallback;
|
||||
import com.mogo.och.taxi.model.NaviToDestinationModel;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/30
|
||||
*/
|
||||
public class TaxiNaviFragment extends BaseTaxiUIFragment implements AMapNaviViewListener, View.OnClickListener {
|
||||
|
||||
private AMapNaviView mAMapNaviView;
|
||||
// private OverviewButtonView mOverviewButtonView;
|
||||
// private NextTurnTipView mNextTurnTipView;
|
||||
private AMap aMap;
|
||||
private ITaxiNaviChangedCallback mNaviToStartInfoCallback; // 前往乘客上车点
|
||||
public static TaxiNaviFragment newInstance() {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
||||
TaxiNaviFragment fragment = new TaxiNaviFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.taxi_navi_view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(View view) {
|
||||
view.bringToFront();
|
||||
initMapView(view);
|
||||
}
|
||||
|
||||
private void initMapView(View view) {
|
||||
// mOverviewButtonView = view.findViewById(R.id.navi_overviewbuttonview);
|
||||
// mAMapNaviView.setLazyOverviewButtonView(mOverviewButtonView);
|
||||
// mOverviewButtonView.setOnClickListener(this);
|
||||
// DriveWayView mDriveWayView = view.findViewById(R.id.navi_drivewayview);
|
||||
// mAMapNaviView.setLazyDriveWayView(mDriveWayView);
|
||||
// mNextTurnTipView = view.findViewById(R.id.navi_nextturntipview);
|
||||
// mAMapNaviView.setLazyNextTurnTipView(mNextTurnTipView);
|
||||
mAMapNaviView = view.findViewById(R.id.navi_view);
|
||||
mAMapNaviView.setAMapNaviViewListener(this);
|
||||
//车头向上模式
|
||||
mAMapNaviView.setNaviMode(AMapNaviView.CAR_UP_MODE);
|
||||
aMap = mAMapNaviView.getMap();
|
||||
//关闭地图文字显示
|
||||
aMap.showMapText(false);
|
||||
// 设置导航地图模式,aMap是地图控制器对象。
|
||||
aMap.setMapType(AMap.MAP_TYPE_NIGHT);
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
aMap.setTrafficEnabled(false);
|
||||
setMapViewOptions();
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (null == getContext()){
|
||||
return;
|
||||
}
|
||||
aMap.setCustomMapStyle(
|
||||
new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style.data"))
|
||||
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra.data"))
|
||||
);
|
||||
|
||||
//设置希望展示的地图缩放级别
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void setMapViewOptions() {
|
||||
AMapNaviViewOptions options = new AMapNaviViewOptions();
|
||||
options.setTilt(0);//设置 2D 模式
|
||||
options.setLayoutVisible(false);//设置导航界面UI是否显示。
|
||||
options.setTrafficBarEnabled(false);//设置路况光柱条是否显示(只适用于驾车导航,需要联网)。
|
||||
options.setAutoLockCar(true);//设置6秒后是否自动锁车
|
||||
options.setAutoDisplayOverview(true);//设置是否自动全览模式,即在算路成功后自动进入全览模式
|
||||
options.setTrafficLine(false);
|
||||
options.setModeCrossDisplayShow(true);//设置是否显示路口放大图(路口模型图)
|
||||
options.setAutoChangeZoom(true);//自动缩放级别
|
||||
options.setCarBitmap(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.taxi_navi_arrow_icon));
|
||||
options.setFourCornersBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.taxi_navi_direction_icon));
|
||||
options.setAutoChangeZoom(true);//设置是否开启动态比例尺 (锁车态下自动进行地图缩放变化)
|
||||
// options.setZoom(18);//14-18
|
||||
// options.setTrafficInfoUpdateEnabled(false);
|
||||
// options.setTrafficLayerEnabled(false);//设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
// options.setCameraInfoUpdateEnabled(false);
|
||||
// options.setCompassEnabled(false);//设置指南针图标否在导航界面显示,默认显示。
|
||||
// options.setLaneInfoShow(false);// 设置是否显示道路信息view
|
||||
// options.setNaviArrowVisible(false);//设置路线转向箭头隐藏和显示
|
||||
// options.setRealCrossDisplayShow(false);//设置是否显示路口放大图(实景图)
|
||||
// options.setRouteListButtonShow(true);//设置导航界面是否显示路线全览按钮。
|
||||
// options.setSettingMenuEnabled(false);//设置菜单按钮是否在导航界面显示。
|
||||
|
||||
RouteOverlayOptions routeOverlayOptions = new RouteOverlayOptions();
|
||||
|
||||
// routeOverlayOptions.setArrowOnTrafficRoute(BitmapFactory.decodeResource(getResources(),R.drawable.custtexture_aolr));
|
||||
routeOverlayOptions.setNormalRoute(BitmapFactory.decodeResource(getResources(), R.drawable.taxi_navi_line_icon));
|
||||
options.setRouteOverlayOptions(routeOverlayOptions);
|
||||
|
||||
mAMapNaviView.setViewOptions(options);
|
||||
}
|
||||
public void goToOverview(){
|
||||
if (mAMapNaviView.isRouteOverviewNow()){
|
||||
mAMapNaviView.recoverLockMode();
|
||||
}else {
|
||||
mAMapNaviView.displayOverview();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// if (v.getId() == R.id.navi_overviewbuttonview){
|
||||
// goToOverview();
|
||||
// }
|
||||
}
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mAMapNaviView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mAMapNaviView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
NaviToDestinationModel.getInstance(getContext()).setVoiceIsMute(false);
|
||||
if (mAMapNaviView != null){
|
||||
mAMapNaviView.onDestroy();
|
||||
}
|
||||
|
||||
if (mNaviToStartInfoCallback != null){
|
||||
mNaviToStartInfoCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviSetting() {
|
||||
//底部导航设置点击回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviCancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviMapMode(int naviMode) {
|
||||
//导航态车头模式,0:车头朝上状态;1:正北朝上模式。
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviTurnClick() {
|
||||
//转弯view的点击回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNextRoadClick() {
|
||||
//下一个道路View点击回调
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onScanViewButtonClick() {
|
||||
//全览按钮点击回调
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLockMap(boolean isLock) {
|
||||
//锁地图状态发生变化时回调
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviViewLoaded() {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + "wlx", "导航页面加载成功");
|
||||
CallerLogger.INSTANCE.d(M_TAXI + "wlx", "请不要使用AMapNaviView.getMap().setOnMapLoadedListener();会overwrite导航SDK内部画线逻辑");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapTypeChanged(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviViewShowMode(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNaviBackClick() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车道信息说明:
|
||||
* <p>
|
||||
* 0xFF, 无对应车道
|
||||
* 0, 直行
|
||||
* 1, 左转
|
||||
* 2, 直行+左转
|
||||
* 3, 右转
|
||||
* 4, 直行+右转
|
||||
* 5, 左掉头
|
||||
* 6, 左转+右转
|
||||
* 7, 直行+左转+右转
|
||||
* 8, 右掉头
|
||||
* 9, 直行+左掉头
|
||||
* 10, 直行+右掉头
|
||||
* 11, 左转+左掉头
|
||||
* 12, 右转+右掉头
|
||||
* 13, 直行+扩展
|
||||
* 14, 左转+左掉头+扩展
|
||||
* 15, 保留
|
||||
* 16, 直行+左转+左掉头
|
||||
* 17, 右转+左掉头
|
||||
* 18, 左转+右转+左掉头
|
||||
* 19, 直行+右转+左掉头
|
||||
* 20, 左转+右掉头
|
||||
* 21, 公交车道
|
||||
* 22, 空车道
|
||||
* 23 可变车道
|
||||
*/
|
||||
|
||||
String[] array = {
|
||||
"直行车道"
|
||||
, "左转车道"
|
||||
, "左转或直行车道"
|
||||
, "右转车道"
|
||||
, "右转或直行车道"
|
||||
, "左掉头车道"
|
||||
, "左转或者右转车道"
|
||||
, " 左转或右转或直行车道"
|
||||
, "右转掉头车道"
|
||||
, "直行或左转掉头车道"
|
||||
, "直行或右转掉头车道"
|
||||
, "左转或左掉头车道"
|
||||
, "右转或右掉头车道"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择该车道"
|
||||
, "直行+左转+左掉头车道"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
|
||||
String[] actions = {
|
||||
"直行"
|
||||
, "左转"
|
||||
, "左转或直行"
|
||||
, "右转"
|
||||
, "右转或这行"
|
||||
, "左掉头"
|
||||
, "左转或者右转"
|
||||
, " 左转或右转或直行"
|
||||
, "右转掉头"
|
||||
, "直行或左转掉头"
|
||||
, "直行或右转掉头"
|
||||
, "左转或左掉头"
|
||||
, "右转或右掉头"
|
||||
, "直行并且车道扩展"
|
||||
, "左转+左掉头+扩展"
|
||||
, "不可以选择"
|
||||
, "直行+左转+左掉头"
|
||||
, "右转+左掉头"
|
||||
, "左转+右转+左掉头"
|
||||
, "直行+右转+左掉头"
|
||||
, "左转+右掉头"
|
||||
, "公交车道"
|
||||
, "空车道"
|
||||
, "可变车道"
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.presenter.NaviPresenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/30
|
||||
*/
|
||||
public class TaxiRottingNaviFragment extends MvpFragment<TaxiRottingNaviFragment, NaviPresenter> {
|
||||
|
||||
private final String TAG = TaxiRottingNaviFragment.class.getSimpleName();
|
||||
|
||||
private TaxiMapDirectionView mMapDirectionView;
|
||||
public static TaxiRottingNaviFragment newInstance() {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
||||
TaxiRottingNaviFragment fragment = new TaxiRottingNaviFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.taxi_rotting_navi_view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
mMapDirectionView = mRootView.findViewById(R.id.rotting_navi_view);
|
||||
mMapDirectionView.onCreateView(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mMapDirectionView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mMapDirectionView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (mMapDirectionView != null){
|
||||
mMapDirectionView.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected NaviPresenter createPresenter() {
|
||||
return new NaviPresenter(this);
|
||||
}
|
||||
|
||||
public void routeResult(List<LatLng> latLngList, int haveArrivedIndex){
|
||||
if (latLngList.size() > 0) {
|
||||
drawablePolylineByRoute(latLngList,haveArrivedIndex);
|
||||
} else {
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
public void setLineMarker(List<LatLng> latLngList){
|
||||
if (latLngList.size() > 0) {
|
||||
if (mMapDirectionView != null) {
|
||||
mMapDirectionView.setCoordinatesLatLng(latLngList);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.setLineMarker();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
public void drawablePolylineByRoute(List<LatLng> mCoordinatesLatLng,int haveArrivedIndex){
|
||||
if (mMapDirectionView != null){
|
||||
mMapDirectionView.setCoordinatesLatLng(mCoordinatesLatLng,haveArrivedIndex);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.drawablePolyline();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
private void clearPolyline() {
|
||||
if (mMapDirectionView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.clearPolyline();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class TaxiServerOrdersFragment extends BaseTaxiUIFragment {
|
||||
private ViewPager mTaxiOrderPager;
|
||||
private String[] mTabTitles = {"进行中","待服务"};
|
||||
private List<Fragment> fragments = new ArrayList<>();
|
||||
private TaxiBeingServerdOrdersFragment beingServerdOrdersFragment = null;
|
||||
private CommonBeingServerdOrdersFragment beingServerdOrdersFragment = null;
|
||||
private TaxiReserveOrdersFragment reserveOrdersFragment = null;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@@ -82,7 +82,7 @@ public class TaxiServerOrdersFragment extends BaseTaxiUIFragment {
|
||||
if (0 == i){
|
||||
mTaxiOrderTab.addTab(tab,true);
|
||||
changeTabLayoutTabUI(tab,true);
|
||||
beingServerdOrdersFragment = TaxiBeingServerdOrdersFragment.newInstance(getActivity(),(TaxiFragment) getParentFragment());
|
||||
beingServerdOrdersFragment = CommonBeingServerdOrdersFragment.newInstance(getActivity(),(TaxiFragment) getParentFragment());
|
||||
fragments.add(beingServerdOrdersFragment);
|
||||
}else if (1 == i){
|
||||
mTaxiOrderTab.addTab(tab);
|
||||
@@ -200,10 +200,7 @@ public class TaxiServerOrdersFragment extends BaseTaxiUIFragment {
|
||||
if (null == beingServerdOrdersFragment) return;
|
||||
beingServerdOrdersFragment.onCurrentOrderCancelDone();
|
||||
}
|
||||
public void onCurrentOrderDistToStartChanged(long meters, long timeInSecond){
|
||||
if (null == beingServerdOrdersFragment) return;
|
||||
beingServerdOrdersFragment.updateDistanceAndTime(meters,timeInSecond);
|
||||
}
|
||||
|
||||
public void onCurrentOrderDistToEndChanged(long meters, long timeInSecond){
|
||||
if (null == beingServerdOrdersFragment) return;
|
||||
beingServerdOrdersFragment.updateDistanceAndTime(meters,timeInSecond);
|
||||
@@ -217,4 +214,9 @@ public class TaxiServerOrdersFragment extends BaseTaxiUIFragment {
|
||||
if (null == beingServerdOrdersFragment) return;
|
||||
beingServerdOrdersFragment.updateOrderBottomBtnUI();
|
||||
}
|
||||
|
||||
public void onNaviToEndAmap(boolean isVoicePlay){
|
||||
if (null == beingServerdOrdersFragment) return;
|
||||
beingServerdOrdersFragment.onNaviToEndAmap(isVoicePlay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TPRouteDataTestUtils {
|
||||
builder.setLongitude(s.getDouble("lon"));
|
||||
list.add(builder.build());
|
||||
}
|
||||
TaxiModel.getInstance().updateOrderRoute(list);
|
||||
// TaxiModel.getInstance().updateOrderRoute(list);
|
||||
TaxiModel.getInstance().updateOrderRouteInfo(list);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.mogo.och.taxi.utils;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/18/20 5:37 PM
|
||||
*/
|
||||
public class TaxiMapAssetStyleUtil {
|
||||
|
||||
public static byte[] getAssetsStyle(Context context,String fileName) {
|
||||
byte[] buffer1 = null;
|
||||
InputStream is1 = null;
|
||||
try {
|
||||
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style.data
|
||||
int lenght1 = is1.available();
|
||||
buffer1 = new byte[lenght1];
|
||||
is1.read(buffer1);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (is1 != null) {
|
||||
is1.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return buffer1;
|
||||
}
|
||||
|
||||
|
||||
public static byte[] getAssetsExtraStyle(Context context, String fileName) {
|
||||
byte[] buffer1 = null;
|
||||
InputStream is1 = null;
|
||||
try {
|
||||
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style_extra.data
|
||||
int lenght1 = is1.available();
|
||||
buffer1 = new byte[lenght1];
|
||||
is1.read(buffer1);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (is1 != null) {
|
||||
is1.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return buffer1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 783 B |
|
After Width: | Height: | Size: 588 B |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 783 B |
|
After Width: | Height: | Size: 588 B |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 783 B |
|
After Width: | Height: | Size: 588 B |
BIN
OCH/mogo-och-taxi/src/main/res/drawable-xhdpi/taxi_map_car.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="30px"
|
||||
app:cardElevation="8px"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardBackgroundColor="@android:color/transparent">
|
||||
<com.mogo.och.common.module.map.CommonAmapNaviVIew
|
||||
android:id="@+id/navi_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -65,7 +65,7 @@
|
||||
tools:text="送乘客至" />
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_station_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="36px"
|
||||
android:textStyle="bold"
|
||||
@@ -74,10 +74,21 @@
|
||||
android:lineSpacingExtra="10px"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="23sp"
|
||||
app:layout_constraintRight_toLeftOf="@+id/module_och_taxi_navi_end_iv"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_taxi_order_station_title_2"
|
||||
tools:text="- -" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_och_taxi_navi_end_iv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/taxi_navi_icon"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_station_2"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_station_2"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_distance_anchor_2"
|
||||
android:layout_width="match_parent"
|
||||
@@ -156,7 +167,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_taxi_order_passenger_data">
|
||||
@@ -205,7 +216,7 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/module_och_taxi_order_arrive_station_32"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -222,7 +233,9 @@
|
||||
android:lineSpacingExtra="16px"
|
||||
android:textColor="#CAD6FF"
|
||||
android:textSize="30px"
|
||||
tools:text="送乘客至" />
|
||||
tools:text="送乘客至"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_end_station_32"
|
||||
android:layout_width="match_parent"
|
||||
@@ -234,8 +247,11 @@
|
||||
android:lineSpacingExtra="16px"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="42px"
|
||||
tools:text="- -" />
|
||||
</LinearLayout>
|
||||
tools:text="- -"
|
||||
app:layout_constraintTop_toBottomOf="@+id/arrive_station_32"
|
||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_other_content_3"
|
||||
|
||||
17
OCH/mogo-och-taxi/src/main/res/layout/taxi_map_view.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.och.common.module.wigets.OCHCornerCustomCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:och_card_right_bottom_radius="@dimen/dp_40"
|
||||
app:och_card_left_bottom_radius="@dimen/dp_40"
|
||||
android:background="#00000000">
|
||||
|
||||
<com.amap.api.maps.TextureMapView
|
||||
android:id="@+id/taxi_amap_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00000000"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
</com.mogo.och.common.module.wigets.OCHCornerCustomCardView>
|
||||
@@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="30px"
|
||||
app:cardElevation="8px"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardBackgroundColor="@android:color/transparent">
|
||||
<com.amap.api.navi.AMapNaviView
|
||||
android:id="@+id/navi_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- <com.amap.api.navi.view.OverviewButtonView-->
|
||||
<!-- android:id="@+id/navi_overviewbuttonview"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_alignParentRight="true" />-->
|
||||
<!-- <com.amap.api.navi.view.DriveWayView-->
|
||||
<!-- android:id="@+id/navi_drivewayview"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"/>-->
|
||||
|
||||
<!-- <com.amap.api.navi.view.NextTurnTipView-->
|
||||
<!-- android:id="@+id/navi_nextturntipview"-->
|
||||
<!-- android:layout_width="100px"-->
|
||||
<!-- android:layout_height="180px"-->
|
||||
<!-- ></com.amap.api.navi.view.NextTurnTipView>-->
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -85,5 +85,12 @@
|
||||
android:text="到达目的地"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/test_bar_route"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="模拟轨迹"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="30px"
|
||||
app:cardElevation="8px"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardBackgroundColor="@android:color/transparent">
|
||||
<com.mogo.och.taxi.ui.TaxiMapDirectionView
|
||||
android:id="@+id/rotting_navi_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -101,6 +101,7 @@ import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
@@ -647,6 +648,11 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
titleBtnData.add(Constants.TITLE.SEND_SET_DEMO_MODE_REQ_CLOSE);
|
||||
titleBtnData.add(Constants.TITLE.SEND_SET_RAIN_MODE_REQ_OPEN);
|
||||
titleBtnData.add(Constants.TITLE.SEND_SET_RAIN_MODE_REQ_CLOSE);
|
||||
titleBtnData.add(Constants.TITLE.SEND_DETOURING_OPEN);
|
||||
titleBtnData.add(Constants.TITLE.SEND_DETOURING_CLOSE);
|
||||
titleBtnData.add(Constants.TITLE.SEND_DETOURING_SPEED);
|
||||
titleBtnData.add(Constants.TITLE.SEND_TRIP_INFO);
|
||||
|
||||
}
|
||||
|
||||
private void initBtnRecyclerView() {
|
||||
@@ -1186,7 +1192,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
msg = "未连接司机端";
|
||||
}
|
||||
showToastCenter(msg);
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
switch (data) {
|
||||
case Constants.TITLE.SEND_SET_AUTOPILOT_MODE_REQ:
|
||||
@@ -1345,12 +1351,100 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
AdasManager.getInstance().sendRainModeReq(0);
|
||||
break;
|
||||
case Constants.TITLE.SEND_RECORD_DATA_CONFIG_RESP:
|
||||
//关闭雨天模式
|
||||
AdasManager.getInstance().sendRecordDataConfigReq();
|
||||
//数据采集配置
|
||||
showRecordDataConfigRespDialog();
|
||||
break;
|
||||
case Constants.TITLE.SEND_DETOURING_OPEN:
|
||||
//绕障类功能开
|
||||
AdasManager.getInstance().sendDetouring(1);
|
||||
break;
|
||||
case Constants.TITLE.SEND_DETOURING_CLOSE:
|
||||
//绕障类功能关
|
||||
AdasManager.getInstance().sendDetouring(0);
|
||||
break;
|
||||
case Constants.TITLE.SEND_DETOURING_SPEED:
|
||||
//绕障速度设置
|
||||
showDetouringSpeedDialog();
|
||||
break;
|
||||
case Constants.TITLE.SEND_TRIP_INFO:
|
||||
//行程信息
|
||||
AdasManager.getInstance().sendTripInfoReq(1, "", "", false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void showDetouringSpeedDialog() {
|
||||
AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
|
||||
builder1.setTitle("绕障速度");
|
||||
View view1 = getLayoutInflater().inflate(R.layout.dialog_detouring_speed, null);
|
||||
final EditText et1 = (EditText) view1.findViewById(R.id.et);
|
||||
builder1.setView(view1);//
|
||||
builder1.setCancelable(false);//
|
||||
builder1.setPositiveButton("设置", null);
|
||||
//设置反面按钮,并做事件处理
|
||||
builder1.setNegativeButton("取消", null);
|
||||
AlertDialog alertDialog1 = builder1.show();//显示Dialog对话框
|
||||
alertDialog1.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Editable editable = et1.getText();
|
||||
if (TextUtils.isEmpty(editable)) {
|
||||
// 条件不成立不能关闭 AlertDialog 窗口
|
||||
Toast.makeText(MainActivity.this, "请输入速度", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
String temp = et1.getText().toString().trim();
|
||||
double speed = Double.parseDouble(temp);
|
||||
AdasManager.getInstance().sendDetouringSpeed(speed);
|
||||
alertDialog1.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showRecordDataConfigRespDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(Constants.TITLE.SEND_RECORD_DATA_CONFIG_RESP);
|
||||
View view = getLayoutInflater().inflate(R.layout.dialog_record_data_config_resp, null);
|
||||
final EditText reqTypeView = view.findViewById(R.id.reqType);
|
||||
final EditText recordTypeView = view.findViewById(R.id.recordType);
|
||||
final EditText topicsNeedToCacheView = view.findViewById(R.id.topicsNeedToCache);
|
||||
builder.setView(view);//
|
||||
builder.setCancelable(false);//
|
||||
builder.setPositiveButton("发送", null);
|
||||
//设置反面按钮,并做事件处理
|
||||
builder.setNegativeButton("取消", null);
|
||||
AlertDialog alertDialog = builder.show();//显示Dialog对话框
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Editable editable = reqTypeView.getText();
|
||||
if (TextUtils.isEmpty(editable)) {
|
||||
// 条件不成立不能关闭 AlertDialog 窗口
|
||||
Toast.makeText(MainActivity.this, "请输入ReqType", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
int reqType = Integer.parseInt(editable.toString().trim());
|
||||
editable = recordTypeView.getText();
|
||||
if (TextUtils.isEmpty(editable)) {
|
||||
Toast.makeText(MainActivity.this, "请输入RecordType", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
int recordType = Integer.parseInt(editable.toString().trim());
|
||||
List<String> topicsNeedToCache = null;
|
||||
editable = topicsNeedToCacheView.getText();
|
||||
if (!TextUtils.isEmpty(editable)) {
|
||||
String cache = editable.toString().trim();
|
||||
cache = cache.replace(",", " ").replace(",", " ");
|
||||
String[] caches = cache.split(" ");
|
||||
topicsNeedToCache = Arrays.asList(caches);
|
||||
}
|
||||
AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache);
|
||||
alertDialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void handleMessage(Message msg) {
|
||||
|
||||
@@ -187,6 +187,10 @@ public class Constants {
|
||||
String SEND_SET_RAIN_MODE_REQ_OPEN = "打开雨天模式";
|
||||
String SEND_SET_RAIN_MODE_REQ_CLOSE = "关闭雨天模式";
|
||||
String SEND_RECORD_DATA_CONFIG_RESP = "数据采集配置";
|
||||
String SEND_DETOURING_OPEN = "绕障类功能开";
|
||||
String SEND_DETOURING_CLOSE = "绕障类功能关";
|
||||
String SEND_DETOURING_SPEED = "绕障速度阈值";
|
||||
String SEND_TRIP_INFO = "行程信息";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="0123456789."
|
||||
android:gravity="center"
|
||||
android:hint="变道绕障的目标障碍物速度阈值"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:inputType="number"
|
||||
android:maxLength="10"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:text="m/s"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:gravity="right"
|
||||
android:text="ReqType:"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/reqType"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:hint="0: all,1:获取当前所有topic列表,2:配置需要预加载的topic组合"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="number"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textColor="#000"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:gravity="right"
|
||||
android:text="RecordType:"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/recordType"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:hint="0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="number"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textColor="#000"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:gravity="right"
|
||||
android:textSize="8sp"
|
||||
android:text="TopicsNeedToCache:"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/topicsNeedToCache"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:hint="逗号间隔"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textColor="#000"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -379,6 +379,16 @@ class MoGoAutopilotProvider :
|
||||
return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration)
|
||||
}
|
||||
|
||||
override fun recordPackage(
|
||||
type: Int,
|
||||
id: Int,
|
||||
duration: Int,
|
||||
bduration: Int,
|
||||
topics: List<String>
|
||||
): Boolean {
|
||||
return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration, topics)
|
||||
}
|
||||
|
||||
override fun stopRecord(type: Int, id: Int): Boolean {
|
||||
return AdasManager.getInstance().stopRecordPackage(id, type)
|
||||
}
|
||||
@@ -497,17 +507,43 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据采集录制模式配置列表
|
||||
* 绕障类功能开关
|
||||
* isEnable = true 开启
|
||||
* isEnable = false 关闭
|
||||
* @return boolean
|
||||
*/
|
||||
override fun getBadCaseConfig() {
|
||||
AdasManager.getInstance().sendRecordDataConfigReq()
|
||||
override fun sendDetouring(isEnable: Boolean): Boolean {
|
||||
return if(isEnable){
|
||||
AdasManager.getInstance().sendDetouring(1)
|
||||
}else{
|
||||
AdasManager.getInstance().sendDetouring(0)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 变道绕障的目标障碍物速度阈值
|
||||
* @param speed 速度阈值 m/s
|
||||
* @return boolean
|
||||
*/
|
||||
override fun sendDetouringSpeed(speed: Double): Boolean {
|
||||
return AdasManager.getInstance().sendDetouringSpeed(speed)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据采集录制模式配置列表
|
||||
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
|
||||
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
|
||||
* @param topicsNeedToCache
|
||||
* @return boolean
|
||||
*/
|
||||
override fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List<String>): Boolean{
|
||||
return AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache)
|
||||
}
|
||||
|
||||
/**
|
||||
* 向左变道
|
||||
*/
|
||||
override fun sendOperatorChangeLaneLeft() {
|
||||
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorChangeLaneLeft -------> ")
|
||||
AdasManager.getInstance().sendOperatorCmdChangeLaneLeft()
|
||||
}
|
||||
|
||||
@@ -515,7 +551,6 @@ class MoGoAutopilotProvider :
|
||||
* 向右变道
|
||||
*/
|
||||
override fun sendOperatorChangeLaneRight() {
|
||||
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorChangeLaneRight -------> ")
|
||||
AdasManager.getInstance().sendOperatorCmdChangeLaneRight()
|
||||
}
|
||||
|
||||
@@ -523,7 +558,6 @@ class MoGoAutopilotProvider :
|
||||
* 发送设置加速度 acc>0加速 acc<0减速 acc=0复位
|
||||
*/
|
||||
override fun sendOperatorSetAcceleratedSpeed(cc: Double) {
|
||||
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorSetAcceleratedSpeed cc $cc ")
|
||||
AdasManager.getInstance().sendOperatorCmdSetAcceleratedSpeed(cc)
|
||||
}
|
||||
|
||||
@@ -531,10 +565,21 @@ class MoGoAutopilotProvider :
|
||||
* 鸣笛 value 1: honk 2: stop honking
|
||||
*/
|
||||
override fun sendOperatorSetHorn(value: Double) {
|
||||
// Log.d("liyz", "MoGoAutopilotProvider sendOperatorSetHorn value $value ")
|
||||
AdasManager.getInstance().sendOperatorCmdSetHorn(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* 行程信息
|
||||
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
|
||||
* @param lineName 路线名, for type 1, 2
|
||||
* @param stopName 站点名, for type 3, 4
|
||||
* @param isLastStop
|
||||
* @return
|
||||
*/
|
||||
override fun sendTripInfo(type: Int, lineName: String, stopName: String, isLastStop: Boolean) {
|
||||
AdasManager.getInstance().sendTripInfoReq(type, lineName, stopName, isLastStop)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送工控机所有节点重启命令
|
||||
*/
|
||||
|
||||
@@ -46,6 +46,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningAction
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotRotting
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotTrajectory
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPointCloudListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordConfig
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
@@ -409,7 +410,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
header: MessagePad.Header?,
|
||||
config: MessagePad.RecordDataConfig?
|
||||
) {
|
||||
|
||||
if(config!=null){
|
||||
invokeAutopilotRecordConfig(config)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,8 +22,8 @@ public interface BindingcarApiService {
|
||||
* @return {@link BindingcarInfo}
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@POST("pad/selectPadByMac")
|
||||
Observable<BindingcarInfo> getBindingcarInfo(@Header("access_token") String access_token, @Body RequestBody requestBody);
|
||||
@POST("eagleEye-mis/cmdbapi/pad/selectPadByMac")
|
||||
Observable<BindingcarInfo> getBindingcarInfo(/*@Header("access_token") String access_token,*/ @Body RequestBody requestBody);
|
||||
|
||||
/**
|
||||
* 绑定和修改绑定车机
|
||||
@@ -31,7 +31,7 @@ public interface BindingcarApiService {
|
||||
* @return {@link ModifyBindingcarInfo}
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@POST("pad/updatePadByMac")
|
||||
Observable<ModifyBindingcarInfo> modifyBindingcarInfo(@Header("access_token") String access_token, @Body RequestBody requestBody);
|
||||
@POST("eagleEye-mis/cmdbapi/pad/updatePadByMac")
|
||||
Observable<ModifyBindingcarInfo> modifyBindingcarInfo(/*@Header("access_token") String access_token,*/ @Body RequestBody requestBody);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.util.Log;
|
||||
import com.mogo.commons.constants.SharedPrefsConstants;
|
||||
import com.mogo.eagle.core.data.bindingcar.BindingcarInfo;
|
||||
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo;
|
||||
import com.mogo.eagle.core.function.BindHostConst;
|
||||
import com.mogo.eagle.core.function.api.bindingcar.BindingcarCallBack;
|
||||
import com.mogo.eagle.core.function.bindingcar.R;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
@@ -34,11 +35,10 @@ import okhttp3.RequestBody;
|
||||
public class BindingcarNetWorkManager {
|
||||
private static volatile BindingcarNetWorkManager requestNoticeManager;
|
||||
private final BindingcarApiService mBindingcarApiService;
|
||||
private String token = "c4a2f30cebf64972bcd11577e1c07f86"; //中台做了接口适配,需要这个token
|
||||
private static final String TAG = "BindingcarNetWorkManager";
|
||||
private static final String TAG = "BindingcarNetManager";
|
||||
|
||||
private BindingcarNetWorkManager() {
|
||||
mBindingcarApiService = MoGoRetrofitFactory.getInstance(HostConst.BINDING_SN_HOST)
|
||||
mBindingcarApiService = MoGoRetrofitFactory.getInstance(BindHostConst.getBaseUrl())
|
||||
.create(BindingcarApiService.class);
|
||||
}
|
||||
|
||||
@@ -60,11 +60,13 @@ public class BindingcarNetWorkManager {
|
||||
* @param macAddress mac地址
|
||||
*/
|
||||
public void getBindingcarInfo(Context context, String macAddress, String widevineIDWithMd5, int screenType) {
|
||||
// String macAddress = "48:b0:2d:3a:bc:78";
|
||||
// String macAddress1 = "48:b0:2d:3a:bc:78";
|
||||
// String macAddress1 = "48:b0:2d:4d:b9:63";
|
||||
// String sn = "X20202203105S688HZ";
|
||||
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, widevineIDWithMd5, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mBindingcarApiService.getBindingcarInfo(token, requestBody)
|
||||
mBindingcarApiService.getBindingcarInfo(requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BindingcarInfo>() {
|
||||
@@ -76,6 +78,7 @@ public class BindingcarNetWorkManager {
|
||||
public void onNext(@NonNull BindingcarInfo info) {
|
||||
if (info != null && info.getData() != null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "getBindingcarInfo onNext info.getData() =" + info.getData().toString());
|
||||
Log.d(TAG, "getBindingcarInfo onNext info.getData() =" + info.getData().toString());
|
||||
if (info.getData().getCompare().equals("0")) {
|
||||
CallerHmiManager.INSTANCE.showBindingcarDialog();
|
||||
} else if (info.getData().getCompare().equals("3")) {
|
||||
@@ -84,10 +87,12 @@ public class BindingcarNetWorkManager {
|
||||
TipToast.shortTip("当前工控机没有入库");
|
||||
}
|
||||
|
||||
//根据车辆类型切换不同的车辆模型
|
||||
//根据车辆类型切换不同的车辆模型,只针对红旗做处理
|
||||
// if (info.getData().getVendor().equals("一汽红旗")) { //TODO
|
||||
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.xiaobache);
|
||||
// } else if (info.getData().getVendor().equals("东风")) {
|
||||
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.hq_h9);
|
||||
// }
|
||||
|
||||
// else if (info.getData().getVendor().equals("东风汽车集团")) {
|
||||
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.chuzuche);
|
||||
// } else if (info.getData().getVendor().equals("金旅星辰")) {
|
||||
// CallerHDMapManager.INSTANCE.changeCurrentIcon(R.raw.xiaobache);
|
||||
@@ -118,7 +123,7 @@ public class BindingcarNetWorkManager {
|
||||
public void modifyBindingcar(String macAddress, String widevineIDWithMd5, BindingcarCallBack callBack, int screenType) {
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, widevineIDWithMd5, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mBindingcarApiService.modifyBindingcarInfo(token, requestBody)
|
||||
mBindingcarApiService.modifyBindingcarInfo(requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<ModifyBindingcarInfo>() {
|
||||
@@ -130,6 +135,7 @@ public class BindingcarNetWorkManager {
|
||||
public void onNext(@NonNull ModifyBindingcarInfo info) {
|
||||
if (info != null) {
|
||||
callBack.callBackResult(info);
|
||||
Log.d(TAG, "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
|
||||
CallerLogger.INSTANCE.d(TAG, "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
|
||||
override fun initBiz() {
|
||||
bizConfigCenter.init(mContext!!)
|
||||
FuncConfigImpl.init()
|
||||
traceManager.init(mContext!!)
|
||||
MogoLogCatchManager.init(mContext!!)
|
||||
}
|
||||
|
||||
@@ -252,8 +252,8 @@ defStyleAttr: Int = 0
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerAutopilotRecordListenerManager.addListener(TAG, this)
|
||||
//获取数据采集录制模式配置列表
|
||||
CallerAutoPilotManager.getBadCaseConfig()
|
||||
//获取数据采集录制模式配置列表 TODO
|
||||
// CallerAutoPilotManager.getBadCaseConfig()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_LCW
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_LIMIT_SPEED_SET
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_LTA
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_OPT_LINE
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_PNC_ACTIONS
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RAIN_MODE
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RTS
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_SLW
|
||||
@@ -88,6 +89,7 @@ class FuncConfigConst {
|
||||
foundationSubList.add(SubBiz(BIZ_LIMIT_SPEED_SET, lock = false, state = true, dependNode = "", data = ""))
|
||||
foundationSubList.add(SubBiz(BIZ_BYPASS, lock = false, state = true, dependNode = "", data = ""))
|
||||
foundationSubList.add(SubBiz(BIZ_AUTOPILOT_LANE_SELECTION, lock = false, state = true, dependNode = "", data = ""))
|
||||
foundationSubList.add(SubBiz(BIZ_PNC_ACTIONS, lock = false, state = true, dependNode = "", data = ""))
|
||||
businessList.add(Business(FOUNDATION,foundationSubList))
|
||||
|
||||
return FuncConfig(0, AppUtils.getAppVersionCode(), getChannelCode(), getEnv(), businessList)
|
||||
|
||||
@@ -23,10 +23,7 @@ object FuncConfigImpl {
|
||||
data: String?
|
||||
) {
|
||||
when (type) {
|
||||
BIZ_BEAUTY_MODE -> FunctionBuildConfig.isDemoMode = state
|
||||
BIZ_RAIN_MODE -> FunctionBuildConfig.isRainMode = state
|
||||
BIZ_WARNING_UPLOAD -> FunctionBuildConfig.isReportWarning = state
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -49,9 +49,19 @@ internal class GpsImpl(ctx: Context): IFlow<GpsStatus>(ctx) {
|
||||
false
|
||||
}
|
||||
|
||||
private val onStateListener = object : IAppStateListener {
|
||||
|
||||
override fun onAppStateChanged(isForeground: Boolean) {
|
||||
if (isForeground) {
|
||||
send(isLocationEnabled(), isGrandFineLocation())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onCreate() {
|
||||
val isGranted = isGrandFineLocation()
|
||||
AppStateManager.registerAppStateListener(onStateListener)
|
||||
send(isLocationEnabled(), isGranted)
|
||||
if (!isGranted) {
|
||||
PermissionUtils.requestAccessFineLocation(object : SimpleCallback {
|
||||
@@ -88,6 +98,7 @@ internal class GpsImpl(ctx: Context): IFlow<GpsStatus>(ctx) {
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
AppStateManager.unRegisterAppStateListener(onStateListener)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -79,6 +79,7 @@ import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.IPCReportWindow
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.ReportListFloatWindow
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.SOPSettingView
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.AutoPilotAndCheckView
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.MaskView
|
||||
@@ -127,6 +128,9 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
private var mDebugSettingViewFloat: WarningFloat.Builder? = null
|
||||
private var mDebugSettingView: DebugSettingView? = null
|
||||
|
||||
//SOPSettingView
|
||||
private var mSOPSettingViewFloat: WarningFloat.Builder? = null
|
||||
private var mSOPSettingView: SOPSettingView? = null
|
||||
|
||||
private var mNoticeFloat: WarningFloat.Builder? = null
|
||||
|
||||
@@ -447,6 +451,10 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
dismissToolsFloatView()
|
||||
CallerDevaToolsManager.showFeedbackView(it)
|
||||
}
|
||||
|
||||
override fun showSOPSettingView() {
|
||||
toggleSOPView()
|
||||
}
|
||||
})
|
||||
}
|
||||
toolsViewFloat = WarningFloat.with(it)
|
||||
@@ -660,6 +668,58 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun toggleSOPView() {
|
||||
activity?.let{
|
||||
if(mSOPSettingViewFloat!= null){
|
||||
WarningFloat.dismiss(mSOPSettingViewFloat!!.config.floatTag, false)
|
||||
mSOPSettingViewFloat = null
|
||||
mSOPSettingView = null
|
||||
}else{
|
||||
if (mSOPSettingView == null){
|
||||
mSOPSettingView = SOPSettingView(it)
|
||||
}
|
||||
var side = RIGHT
|
||||
var gravity = Gravity.RIGHT
|
||||
//调试窗默认靠右显示,Bus的乘客端右端有视图覆盖,调试窗靠左显示
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
|
||||
AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|
||||
) {
|
||||
side = LEFT
|
||||
gravity = Gravity.LEFT
|
||||
}
|
||||
mSOPSettingViewFloat = WarningFloat.with(it)
|
||||
.setTag("mSOPSettingView")
|
||||
.setLayout(mSOPSettingView!!)
|
||||
.setSidePattern(side)
|
||||
.setGravity(gravity, offsetY = 70)
|
||||
.setImmersionStatusBar(true)
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)
|
||||
?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)
|
||||
?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示VR下V2X预警
|
||||
*
|
||||
@@ -1415,29 +1475,27 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
"EmArrow-1013",
|
||||
"it code : ${it.code} , state : ${getAutoPilotStatusInfo().state}"
|
||||
)
|
||||
if (getAutoPilotStatusInfo().state != STATUS_AUTOPILOT_RUNNING) {
|
||||
showWarningV2X(
|
||||
EventTypeEnum.TAKE_OVER_EVENT.poiType,
|
||||
EventTypeEnum.TAKE_OVER_EVENT.content,
|
||||
EventTypeEnum.TAKE_OVER_EVENT.tts,
|
||||
EventTypeEnum.TAKE_OVER_EVENT.poiType,
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
Log.d("EmArrow-1013", "onShow")
|
||||
takeOver = true
|
||||
clTakeOverView.visibility = View.VISIBLE
|
||||
}
|
||||
showWarningV2X(
|
||||
EventTypeEnum.TAKE_OVER_EVENT.poiType,
|
||||
EventTypeEnum.TAKE_OVER_EVENT.content,
|
||||
EventTypeEnum.TAKE_OVER_EVENT.tts,
|
||||
EventTypeEnum.TAKE_OVER_EVENT.poiType,
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
Log.d("EmArrow-1013", "onShow")
|
||||
takeOver = true
|
||||
clTakeOverView.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun onDismiss() {
|
||||
Log.d("EmArrow-1013", "onDismiss")
|
||||
takeOver = false
|
||||
clTakeOverView.visibility = View.GONE
|
||||
}
|
||||
},
|
||||
true,
|
||||
6000L
|
||||
)
|
||||
}
|
||||
override fun onDismiss() {
|
||||
Log.d("EmArrow-1013", "onDismiss")
|
||||
takeOver = false
|
||||
clTakeOverView.visibility = View.GONE
|
||||
}
|
||||
},
|
||||
true,
|
||||
6000L
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.pnc.PncActionsHelper
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_PNC_ACTIONS
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.FOUNDATION
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.trafficlight.currentRoadTrafficLight
|
||||
import com.mogo.eagle.core.data.trafficlight.isRed
|
||||
@@ -19,6 +21,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningAction
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import kotlinx.android.synthetic.main.view_pnc_actions.view.*
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
@@ -67,6 +70,7 @@ class PncActionsView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
@BizConfig(FOUNDATION, "", BIZ_PNC_ACTIONS)
|
||||
override fun pncActions(planningActionMsg: MessagePad.PlanningActionMsg) {
|
||||
mAutoPilotStatusInfo?.let {
|
||||
if (it.state == STATUS_AUTOPILOT_RUNNING) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.text.Html
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.annotation.RequiresApi
|
||||
@@ -1857,7 +1858,6 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
override fun updateBizData(type: String, state: Boolean, lock: Boolean, data: String?) {
|
||||
when (type) {
|
||||
BIZ_BEAUTY_MODE -> {
|
||||
tbIsDemoMode.isClickable = !lock
|
||||
if(lock){
|
||||
tbIsDemoMode.background = resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
}else{
|
||||
@@ -1865,7 +1865,6 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
BIZ_RAIN_MODE -> {
|
||||
tbIsRainMode.isClickable = !lock
|
||||
if(lock){
|
||||
tbIsRainMode.background = resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
}else{
|
||||
@@ -1873,7 +1872,6 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
BIZ_WARNING_UPLOAD -> {
|
||||
tbReportWarning.isClickable = !lock
|
||||
if(lock){
|
||||
tbReportWarning.background = resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
}else{
|
||||
@@ -1882,20 +1880,16 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
BIZ_BAG_RECORD -> {
|
||||
if (lock) {
|
||||
btnRecordBag.isClickable = false
|
||||
btnRecordBag.background = resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
} else {
|
||||
btnRecordBag.isClickable = true
|
||||
btnRecordBag.requestFocus()
|
||||
btnRecordBag.background = null
|
||||
}
|
||||
}
|
||||
BIZ_FULL_LOG -> {
|
||||
if (lock) {
|
||||
tbLogCatch.isClickable = false
|
||||
tbLogCatch.background = resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
} else {
|
||||
tbLogCatch.isClickable = true
|
||||
tbLogCatch.requestFocus()
|
||||
tbLogCatch.background = null
|
||||
}
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.setting
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.module.service.routeoverlay.RouteStrategy
|
||||
import kotlinx.android.synthetic.main.view_sop_setting.view.*
|
||||
|
||||
/**
|
||||
* SOP设置窗口
|
||||
*/
|
||||
class SOPSettingView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr){
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_sop_setting, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
//绕障类功能开关
|
||||
tbObstacleAvoidance.isChecked = FunctionBuildConfig.isDetouring
|
||||
tbObstacleAvoidance.setOnCheckedChangeListener { _, isChecked ->
|
||||
CallerAutoPilotManager.sendDetouring(isChecked)
|
||||
FunctionBuildConfig.isDetouring = isChecked
|
||||
}
|
||||
|
||||
//危险障碍物颜色标记开关
|
||||
tbMarkingObstacles.setOnCheckedChangeListener { _, isChecked ->
|
||||
|
||||
}
|
||||
|
||||
//引导线动态效果
|
||||
tbRouteDynamicEffect.isChecked =
|
||||
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) && !AppIdentityModeUtils.isBus(
|
||||
FunctionBuildConfig.appIdentityMode
|
||||
)
|
||||
tbRouteDynamicEffect.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
RouteStrategy.enable(true)
|
||||
} else {
|
||||
RouteStrategy.enable(false)
|
||||
}
|
||||
}
|
||||
|
||||
//红绿灯标识
|
||||
tbTrafficLight.isChecked = HmiBuildConfig.isShowTrafficLightView
|
||||
tbTrafficLight.setOnCheckedChangeListener { _, isChecked ->
|
||||
if(!isChecked){
|
||||
HmiBuildConfig.isShowTrafficLightView = false
|
||||
}else{
|
||||
HmiBuildConfig.isShowTrafficLightView = true
|
||||
CallerHmiManager.disableWarningTrafficLight()
|
||||
}
|
||||
}
|
||||
|
||||
//限速标识
|
||||
tbSpeedLimit.isChecked = HmiBuildConfig.isShowLimitingVelocityView
|
||||
tbSpeedLimit.setOnCheckedChangeListener { _, isChecked ->
|
||||
if(isChecked){
|
||||
HmiBuildConfig.isShowLimitingVelocityView = true
|
||||
}else{
|
||||
HmiBuildConfig.isShowLimitingVelocityView = false
|
||||
CallerHmiManager.disableLimitingVelocity()
|
||||
}
|
||||
}
|
||||
|
||||
//自车感知到的他车碰撞预警
|
||||
tbCollisionWarning.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
|
||||
}
|
||||
|
||||
// 演示模式,上一次勾选的数据
|
||||
tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode
|
||||
// 演示模式
|
||||
tbDemoMode.setOnCheckedChangeListener { _, isChecked ->
|
||||
CallerAutoPilotManager.setDemoMode(isChecked)
|
||||
if (!isChecked) {
|
||||
//关闭美化模式时,通知工控机
|
||||
CallerAutoPilotManager.setIPCDemoMode(isChecked)
|
||||
}
|
||||
FunctionBuildConfig.isDemoMode = isChecked
|
||||
}
|
||||
//只在司机端设置美化模式开关功能
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
tbDemoMode.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
// 雨天模式,上一次勾选的数据
|
||||
tbRainMode.isChecked = FunctionBuildConfig.isRainMode
|
||||
//雨天模式
|
||||
tbRainMode.setOnCheckedChangeListener { _, isChecked ->
|
||||
CallerAutoPilotManager.setRainMode(isChecked)
|
||||
FunctionBuildConfig.isRainMode = isChecked
|
||||
}
|
||||
//雨天模式按钮只在司机屏生效,乘客屏不显示
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
tbRainMode.visibility = View.GONE
|
||||
}
|
||||
|
||||
//OBU控制总开关
|
||||
tbObu.isChecked = CallerOBUManager.isConnected()
|
||||
tbObu.setOnCheckedChangeListener { _, isChecked ->
|
||||
if(!isChecked){
|
||||
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
|
||||
CallerOBUManager.resetObuIpAddress("192.168.1.199")
|
||||
}else if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)){
|
||||
CallerOBUManager.resetObuIpAddress("192.168.8.199")
|
||||
}
|
||||
}else{
|
||||
//断开链接
|
||||
CallerOBUManager.disConnectObu()
|
||||
}
|
||||
}
|
||||
|
||||
//变道绕障的目标障碍物速度阈值
|
||||
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
|
||||
ivSpeedReduce.setOnClickListener {
|
||||
if(FunctionBuildConfig.detouringSpeed<=3){
|
||||
ToastUtils.showShort("阈值小可为3 m/s")
|
||||
}else{
|
||||
FunctionBuildConfig.detouringSpeed--
|
||||
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
|
||||
}
|
||||
}
|
||||
ivSpeedAdd.setOnClickListener {
|
||||
if(FunctionBuildConfig.detouringSpeed>=7){
|
||||
ToastUtils.showShort("阈值最大可为7 m/s")
|
||||
}else{
|
||||
FunctionBuildConfig.detouringSpeed++
|
||||
tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s"
|
||||
}
|
||||
}
|
||||
btnSpeedSet.setOnClickListener {
|
||||
val isSuccess = CallerAutoPilotManager.sendDetouringSpeed(FunctionBuildConfig.detouringSpeed.toDouble())
|
||||
if(isSuccess == true){
|
||||
ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置成功")
|
||||
}else{
|
||||
ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置失败")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -59,15 +59,13 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
|
||||
companion object {
|
||||
private var maxAcceleration: Double = 2.0
|
||||
private var speedLimit: Double = 0.0
|
||||
private var speedLimit: Int = 0
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun initView() {
|
||||
background = ColorDrawable(Color.parseColor("#F0151D41"))
|
||||
if (keyBoardUtil == null) {
|
||||
keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed)
|
||||
}
|
||||
|
||||
keyBoardUtil?.setActionListener { inputContent ->
|
||||
inputContent.toIntOrNull()?.let { speed ->
|
||||
when {
|
||||
@@ -76,10 +74,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
ToastUtils.showShort("超过最大限速值60,设置失败")
|
||||
}
|
||||
else -> {
|
||||
llSpeedPosition.background =
|
||||
resources.getDrawable(R.drawable.pilot_speed_bg)
|
||||
keyBoardUtil?.hideKeyboard()
|
||||
etInputSpeed.clearFocus()
|
||||
// 设置自动驾驶速度
|
||||
val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speed)
|
||||
when {
|
||||
@@ -94,13 +88,15 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
KeyBoardUtil.hideSystemSoftKeyboard(context, etInputSpeed)
|
||||
ivCloseIcon.setOnClickListener {
|
||||
clickListener?.onClose(it)
|
||||
}
|
||||
rlKillLayout.setOnClickListener {
|
||||
killApp()
|
||||
}
|
||||
sopLayout.setOnClickListener {
|
||||
clickListener?.showSOPSettingView()
|
||||
}
|
||||
viewCheckStatus.setOnClickListener {
|
||||
clickListener?.go2CheckPage()
|
||||
}
|
||||
@@ -110,49 +106,60 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
ivDebugFeedback.onClick {
|
||||
clickListener?.showFeedbackView()
|
||||
}
|
||||
etInputSpeed.setOnFocusChangeListener { v, hasFocus ->
|
||||
when {
|
||||
hasFocus -> {
|
||||
llSpeedPosition.background =
|
||||
resources.getDrawable(R.drawable.pilot_speed_high_light_bg)
|
||||
if (keyBoardUtil == null) {
|
||||
keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed)
|
||||
}
|
||||
keyBoardUtil?.showKeyboard()
|
||||
}
|
||||
else -> llSpeedPosition.background =
|
||||
resources.getDrawable(R.drawable.pilot_speed_bg)
|
||||
}
|
||||
}
|
||||
etInputSpeed.setOnTouchListener { v, event ->
|
||||
var curTime = System.currentTimeMillis()
|
||||
if (curTime - lastTime < 1000) {
|
||||
return@setOnTouchListener true
|
||||
}
|
||||
if (!connectStatus) {
|
||||
ToastUtils.showShort("设置车速失败,请启动域控制器")
|
||||
keyBoardUtil?.hideKeyboard()
|
||||
return@setOnTouchListener true
|
||||
} else {
|
||||
return@setOnTouchListener false
|
||||
}
|
||||
}
|
||||
updateSpeedSettingViews()
|
||||
|
||||
if (AppConfigInfo.isConnectAutopilot) {
|
||||
CallerAutoPilotManager.getCarConfig()
|
||||
}
|
||||
if (maxAcceleration > 0) {
|
||||
tvAcceleration.text = "加速度 $maxAcceleration m/s²"
|
||||
}
|
||||
// if (maxAcceleration > 0) {
|
||||
// tvAcceleration.text = "加速度 $maxAcceleration m/s²"
|
||||
// }
|
||||
tvAcceleration.text = "每次调整车速±5km/h"
|
||||
if (speedLimit > 0) {
|
||||
etInputSpeed.setText((speedLimit * 3.6).toInt().toString())
|
||||
tvSpeed.text = speedLimit.toString()
|
||||
}else{
|
||||
tvSpeed.text = "0"
|
||||
}
|
||||
ivSpeedReduce.setOnClickListener {
|
||||
if(speedLimit>=5){
|
||||
speedLimit -= 5
|
||||
//速度显示
|
||||
val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speedLimit)
|
||||
when {
|
||||
isSuccess -> {
|
||||
//速度显示
|
||||
tvSpeed.text = speedLimit.toString()
|
||||
ToastUtils.showShort("车速设置成功,立即生效")
|
||||
}
|
||||
else -> {
|
||||
ToastUtils.showShort("设置车速失败,请启动域控制器")
|
||||
}
|
||||
}
|
||||
}else{
|
||||
ToastUtils.showShort("车速不能再减了")
|
||||
}
|
||||
}
|
||||
ivSpeedAdd.setOnClickListener {
|
||||
if(speedLimit<=55){
|
||||
speedLimit += 5
|
||||
//速度显示
|
||||
val isSuccess = CallerAutoPilotManager.setAutoPilotSpeed(speedLimit)
|
||||
when {
|
||||
isSuccess -> {
|
||||
//速度显示
|
||||
tvSpeed.text = speedLimit.toString()
|
||||
ToastUtils.showShort("车速设置成功,立即生效")
|
||||
}
|
||||
else -> {
|
||||
ToastUtils.showShort("设置车速失败,请启动域控制器")
|
||||
}
|
||||
}
|
||||
}else{
|
||||
ToastUtils.showShort("车速不能再加了")
|
||||
}
|
||||
}
|
||||
initOchView()
|
||||
// // 比如需要设置默认速度
|
||||
// val speed = "30"
|
||||
// etInputSpeed.setText(speed)
|
||||
// etInputSpeed.setSelection(speed.length)
|
||||
|
||||
|
||||
initOchView()
|
||||
}
|
||||
|
||||
private fun initOchView() {
|
||||
@@ -189,11 +196,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
|
||||
private fun updateSpeedSettingViews() {
|
||||
tvSpeedTitle.visibility = View.VISIBLE
|
||||
llSpeedPosition.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
fun showAdUpgradeStatus(ipcUpgradeStateInfo: IPCUpgradeStateInfo) {
|
||||
systemVersionView?.showAdUpgradeStatus(ipcUpgradeStateInfo)
|
||||
}
|
||||
@@ -220,16 +222,20 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
fun onClose(v: View)
|
||||
fun showDebugPanelView()
|
||||
fun showFeedbackView()
|
||||
fun showSOPSettingView()
|
||||
}
|
||||
|
||||
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
|
||||
UiThreadHandler.post {
|
||||
tvAcceleration?.let {
|
||||
maxAcceleration = carConfigResp.maxAcceleration
|
||||
speedLimit = carConfigResp.speedLimit
|
||||
tvAcceleration.text = "加速度 ${carConfigResp.maxAcceleration} m/s²"
|
||||
etInputSpeed.setText((carConfigResp.speedLimit * 3.6).toInt().toString())
|
||||
}
|
||||
// tvAcceleration?.let {
|
||||
// maxAcceleration = carConfigResp.maxAcceleration
|
||||
// speedLimit = carConfigResp.speedLimit
|
||||
//// tvAcceleration.text = "加速度 ${carConfigResp.maxAcceleration} m/s²"
|
||||
// tvSpeed.text = (carConfigResp.speedLimit * 3.6).toInt().toString()
|
||||
// }
|
||||
maxAcceleration = carConfigResp.maxAcceleration
|
||||
speedLimit = (carConfigResp.speedLimit * 3.6).toInt()
|
||||
tvSpeed.text = speedLimit.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,18 +32,18 @@ class PerspectiveSwitchView @JvmOverloads constructor(
|
||||
override fun onClick(v: View?) {
|
||||
//切换地图的远近视图
|
||||
if (MogoMapUIController.getInstance().currentMapVisualAngle.isLongSight) {
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.visibleAllMarkers()
|
||||
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
// .visibleAllMarkers()
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
textSwitch.setText(R.string.module_map_model_normal)
|
||||
} else if (MogoMapUIController.getInstance().currentMapVisualAngle.isMediumSight) {
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS)
|
||||
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
// .inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS)
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
|
||||
textSwitch.setText(R.string.module_map_model_faster)
|
||||
} else {
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.visibleAllMarkers()
|
||||
// MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
// .visibleAllMarkers()
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
textSwitch.setText(R.string.module_map_model_normal)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
@@ -49,7 +50,9 @@ class SingleTrafficLightView @JvmOverloads constructor(
|
||||
override fun showWarningTrafficLight(checkLightId: Int,lightSource: Int) {
|
||||
super.showWarningTrafficLight(checkLightId,lightSource)
|
||||
mCurrentLightId = checkLightId
|
||||
updateTrafficLightIcon(checkLightId,lightSource)
|
||||
if(!HmiBuildConfig.isShowTrafficLightView){
|
||||
updateTrafficLightIcon(checkLightId,lightSource)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,12 +26,17 @@ class VipIdentificationView @JvmOverloads constructor(
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
val lp = this.layoutParams as LayoutParams
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
lp.marginStart = resources.getDimension(R.dimen.module_vip_margin_left_bus).toInt()
|
||||
lp.topMargin = resources.getDimension(R.dimen.module_vip_margin_top_bus).toInt()
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|
||||
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
lp.marginStart = resources.getDimension(R.dimen.module_vip_margin_left_bus_passenger).toInt()
|
||||
lp.topMargin = resources.getDimension(R.dimen.module_vip_margin_top_passenger).toInt()
|
||||
} else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)
|
||||
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
lp.marginStart = resources.getDimension(R.dimen.module_vip_margin_left_taxi_passenger).toInt()
|
||||
lp.topMargin = resources.getDimension(R.dimen.module_vip_margin_top_passenger).toInt()
|
||||
} else {
|
||||
lp.marginStart = resources.getDimension(R.dimen.module_vip_margin_left_taxi).toInt()
|
||||
lp.topMargin = resources.getDimension(R.dimen.module_vip_margin_top_taxi).toInt()
|
||||
lp.marginStart = resources.getDimension(R.dimen.module_vip_margin_left).toInt()
|
||||
lp.topMargin = resources.getDimension(R.dimen.module_vip_margin_top).toInt()
|
||||
}
|
||||
this.layoutParams = lp
|
||||
invalidate()
|
||||
|
||||
@@ -215,7 +215,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { //向上长按 开启自动驾驶
|
||||
long currentTime = System.currentTimeMillis() / (1000);
|
||||
long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_up", 0);
|
||||
// Log.d("liyz", "time = " + (currentTime - oldTime));
|
||||
if (currentTime - oldTime > 6) {
|
||||
SharedPrefsMgr.getInstance(getContext()).putLong("old_time_up", System.currentTimeMillis() / 1000);
|
||||
// ToastUtils.showShort("长按 ↑↑↑ 开启自动驾驶");
|
||||
@@ -456,7 +455,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
Method isConnectedMethod = BluetoothDevice.class.getDeclaredMethod("isConnected", (Class[]) null);
|
||||
isConnectedMethod.setAccessible(true);
|
||||
boolean isConnected = (boolean) isConnectedMethod.invoke(device, (Object[]) null);
|
||||
// Log.e("liyz", "showBondedDevice Name:" + device.getName() + " Mac:" + device.getAddress() + "---isConnected = " + isConnected);
|
||||
mAreadlyConnectedList.add(device);
|
||||
if (device.getName().equals("JX-05")) { //后面魔戒可能不使用了
|
||||
SharedPrefsMgr.getInstance(getContext()).putString("BT_MAC", device.getAddress());
|
||||
@@ -486,7 +484,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
* 主动连接最近的一次连接
|
||||
*/
|
||||
private void connectBluetooth() {
|
||||
// Log.d("liyz", "connectBluetooth ----> size() = " + mAreadlyConnectedList.size());
|
||||
if (mAreadlyConnectedList.size() > 0) {
|
||||
try {
|
||||
Method method = BluetoothDevice.class.getMethod("createBond");
|
||||
@@ -498,7 +495,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
}
|
||||
}
|
||||
|
||||
// Log.d("liyz", "connectBluetooth macAddress = " + macAddress + "---pos = " + pos);
|
||||
if (mAreadlyConnectedList.size() > pos && (pos >= 0)) {
|
||||
method.invoke(mAreadlyConnectedList.get(pos));
|
||||
}
|
||||
|
||||
@@ -45,13 +45,11 @@ public class BluetoothMonitorReceiver extends BroadcastReceiver {
|
||||
|
||||
case BluetoothDevice.ACTION_ACL_CONNECTED:
|
||||
// Toast.makeText(context, "蓝牙设备已连接", Toast.LENGTH_SHORT).show();
|
||||
// Log.d("liyz", "蓝牙设备已连接 ----> ");
|
||||
// SharedPrefsMgr.getInstance(context).putBoolean("BLUETOOTH", true);
|
||||
break;
|
||||
|
||||
case BluetoothDevice.ACTION_ACL_DISCONNECTED:
|
||||
// SharedPrefsMgr.getInstance(context).putBoolean("BLUETOOTH", false);
|
||||
// Log.d("liyz", "蓝牙设备已断开 ----> ");
|
||||
// Toast.makeText(context, "蓝牙设备已断开", Toast.LENGTH_SHORT).show();
|
||||
EventBus.getDefault().post(new ConnectBluetoothEvent());
|
||||
break;
|
||||
|
||||
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 387 B |
|
After Width: | Height: | Size: 302 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
@@ -8,7 +8,7 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/viewShowDebugView"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_width="@dimen/dp_400"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_check_title"
|
||||
app:layout_constraintTop_toBottomOf="@+id/v_second_group">
|
||||
|
||||
@@ -144,6 +145,32 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/sopLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_216"
|
||||
android:layout_marginTop="@dimen/dp_90"
|
||||
app:layout_constraintTop_toBottomOf="@id/checkLayout"
|
||||
app:layout_constraintLeft_toLeftOf="@id/checkLayout">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="150px"
|
||||
android:layout_height="150px"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/debug_icon_sop" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="42px"
|
||||
android:text="@string/debug_sop"
|
||||
android:textColor="@color/color_FFA7B6F0"
|
||||
android:textSize="32px"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_check_title"
|
||||
android:layout_width="84px"
|
||||
@@ -164,7 +191,7 @@
|
||||
android:layout_marginTop="94px"
|
||||
android:background="@color/color_FF2966EC"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/checkLayout" />
|
||||
app:layout_constraintTop_toBottomOf="@id/sopLayout" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSpeedTitle"
|
||||
@@ -177,45 +204,53 @@
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="42px"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/checkLayout" />
|
||||
app:layout_constraintTop_toBottomOf="@id/sopLayout" />
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/llSpeedPosition"
|
||||
android:layout_width="390px"
|
||||
<ImageView
|
||||
android:id="@+id/ivSpeedReduce"
|
||||
android:layout_width="105px"
|
||||
android:layout_height="140px"
|
||||
android:layout_marginStart="113px"
|
||||
android:layout_marginTop="40px"
|
||||
android:background="@drawable/pilot_speed_bg"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="horizontal"
|
||||
android:src="@drawable/icon_speed_reduce"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSpeedTitle">
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSpeedTitle"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/etInputSpeed"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="92px"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:gravity="center"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="80px"
|
||||
tools:ignore="SpeakableTextPresentCheck" />
|
||||
<TextView
|
||||
android:id="@+id/tvSpeed"
|
||||
android:layout_width="189px"
|
||||
android:layout_height="140px"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedReduce"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedReduce"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivSpeedReduce"
|
||||
android:background="#1E3062"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="80px"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="93px"
|
||||
android:layout_height="53px"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="28px"
|
||||
android:text="km/h"
|
||||
android:textColor="@color/color_B3FFFFFF"
|
||||
android:textSize="38px" />
|
||||
<ImageView
|
||||
android:id="@+id/ivSpeedAdd"
|
||||
android:layout_width="105px"
|
||||
android:layout_height="140px"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSpeed"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSpeed"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvSpeed"
|
||||
android:src="@drawable/icon_speed_add"
|
||||
/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="km/h"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="38px"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivSpeedAdd"
|
||||
android:layout_marginStart="40px"
|
||||
/>x`
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAcceleration"
|
||||
@@ -226,7 +261,7 @@
|
||||
android:textColor="#A7B6F0"
|
||||
android:textSize="32px"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/llSpeedPosition" />
|
||||
app:layout_constraintTop_toBottomOf="@id/ivSpeedReduce" />
|
||||
|
||||
<View
|
||||
android:layout_width="14px"
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
<?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_800"
|
||||
android:layout_height="@dimen/dp_1100"
|
||||
android:background="#FFFFFF">
|
||||
<!--绕障类功能-->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbObstacleAvoidance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启绕障类功能"
|
||||
android:textOn="关闭绕障类功能"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
<!--危险障碍物颜色标记-->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbMarkingObstacles"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启「危险障碍物颜色标记」"
|
||||
android:textOn="关闭「危险障碍物颜色标记」"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbObstacleAvoidance"
|
||||
/>
|
||||
<!--引导线动态效果-->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbRouteDynamicEffect"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启「引导线动态效果」"
|
||||
android:textOn="关闭「引导线动态效果」"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbMarkingObstacles"
|
||||
/>
|
||||
<!--红绿灯标识-->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbTrafficLight"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="隐藏红绿灯标识"
|
||||
android:textOn="展示红绿灯标识"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbRouteDynamicEffect"
|
||||
/>
|
||||
<!--限速标识-->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbSpeedLimit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="展示限速标识"
|
||||
android:textOn="隐藏限速标识"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbTrafficLight"
|
||||
/>
|
||||
<!--自车感知到的他车碰撞预警-->
|
||||
<ToggleButton
|
||||
android:id="@+id/tbCollisionWarning"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启「自车感知到的他车碰撞预警」"
|
||||
android:textOn="关闭「自车感知到的他车碰撞预警」"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbSpeedLimit"
|
||||
/>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbDemoMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启美化模式"
|
||||
android:textOn="关闭美化模式"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbCollisionWarning"
|
||||
/>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbRainMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="开启雨天模式"
|
||||
android:textOn="关闭雨天模式"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbDemoMode"
|
||||
/>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbObu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:textOff="关闭OBU"
|
||||
android:textOn="开启OBU"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbRainMode"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSpeedThresholdTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tbObu"
|
||||
android:text="变道速度阈值:"
|
||||
android:textSize="18sp"
|
||||
android:textColor="#1A1A1A"
|
||||
android:layout_margin="10dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSpeedReduce"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvSpeedThresholdTitle"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSpeedThresholdTitle"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSpeedThresholdTitle"
|
||||
android:src="@drawable/icon_reduce"
|
||||
android:padding="10dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSpeed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedReduce"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedReduce"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivSpeedReduce"
|
||||
android:textSize="18sp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/debug_setting_edit_bg"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSpeedAdd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSpeed"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSpeed"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvSpeed"
|
||||
android:src="@drawable/icon_add"
|
||||
android:padding="10dp"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSpeedSet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivSpeedAdd"
|
||||
android:text="设置阈值"
|
||||
android:layout_marginStart="10dp"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:background="#F0F0F0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnSpeedSet"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -22,6 +22,7 @@
|
||||
<string name="check_vehicle_detection">车辆检测</string>
|
||||
<string name="debug_panel">调试面板</string>
|
||||
<string name="debug_panel_fb">录包设置</string>
|
||||
<string name="debug_sop">运营面板</string>
|
||||
<string name="check_vehicle_speed_setting">车速设置</string>
|
||||
<string name="bus_operation_title">账户信息</string>
|
||||
<string name="check_system_operation">系统运行</string>
|
||||
|
||||
@@ -54,5 +54,12 @@ class MoGoObuProvider : IMoGoObuProvider {
|
||||
|
||||
}
|
||||
|
||||
override fun disConnect() {
|
||||
MogoPrivateObuManager.INSTANCE.disConnectObu()
|
||||
}
|
||||
|
||||
override fun isConnected(): Boolean {
|
||||
return MogoPrivateObuManager.INSTANCE.isConnected()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -77,6 +77,14 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
fun disConnectObu(){
|
||||
MogoObuManager.getInstance().disConnect()
|
||||
}
|
||||
|
||||
fun isConnected(): Boolean{
|
||||
return MogoObuManager.getInstance().isConnected
|
||||
}
|
||||
|
||||
private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() {
|
||||
// OBU连接成功
|
||||
override fun onConnected() {
|
||||
|
||||
@@ -483,6 +483,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
})
|
||||
}
|
||||
|
||||
AiRoadMarker.receive(Marker(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, null, null, null))
|
||||
}
|
||||
|
||||
// private fun buildRoadEntity(e: V2XMarkerExploreWay, extra: Map<String, Any>? = null): V2XRoadEventEntity { // 记录道路事件
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
@@ -62,6 +63,7 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
|
||||
LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent);
|
||||
AiRoadMarker.INSTANCE.clear();
|
||||
// 如果没有拿到之前的,根据类型分发
|
||||
switch (v2XMessageEntity.getType()) {
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad
|
||||
import android.animation.*
|
||||
import android.content.*
|
||||
import android.graphics.*
|
||||
import android.os.*
|
||||
import android.view.animation.*
|
||||
import androidx.core.util.Pair
|
||||
import androidx.lifecycle.*
|
||||
@@ -22,6 +23,7 @@ import com.mogo.map.overlay.*
|
||||
import com.mogo.module.common.entity.*
|
||||
import com.mogo.module.common.utils.*
|
||||
import io.netty.util.internal.*
|
||||
import java.lang.Runnable
|
||||
import java.util.*
|
||||
import java.util.concurrent.*
|
||||
import java.util.concurrent.atomic.*
|
||||
@@ -49,6 +51,17 @@ object AiRoadMarker {
|
||||
private val START_COLOR = Color.parseColor("#002ABAD9")
|
||||
private val END_COLOR = Color.parseColor("#66FF7A30")
|
||||
|
||||
private val handler by lazy {
|
||||
Handler(Looper.getMainLooper())
|
||||
}
|
||||
|
||||
private val checkExpiredTask = Runnable {
|
||||
val marker = this@AiRoadMarker.marker.get()
|
||||
if (marker != null) {
|
||||
unMarker(marker)
|
||||
}
|
||||
}
|
||||
|
||||
private val markers = ConcurrentSet<Marker>()
|
||||
|
||||
private val options by lazy {
|
||||
@@ -189,6 +202,7 @@ object AiRoadMarker {
|
||||
|
||||
fun marker(marker: Marker, drawMarker: Boolean) {
|
||||
val location = carLocation.get() ?: return
|
||||
this.marker.set(marker)
|
||||
//施工中心点前方的自车行驶方向上300米距离
|
||||
val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), 300f)
|
||||
//施工中心点后方的自车行驶方向上300米距离
|
||||
@@ -285,7 +299,7 @@ object AiRoadMarker {
|
||||
|
||||
fun clear() {
|
||||
hideLine()
|
||||
// V2XAiRoadEventMarker.removeMarkers(null)
|
||||
V2XAiRoadEventMarker.removeMarkers(null)
|
||||
}
|
||||
|
||||
fun restore() {
|
||||
@@ -319,12 +333,31 @@ object AiRoadMarker {
|
||||
return degree < 90
|
||||
}
|
||||
|
||||
fun receive(marker: Marker) {
|
||||
val cur = this.marker.get()
|
||||
if (cur == marker) {
|
||||
val poi = this.marker.get()
|
||||
val car = this.carLocation.get()
|
||||
if (poi != null && car != null) {
|
||||
val distance = DrivingDirectionUtils.distance(car.first, car.second, marker.poi_lon, marker.poi_lat)
|
||||
if (distance < 300) {
|
||||
checkExpired()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkExpired() {
|
||||
handler.removeCallbacks(checkExpiredTask)
|
||||
handler.postDelayed(checkExpiredTask, 5000)
|
||||
}
|
||||
|
||||
data class Marker(
|
||||
val poi_lat: Double,
|
||||
val poi_lon: Double,
|
||||
val poi_angle: Double,
|
||||
val polygon: List<androidx.core.util.Pair<Double, Double>>?,
|
||||
var farthestPoint: androidx.core.util.Pair<Double, Double>? = null,
|
||||
val polygon: List<Pair<Double, Double>>?,
|
||||
var farthestPoint: Pair<Double, Double>? = null,
|
||||
var entity: V2XRoadEventEntity? = null
|
||||
) {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Objects;
|
||||
public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
|
||||
|
||||
|
||||
private AiRoadMarker.Marker mMarker;
|
||||
private static AiRoadMarker.Marker mMarker;
|
||||
|
||||
@Override
|
||||
public void drawPOI(V2XRoadEventEntity entity) {
|
||||
|
||||
@@ -120,8 +120,7 @@ class TrafficLightNetWorkModel {
|
||||
}
|
||||
loader {
|
||||
apiCall {
|
||||
MoGoRetrofitFactory.getInstanceNoCallAdapter("http://dzt-qa-city.zhidaozhixing.com")
|
||||
.create(TrafficLightApiService::class.java).changeLight(map)
|
||||
getNetWorkApi().changeLight(map)
|
||||
}
|
||||
}
|
||||
onSuccess {
|
||||
|
||||
@@ -245,9 +245,7 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
v2xType, alertContent, ttsContent, tag,
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {}
|
||||
override fun onDismiss() {
|
||||
resetConditions()
|
||||
}
|
||||
override fun onDismiss() {}
|
||||
},
|
||||
true,
|
||||
5000L
|
||||
|
||||
@@ -29,6 +29,22 @@ object FunctionBuildConfig {
|
||||
@JvmField
|
||||
var isRainMode = false
|
||||
|
||||
/**
|
||||
* 是否开启绕障类功能
|
||||
* 默认开启
|
||||
*/
|
||||
@Volatile
|
||||
@JvmField
|
||||
var isDetouring = true
|
||||
|
||||
/**
|
||||
* 变道绕障的目标障碍物速度阈值
|
||||
* 默认 3 m/s
|
||||
*/
|
||||
@Volatile
|
||||
@JvmField
|
||||
var detouringSpeed = 3
|
||||
|
||||
/**
|
||||
* 是否是感知优化模式
|
||||
* 默认开启
|
||||
|
||||
@@ -40,6 +40,7 @@ class FuncBizConfig {
|
||||
const val BIZ_LIMIT_SPEED_SET = "BIZ_LIMIT_SPEED_SET" // 限速设置 todo 暂未有场景,未实现
|
||||
const val BIZ_BYPASS = "BIZ_BYPASS" // 绕障 todo 暂未实现
|
||||
const val BIZ_AUTOPILOT_LANE_SELECTION = "BIZ_AUTOPILOT_LANE_SELECTION" // 择机变道 todo 暂未实现
|
||||
const val BIZ_PNC_ACTIONS = "BIZ_PNC_ACTIONS" // PNC行为决策
|
||||
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,17 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
|
||||
*/
|
||||
fun recordPackage(type: Int,id: Int,duration: Int,bduration: Int): Boolean
|
||||
|
||||
/**
|
||||
* 开启域控制器录制bag包
|
||||
* @param type 录制类型 1: badcase 2:map 3:rests
|
||||
* @param id 指令/任务 ID
|
||||
* @param duration 录制时长
|
||||
* @param bduration 录制前溯时长
|
||||
* @param topics 录制Topic集合
|
||||
* @return true-成功,false-失败
|
||||
*/
|
||||
fun recordPackage(type: Int,id: Int,duration: Int,bduration: Int,topics: List<String>): Boolean
|
||||
|
||||
/**
|
||||
* Log 是否显示
|
||||
*
|
||||
@@ -152,9 +163,28 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
|
||||
fun setRainMode(isEnable: Boolean)
|
||||
|
||||
/**
|
||||
* 获取数据采集录制模式配置列表
|
||||
* 绕障类功能开关
|
||||
* isEnable = true 开启
|
||||
* isEnable = false 关闭
|
||||
* @return boolean
|
||||
*/
|
||||
fun getBadCaseConfig()
|
||||
fun sendDetouring(isEnable: Boolean): Boolean
|
||||
|
||||
/**
|
||||
* 变道绕障的目标障碍物速度阈值
|
||||
* @param speed 速度阈值 m/s
|
||||
* @return boolean
|
||||
*/
|
||||
fun sendDetouringSpeed(speed: Double): Boolean
|
||||
|
||||
/**
|
||||
* 获取数据采集录制模式配置列表
|
||||
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
|
||||
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
|
||||
* @param topicsNeedToCache
|
||||
* @return boolean
|
||||
*/
|
||||
fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List<String>): Boolean
|
||||
|
||||
/**
|
||||
* 发送工控机所有节点重启命令
|
||||
@@ -232,4 +262,14 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
|
||||
* 鸣笛 开始:1,结束:2
|
||||
*/
|
||||
fun sendOperatorSetHorn(value: Double)
|
||||
|
||||
/**
|
||||
* 行程信息
|
||||
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
|
||||
* @param lineName 路线名, for type 1, 2
|
||||
* @param stopName 站点名, for type 3, 4
|
||||
* @param isLastStop 是否是最后一站
|
||||
* @return
|
||||
*/
|
||||
fun sendTripInfo(type: Int, lineName: String, stopName: String, isLastStop: Boolean)
|
||||
}
|
||||
@@ -68,6 +68,11 @@ interface IMoGoWaringProvider : IMoGoHmiViewProxy {
|
||||
*/
|
||||
fun toggleDebugView()
|
||||
|
||||
/**
|
||||
* 开关SOPSettingView
|
||||
*/
|
||||
fun toggleSOPView()
|
||||
|
||||
/**
|
||||
* 展示VR下V2X预警
|
||||
*
|
||||
|
||||
@@ -11,4 +11,7 @@ interface IMoGoObuProvider : IMoGoFunctionServerProvider {
|
||||
|
||||
fun connect(ipAddress: String)
|
||||
|
||||
fun disConnect()
|
||||
|
||||
fun isConnected(): Boolean
|
||||
}
|
||||
@@ -136,6 +136,12 @@ object CallerAutoPilotManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun recordPackage(type: Int,id: Int,duration: Int,bduration: Int,topics: List<String>){
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
|
||||
providerApi?.recordPackage(type, id, duration, bduration, topics)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止录制bag包
|
||||
*/
|
||||
@@ -229,12 +235,34 @@ object CallerAutoPilotManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据采集录制模式配置列表
|
||||
* 绕障类功能开关
|
||||
* isEnable = true 开启
|
||||
* isEnable = false 关闭
|
||||
* @return boolean
|
||||
*/
|
||||
fun getBadCaseConfig() {
|
||||
fun sendDetouring(isEnable: Boolean): Boolean?{
|
||||
return providerApi?.sendDetouring(isEnable)
|
||||
}
|
||||
|
||||
/**
|
||||
* 变道绕障的目标障碍物速度阈值
|
||||
* @param speed 速度阈值 m/s
|
||||
* @return boolean
|
||||
*/
|
||||
fun sendDetouringSpeed(speed: Double): Boolean?{
|
||||
return providerApi?.sendDetouringSpeed(speed)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据采集录制模式配置列表
|
||||
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
|
||||
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
|
||||
* @param topicsNeedToCache
|
||||
*/
|
||||
fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List<String>){
|
||||
// 司机屏才能查询数据采集的配置
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
providerApi?.getBadCaseConfig()
|
||||
providerApi?.getBadCaseConfig(reqType, recordType, topicsNeedToCache)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,6 +294,18 @@ object CallerAutoPilotManager {
|
||||
providerApi?.sendOperatorSetHorn(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* 行程信息
|
||||
* @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警
|
||||
* @param lineName 路线名, for type 1, 2
|
||||
* @param stopName 站点名, for type 3, 4
|
||||
* @param isLastStop 是否终点站
|
||||
* @return
|
||||
*/
|
||||
fun sendTripInfo(type: Int, lineName: String, stopName: String, isLastStop: Boolean) {
|
||||
providerApi?.sendTripInfo(type, lineName, stopName, isLastStop)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送工控机所有节点重启命令
|
||||
*/
|
||||
|
||||
@@ -26,4 +26,19 @@ object CallerOBUManager {
|
||||
providerApi.connect(ipAddress)
|
||||
}
|
||||
|
||||
/**
|
||||
* 断开OBU连接
|
||||
*/
|
||||
fun disConnectObu(){
|
||||
providerApi.disConnect()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取OBU连接状态
|
||||
* @return boolean 连接状态
|
||||
*/
|
||||
fun isConnected(): Boolean{
|
||||
return providerApi.isConnected()
|
||||
}
|
||||
|
||||
}
|
||||