Merge branch 'dev_robotaxi-d-app-module_290_220715_2.9.0' into dev_robotaxi-d-app-module_290_220715_2.9.0_interface_subscribe
@@ -29,15 +29,13 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ public class BusPassengerStation {
|
||||
private String cityCode;
|
||||
private double lon; //高精坐标
|
||||
private double lat; //高精坐标
|
||||
private double gcjLon; //高德坐标
|
||||
private double gcjLat; //高德坐标
|
||||
private int businessType; //站点类型,9:taxi,10:bus
|
||||
private int status;
|
||||
private int siteId;
|
||||
@@ -72,6 +74,13 @@ public class BusPassengerStation {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public double getGcjLon() {
|
||||
return gcjLon;
|
||||
}
|
||||
|
||||
public double getGcjLat() {
|
||||
return gcjLat;
|
||||
}
|
||||
|
||||
public int getBusinessType() {
|
||||
return businessType;
|
||||
|
||||
@@ -84,6 +84,10 @@ public class BusPassengerModel {
|
||||
|
||||
private double mLongitude, mLatitude;
|
||||
|
||||
List<BusPassengerStation> mStations = new ArrayList<>();
|
||||
private int mNextStationIndex = 0;// 要到达站的index
|
||||
private List<LatLng> mTwoStationsRouts = new ArrayList<>();
|
||||
|
||||
private BusPassengerModel() {
|
||||
}
|
||||
|
||||
@@ -147,12 +151,22 @@ public class BusPassengerModel {
|
||||
mRouteLineInfoCallback.updateLineInfo(result.getName(),result.getRunningDur());
|
||||
if (result.getSites() != null){
|
||||
List<BusPassengerStation> stations = result.getSites();
|
||||
mStations.clear();
|
||||
mStations.addAll(stations);
|
||||
for (int i = 0; i< stations.size(); i++){
|
||||
BusPassengerStation station = stations.get(i);
|
||||
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving() && i+1 < stations.size()){
|
||||
mRouteLineInfoCallback.updateStationsInfo(stations,i+1,false);
|
||||
if(mNextStationIndex != i+1){
|
||||
mTwoStationsRouts.clear();
|
||||
startRemainRouteInfo();
|
||||
}
|
||||
mNextStationIndex = i+1;
|
||||
return;
|
||||
}else if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){
|
||||
if (i == 0){
|
||||
startOrStopRouteAndWipe(false);
|
||||
}
|
||||
startOrStopCalculateRouteInfo(false);
|
||||
mRouteLineInfoCallback.updateStationsInfo(stations,i,true);
|
||||
return;
|
||||
@@ -286,6 +300,8 @@ public class BusPassengerModel {
|
||||
}
|
||||
};
|
||||
|
||||
private volatile int mPreAutoStatus = -1;
|
||||
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
|
||||
|
||||
@Override
|
||||
@@ -301,17 +317,27 @@ public class BusPassengerModel {
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
// if (autopilotStatusInfo == null) return;
|
||||
// int state = autopilotStatusInfo.getState();
|
||||
// CallerLogger.INSTANCE.d( M_BUS_P + TAG, "state = %s", state );
|
||||
// if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
// //2022.7.20 自动驾驶更换成带档位的
|
||||
//// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
// } else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
//// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
|
||||
// } else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
//// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
|
||||
// }
|
||||
if (autopilotStatusInfo == null) return;
|
||||
int state = autopilotStatusInfo.getState();
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
//2022.7.20 自动驾驶更换成带档位的
|
||||
// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
if(state != mPreAutoStatus){
|
||||
mTwoStationsRouts.clear();
|
||||
}
|
||||
// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
if(state != mPreAutoStatus){
|
||||
mTwoStationsRouts.clear();
|
||||
}
|
||||
// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
|
||||
}else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING){
|
||||
if(state != mPreAutoStatus){
|
||||
mTwoStationsRouts.clear();
|
||||
}
|
||||
}
|
||||
mPreAutoStatus = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -354,7 +380,6 @@ public class BusPassengerModel {
|
||||
List<MessagePad.Location> routePoints = routeList.getWayPointsList();
|
||||
if (null != routePoints && routePoints.size() > 0){
|
||||
updateRoutePoints(routePoints);
|
||||
startRemainRouteInfo();
|
||||
setRouteLineMarker();
|
||||
startToRouteAndWipe();
|
||||
}
|
||||
@@ -366,31 +391,63 @@ public class BusPassengerModel {
|
||||
List<LatLng> latLngModels = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterWgsToGcjListCommon(mContext,routePoints);
|
||||
mRoutePoints.addAll(latLngModels);
|
||||
calculateTwoStationsRoute();
|
||||
}
|
||||
|
||||
float sumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(mRoutePoints);
|
||||
SharedPrefsMgr.getInstance(mContext).putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS,(int) sumLength);
|
||||
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.updateTotalDistance();
|
||||
private void calculateTwoStationsRoute(){
|
||||
//找出前往站对应的轨迹点,拿出两站点的集合
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "mRoutePoints.size() = " + mRoutePoints.size());
|
||||
if (mRoutePoints.size() > 0) {
|
||||
if (mStations.size() > 2){ //两个站点以上要计算两个站点间的估计路线
|
||||
if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex - 1 >=0){
|
||||
mTwoStationsRouts.clear();
|
||||
BusPassengerStation stationNext = mStations.get(mNextStationIndex);
|
||||
BusPassengerStation stationCur = mStations.get(mNextStationIndex - 1);
|
||||
//当前站在轨迹中对应的点
|
||||
int currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints
|
||||
,stationCur.getGcjLon(),stationCur.getGcjLat());
|
||||
//要前往的站在轨迹中对应的点
|
||||
int nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints
|
||||
,stationNext.getGcjLon(),stationNext.getGcjLat());
|
||||
mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex));
|
||||
}
|
||||
}else { //只有两个站点的时候整个路线就是两个站点之间的轨迹
|
||||
mTwoStationsRouts.clear();
|
||||
mTwoStationsRouts.addAll(mRoutePoints);
|
||||
}
|
||||
if (mTwoStationsRouts.size() > 0){
|
||||
float sumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(mTwoStationsRouts);
|
||||
SharedPrefsMgr.getInstance(mContext).putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS,(int) sumLength);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.updateTotalDistance();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void dynamicCalculateRouteInfo() {
|
||||
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompare(mRoutePoints,mLongitude,mLatitude);
|
||||
|
||||
float lastSumLength = 0;
|
||||
if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
lastPoints.get(0).longitude, lastPoints.get(0).latitude,
|
||||
mLongitude, mLatitude);
|
||||
}else {
|
||||
lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
|
||||
//计算当前位置和下一站的剩余点集合
|
||||
//计算剩余点总里程和时间
|
||||
if (mTwoStationsRouts.size() == 0){
|
||||
calculateTwoStationsRoute();
|
||||
}
|
||||
double lastTime = lastSumLength / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 ; //秒
|
||||
if (mTwoStationsRouts.size() > 0){
|
||||
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompare(mTwoStationsRouts,mLongitude,mLatitude);
|
||||
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.routePlanningToNextStationChanged((long)lastSumLength,(long) lastTime);
|
||||
float lastSumLength = 0;
|
||||
if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
lastPoints.get(0).longitude, lastPoints.get(0).latitude,
|
||||
mLongitude, mLatitude);
|
||||
}else {
|
||||
lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
|
||||
}
|
||||
double lastTime = lastSumLength / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 ; //秒
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "lastSumLength = " + lastSumLength);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.routePlanningToNextStationChanged((long)lastSumLength,(long) lastTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,10 +498,11 @@ public class BusPassengerModel {
|
||||
* @param isStart
|
||||
*/
|
||||
public void startOrStopCalculateRouteInfo(boolean isStart) {
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "startOrStopOrderLoop() " + isStart);
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "startOrStopCalculateRouteInfo() " + isStart);
|
||||
if (isStart) {
|
||||
BusPassengerModelLoopManager.getInstance().startCalculateRouteInfoLoop();
|
||||
} else {
|
||||
mTwoStationsRouts.clear();
|
||||
BusPassengerModelLoopManager.getInstance().stopCalculateRouteInfLoop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveEnd() {
|
||||
mView.showOverviewFragment();
|
||||
// mView.showOverviewFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,7 +139,7 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
public void routeResult(List<LatLng> models, int haveArrivedIndex) {
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "routeResult:" + models.size()
|
||||
+ " haveArrivedIndex = "+haveArrivedIndex);
|
||||
mView.routeResult(models,haveArrivedIndex);
|
||||
runOnUIThread(() ->mView.routeResult(models,haveArrivedIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -107,13 +107,13 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
|
||||
if (currentIndex == 0){
|
||||
mCurrentArriveStationTitle.setText(getResources().getString(R.string.bus_p_cur_station_title_init));
|
||||
mCurrentArriveTip.setText(getResources().getString(R.string.bus_p_cur_station_arrived_tip_init));
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
removeProgressBar();
|
||||
return;
|
||||
}
|
||||
if (isArrived){
|
||||
mCurrentArriveStationTitle.setText(getResources().getString(R.string.bus_p_cur_station_title));
|
||||
mCurrentArriveTip.setText(getResources().getString(R.string.bus_p_cur_station_arrived_tip));
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
removeProgressBar();
|
||||
}else {
|
||||
mCurrentArriveStationTitle.setText(getResources().getString(R.string.bus_p_cur_next_station_title));
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
@@ -122,10 +122,15 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
|
||||
|
||||
}
|
||||
|
||||
private void removeProgressBar() {
|
||||
mProgressBar.setProgress(0);
|
||||
mProgressBar.setMax(0);
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void updateRoutePlanningToNextStation(long meters, long timeInSecond){
|
||||
//更新进度条
|
||||
updateProgressBar(meters);
|
||||
|
||||
String dis = "0";
|
||||
String disUnit = "公里";
|
||||
if (meters > 0){
|
||||
|
||||
@@ -298,6 +298,8 @@ public class BusPassengerMapDirectionView
|
||||
}
|
||||
|
||||
public void clearCoordinatesLatLng(){
|
||||
textureList.clear();
|
||||
texIndexList.clear();
|
||||
mCoordinatesLatLng.clear();
|
||||
mLinePointsLatLng.clear();
|
||||
}
|
||||
|
||||
@@ -248,8 +248,8 @@ public class BusPassengerRouteFragment extends
|
||||
if (currentStationIndex == 0 && isArrived){ //到达始发站且并未出发, 恢复站点marker 清楚路径 清空路径点
|
||||
SharedPrefsMgr.getInstance(getContext())
|
||||
.remove(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS);
|
||||
clearPolyline();
|
||||
if (mMapDirectionView != null) mMapDirectionView.clearCoordinatesLatLng();
|
||||
clearPolyline();
|
||||
}
|
||||
|
||||
if (stations.size() > 0){
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
|
||||
android:id="@+id/edge_view"
|
||||
android:layout_width="720px"
|
||||
android:layout_width="725px"
|
||||
android:layout_height="match_parent"
|
||||
app:shadowColor="@color/bus_p_route_view_left_edge_shadow"
|
||||
app:xOffset="0px"
|
||||
|
||||
@@ -539,8 +539,9 @@ public class BusOrderModel {
|
||||
*/
|
||||
private void startAutopilot(boolean isRestart) {
|
||||
|
||||
isArrivedStation = false;
|
||||
triggerStartServiceEvent(isRestart, false);
|
||||
|
||||
isArrivedStation = false;
|
||||
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
|
||||
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex + 1);
|
||||
|
||||
@@ -573,8 +574,6 @@ public class BusOrderModel {
|
||||
+" startLatLon="+currentStation.getName()+",endLatLon="+nextStation.getName());
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
|
||||
|
||||
triggerStartServiceEvent(isRestart, false);
|
||||
|
||||
if (mControllerStatusCallback != null) {
|
||||
mControllerStatusCallback.startOpenAutopilot();
|
||||
}
|
||||
@@ -990,7 +989,7 @@ public class BusOrderModel {
|
||||
}
|
||||
|
||||
public void triggerStartServiceEvent(boolean isRestart, boolean send) {
|
||||
if (stationList == null || backgroundCurrentStationIndex >= stationList.size() || backgroundCurrentStationIndex == 0) {
|
||||
if (stationList == null || backgroundCurrentStationIndex >= stationList.size()-1) {
|
||||
return;
|
||||
}
|
||||
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
|
||||
|
||||
@@ -29,15 +29,13 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,19 @@ package com.mogo.och.taxi.passenger.mulprocess;
|
||||
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.passenger.ui.leftmenu.LeftMenuOpen;
|
||||
import com.mogo.och.taxi.passenger.ui.leftmenu.OverlayLeftViewUtils;
|
||||
|
||||
public class OrderServiceImpl extends ILeftMenuService.Stub {
|
||||
|
||||
public static final String TAG = "mulprocessOrderServiceImpl";
|
||||
|
||||
@Override
|
||||
public void transmissionIndex(int index) throws RemoteException {
|
||||
|
||||
CallerLogger.INSTANCE.d(SceneConstant.M_TAXI_P + TAG, "跨进程 transmissionIndex"+index);
|
||||
UiThreadHandler.getsUiHandler().post(() -> {
|
||||
OverlayLeftViewUtils.INSTANCE.transmissionIndexGet(index);
|
||||
});
|
||||
@@ -18,11 +22,13 @@ public class OrderServiceImpl extends ILeftMenuService.Stub {
|
||||
|
||||
@Override
|
||||
public void registerCallback(ICallback cb) throws RemoteException {
|
||||
CallerLogger.INSTANCE.d(SceneConstant.M_TAXI_P + TAG, "跨进程 registerCallback");
|
||||
LeftMenuOpen.INSTANCE.registerCallbackHost(cb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegisterCallback(ICallback cb) throws RemoteException {
|
||||
CallerLogger.INSTANCE.d(SceneConstant.M_TAXI_P + TAG, "跨进程 unRegisterCallback");
|
||||
LeftMenuOpen.INSTANCE.unregisterCallbackHost(cb);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
|
||||
if (models == null) return;
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "routeResultByServer:" + models.size()
|
||||
+ " haveArrivedIndex = " + haveArrivedIndex);
|
||||
mView.routeResultByServer(models,haveArrivedIndex);
|
||||
runOnUIThread(() ->mView.routeResultByServer(models,haveArrivedIndex));
|
||||
}
|
||||
|
||||
|
||||
@@ -94,9 +94,9 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
|
||||
TaxiPassengerModel.getInstance().queryOrderRouteList();
|
||||
}
|
||||
|
||||
mView.updateOrderStatusView(order);
|
||||
runOnUIThread(() ->mView.updateOrderStatusView(order));
|
||||
}else if (mCurrentPassengerOrder.orderStatus != order.orderStatus) {
|
||||
mView.updateOrderStatusView(order);
|
||||
runOnUIThread(() ->mView.updateOrderStatusView(order));
|
||||
|
||||
if (TaxiPassengerOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus){
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "-----OnTheWayToEndStation----");
|
||||
|
||||
@@ -10,6 +10,8 @@ import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_TAXI_P
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
@@ -25,6 +27,8 @@ import rx.schedulers.Schedulers
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object LeftMenuOpen {
|
||||
|
||||
const val TAG = "mulprocessLeftMenuOpen"
|
||||
|
||||
private var windowView: View? = null
|
||||
private var wl: WindowManager.LayoutParams? = null
|
||||
private var windowManager: WindowManager? = null
|
||||
@@ -43,7 +47,7 @@ object LeftMenuOpen {
|
||||
|
||||
var checkIndex = OverlayLeftViewUtils.LIVE
|
||||
private var lastClickTime = 0L
|
||||
private const val FAST_CLICK_DELAY_TIME = 1000 // 防止事件发送过快
|
||||
private const val FAST_CLICK_DELAY_TIME = 1300 // 防止事件发送过快
|
||||
|
||||
|
||||
fun setValue(
|
||||
@@ -51,7 +55,8 @@ object LeftMenuOpen {
|
||||
wl: WindowManager.LayoutParams?,
|
||||
windowManager: WindowManager?,
|
||||
close: (view: View, windowManager: WindowManager?) -> Unit,
|
||||
open: (view: View, windowManager: WindowManager?) -> Unit
|
||||
open: (view: View, windowManager: WindowManager?) -> Unit,
|
||||
isMainProcess: Boolean
|
||||
) {
|
||||
this.open = open
|
||||
this.close = close
|
||||
@@ -61,7 +66,9 @@ object LeftMenuOpen {
|
||||
dragList.forEach {
|
||||
registerDragView(it)
|
||||
}
|
||||
registerC()
|
||||
if(!isMainProcess) {
|
||||
registerC()
|
||||
}
|
||||
}
|
||||
|
||||
fun clearValue() {
|
||||
@@ -168,9 +175,9 @@ object LeftMenuOpen {
|
||||
fun registerDragView(view: View?) {
|
||||
if (view != null) {
|
||||
dragList.add(view)
|
||||
if (orderService == null) {
|
||||
registerC()
|
||||
}
|
||||
// if (orderService == null) {
|
||||
// registerC()
|
||||
// }
|
||||
view.setOnTouchListener(ItemViewTouchListener())
|
||||
view.setOnClickListener {
|
||||
open?.let { it1 -> it1(windowView!!, windowManager) }
|
||||
@@ -193,6 +200,7 @@ object LeftMenuOpen {
|
||||
}
|
||||
|
||||
fun transmissionIndex(index:Int){
|
||||
CallerLogger.d(M_TAXI_P + TAG, "tran--transmissionIndex---$index")
|
||||
if (orderService == null) {
|
||||
registerC()
|
||||
}
|
||||
@@ -200,22 +208,23 @@ object LeftMenuOpen {
|
||||
}
|
||||
|
||||
fun registerCallbackHost(cb:ICallback?){
|
||||
if (orderService == null) {
|
||||
registerC()
|
||||
}
|
||||
// if (orderService == null) {
|
||||
// registerC()
|
||||
// }
|
||||
cb?.let {
|
||||
icallbacks?.register(it)
|
||||
icallbacks.register(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun unregisterCallbackHost(cb:ICallback?){
|
||||
cb?.let {
|
||||
icallbacks?.unregister(it)
|
||||
icallbacks.unregister(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun registerCallback(cb:ICallback?){
|
||||
CallerLogger.d(M_TAXI_P + TAG, "tran--registerCallback--注册")
|
||||
if (orderService == null) {
|
||||
registerC()
|
||||
}
|
||||
@@ -225,6 +234,7 @@ object LeftMenuOpen {
|
||||
}
|
||||
|
||||
fun unregisterCallback(cb:ICallback?){
|
||||
CallerLogger.d(M_TAXI_P + TAG, "tran--unregisterCallback--反注册")
|
||||
cb?.let {
|
||||
orderService?.unRegisterCallback(it)
|
||||
}
|
||||
@@ -240,15 +250,20 @@ object LeftMenuOpen {
|
||||
Observable.empty<String?>().subscribeOn(Schedulers.io())
|
||||
.subscribe(object : Observer<String?> {
|
||||
override fun onCompleted() {
|
||||
val len = icallbacks.beginBroadcast()
|
||||
for (i in 0 until len) {
|
||||
try {
|
||||
icallbacks.getBroadcastItem(i).onResult(meters, timeInSecond, speed)
|
||||
} catch (e: RemoteException) {
|
||||
e.printStackTrace()
|
||||
CallerLogger.d(M_TAXI_P + TAG, "callCallBack$meters--$timeInSecond--$speed")
|
||||
try {
|
||||
val len = icallbacks.beginBroadcast()
|
||||
for (i in 0 until len) {
|
||||
try {
|
||||
icallbacks.getBroadcastItem(i).onResult(meters, timeInSecond, speed)
|
||||
} catch (e: RemoteException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
icallbacks.finishBroadcast()
|
||||
}catch (e:Exception){
|
||||
CallerLogger.e(M_TAXI_P + TAG, "callCallBack${e.message}")
|
||||
}
|
||||
icallbacks.finishBroadcast()
|
||||
}
|
||||
override fun onError(e: Throwable?) {}
|
||||
override fun onNext(t: String?) {}
|
||||
@@ -273,7 +288,12 @@ object LeftMenuOpen {
|
||||
* 主进程在显示是主动调用
|
||||
* video进程在天津View是判断是否调用了
|
||||
*/
|
||||
@Synchronized
|
||||
private fun registerC() {
|
||||
if(orderService!=null){
|
||||
return
|
||||
}
|
||||
CallerLogger.d(M_TAXI_P + TAG, "tran--registerC--获取jni")
|
||||
val resolver: ContentResolver = Utils.getApp().contentResolver
|
||||
|
||||
cu = resolver.query(
|
||||
|
||||
@@ -177,7 +177,7 @@ object OverlayLeftViewUtils {
|
||||
|
||||
addTarget(context)
|
||||
|
||||
LeftMenuOpen.setValue(view, params, windowManager,::close,::open)
|
||||
LeftMenuOpen.setValue(view, params, windowManager,::close,::open,isMainProcess)
|
||||
try {
|
||||
windowManager!!.addView(overlayView, params)
|
||||
checkProcess()
|
||||
|
||||
@@ -11,6 +11,8 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
@@ -52,6 +54,7 @@ class VideoActivity : AppCompatActivity() {
|
||||
private lateinit var acivTitleIcon: AppCompatImageView
|
||||
private lateinit var tvTitle: TextView
|
||||
private var subscribe: Subscription?=null
|
||||
private val TAG = "mulprocessVideoActivity"
|
||||
|
||||
private val arrayListOf = ArrayList<TaxiPassengerVideoPlay>()
|
||||
|
||||
@@ -352,7 +355,7 @@ class VideoActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
}
|
||||
subscribe = Observable.interval(0, 8, TimeUnit.SECONDS)
|
||||
subscribe = Observable.interval(2, 8, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Observer<Long> {
|
||||
@@ -387,15 +390,13 @@ class VideoActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
subscribe?.let {
|
||||
if(it.isUnsubscribed){
|
||||
it.unsubscribe()
|
||||
}
|
||||
}
|
||||
cancleSubscribe()
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun finishActivity(event: FinishActivity){
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "finishActivity(event)")
|
||||
cancleSubscribe()
|
||||
val intent = Intent()
|
||||
val parse = Uri.parse("mogo://launcher/main/switch2?type=launch")
|
||||
intent.data = parse
|
||||
@@ -405,6 +406,7 @@ class VideoActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "onDestroy()")
|
||||
super.onDestroy()
|
||||
EventBus.getDefault().unregister(this)
|
||||
LeftMenuOpen.unregisterCallback(callBack)
|
||||
@@ -412,6 +414,15 @@ class VideoActivity : AppCompatActivity() {
|
||||
OverlayLeftViewUtils.dismissOverlayView(false)
|
||||
FloatingDistanceInfoUtils.dismissOverlayView()
|
||||
FixMemoryLeak.fixLeak(this)
|
||||
cancleSubscribe()
|
||||
}
|
||||
|
||||
private fun cancleSubscribe(){
|
||||
subscribe?.let {
|
||||
if(!it.isUnsubscribed){
|
||||
it.unsubscribe()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun releaseOnNewInstance() {
|
||||
|
||||
@@ -29,15 +29,13 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.amap.api.navi.model.AMapLaneInfo;
|
||||
import com.amap.api.navi.model.AMapModelCross;
|
||||
import com.amap.api.navi.model.AMapNaviCameraInfo;
|
||||
import com.amap.api.navi.model.AMapNaviCross;
|
||||
import com.amap.api.navi.model.AMapNaviInfo;
|
||||
import com.amap.api.navi.model.AMapNaviLocation;
|
||||
import com.amap.api.navi.model.AMapNaviRouteNotifyData;
|
||||
import com.amap.api.navi.model.AMapNaviTrafficFacilityInfo;
|
||||
@@ -23,7 +22,6 @@ import com.amap.api.navi.model.AimLessModeCongestionInfo;
|
||||
import com.amap.api.navi.model.AimLessModeStat;
|
||||
import com.amap.api.navi.model.NaviInfo;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.autonavi.tbt.TrafficFacilityInfo;
|
||||
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;
|
||||
@@ -279,6 +277,11 @@ public class NaviToDestinationModel implements AMapNaviListener {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGpsSignalWeak(boolean b) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCameraInfo(AMapNaviCameraInfo[] aMapCameraInfos) {
|
||||
|
||||
@@ -289,21 +292,11 @@ public class NaviToDestinationModel implements AMapNaviListener {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdated(AMapNaviInfo aMapNaviInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OnUpdateTrafficFacility(AMapNaviTrafficFacilityInfo aMapNaviTrafficFacilityInfo) {
|
||||
//已过时
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OnUpdateTrafficFacility(TrafficFacilityInfo trafficFacilityInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCross(AMapNaviCross aMapNaviCross) {
|
||||
//显示放大图回调
|
||||
|
||||
@@ -1208,8 +1208,10 @@ public class TaxiModel {
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp routeList) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onAutopilotRotting = "
|
||||
+ GsonUtil.jsonFromObject(routeList));
|
||||
if (null != routeList && routeList.getWayPointsList() != null){
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "getWayPointsList = "
|
||||
+ routeList.getWayPointsList().size());
|
||||
}
|
||||
if (null != routeList && routeList.getWayPointsList().size() > 0) {
|
||||
updateOrderRoute(routeList.getWayPointsList());
|
||||
updateOrderRouteInfo(routeList.getWayPointsList());
|
||||
@@ -1268,7 +1270,10 @@ public class TaxiModel {
|
||||
Logger.d(M_TAXI + TAG, "--------计算出sumLength开始---------- ");
|
||||
|
||||
//转换成高德坐标系
|
||||
mRoutePoints = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext, models);
|
||||
if (mRoutePoints.size() > 0){
|
||||
mRoutePoints.clear();
|
||||
}
|
||||
mRoutePoints.addAll(CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext, models));
|
||||
startDynamicCalculateRouteInfo();
|
||||
}
|
||||
|
||||
@@ -1287,30 +1292,32 @@ public class TaxiModel {
|
||||
* 实时计算当前剩余里程和时间
|
||||
*/
|
||||
public void dynamicCalculateRouteInfo() {
|
||||
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompare(mRoutePoints, mLongitude, mLatitude);
|
||||
if (mRoutePoints.size() > 0){
|
||||
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompare(mRoutePoints, mLongitude, mLatitude);
|
||||
|
||||
float lastSumLength = 0;
|
||||
float lastSumLength = 0;
|
||||
|
||||
if (lastPoints.size() == 1) { //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
lastPoints.get(0).longitude, lastPoints.get(0).latitude,
|
||||
mLongitude, mLatitude);
|
||||
} else {
|
||||
lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
|
||||
if (lastPoints.size() == 1) { //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
lastPoints.get(0).longitude, lastPoints.get(0).latitude,
|
||||
mLongitude, mLatitude);
|
||||
} else {
|
||||
lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
|
||||
}
|
||||
|
||||
double lastTime = lastSumLength / TaxiConst.TAXI_AVERAGE_SPEED * 3.6; //秒
|
||||
Logger.d(M_TAXI + "dynamicCalculateRouteInfo"
|
||||
, "---lastSumLength: " + lastSumLength + "----lastTime : " + lastTime
|
||||
+ " thread = "+ Thread.currentThread().getName());
|
||||
|
||||
mCurrentOCHOrder.decreaseTravelDistance(lastSumLength);
|
||||
if (mOrderStatusCallback != null) {
|
||||
mOrderStatusCallback.onCurrentOrderDistToEndChanged((long) lastSumLength, (long) lastTime);
|
||||
}
|
||||
|
||||
reportOrderRemain((long) lastSumLength, (long) lastTime);
|
||||
}
|
||||
|
||||
double lastTime = lastSumLength / TaxiConst.TAXI_AVERAGE_SPEED * 3.6; //秒
|
||||
Logger.d(M_TAXI + "dynamicCalculateRouteInfo"
|
||||
, "---lastSumLength: " + lastSumLength + "----lastTime : " + lastTime
|
||||
+ " thread = "+ Thread.currentThread().getName());
|
||||
|
||||
mCurrentOCHOrder.decreaseTravelDistance(lastSumLength);
|
||||
if (mOrderStatusCallback != null) {
|
||||
mOrderStatusCallback.onCurrentOrderDistToEndChanged((long) lastSumLength, (long) lastTime);
|
||||
}
|
||||
|
||||
reportOrderRemain((long) lastSumLength, (long) lastTime);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1322,7 +1329,7 @@ public class TaxiModel {
|
||||
new TaxiServiceCallback<QueryOrderRouteResp>() {
|
||||
@Override
|
||||
public void onSuccess(QueryOrderRouteResp data) {
|
||||
if (data != null && data.data != null) {
|
||||
if (data != null && data.data != null && mRoutePoints.size() == 0) {
|
||||
mRoutePoints.clear();
|
||||
mRoutePoints.addAll(data.data);
|
||||
}
|
||||
|
||||
@@ -167,6 +167,8 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
if (order.orderStatus == TaxiOrderStatusEnum.JourneyCompleted.getCode()) {
|
||||
mCurrentOrder = null;
|
||||
isHaveBeingOrder(false);
|
||||
mDistanceAndTime2.setText("距离 - - 公里,用时 - - 分");
|
||||
mDistanceAndTime3.setText("距离 - - 公里,用时 - - 分");
|
||||
return;
|
||||
}
|
||||
mOrderNo = order.orderNo;
|
||||
@@ -407,6 +409,8 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
if (status == TaxiOrderStatusEnum.None.getCode() || status == TaxiOrderStatusEnum.Cancel.getCode() || status == TaxiOrderStatusEnum.JourneyCompleted.getCode()) {
|
||||
isHaveBeingOrder(false);
|
||||
mCurrentOrder = null;
|
||||
mDistanceAndTime2.setText("距离 - - 公里,用时 - - 分");
|
||||
mDistanceAndTime3.setText("距离 - - 公里,用时 - - 分");
|
||||
} else {
|
||||
isHaveBeingOrder(true);
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ aspectjx {
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||
//Crash日志收集
|
||||
implementation rootProject.ext.dependencies.crashSdk
|
||||
// implementation rootProject.ext.dependencies.crashSdk
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.boostmultidex
|
||||
|
||||
@@ -52,7 +52,7 @@ class AutoPilotBadCaseTest {
|
||||
it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date())
|
||||
index++
|
||||
}
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
// CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
}
|
||||
.flowOn(Dispatchers.Default)
|
||||
.collect()
|
||||
@@ -86,7 +86,7 @@ class AutoPilotBadCaseTest {
|
||||
it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date())
|
||||
index++
|
||||
}
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
// CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
}
|
||||
.flowOn(Dispatchers.Default)
|
||||
.collect()
|
||||
@@ -114,7 +114,7 @@ class AutoPilotBadCaseTest {
|
||||
it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date())
|
||||
index++
|
||||
}
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
// CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
}
|
||||
.flowOn(Dispatchers.Default)
|
||||
.collect()
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
|
||||
import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator
|
||||
import com.mogo.eagle.core.data.enums.SidePattern
|
||||
import com.mogo.eagle.core.function.hmi.ui.*
|
||||
import com.mogo.eagle.core.function.main.MainLauncherActivity
|
||||
import com.mogo.eagle.core.utilcode.kotlin.shape
|
||||
import com.mogo.eagle.core.utilcode.reminder.Reminder
|
||||
@@ -27,14 +28,14 @@ import com.mogo.eagle.core.utilcode.reminder.api.impl.ActivityReminder
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.impl.PopupWindowReminder
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.impl.ViewReminder
|
||||
import com.mogo.eagle.core.utilcode.util.AppStateManager
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.*
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import java.lang.Integer.min
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.*
|
||||
import java.util.concurrent.TimeUnit.MILLISECONDS
|
||||
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@@ -64,6 +65,46 @@ class ReminderTest {
|
||||
return@runBlocking
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testShowWarningV2x() = runBlocking {
|
||||
val f = ensureMoGoHmiFragmentShow()
|
||||
|
||||
delay(5000)
|
||||
(1 until 20).map {
|
||||
it
|
||||
}.asFlow()
|
||||
.onEach {
|
||||
f.showWarningV2X("10006", "test", "测试$it", "$it", null, true, 5000)
|
||||
}
|
||||
.flowOn(Dispatchers.Default)
|
||||
.collect()
|
||||
delay(3000000)
|
||||
}
|
||||
|
||||
private suspend fun ensureMoGoHmiFragmentShow(): MoGoHmiFragment = suspendCancellableCoroutine {
|
||||
launch.onActivity { itx ->
|
||||
val executor = Executors.newSingleThreadScheduledExecutor()
|
||||
executor.scheduleAtFixedRate({
|
||||
var find =
|
||||
itx.supportFragmentManager.fragments.find { it is MoGoHmiFragment } as? MoGoHmiFragment
|
||||
while (find == null) {
|
||||
find =
|
||||
itx.supportFragmentManager.fragments.find { it is MoGoHmiFragment } as? MoGoHmiFragment
|
||||
}
|
||||
while (!find.isResumed) {
|
||||
Thread.sleep(500)
|
||||
}
|
||||
it.resumeWith(Result.success(find))
|
||||
try {
|
||||
Thread.sleep(500)
|
||||
executor.shutdownNow()
|
||||
} catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}, 50, 500, MILLISECONDS)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testViewReminderOverride() = runBlocking(Dispatchers.Main) {
|
||||
launch.onActivity {
|
||||
@@ -357,14 +398,14 @@ class ReminderTest {
|
||||
}
|
||||
}
|
||||
|
||||
class TestPopupWindowReminder(private val anchor: View, private val popupWindow: PopupWindow): PopupWindowReminder(popupWindow) {
|
||||
class TestPopupWindowReminder(private val anchor: View, override val popupWindow: PopupWindow): PopupWindowReminder(popupWindow) {
|
||||
|
||||
override fun show() {
|
||||
popupWindow.showAtLocation(anchor, Gravity.CENTER, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
class TestPopupWindowReminderOverride(private val anchor: View, private val popupWindow: PopupWindow): PopupWindowReminder(popupWindow) {
|
||||
class TestPopupWindowReminderOverride(private val anchor: View, override val popupWindow: PopupWindow): PopupWindowReminder(popupWindow) {
|
||||
|
||||
override fun show() {
|
||||
popupWindow.showAtLocation(anchor, Gravity.CENTER, 0, 0)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.mogo.launcher;
|
||||
|
||||
import com.auto.zhidao.logsdk.CrashSystem;
|
||||
import com.mogo.eagle.core.function.main.MainMoGoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.launcher.crash.CrashSystem;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -17,7 +17,6 @@ public class MogoApplication extends MainMoGoApplication {
|
||||
protected void initCrashConfig() {
|
||||
CrashSystem crashSystem = CrashSystem.getInstance(this);
|
||||
crashSystem.init();
|
||||
|
||||
//设置debug模式,日志不上传
|
||||
crashSystem.setDebug(BuildConfig.DEBUG);
|
||||
}
|
||||
|
||||
218
app/src/main/java/com/mogo/launcher/crash/CrashSystem.java
Normal file
@@ -0,0 +1,218 @@
|
||||
package com.mogo.launcher.crash;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.lang.Thread.UncaughtExceptionHandler;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class CrashSystem implements UncaughtExceptionHandler {
|
||||
public static final String TAG = "CrashSystem";
|
||||
private String mAppPackage = null;
|
||||
private String mAppVersionCode = null;
|
||||
private String mAppVersionName = null;
|
||||
private String mAppName = null;
|
||||
private String mOsVersion = null;
|
||||
private String mDeviceId = null;
|
||||
private UncaughtExceptionHandler mDefaultHandler;
|
||||
private final Map<String, String> info = new HashMap();
|
||||
private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
|
||||
private boolean mDebug = false;
|
||||
private final List<CrashCallback> callbackList = new ArrayList<>();
|
||||
|
||||
private static CrashSystem sCrashSystem = null;
|
||||
|
||||
private static final Object lock = new Object();
|
||||
|
||||
public void init() {
|
||||
this.mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
Thread.setDefaultUncaughtExceptionHandler(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否收集记录crash信息
|
||||
* @param debug 是否是debug
|
||||
*/
|
||||
public void setDebug(boolean debug) {
|
||||
this.mDebug = debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加crash事件回调
|
||||
*/
|
||||
public void addCallback(CrashCallback callback) {
|
||||
if(callback != null) {
|
||||
callbackList.add(callback);
|
||||
}
|
||||
}
|
||||
|
||||
private CrashSystem(Context context) {
|
||||
this.inflateSystemInfo(context);
|
||||
}
|
||||
|
||||
public static CrashSystem getInstance(Context context) {
|
||||
CrashSystem crashSystem = sCrashSystem;
|
||||
if(crashSystem == null) {
|
||||
synchronized (lock) {
|
||||
crashSystem = sCrashSystem;
|
||||
if(crashSystem == null) {
|
||||
crashSystem = new CrashSystem(context.getApplicationContext());
|
||||
sCrashSystem = crashSystem;
|
||||
}
|
||||
}
|
||||
}
|
||||
return crashSystem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uncaughtException(Thread thread, Throwable ex) {
|
||||
try {
|
||||
this.handleException(ex);
|
||||
dispatchCrashError();
|
||||
} finally {
|
||||
if (mDefaultHandler != null) {
|
||||
mDefaultHandler.uncaughtException(thread, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分发异常事件
|
||||
*/
|
||||
private void dispatchCrashError() {
|
||||
for (CrashCallback callback : callbackList) {
|
||||
if(callback != null) {
|
||||
callback.onCrashError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleException(Throwable ex) {
|
||||
if(ex == null) {
|
||||
return true;
|
||||
} else {
|
||||
String msg = ex.getLocalizedMessage();
|
||||
Log.e("CrashSystem", msg);
|
||||
String filePath = saveCrashInfo2File(ex);
|
||||
Log.i(TAG, "handleException: filePath = " + filePath);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private String saveCrashInfo2File(Throwable ex) {
|
||||
try {
|
||||
if(!Environment.getExternalStorageState().equals("mounted")) {
|
||||
return null;
|
||||
}
|
||||
File dir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "crash");
|
||||
if(!dir.exists()) {
|
||||
dir.mkdir();
|
||||
}
|
||||
String[] fileList = dir.list((dir1, name) -> name.contains(mAppPackage));
|
||||
if(fileList == null || fileList.length >= 20) { //避免crash日志一直重复
|
||||
return null;
|
||||
}
|
||||
String time = this.format.format(new Date());
|
||||
String fileName = "app-crash-" + this.mAppPackage + "-" + time + ".log";
|
||||
if(mDebug) {
|
||||
fileName = "debug-" + fileName;
|
||||
}
|
||||
String fileTemp = fileName + ".temp";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Iterator<Entry<String, String>> var4 = this.info.entrySet().iterator();
|
||||
String result;
|
||||
while(var4.hasNext()) {
|
||||
Entry<String, String> entry = var4.next();
|
||||
String key = entry.getKey();
|
||||
result = entry.getValue();
|
||||
sb.append(key).append("=").append(result).append("\n");
|
||||
}
|
||||
sb.append("TIME=").append(String.valueOf(System.currentTimeMillis())).append("\n");
|
||||
sb.append("fileName=").append(fileName).append("\n");
|
||||
Writer writer = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(writer);
|
||||
ex.printStackTrace(pw);
|
||||
for(Throwable cause = ex.getCause(); cause != null; cause = cause.getCause()) {
|
||||
cause.printStackTrace(pw);
|
||||
}
|
||||
pw.close();
|
||||
result = writer.toString();
|
||||
sb.append(result);
|
||||
FileOutputStream fos = null;
|
||||
try {
|
||||
File dest = new File(dir, fileTemp);
|
||||
fos = new FileOutputStream(dest);
|
||||
fos.write(sb.toString().getBytes());
|
||||
fos.flush();
|
||||
File file = new File(dir,fileName);
|
||||
dest.renameTo(file);
|
||||
return dir.getAbsolutePath() + File.separator + fileName;
|
||||
} catch (IOException var13) {
|
||||
var13.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (fos != null) {
|
||||
fos.close();
|
||||
}
|
||||
} catch (IOException ignore) {}
|
||||
}
|
||||
} catch (Throwable ignore) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void inflateSystemInfo(Context context) {
|
||||
this.mAppPackage = context.getPackageName();
|
||||
PackageManager pm = context.getPackageManager();
|
||||
try {
|
||||
PackageInfo packageInfo = pm.getPackageInfo(this.mAppPackage, 0);
|
||||
this.mAppVersionCode = "" + packageInfo.versionCode;
|
||||
this.mAppVersionName = packageInfo.versionName;
|
||||
this.mAppPackage = packageInfo.packageName;
|
||||
this.mAppName = packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString();
|
||||
this.mOsVersion = Build.DISPLAY;
|
||||
String deviceId = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
if(TextUtils.isEmpty(deviceId)) {
|
||||
deviceId = "11111111";
|
||||
}
|
||||
this.mDeviceId = deviceId;
|
||||
} catch (Exception var5) {
|
||||
var5.printStackTrace();
|
||||
}
|
||||
|
||||
this.info.put("appName",this.mAppName);
|
||||
this.info.put("appPackageName", this.mAppPackage);
|
||||
this.info.put("versionCode", this.mAppVersionCode);
|
||||
this.info.put("versionName", this.mAppVersionName);
|
||||
this.info.put("sn", this.mDeviceId);
|
||||
this.info.put("DISPLAY", this.mOsVersion);
|
||||
}
|
||||
|
||||
public interface CrashCallback {
|
||||
void onCrashError();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ ext {
|
||||
// amapnavi3dmap : "com.amap.api:navi-3dmap:8.0.1_3dmap8.0.1",
|
||||
// amapsearch : "com.amap.api:search:7.9.0",
|
||||
// amaplocation : "com.amap.api:location:5.5.0",
|
||||
amapnavi3dmap : "com.amap.api:navi-3dmap:7.2.0_3dmap7.2.0",
|
||||
amapnavi3dmap : "com.amap.api:navi-3dmap:7.7.0_3dmap7.7.0",
|
||||
amapsearch : "com.amap.api:search:7.1.0",
|
||||
amaplocation : "com.amap.api:location:5.3.1",
|
||||
// json 转换
|
||||
@@ -89,7 +89,6 @@ ext {
|
||||
jetbrainsannotationsjava5 : "org.jetbrains:annotations-java5:15.0",
|
||||
|
||||
// crash
|
||||
crashSdk : "com.zhidaoauto.crash.log:library:1.0.5",
|
||||
kotlinstdlibjdk7 : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}",
|
||||
|
||||
//探路使用的直播组件
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.zhjt.mogo_core_function_devatools
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.view.*
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
|
||||
@@ -102,12 +102,12 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
upgradeManager.downLoadPackage(mContext!!, downloadKey,downloadUrl)
|
||||
}
|
||||
|
||||
override fun showStatusBar(ctx: Context, anchor: View) {
|
||||
StatusManager.init(ctx, anchor)
|
||||
StatusManager.show()
|
||||
override fun showStatusBar(ctx: Context, container: ViewGroup) {
|
||||
StatusManager.init(ctx)
|
||||
StatusManager.show(container)
|
||||
}
|
||||
|
||||
override fun hideStatusBar() {
|
||||
StatusManager.hide()
|
||||
override fun hideStatusBar(container: ViewGroup) {
|
||||
StatusManager.hide(container)
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
@file:Suppress("COMPATIBILITY_WARNING")
|
||||
|
||||
package com.zhjt.mogo_core_function_devatools.status
|
||||
|
||||
import android.content.*
|
||||
import android.view.*
|
||||
import android.view.WindowManager.LayoutParams
|
||||
import android.widget.*
|
||||
import androidx.core.view.*
|
||||
import androidx.lifecycle.*
|
||||
import androidx.lifecycle.Lifecycle.Event
|
||||
import androidx.lifecycle.Lifecycle.Event.ON_CREATE
|
||||
@@ -13,7 +12,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.zhjt.mogo_core_function_devatools.ext.*
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.GpsStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.IpcStatus
|
||||
@@ -29,11 +27,12 @@ import com.zhjt.mogo_core_function_devatools.status.flow.ipc.IpcImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.nets.NetsImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.rtk.RTKImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.trace.TracingImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.ui.*
|
||||
import com.zhjt.mogo_core_function_devatools.status.ui.StatusView
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.*
|
||||
import mogo_msg.MogoReportMsg
|
||||
import java.lang.ref.*
|
||||
import java.util.concurrent.*
|
||||
|
||||
|
||||
object StatusManager {
|
||||
|
||||
@@ -41,18 +40,13 @@ object StatusManager {
|
||||
|
||||
private lateinit var model: StatusModel
|
||||
|
||||
private var pop: PopupWindow? = null
|
||||
|
||||
private var timer: Job? = null
|
||||
|
||||
private var context: WeakReference<Context>? = null
|
||||
|
||||
private var anchor: WeakReference<View>? = null
|
||||
|
||||
private var hasInit = false
|
||||
|
||||
private var oldX = 0
|
||||
private var oldY = 0
|
||||
private val listeners by lazy { CopyOnWriteArrayList<IStatusListener>() }
|
||||
|
||||
|
||||
private val listener = object : IMoGoAutopilotStatusListener {
|
||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
|
||||
@@ -93,7 +87,7 @@ object StatusManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun init(ctx: Context, anchor: View) {
|
||||
fun init(ctx: Context) {
|
||||
if (hasInit) {
|
||||
return
|
||||
}
|
||||
@@ -110,26 +104,6 @@ object StatusManager {
|
||||
}
|
||||
}
|
||||
})
|
||||
context = WeakReference(ctx)
|
||||
anchor.viewTreeObserver.addOnGlobalLayoutListener {
|
||||
anchor.getLocationInWindow(IntArray(2).also {
|
||||
val currentX = it[0]
|
||||
val currentY = it[1]
|
||||
var changed = false
|
||||
if (oldX != currentX) {
|
||||
oldX = currentX
|
||||
changed = true
|
||||
}
|
||||
if (oldY != currentY) {
|
||||
changed = true
|
||||
oldY = currentY
|
||||
}
|
||||
if (changed && pop?.isShowing == true) {
|
||||
pop?.update(getOffsetX(currentX), currentY + 130.PX, -1, -1)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.anchor = WeakReference(anchor)
|
||||
}
|
||||
|
||||
private fun onCreate(ctx: Context) {
|
||||
@@ -153,35 +127,42 @@ object StatusManager {
|
||||
model.update(it)
|
||||
}
|
||||
}
|
||||
f.onCreate()
|
||||
}
|
||||
}
|
||||
|
||||
fun show() {
|
||||
val anchor = this.anchor?.get() ?: return
|
||||
context?.get()?.also { ctx ->
|
||||
pop?.takeIf { it.isShowing }?.dismiss()
|
||||
val content = StatusView(model, ctx)
|
||||
content.doOnAttach {
|
||||
for (f in flows) {
|
||||
f.onCreate()
|
||||
}
|
||||
}
|
||||
val out = IntArray(2)
|
||||
anchor.getLocationInWindow(out)
|
||||
ctx.normalPop(content, width = LayoutParams.WRAP_CONTENT, height = LayoutParams.WRAP_CONTENT, gravity = Gravity.END or Gravity.TOP, startX = getOffsetX(out[0]), startY = out[1] + 130.PX , isFocusable = false)?.also {
|
||||
pop = it
|
||||
model.status.observe(ctx.lifeCycleOwner) {
|
||||
listeners.forEach { itx ->
|
||||
itx.onStatusChanged(it.second, it.first != null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getOffsetX(anchorX: Int): Int {
|
||||
return ScreenUtils.getScreenWidth() - anchorX + 40.PX
|
||||
|
||||
fun registerListener(listener: IStatusListener) {
|
||||
listeners.add(listener)
|
||||
}
|
||||
|
||||
fun hide() {
|
||||
pop?.takeIf { it.isShowing }?.dismiss()
|
||||
|
||||
fun unRegisterListener(listener: IStatusListener) {
|
||||
listeners.remove(listener)
|
||||
}
|
||||
|
||||
fun show(container: ViewGroup) {
|
||||
if (container.childCount > 0) {
|
||||
if (container.visibility != View.VISIBLE) {
|
||||
container.visibility = View.VISIBLE
|
||||
}
|
||||
return
|
||||
}
|
||||
val child = StatusView(model, container.context)
|
||||
container.addView(child, ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT))
|
||||
}
|
||||
|
||||
fun hide(container: ViewGroup) {
|
||||
container.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
private fun onDestroy(ctx: Context) {
|
||||
hasInit = false
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
@@ -190,7 +171,12 @@ object StatusManager {
|
||||
flows.forEach {
|
||||
it.onDestroy()
|
||||
}
|
||||
listeners.clear()
|
||||
flows.clear()
|
||||
pop?.takeIf { it.isShowing }?.dismiss()
|
||||
}
|
||||
|
||||
interface IStatusListener {
|
||||
|
||||
fun onStatusChanged(data: List<Status>, hasException: Boolean)
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,12 @@ package com.zhjt.mogo_core_function_devatools.status.entity
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus.Tracing.*
|
||||
|
||||
internal sealed class Status
|
||||
sealed class Status
|
||||
|
||||
/**
|
||||
* 工控机
|
||||
*/
|
||||
internal class IpcStatus(val enabled: Boolean = false): Status() {
|
||||
class IpcStatus(val enabled: Boolean = false): Status() {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (javaClass != other?.javaClass) return false
|
||||
@@ -26,7 +26,7 @@ internal class IpcStatus(val enabled: Boolean = false): Status() {
|
||||
}
|
||||
}
|
||||
|
||||
internal class NetStatus(val enabled: Boolean = false, var name: String? = null, val speed: Speed? = null): Status() {
|
||||
class NetStatus(val enabled: Boolean = false, var name: String? = null, val speed: Speed? = null): Status() {
|
||||
class Speed(val tx: Int, val rx: Int) {
|
||||
|
||||
override fun toString(): String {
|
||||
@@ -56,7 +56,7 @@ internal class NetStatus(val enabled: Boolean = false, var name: String? = null,
|
||||
/**
|
||||
* android系统定位状态
|
||||
*/
|
||||
internal class GpsStatus(val enabled: Boolean = false, val isGranted: Boolean = false): Status() {
|
||||
class GpsStatus(val enabled: Boolean = false, val isGranted: Boolean = false): Status() {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (javaClass != other?.javaClass) return false
|
||||
@@ -81,7 +81,7 @@ internal class GpsStatus(val enabled: Boolean = false, val isGranted: Boolean =
|
||||
/**
|
||||
* RTK/GNSS定位状态
|
||||
*/
|
||||
internal class RTKStatus(var enabled: Boolean = false, var desc: String = "RTK"): Status() {
|
||||
class RTKStatus(var enabled: Boolean = false, var desc: String = "RTK"): Status() {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (javaClass != other?.javaClass) return false
|
||||
@@ -102,7 +102,7 @@ internal class RTKStatus(var enabled: Boolean = false, var desc: String = "RTK")
|
||||
/**
|
||||
* Can总线
|
||||
*/
|
||||
internal class CanStatus(var enabled: Boolean = false): Status() {
|
||||
class CanStatus(var enabled: Boolean = false): Status() {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (javaClass != other?.javaClass) return false
|
||||
@@ -125,7 +125,7 @@ internal class CanStatus(var enabled: Boolean = false): Status() {
|
||||
/**
|
||||
* 寻迹/算路/未知
|
||||
*/
|
||||
internal class TracingStatus(var state: Tracing = UNKNOWN): Status() {
|
||||
class TracingStatus(var state: Tracing = UNKNOWN): Status() {
|
||||
|
||||
enum class Tracing(val code: String? = "") {
|
||||
/**
|
||||
@@ -188,7 +188,7 @@ internal class TracingStatus(var state: Tracing = UNKNOWN): Status() {
|
||||
}
|
||||
}
|
||||
|
||||
internal fun String.toState(): Tracing? {
|
||||
fun String.toState(): Tracing? {
|
||||
return when(this) {
|
||||
"IMAP_TRA_EXIST" -> TRACK_FINDED
|
||||
"IMAP_TRA_LOADED" -> TRACK_LOADED
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.*
|
||||
import android.graphics.*
|
||||
import android.graphics.drawable.*
|
||||
import android.transition.*
|
||||
import android.util.*
|
||||
import android.view.*
|
||||
import androidx.appcompat.widget.*
|
||||
import androidx.constraintlayout.widget.*
|
||||
@@ -42,7 +43,6 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra
|
||||
}
|
||||
|
||||
private fun init() {
|
||||
isClickable = true
|
||||
dot.background = shape(solid = Color.parseColor("#F33F1D"), shape = GradientDrawable.OVAL, width = 30.PX, height = 30.PX)
|
||||
iv.also {
|
||||
it.background = ContextCompat.getDrawable(context, R.drawable.icon_dev_status_un_fold)
|
||||
@@ -59,13 +59,14 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra
|
||||
moveDuration = 0
|
||||
removeDuration = 0
|
||||
}
|
||||
itx.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||
itx.layoutManager = GridLayoutManager(context,4, GridLayoutManager.VERTICAL, false)
|
||||
itx.background = shape(solid = Color.parseColor("#80000000"), radius = 40.PX)
|
||||
itx.addItemDecoration(
|
||||
CommonDividerItemDecoration.Builder()
|
||||
.horizontalExternalSpace(38.PX)
|
||||
.verticalExternalSpace(30.PX)
|
||||
.spanCountLRCare(false)
|
||||
.verticalInnerSpace(20.PX)
|
||||
.spanCountTBCare(false)
|
||||
.horizontalInnerSpace(50.PX)
|
||||
.build()
|
||||
)
|
||||
@@ -90,6 +91,17 @@ internal class StatusView(private val model: StatusModel, ctx: Context): Constra
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVisibilityChanged(changedView: View, visibility: Int) {
|
||||
super.onVisibilityChanged(changedView, visibility)
|
||||
if (changedView != this) {
|
||||
if (visibility == View.VISIBLE) {
|
||||
observer?.also { model.status.observeForever(it) }
|
||||
} else {
|
||||
observer?.also { model.status.removeObserver(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun animate(expand: Boolean) {
|
||||
TransitionManager.beginDelayedTransition(this, AutoTransition().setDuration(200))
|
||||
rv.visibility = if (expand) View.VISIBLE else View.INVISIBLE
|
||||
|
||||
@@ -8,13 +8,12 @@
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="156px"
|
||||
android:minWidth="902px"
|
||||
android:layout_width="611px"
|
||||
android:layout_height="271px"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/iv"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginEnd="20px"
|
||||
android:layout_marginEnd="42px"
|
||||
android:overScrollMode="never"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
@@ -24,7 +23,7 @@
|
||||
android:layout_height="107px"
|
||||
android:layout_marginBottom="20px"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginTop="12px"
|
||||
app:layout_constraintStart_toEndOf="@+id/rv"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:background="@drawable/icon_dev_status_un_fold"/>
|
||||
|
||||
@@ -62,7 +62,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
|
||||
//Crash日志收集
|
||||
implementation rootProject.ext.dependencies.crashSdk
|
||||
// implementation rootProject.ext.dependencies.crashSdk
|
||||
implementation rootProject.ext.dependencies.boostmultidex
|
||||
|
||||
debugImplementation rootProject.ext.dependencies.debugleakcanary
|
||||
|
||||
@@ -74,7 +74,6 @@ import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
|
||||
import com.mogo.eagle.core.utilcode.reminder.*
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.*
|
||||
@@ -144,7 +143,9 @@ import java.util.*
|
||||
|
||||
private var adUpgradeDialog: AdUpgradeDialog?=null
|
||||
|
||||
private var speakJob: Job? = null
|
||||
private var lastSpeakJob: Job? = null
|
||||
|
||||
private var lastShowV2XJob: Job? = null
|
||||
|
||||
private var showingV2XTip: IReminder? = null
|
||||
private var roadVideoDialog: RoadVideoDialog? = null
|
||||
@@ -206,7 +207,7 @@ import java.util.*
|
||||
setProxyLimitingSpeedView(viewLimitingVelocity)
|
||||
setViewNotificationProvider(this)
|
||||
context?.also {
|
||||
CallerDevaToolsManager.showStatusBar(it, vs_status_bar)
|
||||
CallerDevaToolsManager.showStatusBar(it, statusBarContainer)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,11 +607,9 @@ import java.util.*
|
||||
CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!")
|
||||
return
|
||||
}
|
||||
speakJob?.safeCancel()
|
||||
val content = mViewNotificationProvider?.getNotificationView() ?: return
|
||||
content.setWarningIcon(EventTypeEnum.getWarningIcon(v2xType))
|
||||
content.setWarningContent(warningContent)
|
||||
var reminder: IReminder? = null
|
||||
Log.d("$M_HMI$TAG", "--- show v2x dialog 1 ---: info -> v2x-type: $v2xType : expireTime: $expireTime")
|
||||
Reminder.enqueue(this@MoGoHmiFragment, object : PopupWindowReminder(PopupWindow(content, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT).also { itx ->
|
||||
itx.isTouchable = false
|
||||
@@ -639,37 +638,42 @@ import java.util.*
|
||||
popupWindow.showAtLocation(parent, content.layoutGravity, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
override fun isOverride(): Boolean {
|
||||
return true
|
||||
}
|
||||
}.also { itx -> reminder = itx }, object : IStateChangeListener {
|
||||
|
||||
override fun key(): String {
|
||||
return v2xType
|
||||
}
|
||||
}, object : IStateChangeListener {
|
||||
|
||||
override fun onShow(reminder: IReminder) {
|
||||
listener?.onShow()
|
||||
lastShowV2XJob?.safeCancel()
|
||||
lastSpeakJob?.safeCancel()
|
||||
showingV2XTip = reminder
|
||||
lifecycleScope.launch {
|
||||
delay(expireTime)
|
||||
}.also { itx ->
|
||||
lastShowV2XJob = itx
|
||||
}.invokeOnCompletion { _ ->
|
||||
reminder.hide()
|
||||
}
|
||||
if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) {
|
||||
lifecycleScope.launch {
|
||||
speak(it, ttsContent)
|
||||
}.also {
|
||||
speakJob = it
|
||||
}.also { itx ->
|
||||
lastSpeakJob = itx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onHide(reminder: IReminder) {
|
||||
listener?.onDismiss()
|
||||
showingV2XTip = null
|
||||
showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
})
|
||||
|
||||
if (reminder == null) {
|
||||
return
|
||||
}
|
||||
showingV2XTip = reminder
|
||||
lifecycleScope.launch {
|
||||
delay(expireTime)
|
||||
reminder?.hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1210,7 +1214,7 @@ import java.util.*
|
||||
}
|
||||
|
||||
override fun showSmallFragment() {
|
||||
CallerDevaToolsManager.hideStatusBar()
|
||||
CallerDevaToolsManager.hideStatusBar(statusBarContainer)
|
||||
// 加载全览模式图层
|
||||
val fragmentOverview = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_OVERVIEW)
|
||||
.navigation() as BaseFragment
|
||||
@@ -1225,7 +1229,7 @@ import java.util.*
|
||||
}
|
||||
|
||||
override fun hideSmallFragment() {
|
||||
context?.let { CallerDevaToolsManager.showStatusBar(it, vs_status_bar) }
|
||||
context?.let { CallerDevaToolsManager.showStatusBar(it, statusBarContainer) }
|
||||
val fragmentOverview = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_OVERVIEW)
|
||||
.navigation() as BaseFragment
|
||||
activity?.supportFragmentManager?.beginTransaction()
|
||||
|
||||
@@ -129,14 +129,26 @@ public class SteeringWheelView extends ConstraintLayout {
|
||||
if (autopilotIV != null) {
|
||||
Log.d(TAG, "autopilotIV != null");
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
// TODO
|
||||
|
||||
autopilotIV.setImageResource(R.drawable.bg_auto);
|
||||
|
||||
} else {
|
||||
autopilotIV.setImageResource(R.drawable.bg_auto);
|
||||
}
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
autopilotIV.setImageResource(R.drawable.bg_auto_nor);
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
// TODO
|
||||
|
||||
} else {
|
||||
autopilotIV.setImageResource(R.drawable.bg_auto_nor);
|
||||
}
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
autopilotIV.setImageResource(R.drawable.bg_auto_nor);
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
// TODO
|
||||
|
||||
} else {
|
||||
autopilotIV.setImageResource(R.drawable.bg_auto_nor);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "autopilotIV=null");
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
@@ -42,6 +43,8 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
|
||||
private static final int MSG_SEND_UPDATE = 1;
|
||||
private volatile double acceleration;
|
||||
private volatile float mBrake;
|
||||
private volatile float mThrottle;
|
||||
|
||||
@SuppressLint("HandlerLeak")
|
||||
private final Handler handler = new Handler() {
|
||||
@@ -49,10 +52,28 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
public void handleMessage(@NonNull Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_SEND_UPDATE) {
|
||||
java.text.DecimalFormat mFormat = new java.text.DecimalFormat("0.00");
|
||||
String accStr = mFormat.format(acceleration);
|
||||
accTextView.setText("a: " + accStr);
|
||||
java.text.DecimalFormat mFormat = new java.text.DecimalFormat("0.0");
|
||||
String accStr = mFormat.format(Math.abs(acceleration));
|
||||
if (acceleration > 0f) {
|
||||
accTextView.setText(accStr);
|
||||
} else {
|
||||
accTextView.setText("- " + accStr);
|
||||
}
|
||||
int state = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState();
|
||||
if (state < 2) {
|
||||
if (mBrake > 0) {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_brake);
|
||||
} else if (mThrottle >= 0 && mBrake == 0) {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_accelerator);
|
||||
} else {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_empty);
|
||||
}
|
||||
}
|
||||
if (state == 2) {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_empty);
|
||||
}
|
||||
}
|
||||
handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -76,12 +97,12 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L);
|
||||
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener);
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, gnssInfo -> {
|
||||
if (gnssInfo != null) {
|
||||
acceleration = gnssInfo.getAcceleration();
|
||||
}
|
||||
handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -162,25 +183,13 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
@Override
|
||||
public void onAutopilotBrake(float brake) {
|
||||
CallerLogger.INSTANCE.d(TAG, "刹车:" + brake);
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (brake > 0) {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_brake);
|
||||
} else {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_empty);
|
||||
}
|
||||
});
|
||||
mBrake = brake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotThrottle(float throttle) {
|
||||
CallerLogger.INSTANCE.d(TAG, "油门:" + throttle);
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (throttle > 0) {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_accelerator);
|
||||
} else {
|
||||
brakeStatus.setImageResource(R.drawable.traffic_data_empty);
|
||||
}
|
||||
});
|
||||
mThrottle = throttle;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
android:layout_height="120px"
|
||||
android:layout_marginTop="30px"
|
||||
android:layout_marginEnd="40px"
|
||||
|
||||
android:background="@drawable/bg_waring_limiting_velocity"
|
||||
android:elevation="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
@@ -158,7 +159,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
|
||||
app:layout_goneMarginEnd="40px"
|
||||
app:layout_goneMarginTop="40px"
|
||||
tools:visibility="visible" />
|
||||
tools:visibility="gone" />
|
||||
|
||||
<!--左右转向灯-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.turnlight.TurnLightViewStatus
|
||||
@@ -189,13 +190,15 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vs_status_bar"
|
||||
android:layout_width="107px"
|
||||
android:layout_height="107px"
|
||||
<RelativeLayout
|
||||
android:id="@+id/statusBarContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="30px"
|
||||
app:layout_constraintTop_toTopOf="@+id/viewLimitingVelocity"
|
||||
app:layout_constraintEnd_toStartOf="@+id/viewLimitingVelocity"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/viewLimitingVelocity"/>
|
||||
app:layout_goneMarginTop="30px"
|
||||
app:layout_goneMarginEnd="40px"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
|
||||
@@ -73,8 +73,19 @@
|
||||
android:id="@+id/speedAccTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:layout_marginLeft="@dimen/dp_42"
|
||||
android:text="a: "
|
||||
android:layout_marginEnd="@dimen/dp_80"
|
||||
android:gravity="end"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/brakeStatus"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/brakeStatus"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:layout_marginLeft="@dimen/dp_14"
|
||||
android:text="a:"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/dp_40"
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.data.map.Infrastructure;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider;
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
|
||||
@@ -30,11 +29,8 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.business.PointCloudHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import ch.hsr.geohash.GeoHash;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
@@ -96,6 +92,7 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
|
||||
}
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -212,6 +209,17 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
|
||||
viewModel.fetchInfStructures();
|
||||
}
|
||||
|
||||
private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener() {
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp globalPathResp) {
|
||||
InfStructureManager.INSTANCE.savePlanningData(globalPathResp.getWayPointsList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotTrajectory(@NonNull List<MessagePad.TrajectoryPoint> trajectoryInfos) {}
|
||||
};
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getUIController() {
|
||||
return mMogoMap.getUIController();
|
||||
|
||||
@@ -72,7 +72,7 @@ class IdentifyOriginDataDrawer : Identify, IMoGoAutopilotStatusListener {
|
||||
//0是leading障碍物,障碍物车身红色提示
|
||||
trackObj?.let {
|
||||
colorTrafficData[trackId] = PlanningTrack(
|
||||
"#D77F70FF",
|
||||
"#D65D5AFF",
|
||||
CallerAutoPilotStatusListenerManager.getCurWgs84SatelliteTime()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.eagle.core.function.overview
|
||||
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
* 本地数据库查询出来的红绿灯、摄像头等数据
|
||||
@@ -17,6 +18,10 @@ object InfStructureManager {
|
||||
HashMap<String, ArrayList<Infrastructure>>()
|
||||
}
|
||||
|
||||
private val _planningList by lazy {
|
||||
ArrayList<MessagePad.Location>()
|
||||
}
|
||||
|
||||
fun saveData(map: HashMap<String, java.util.ArrayList<Infrastructure>>) {
|
||||
if (_infMap.isNotEmpty()) {
|
||||
_infMap.clear()
|
||||
@@ -34,4 +39,13 @@ object InfStructureManager {
|
||||
}
|
||||
|
||||
fun getPathData(): Map<String, ArrayList<Infrastructure>> = _pathMap
|
||||
|
||||
fun savePlanningData(planningList: List<MessagePad.Location>) {
|
||||
if (_planningList.isNotEmpty()) {
|
||||
_planningList.clear()
|
||||
}
|
||||
_planningList.addAll(planningList)
|
||||
}
|
||||
|
||||
fun getPlanningData() = _planningList
|
||||
}
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.mogo.eagle.core.function.overview.vm
|
||||
|
||||
import androidx.lifecycle.*
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
import com.mogo.eagle.core.function.overview.OverviewDao
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import kotlinx.coroutines.launch
|
||||
import java.lang.Exception
|
||||
|
||||
class OverViewModel(
|
||||
private val overviewDao: OverviewDao
|
||||
) : ViewModel() {
|
||||
private val _infStructures = MutableLiveData<List<Infrastructure>>()
|
||||
|
||||
val infStructures
|
||||
get() = _infStructures
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@ package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
@@ -14,62 +12,36 @@ import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
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.navi.AMapNavi;
|
||||
import com.amap.api.navi.AMapNaviListener;
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.amap.api.navi.AMapNaviViewListener;
|
||||
import com.amap.api.navi.AMapNaviViewOptions;
|
||||
import com.amap.api.navi.enums.NaviType;
|
||||
import com.amap.api.navi.model.AMapCalcRouteResult;
|
||||
import com.amap.api.navi.model.AMapLaneInfo;
|
||||
import com.amap.api.navi.model.AMapModelCross;
|
||||
import com.amap.api.navi.model.AMapNaviCameraInfo;
|
||||
import com.amap.api.navi.model.AMapNaviCross;
|
||||
import com.amap.api.navi.model.AMapNaviInfo;
|
||||
import com.amap.api.navi.model.AMapNaviLocation;
|
||||
import com.amap.api.navi.model.AMapNaviRouteNotifyData;
|
||||
import com.amap.api.navi.model.AMapNaviTrafficFacilityInfo;
|
||||
import com.amap.api.navi.model.AMapServiceAreaInfo;
|
||||
import com.amap.api.navi.model.AimLessModeCongestionInfo;
|
||||
import com.amap.api.navi.model.AimLessModeStat;
|
||||
import com.amap.api.navi.model.NaviInfo;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.amap.api.navi.model.RouteOverlayOptions;
|
||||
import com.autonavi.tbt.TrafficFacilityInfo;
|
||||
import com.elegant.utils.UiThreadHandler;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.Infrastructure;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager;
|
||||
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.common.utils.DrivingDirectionUtils;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -79,9 +51,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import ch.hsr.geohash.GeoHash;
|
||||
import kotlin.Pair;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
* 小地图的方向View
|
||||
@@ -92,23 +63,14 @@ import system_master.SystemStatusInfo;
|
||||
*/
|
||||
public class AMapCustomView
|
||||
extends RelativeLayout
|
||||
implements IMoGoMapLocationListener, ISmallMapDirectionView, AMapNaviListener, AMapNaviViewListener {
|
||||
implements IMoGoMapLocationListener {
|
||||
public static final String TAG = "AMapCustomView";
|
||||
private AMapNaviView mAMapNaviView;
|
||||
protected AMapNavi mAMapNavi;
|
||||
private TextureMapView mAMapView;
|
||||
private AMap mAMap;
|
||||
protected NaviLatLng mStartLatlng = new NaviLatLng();
|
||||
protected NaviLatLng mEndLatlng = new NaviLatLng();
|
||||
protected final List<NaviLatLng> sList = new ArrayList<NaviLatLng>();
|
||||
protected final List<NaviLatLng> eList = new ArrayList<NaviLatLng>();
|
||||
private int zoomLevel = 15;
|
||||
private final List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
private final List<MogoLatLng> mCoordinatesLatLngCurrent = new ArrayList<>();
|
||||
protected List<NaviLatLng> mWayPointList = new ArrayList<NaviLatLng>();
|
||||
private Polyline mPolyline;
|
||||
private CameraUpdate mCameraUpdate;
|
||||
private Context mContext;
|
||||
private float tilt = 30f;
|
||||
private float mTilt = 60f;
|
||||
private TextView overLayerView;
|
||||
private boolean calculate = false;
|
||||
|
||||
@@ -116,6 +78,23 @@ public class AMapCustomView
|
||||
private Map<String, ArrayList<Infrastructure>> pathMap = new HashMap();
|
||||
private Map<LatLng, ArrayList<Infrastructure>> posInfMap = new HashMap();
|
||||
|
||||
// =============绘制轨迹线相关=============
|
||||
private Marker mCarMarker;
|
||||
private Marker mCompassMarker;
|
||||
private Marker mStartMarker;
|
||||
private Marker mEndMarker;
|
||||
private Polyline mBottomPolyline;
|
||||
private Polyline mCoveredPolyline;
|
||||
// 计算索引并设置对应的Bitmap
|
||||
BitmapDescriptor arrivedBitmap;
|
||||
BitmapDescriptor unArrivedBitmap;
|
||||
// 绘制轨迹线的集合
|
||||
private List<BitmapDescriptor> textureList = new ArrayList<>();
|
||||
private List<Integer> texIndexList = new ArrayList<>();
|
||||
|
||||
private MogoLocation mLocation;
|
||||
private boolean isFirstLocation = true;
|
||||
|
||||
public AMapCustomView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -136,35 +115,48 @@ public class AMapCustomView
|
||||
private void initView(Context context) {
|
||||
mContext = context;
|
||||
View smpView = LayoutInflater.from(context).inflate(R.layout.module_overview_map_view, this);
|
||||
mAMapNaviView = smpView.findViewById(R.id.aMapNaviView);
|
||||
mAMapView = smpView.findViewById(R.id.aMapView);
|
||||
overLayerView = findViewById(R.id.overLayer);
|
||||
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
overLayerView.setBackground(getResources().getDrawable(R.drawable.amap_reset));
|
||||
}else {
|
||||
arrivedBitmap = BitmapDescriptorFactory.fromResource(R.drawable.arrow_arrived_img);
|
||||
unArrivedBitmap = BitmapDescriptorFactory.fromResource(R.drawable.amap_bus_smooth_route);
|
||||
} else {
|
||||
overLayerView.setBackground(getResources().getDrawable(R.drawable.amap_reset_bus));
|
||||
arrivedBitmap = BitmapDescriptorFactory.fromResource(R.drawable.arrow_arrived_img);
|
||||
unArrivedBitmap = BitmapDescriptorFactory.fromResource(R.drawable.amap_bus_smooth_route);
|
||||
}
|
||||
mAMapNavi = AMapNavi.getInstance(context);
|
||||
mAMapNavi.addAMapNaviListener(this);
|
||||
mAMapNaviView.setAMapNaviViewListener(this);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
initAMapView(context);
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
|
||||
//设置全览模式
|
||||
overLayerView.setOnClickListener(v -> {
|
||||
mAMapNaviView.displayOverview();
|
||||
displayCustomOverView();
|
||||
});
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
}
|
||||
|
||||
private void initAMapView(Context context) {
|
||||
Log.d(TAG, "initAMapView");
|
||||
mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
|
||||
mAMap = mAMapNaviView.getMap();
|
||||
mAMap = mAMapView.getMap();
|
||||
mAMap.setOnMapLoadedListener(() -> {
|
||||
Log.d(TAG, "---onMapLoaded---");
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions();
|
||||
// 加载自定义样式
|
||||
customMapStyleOptions.setEnable(true);
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
customMapStyleOptions.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style.data"));
|
||||
customMapStyleOptions.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra.data"));
|
||||
} else {
|
||||
customMapStyleOptions.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style_bus.data"));
|
||||
customMapStyleOptions.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra_bus.data"));
|
||||
}
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
// 实时路况图层关闭,必须添加在loaded结束之后,其他位置不生效
|
||||
mAMap.setTrafficEnabled(false);
|
||||
});
|
||||
setUpMap();
|
||||
customOptions();
|
||||
}
|
||||
@@ -195,98 +187,28 @@ public class AMapCustomView
|
||||
* 自定义导航View和路况状态
|
||||
*/
|
||||
private void customOptions() {
|
||||
AMapNaviViewOptions options = mAMapNaviView.getViewOptions();
|
||||
//关闭自动绘制路线,自行绘制路线
|
||||
// options.setAutoDrawRoute(false);
|
||||
//不显示导航界面
|
||||
options.setLayoutVisible(false);
|
||||
options.setTilt(60);
|
||||
//黑夜模式
|
||||
options.setNaviNight(true);
|
||||
//导航全程光柱
|
||||
options.setTrafficBarEnabled(false);
|
||||
//隐藏摄像头
|
||||
options.setCameraBubbleShow(false);
|
||||
//转向箭头
|
||||
options.setNaviArrowVisible(false);
|
||||
//指南针
|
||||
// options.setCompassEnabled(false);
|
||||
// options.setTilt((int) tilt);
|
||||
//自车车标
|
||||
options.setCarBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.map_car_icon));
|
||||
options.setFourCornersBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.amap_custom_corner));
|
||||
options.setStartPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.module_small_map_view_dir_start));
|
||||
options.setWayPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.icon_module_small_map_four_corners));
|
||||
options.setEndPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.module_small_map_view_dir_end));
|
||||
//与走过的路线
|
||||
options.setAfterRouteAutoGray(true);
|
||||
//路线纹理自定义
|
||||
RouteOverlayOptions routeOverlayOptions = new RouteOverlayOptions();
|
||||
routeOverlayOptions.setTurnArrowIs3D(false);
|
||||
// 未知路段和导航路段颜色一样
|
||||
routeOverlayOptions.setUnknownTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.amap_custom_smooth_route));//未知路段
|
||||
routeOverlayOptions.setSmoothTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.amap_custom_smooth_route));
|
||||
routeOverlayOptions.setJamTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_bad));//拥堵路段
|
||||
routeOverlayOptions.setVeryJamTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_grayred));//超级拥堵路段
|
||||
routeOverlayOptions.setPassRoute(BitmapFactory.decodeResource(getResources(), R.drawable.amap_custom_pass_route));//走过的路段
|
||||
options.setRouteOverlayOptions(routeOverlayOptions);
|
||||
mAMapNaviView.setTrafficLightsVisible(true);
|
||||
mAMapNaviView.setViewOptions(options);
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.map_car_icon))
|
||||
.anchor(0.5f, 0.5f));
|
||||
mCompassMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.amap_custom_corner))
|
||||
.anchor(0.5f, 0.5f));
|
||||
} else {
|
||||
mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.map_bus_icon))
|
||||
.anchor(0.5f, 0.5f));
|
||||
mCompassMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.amap_bus_corner))
|
||||
.anchor(0.5f, 0.5f));
|
||||
}
|
||||
|
||||
mStartMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_start)));
|
||||
mEndMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_end)));
|
||||
}
|
||||
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @org.jetbrains.annotations.Nullable String reason) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@org.jetbrains.annotations.Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@org.jetbrains.annotations.Nullable MessagePad.ArrivalNotification arrivalNotification) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (autoPilotStatusInfo == null) return;
|
||||
int state = autoPilotStatusInfo.getState();
|
||||
//0 不能自动驾驶 1 可以自动驾驶,但是在人工干预 2 自动驾驶中
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
Log.d(TAG, "自动驾驶中 state=" + String.valueOf(state));
|
||||
if (sList.size() == 0 && eList.size() == 0 && mWayPointList.size() == 0) {
|
||||
Log.d(TAG, "sendGlobalPathReq");
|
||||
AdasManager.getInstance().sendGlobalPathReq();
|
||||
}
|
||||
} else {
|
||||
int type = mAMapNavi.getNaviType();
|
||||
Log.d(TAG, "非自动驾驶状态,导航类型==" + String.valueOf(type));
|
||||
if (type == NaviType.GPS || type == NaviType.EMULATOR) {
|
||||
mAMapNavi.stopNavi();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener() {
|
||||
|
||||
@Override
|
||||
@@ -301,52 +223,39 @@ public class AMapCustomView
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotRotting(@org.jetbrains.annotations.Nullable MessagePad.GlobalPathResp globalPathResp) {
|
||||
if (calculate == true && sList.size() == 0 && eList.size() == 0 && mWayPointList.size() == 0) {
|
||||
return;
|
||||
}
|
||||
calculate = true;
|
||||
Log.d(TAG, "onAutopilotRotting");
|
||||
List list = globalPathResp.getWayPointsList();
|
||||
int minCount = 2;
|
||||
if (list.size() >= minCount) {
|
||||
calculate = true;
|
||||
MessagePad.Location sLocation = (MessagePad.Location) list.get(0);
|
||||
MessagePad.Location eLocation = (MessagePad.Location) list.get(list.size() - 1);
|
||||
mStartLatlng = new NaviLatLng(sLocation.getLatitude(), sLocation.getLongitude());
|
||||
mEndLatlng = new NaviLatLng(eLocation.getLatitude(), eLocation.getLongitude());
|
||||
sList.clear();
|
||||
eList.clear();
|
||||
sList.add(mStartLatlng);
|
||||
eList.add(mEndLatlng);
|
||||
|
||||
mWayPointList.clear();
|
||||
for (int i = 1; i < list.size() - minCount; i++) {
|
||||
MessagePad.Location wayLoc = (MessagePad.Location) list.get(i);
|
||||
NaviLatLng way = new NaviLatLng(wayLoc.getLatitude(), wayLoc.getLongitude());
|
||||
mWayPointList.add(way);
|
||||
}
|
||||
}
|
||||
int strategy = 0;
|
||||
try {
|
||||
//再次强调,最后一个参数为true时代表多路径,否则代表单路径
|
||||
strategy = mAMapNavi.strategyConvert(true, false, false, false, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.d(TAG, "全局路径" + list.size() + ",起点:" + sList.toString() + ",终点:" + eList.toString() + ",经点:" + mWayPointList.toString());
|
||||
//指定路径绘制导航路线
|
||||
mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList, strategy);
|
||||
|
||||
drawInfrastructureMarkers(globalPathResp);
|
||||
handlePlanningData(globalPathResp.getWayPointsList());
|
||||
}
|
||||
};
|
||||
|
||||
public void handlePlanningData(List<MessagePad.Location> locationList) {
|
||||
List list = locationList;
|
||||
// 转成高德坐标系并存储
|
||||
MarkerDrawerManager.INSTANCE.updateRoutePoints(list, mContext);
|
||||
List<LatLng> planningPointList = MarkerDrawerManager.INSTANCE.getPlanningPoints();
|
||||
UiThreadHandler.post(() -> {
|
||||
displayCustomOverView();
|
||||
drawStartAndEndMarker(planningPointList);
|
||||
});
|
||||
MarkerDrawerManager.INSTANCE.setCallback((points, locIndex) -> {
|
||||
// 每1s刷新一下轨迹线
|
||||
UiThreadHandler.post(() -> {
|
||||
if (points.size() > 0) {
|
||||
drawPolyline(points, locIndex);
|
||||
}
|
||||
});
|
||||
});
|
||||
MarkerDrawerManager.INSTANCE.startLoopCalCarLocation();
|
||||
UiThreadHandler.post(() -> {
|
||||
drawInfrastructureMarkers(locationList);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
// 注册定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
@@ -358,395 +267,78 @@ public class AMapCustomView
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from) {
|
||||
|
||||
}
|
||||
|
||||
private void removeLocation(Location latLng) {
|
||||
for (LatLng l : mCoordinatesLatLng) {
|
||||
if (!isPointOnCarFront(latLng, l)) {
|
||||
mCoordinatesLatLng.remove(l);
|
||||
mLocation = location;
|
||||
MarkerDrawerManager.INSTANCE.setLonLat(new Pair(location.getLongitude(), location.getLatitude()));
|
||||
UiThreadHandler.post(() -> {
|
||||
drawCarMarker(location);
|
||||
if (isFirstLocation) {
|
||||
displayCustomOverView();
|
||||
isFirstLocation = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPointOnCarFront(Location carLocal, LatLng pointLocal) {
|
||||
double carLon = carLocal.getLongitude();
|
||||
double carLat = carLocal.getLatitude();
|
||||
double poiLon = pointLocal.longitude;
|
||||
double poiLat = pointLocal.latitude;
|
||||
float carAngle = carLocal.getBearing();
|
||||
|
||||
// 计算车辆与点之间的夹角
|
||||
int diffAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
carLon, carLat, poiLon, poiLat, (int) carAngle);
|
||||
|
||||
return diffAngle <= 90;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawablePolyline() {
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
return mCoordinateConverter.convert();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
public void resetPolyLine() {
|
||||
mCoordinatesLatLng.clear();
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onCreateView(Bundle savedInstanceState) {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
if (mAMapView != null) {
|
||||
mAMapView.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onResume();
|
||||
if (mAMapView != null) {
|
||||
mAMapView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onPause();
|
||||
if (mAMapView != null) {
|
||||
mAMapView.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onDestroy();
|
||||
if (mAMapView != null) {
|
||||
mAMapView.onDestroy();
|
||||
}
|
||||
//since 1.6.0 不再在naviview destroy的时候自动执行AMapNavi.stopNavi();请自行执行
|
||||
if (mAMapNavi != null) {
|
||||
mAMapNavi.stopNavi();
|
||||
mAMapNavi.destroy();
|
||||
}
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onDestroy();
|
||||
|
||||
if (mAMapView != null) {
|
||||
mAMapView.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void convert(List<MogoLatLng> coordinates) {
|
||||
|
||||
}
|
||||
|
||||
//多路径算路成功回调
|
||||
@Override
|
||||
public void onCalculateRouteSuccess(int[] ints) {
|
||||
Log.d(TAG, "onCalculateRouteSuccess int");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
calculate = false;
|
||||
Log.d(TAG, "onInitNaviFailure");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
Log.d(TAG, "onInitNaviSuccess");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi(int i) {
|
||||
Log.d(TAG, "onStartNavi");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrafficStatusUpdate() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChange(AMapNaviLocation aMapNaviLocation) {
|
||||
// Log.d(TAG, "高德地图经纬度:" + aMapNaviLocation.getCoord().getLongitude() + "," + aMapNaviLocation.getCoord().getLatitude());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetNavigationText(int i, String s) {
|
||||
Log.d(TAG, "onGetNavigationText int");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetNavigationText(String s) {
|
||||
Log.d(TAG, "onGetNavigationText ss");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEndEmulatorNavi() {
|
||||
Log.d(TAG, "onEndEmulatorNavi");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveDestination() {
|
||||
Log.d(TAG, "onArriveDestination");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateRouteFailure(int i) {
|
||||
Log.d(TAG, "onCalculateRouteFailure");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReCalculateRouteForYaw() {
|
||||
Log.d(TAG, "onReCalculateRouteForYaw");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReCalculateRouteForTrafficJam() {
|
||||
Log.d(TAG, "onReCalculateRouteForTrafficJam");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArrivedWayPoint(int i) {
|
||||
Log.d(TAG, "onArrivedWayPoint");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGpsOpenStatus(boolean b) {
|
||||
Log.d(TAG, "onGpsOpenStatus");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(NaviInfo naviInfo) {
|
||||
Log.d(TAG, "onNaviInfoUpdate");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdated(AMapNaviInfo aMapNaviInfo) {
|
||||
Log.d(TAG, "onNaviInfoUpdated");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCameraInfo(AMapNaviCameraInfo[] aMapNaviCameraInfos) {
|
||||
Log.d(TAG, "updateCameraInfo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateIntervalCameraInfo(AMapNaviCameraInfo aMapNaviCameraInfo, AMapNaviCameraInfo aMapNaviCameraInfo1, int i) {
|
||||
Log.d(TAG, "updateIntervalCameraInfo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceAreaUpdate(AMapServiceAreaInfo[] aMapServiceAreaInfos) {
|
||||
Log.d(TAG, "onServiceAreaUpdate");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCross(AMapNaviCross aMapNaviCross) {
|
||||
Log.d(TAG, "showCross");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideCross() {
|
||||
Log.d(TAG, "hideCross");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showModeCross(AMapModelCross aMapModelCross) {
|
||||
Log.d(TAG, "showModeCross");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideModeCross() {
|
||||
Log.d(TAG, "hideModeCross");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLaneInfo(AMapLaneInfo[] aMapLaneInfos, byte[] bytes, byte[] bytes1) {
|
||||
Log.d(TAG, "showLaneInfo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLaneInfo(AMapLaneInfo aMapLaneInfo) {
|
||||
Log.d(TAG, "showLaneInfo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideLaneInfo() {
|
||||
Log.d(TAG, "hideLaneInfo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyParallelRoad(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OnUpdateTrafficFacility(AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OnUpdateTrafficFacility(AMapNaviTrafficFacilityInfo aMapNaviTrafficFacilityInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OnUpdateTrafficFacility(TrafficFacilityInfo trafficFacilityInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAimlessModeStatistics(AimLessModeStat aimLessModeStat) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAimlessModeCongestionInfo(AimLessModeCongestionInfo aimLessModeCongestionInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayRing(int i) {
|
||||
|
||||
}
|
||||
|
||||
//算路详情
|
||||
@Override
|
||||
public void onCalculateRouteSuccess(AMapCalcRouteResult aMapCalcRouteResult) {
|
||||
Log.d(TAG, "onCalculateRouteSuccess aMapCalcRouteResult" + aMapCalcRouteResult.toString());
|
||||
//提测修改为EMULATOR
|
||||
mAMapNavi.startNavi(NaviType.GPS);
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
mAMapNaviView.displayOverview();
|
||||
}, 2000);
|
||||
//停止导航测试代码
|
||||
// UiThreadHandler.postDelayed(() -> {
|
||||
// mAMapNavi.stopNavi();
|
||||
// Log.d(TAG, "stop------------");
|
||||
// }, 20000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateRouteFailure(AMapCalcRouteResult aMapCalcRouteResult) {
|
||||
Log.d(TAG, "onCalculateRouteFailure");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviRouteNotify(AMapNaviRouteNotifyData aMapNaviRouteNotifyData) {
|
||||
Log.d(TAG, "onNaviRouteNotify");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviSetting() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviCancel() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNaviBackClick() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviMapMode(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviTurnClick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNextRoadClick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScanViewButtonClick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap(boolean b) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviViewLoaded() {
|
||||
Log.d(TAG, "---onNaviViewLoaded---");
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions();
|
||||
// 加载自定义样式
|
||||
customMapStyleOptions.setEnable(true);
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
customMapStyleOptions.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style.data"));
|
||||
customMapStyleOptions.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra.data"));
|
||||
} else {
|
||||
customMapStyleOptions.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style_bus.data"));
|
||||
customMapStyleOptions.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra_bus.data"));
|
||||
public void clearCustomPolyline() {
|
||||
if (mBottomPolyline != null) {
|
||||
mBottomPolyline.remove();
|
||||
}
|
||||
if (mCoveredPolyline != null) {
|
||||
mCoveredPolyline.remove();
|
||||
}
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
// 实时路况图层关闭,必须添加在loaded结束之后,其他位置不生效
|
||||
mAMap.setTrafficEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapTypeChanged(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviViewShowMode(int i) {
|
||||
|
||||
}
|
||||
|
||||
private void drawInfrastructureMarkers(MessagePad.GlobalPathResp globalPathResp) {
|
||||
if (globalPathResp != null) {
|
||||
if (!pathMap.isEmpty()) {
|
||||
pathMap.clear();
|
||||
}
|
||||
String geoHash;
|
||||
ArrayList<Infrastructure> infList;
|
||||
for (MessagePad.Location location : globalPathResp.getWayPointsList()) {
|
||||
geoHash = GeoHash.withCharacterPrecision(location.getLatitude(), location.getLongitude(), 7).toBase32();
|
||||
// 网格内的轨迹点只取一次
|
||||
if (!pathMap.containsKey(geoHash)) {
|
||||
// 从缓存的新基建数据中去取对应geoHash的新基建数据集合
|
||||
infList = InfStructureManager.INSTANCE.getData().get(geoHash);
|
||||
if (infList != null) {
|
||||
pathMap.put(geoHash, infList);
|
||||
}
|
||||
/**
|
||||
* 绘制新基建Markers(比如:摄像头)
|
||||
*
|
||||
* @param locationList
|
||||
*/
|
||||
private void drawInfrastructureMarkers(List<MessagePad.Location> locationList) {
|
||||
if (!pathMap.isEmpty()) {
|
||||
pathMap.clear();
|
||||
}
|
||||
String geoHash;
|
||||
ArrayList<Infrastructure> infList;
|
||||
for (MessagePad.Location location : locationList) {
|
||||
LatLng latLng = MarkerDrawerManager.INSTANCE.coordinateConverterWgsToGcj(mContext, location);
|
||||
geoHash = GeoHash.withCharacterPrecision(latLng.latitude, latLng.longitude, 7).toBase32();
|
||||
// 网格内的轨迹点只取一次s
|
||||
if (!pathMap.containsKey(geoHash)) {
|
||||
// 从缓存的新基建数据中去取对应geoHash的新基建数据集合
|
||||
infList = InfStructureManager.INSTANCE.getData().get(geoHash);
|
||||
if (infList != null) {
|
||||
pathMap.put(geoHash, infList);
|
||||
}
|
||||
}
|
||||
drawInfMarkers(pathMap);
|
||||
}
|
||||
drawInfMarkers(pathMap);
|
||||
}
|
||||
|
||||
public void drawInfMarkers(Map<String, ArrayList<Infrastructure>> infStruMap) {
|
||||
@@ -782,7 +374,7 @@ public class AMapCustomView
|
||||
});
|
||||
}
|
||||
|
||||
private Bitmap getBitmap(int count) {
|
||||
private Bitmap getBitmap(int count) {
|
||||
MakerWithCount marker = new MakerWithCount(getContext());
|
||||
marker.setCount(count);
|
||||
|
||||
@@ -793,4 +385,114 @@ public class AMapCustomView
|
||||
marker.draw(new Canvas(bitmap));
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入自定义全览模式
|
||||
*/
|
||||
private void displayCustomOverView() {
|
||||
ArrayList<LatLng> linePointsLatLng = MarkerDrawerManager.INSTANCE.getPlanningPoints();
|
||||
MogoLocation location = mLocation;
|
||||
if (linePointsLatLng.size() > 1) {
|
||||
//圈定地图显示范围
|
||||
//存放经纬度
|
||||
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
|
||||
for (int i = 0; i < linePointsLatLng.size(); i++) {
|
||||
boundsBuilder.include(linePointsLatLng.get(i));
|
||||
}
|
||||
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
boundsBuilder.include(currentLatLng);
|
||||
|
||||
CameraPosition cameraPosition = new CameraPosition.Builder().tilt(mTilt).build();
|
||||
//第二个参数为四周留空宽度
|
||||
mAMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(), 100, 100, 100, 100));
|
||||
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
} else {
|
||||
//设置希望展示的地图缩放级别
|
||||
CameraPosition cameraPosition = new CameraPosition.Builder()
|
||||
.target(mCarMarker.getPosition()).tilt(0).zoom(zoomLevel).build();
|
||||
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制自车
|
||||
*
|
||||
* @param location
|
||||
*/
|
||||
private void drawCarMarker(MogoLocation location) {
|
||||
if (location == null) return;
|
||||
if (mCarMarker != null) {
|
||||
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
mCarMarker.setRotateAngle(360 - location.getBearing());
|
||||
mCarMarker.setPosition(currentLatLng);
|
||||
mCarMarker.setToTop();
|
||||
if (mCompassMarker != null) {
|
||||
mCompassMarker.setRotateAngle(360 - location.getBearing());
|
||||
mCompassMarker.setPosition(currentLatLng);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制起始点、终点
|
||||
*/
|
||||
private void drawStartAndEndMarker(List<LatLng> coordinates) {
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
if (coordinates.size() > 2) {
|
||||
// 设置开始结束Marker位置
|
||||
|
||||
LatLng startLatLng = coordinates.get(0);
|
||||
LatLng endLatLng = coordinates.get(coordinates.size() - 1);
|
||||
|
||||
mStartMarker.setPosition(startLatLng);
|
||||
mEndMarker.setPosition(endLatLng);
|
||||
mStartMarker.setVisible(true);
|
||||
mEndMarker.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制轨迹线
|
||||
*
|
||||
* @param coordinates
|
||||
* @param locIndex
|
||||
*/
|
||||
private void drawPolyline(List<LatLng> coordinates, int locIndex) {
|
||||
if (textureList.size() > 0) {
|
||||
textureList.clear();
|
||||
}
|
||||
if (texIndexList.size() > 0) {
|
||||
texIndexList.clear();
|
||||
}
|
||||
for (int i = 0; i < coordinates.size(); i++) {
|
||||
if (i <= locIndex) {
|
||||
// 已走过的置灰
|
||||
textureList.add(arrivedBitmap);
|
||||
} else {
|
||||
// 未走过的纹理
|
||||
textureList.add(unArrivedBitmap);
|
||||
}
|
||||
texIndexList.add(i);
|
||||
}
|
||||
if (mAMap != null && coordinates.size() > 2) {
|
||||
//设置线段纹理
|
||||
PolylineOptions polylineOptions = new PolylineOptions();
|
||||
polylineOptions.addAll(coordinates);
|
||||
polylineOptions.width(14); //线段宽度
|
||||
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
|
||||
polylineOptions.setCustomTextureList(textureList);
|
||||
polylineOptions.setCustomTextureIndex(texIndexList);
|
||||
// 绘制线
|
||||
mBottomPolyline = mCoveredPolyline;
|
||||
mCoveredPolyline = mAMap.addPolyline(polylineOptions);
|
||||
if (mBottomPolyline != null) {
|
||||
mBottomPolyline.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.mogo.eagle.core.function.smp
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.amap.api.maps.CoordinateConverter
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* 自定义高德地图画线管理者
|
||||
*/
|
||||
object MarkerDrawerManager {
|
||||
|
||||
interface Callback {
|
||||
fun onLocationChanged(planningPoints: List<LatLng>, locIndex: Int)
|
||||
}
|
||||
|
||||
private val routeWipeDisposable by lazy {
|
||||
CompositeDisposable()
|
||||
}
|
||||
|
||||
// 自主画线的所有高德坐标系的轨迹点
|
||||
val planningPoints by lazy {
|
||||
ArrayList<LatLng>()
|
||||
}
|
||||
|
||||
@Volatile
|
||||
var lastArrivedIndex: Int = -1
|
||||
|
||||
@Volatile
|
||||
var lonLat = Pair(0.0, 0.0)
|
||||
|
||||
var callback: Callback? = null
|
||||
|
||||
fun startLoopCalCarLocation() {
|
||||
getLoopCalCarObservable().delay(1000L, TimeUnit.MILLISECONDS, true)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.repeat()
|
||||
.retry()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe().let {
|
||||
routeWipeDisposable.add(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun stopLoopCalCarLocation() {
|
||||
if (!routeWipeDisposable.isDisposed) {
|
||||
routeWipeDisposable.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLoopCalCarObservable(): Observable<Int> {
|
||||
return Observable.create(ObservableOnSubscribe { emitter ->
|
||||
if (emitter.isDisposed) return@ObservableOnSubscribe
|
||||
loopRouteAndWipe(planningPoints, lonLat.first, lonLat.second)
|
||||
emitter.onComplete()
|
||||
})
|
||||
}
|
||||
|
||||
private fun loopRouteAndWipe(routePoints: List<LatLng>?, lon: Double, lat: Double) {
|
||||
if (routePoints != null && routePoints.isNotEmpty()) {
|
||||
val arrivedIndex: Int = getArrivedPointIndex(routePoints, lon, lat)
|
||||
Log.d("cff", "thread is:${Thread.currentThread().name},arrivedIndex is:$arrivedIndex")
|
||||
if (arrivedIndex != -1 && lastArrivedIndex != arrivedIndex) {
|
||||
callback?.onLocationChanged(routePoints, arrivedIndex)
|
||||
lastArrivedIndex = arrivedIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateRoutePoints(routePoints: List<MessagePad.Location>?, context: Context) {
|
||||
if (routePoints == null || routePoints.isEmpty()) return
|
||||
val latLngModels = coordinateConverterWgsToGcjListCommon(context, routePoints)
|
||||
planningPoints.clear()
|
||||
planningPoints.addAll(latLngModels)
|
||||
// float remainingSumLength = calculateRemainingSumLength(mRoutePoints);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param routePoints
|
||||
* @param realLon
|
||||
* @param realLat
|
||||
* @return 返回已经到达点的index
|
||||
*/
|
||||
private fun getArrivedPointIndex(
|
||||
routePoints: List<LatLng>,
|
||||
realLon: Double,
|
||||
realLat: Double
|
||||
): Int {
|
||||
var currentIndex = 0 //记录疑似点
|
||||
if (routePoints.isNotEmpty()) {
|
||||
//基础点
|
||||
val baseLatLng = routePoints[0]
|
||||
var baseDiffDis = CoordinateUtils.calculateLineDistance(
|
||||
realLon, realLat, baseLatLng.longitude, baseLatLng.latitude
|
||||
) // lon,lat, prelon, prelat
|
||||
for (i in 1 until routePoints.size) {
|
||||
val latLng = routePoints[i]
|
||||
val diff = CoordinateUtils.calculateLineDistance(
|
||||
realLon, realLat, latLng.longitude, latLng.latitude
|
||||
)
|
||||
if (baseDiffDis > diff) {
|
||||
baseDiffDis = diff
|
||||
currentIndex = i
|
||||
}
|
||||
}
|
||||
return currentIndex
|
||||
}
|
||||
return currentIndex
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param points
|
||||
* @return 剩余的总距离
|
||||
*/
|
||||
private fun calculateRemainingSumLength(points: List<LatLng>?): Float {
|
||||
if (null == points || points.isEmpty()) return 0F
|
||||
var sumLength = 0f
|
||||
|
||||
//计算全路径总距离
|
||||
var i = 0
|
||||
while (i + 1 < points.size) {
|
||||
val preLat = points[i].latitude
|
||||
val preLon = points[i].longitude
|
||||
val laLat = points[i + 1].latitude
|
||||
val laLon = points[i + 1].longitude
|
||||
val length = CoordinateUtils.calculateLineDistance(laLon, laLat, preLon, preLat)
|
||||
sumLength += length
|
||||
i++
|
||||
}
|
||||
return sumLength
|
||||
}
|
||||
|
||||
private fun coordinateConverterWgsToGcjListCommon(
|
||||
mContext: Context,
|
||||
models: List<MessagePad.Location>
|
||||
): List<LatLng> {
|
||||
//转成MogoLatLng集合
|
||||
val list: MutableList<LatLng> = java.util.ArrayList()
|
||||
for (m in models) {
|
||||
val mogoLatLng = coordinateConverterWgsToGcj(mContext, m)
|
||||
list.add(mogoLatLng)
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
fun coordinateConverterWgsToGcj(
|
||||
mContext: Context,
|
||||
mogoLatLng: MessagePad.Location
|
||||
): LatLng {
|
||||
val mCoordinateConverter =
|
||||
CoordinateConverter(mContext)
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS)
|
||||
mCoordinateConverter.coord(LatLng(mogoLatLng.latitude, mogoLatLng.longitude))
|
||||
return mCoordinateConverter.convert()
|
||||
}
|
||||
}
|
||||
@@ -4,32 +4,18 @@ import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.mvp.BaseFragment;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager;
|
||||
import com.mogo.eagle.core.data.map.Infrastructure;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
@@ -38,8 +24,7 @@ import system_master.SystemStatusInfo;
|
||||
*/
|
||||
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_OVERVIEW)
|
||||
public class OverviewMapFragment extends BaseFragment
|
||||
implements IMogoSmallMapProvider, IMoGoAutopilotPlanningListener,
|
||||
IMoGoAutopilotStatusListener {
|
||||
implements IMogoSmallMapProvider {
|
||||
private final String TAG = "SmallMapFragment";
|
||||
protected AMapCustomView mAMapCustomView;
|
||||
|
||||
@@ -68,7 +53,6 @@ public class OverviewMapFragment extends BaseFragment
|
||||
super.initViews(savedInstanceState);
|
||||
mAMapCustomView = mRootView.findViewById(R.id.smallMapDirectionView);
|
||||
mAMapCustomView.onCreateView(savedInstanceState);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,17 +71,10 @@ public class OverviewMapFragment extends BaseFragment
|
||||
|
||||
@Override
|
||||
public void drawablePolyline(List<MogoLatLng> coordinates) {
|
||||
if (mAMapCustomView != null) {
|
||||
mAMapCustomView.convert(coordinates);
|
||||
UiThreadHandler.post(() -> mAMapCustomView.drawablePolyline());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPolyline() {
|
||||
if (mAMapCustomView != null) {
|
||||
UiThreadHandler.post(() -> mAMapCustomView.clearPolyline());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,6 +83,7 @@ public class OverviewMapFragment extends BaseFragment
|
||||
if (mAMapCustomView != null) {
|
||||
mAMapCustomView.onResume();
|
||||
}
|
||||
mAMapCustomView.handlePlanningData(InfStructureManager.INSTANCE.getPlanningData());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,56 +118,4 @@ public class OverviewMapFragment extends BaseFragment
|
||||
}
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotTrajectory(List<MessagePad.TrajectoryPoint> trajectoryInfos) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
if (autoPilotStatusInfo.getPilotmode() != 1) {
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) {
|
||||
if (globalPathResp == null || globalPathResp.getWayPointsList().size() == 0) {
|
||||
return;
|
||||
}
|
||||
List<MogoLatLng> latLngList = new ArrayList<>();
|
||||
for (MessagePad.Location routeModel : globalPathResp.getWayPointsList()) {
|
||||
latLngList.add(new MogoLatLng(routeModel.getLatitude(), routeModel.getLongitude()));
|
||||
}
|
||||
if (latLngList.size() > 0) {
|
||||
drawablePolyline(latLngList);
|
||||
} else {
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 879 B |
|
After Width: | Height: | Size: 443 B |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 879 B |
|
After Width: | Height: | Size: 215 B |
|
After Width: | Height: | Size: 443 B |
|
After Width: | Height: | Size: 6.9 KiB |
@@ -17,8 +17,8 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
<com.amap.api.navi.AMapNaviView
|
||||
android:id="@+id/aMapNaviView"
|
||||
<com.amap.api.maps.TextureMapView
|
||||
android:id="@+id/aMapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.mogo.eagle.core.function.api.devatools
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.view.*
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
|
||||
import com.mogo.eagle.core.data.deva.scene.SceneModule
|
||||
@@ -107,10 +107,10 @@ interface IDevaToolsProvider : IProvider {
|
||||
/**
|
||||
* 展示状态栏
|
||||
*/
|
||||
fun showStatusBar(ctx: Context, anchor: View)
|
||||
fun showStatusBar(ctx: Context, container: ViewGroup)
|
||||
|
||||
/**
|
||||
* 隐藏状态栏
|
||||
*/
|
||||
fun hideStatusBar()
|
||||
fun hideStatusBar(container: ViewGroup)
|
||||
}
|
||||
@@ -150,27 +150,18 @@ object CallerDevaToolsManager {
|
||||
/**
|
||||
* 展示状态栏
|
||||
*/
|
||||
fun showStatusBar(ctx: Context, anchor: View) {
|
||||
fun showStatusBar(ctx: Context, container: ViewGroup) {
|
||||
if (!AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
if (anchor.isLaidOut) {
|
||||
devaToolsProviderApi?.showStatusBar(ctx, anchor)
|
||||
} else {
|
||||
anchor.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
|
||||
override fun onGlobalLayout() {
|
||||
devaToolsProviderApi?.showStatusBar(ctx, anchor)
|
||||
anchor.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||
}
|
||||
})
|
||||
}
|
||||
devaToolsProviderApi?.showStatusBar(ctx, container)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏状态栏
|
||||
*/
|
||||
fun hideStatusBar() {
|
||||
fun hideStatusBar(container: ViewGroup) {
|
||||
if (!AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
devaToolsProviderApi?.hideStatusBar()
|
||||
devaToolsProviderApi?.hideStatusBar(container)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,17 +100,23 @@ object Reminder {
|
||||
if (key.isEmpty()) {
|
||||
throw IllegalStateException("reminder: ${reminder.javaClass.name}'s key can't be empty.")
|
||||
}
|
||||
if (enqueued.contains(key)) {
|
||||
return
|
||||
synchronized(enqueued) {
|
||||
if (enqueued.contains(key)) {
|
||||
return
|
||||
}
|
||||
enqueued += key
|
||||
}
|
||||
enqueued += key
|
||||
attaches.getOrPut(attachTo) {
|
||||
mutableListOf()
|
||||
}.also {
|
||||
it.add(WeakReference(reminder))
|
||||
synchronized(attaches) {
|
||||
attaches.getOrPut(attachTo) {
|
||||
mutableListOf()
|
||||
}.also {
|
||||
it.add(WeakReference(reminder))
|
||||
}
|
||||
}
|
||||
listener?.let {
|
||||
reminderListeners[reminder] = it
|
||||
synchronized(reminderListeners) {
|
||||
listener?.let {
|
||||
reminderListeners[reminder] = it
|
||||
}
|
||||
}
|
||||
scope.launch {
|
||||
if (reminder is ActivityReminder) {
|
||||
@@ -131,11 +137,14 @@ object Reminder {
|
||||
heap += reminder
|
||||
dequeueHeap()
|
||||
} else {
|
||||
queue += reminder
|
||||
val pre = findPreShowedReminder()
|
||||
if (pre != null) {
|
||||
pre.hide()
|
||||
queue.clear()
|
||||
queue += reminder
|
||||
} else {
|
||||
queue.clear()
|
||||
queue += reminder
|
||||
dequeue()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.widget.PopupWindow
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.IReminder
|
||||
|
||||
abstract class PopupWindowReminder(val popupWindow: PopupWindow): IReminder {
|
||||
abstract class PopupWindowReminder(open val popupWindow: PopupWindow): IReminder {
|
||||
|
||||
override fun lifecycleOwner(): LifecycleOwner = popupWindow.lifecycleOwner
|
||||
|
||||
|
||||
@@ -31,12 +31,15 @@ class CommonDividerItemDecoration internal constructor(builder: Builder) : ItemD
|
||||
private var mSpanCountTBCare = false
|
||||
private val mHorizontalExternalSpace: Int
|
||||
private val mVerticalExternalSpace: Int
|
||||
private var mLastRight = 0
|
||||
private var mLastBottom = 0
|
||||
private var mFromPosition = 0
|
||||
private var mHorizontalDelta: Pair<Int, Int>? = null
|
||||
private var mVerticalDelta: Pair<Int, Int>? = null
|
||||
|
||||
private var mRightCache: HashMap<Int, Int> = HashMap()
|
||||
private var mLeftCache: HashMap<Int, Int> = HashMap()
|
||||
private var mBottomCache: HashMap<Int, Int> = HashMap()
|
||||
private var mTopCache: HashMap<Int, Int> = HashMap()
|
||||
|
||||
/**
|
||||
* 外部间隔结束位置是否需要
|
||||
*/
|
||||
@@ -84,23 +87,28 @@ class CommonDividerItemDecoration internal constructor(builder: Builder) : ItemD
|
||||
}
|
||||
} else {
|
||||
val averageDistance = (((spanCount - 1) * mHorizontalInnerSpace + 2 * mHorizontalExternalSpace + deltaHL + deltaHR) * 1.0f / spanCount).toInt()
|
||||
Log.d("UUUU", "step::0::$averageDistance: lastRight: $mLastRight : state: $state " )
|
||||
if (spanIndex == 0) {
|
||||
outRect.left = mHorizontalExternalSpace + deltaHL
|
||||
outRect.right = averageDistance - outRect.left
|
||||
mLastRight = outRect.right
|
||||
Log.d("UUUU", "step::1::$averageDistance: lastRight: $mLastRight" )
|
||||
if (state.didStructureChange()) {
|
||||
mRightCache[position] = outRect.right
|
||||
}
|
||||
Log.d("UUUU", "step::1::$averageDistance: outRect.right: ${outRect.right} ::outRect.left: ${outRect.left}:: position: $position :: state: $state" )
|
||||
} else if (spanIndex == spanCount - 1) {
|
||||
outRect.right = mHorizontalExternalSpace + deltaHR
|
||||
outRect.left = averageDistance - outRect.right
|
||||
Log.d("UUUU", "step::2::$averageDistance: lastRight: $mLastRight ::outRect.left: ${outRect.left}" )
|
||||
Log.d("UUUU", "step::2::$averageDistance: outRect.right: ${outRect.right} ::outRect.left: ${outRect.left} :: position: $position :: state: $state" )
|
||||
} else {
|
||||
outRect.left = mHorizontalInnerSpace - mLastRight
|
||||
outRect.right = averageDistance - outRect.left
|
||||
if (state.didStructureChange()) {
|
||||
mLastRight = outRect.right
|
||||
outRect.left = mHorizontalInnerSpace - (mRightCache[position - 1] ?: 0)
|
||||
outRect.right = averageDistance - outRect.left
|
||||
mLeftCache[position] = outRect.left
|
||||
mRightCache[position] = outRect.right
|
||||
} else {
|
||||
outRect.left = mLeftCache[position]!!
|
||||
outRect.right = mRightCache[position]!!
|
||||
}
|
||||
Log.d("UUUU", "step::2::$averageDistance: lastRight: $mLastRight ::outRect.left: ${outRect.left}" )
|
||||
Log.d("UUUU", "step::2::$averageDistance: outRect.right: ${outRect.right} ::outRect.left: ${outRect.left} :: position: $position :: state: $state" )
|
||||
}
|
||||
} //所在的行数
|
||||
if (lookUp.getSpanGroupIndex(childPosition, spanCount) == lookUp.getSpanGroupIndex(mFromPosition, spanCount)) {
|
||||
@@ -130,15 +138,21 @@ class CommonDividerItemDecoration internal constructor(builder: Builder) : ItemD
|
||||
if (spanIndex == 0) {
|
||||
outRect.top = mVerticalExternalSpace + deltaVT
|
||||
outRect.bottom = averageDistance - outRect.top
|
||||
mLastBottom = outRect.bottom
|
||||
if (state.didStructureChange()) {
|
||||
mBottomCache[position] = outRect.bottom
|
||||
}
|
||||
} else if (spanIndex == spanCount - 1) {
|
||||
outRect.top = mVerticalExternalSpace + deltaVB
|
||||
outRect.bottom = averageDistance - outRect.top
|
||||
} else {
|
||||
outRect.top = mVerticalInnerSpace - mLastBottom
|
||||
outRect.bottom = averageDistance - outRect.top
|
||||
if (state.didStructureChange()) {
|
||||
mLastBottom = outRect.bottom
|
||||
outRect.top = mVerticalInnerSpace - (mBottomCache[position - 1] ?: 0 )
|
||||
outRect.bottom = averageDistance - outRect.top
|
||||
mBottomCache[position] = outRect.bottom
|
||||
mTopCache[position] = outRect.top
|
||||
} else {
|
||||
outRect.top = mTopCache[position]!!
|
||||
outRect.bottom = mBottomCache[position]!!
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,15 +237,21 @@ class CommonDividerItemDecoration internal constructor(builder: Builder) : ItemD
|
||||
if (spanIndex == 0) {
|
||||
outRect.left = mHorizontalExternalSpace + deltaHL
|
||||
outRect.right = averageDistance - outRect.left
|
||||
mLastRight = outRect.right
|
||||
if (state.didStructureChange()) {
|
||||
mRightCache[position] = outRect.right
|
||||
}
|
||||
} else if (spanIndex == spanCount - 1) {
|
||||
outRect.right = mHorizontalExternalSpace + deltaHR
|
||||
outRect.left = averageDistance - outRect.right
|
||||
} else {
|
||||
outRect.left = mHorizontalInnerSpace - mLastRight
|
||||
outRect.right = averageDistance - outRect.left
|
||||
if (state.didStructureChange()) {
|
||||
mLastRight = outRect.right
|
||||
outRect.left = mHorizontalInnerSpace - (mRightCache[position - 1] ?: 0)
|
||||
outRect.right = averageDistance - outRect.left
|
||||
mLeftCache[position] = outRect.left
|
||||
mRightCache[position] = outRect.right
|
||||
} else {
|
||||
outRect.left = mLeftCache[position]!!
|
||||
outRect.right = mRightCache[position]!!
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -282,15 +302,22 @@ class CommonDividerItemDecoration internal constructor(builder: Builder) : ItemD
|
||||
if (spanIndex == 0) {
|
||||
outRect.top = mVerticalExternalSpace + deltaVT
|
||||
outRect.bottom = averageDistance - outRect.top
|
||||
mLastBottom = outRect.bottom
|
||||
if (state.didStructureChange()) {
|
||||
mBottomCache[position] = outRect.bottom
|
||||
}
|
||||
} else if (spanIndex == spanCount - 1) {
|
||||
outRect.top = mVerticalExternalSpace + deltaVB
|
||||
outRect.bottom = averageDistance - outRect.top
|
||||
} else {
|
||||
outRect.top = mVerticalInnerSpace - mLastBottom
|
||||
outRect.bottom = averageDistance - outRect.top
|
||||
|
||||
if (state.didStructureChange()) {
|
||||
mLastBottom = outRect.bottom
|
||||
outRect.top = mVerticalInnerSpace - (mBottomCache[position - 1] ?: 0)
|
||||
outRect.bottom = averageDistance - outRect.top
|
||||
mBottomCache[position] = outRect.bottom
|
||||
mTopCache[position] = outRect.top
|
||||
} else {
|
||||
outRect.top = mTopCache[position]!!
|
||||
outRect.bottom = mBottomCache[position]!!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@ package com.zhidao.support.adas.high.common;
|
||||
|
||||
/**
|
||||
* 监控事件报告中定义的事件以及解释
|
||||
* 根据250消息定义编写
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=79433139
|
||||
* 根据260消息定义编写
|
||||
*/
|
||||
public class MogoReport {
|
||||
private static final String RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED";
|
||||
@@ -223,7 +222,7 @@ public class MogoReport {
|
||||
String AUTOPILOT_FAILED = "ESYS_AUTOPILOT_FAILED";//在尝试启动自动驾驶,但是超过指定时间后底盘未进入,会发送此事件
|
||||
@Deprecated
|
||||
String IN_INIT = "ESYS_IN_INIT";//系统处于启动中,拒绝进入自动驾驶/远程驾驶
|
||||
String IN_EXIT = "ESYS_IN_EXIT";//系统处于退出中,拒绝进入自动驾驶/远程驾驶
|
||||
String IN_EXIT = "ESYS_IN_EXIT";//系统处于退出中,拒绝进入自动驾驶
|
||||
String NOT_ALLOW_AUTOPILOT_FOR_REMOTE = "ESYS_NOT_ALLOW_AUTOPILOT_FOR_REMOTE";//系统处于远程驾驶中,拒绝进入自动驾驶
|
||||
String NOT_ALLOW_REBOOT = "ESYS_NOT_ALLOW_REBOOT";//重启拒绝
|
||||
String TOPIC_FREQ_DROPED = "ESYS_TOPIC_FREQ_DROPED";//存在topic严重掉频
|
||||
@@ -232,6 +231,7 @@ public class MogoReport {
|
||||
String AUTOPILOT_TAKEN_OVER_BY_REMOTE = "ESYS_AUTOPILOT_TAKEN_OVER_BY_REMOTE";//自动驾驶被远程驾驶接管
|
||||
String ROUTING_REQ_TIMEOUT = "ESYS_ROUTING_REQ_TIMEOUT";//自动驾驶开始前,routing请求无响应
|
||||
String PLANNING_CHANGE_FAILIED = "ESYS_PLANNING_CHANGE_FAILIED";//planning版本切换启动失败
|
||||
String CHECK_TRAJECTORY_FAILURE = "ESYS_CHECK_TRAJECTORY_FAILURE";//轨迹文件检查超时或检查结果无可用轨迹
|
||||
String FAULT = "ESYS_FAULT";//master启动10分钟,仍有agent未连接
|
||||
}
|
||||
|
||||
@@ -331,6 +331,7 @@ public class MogoReport {
|
||||
|
||||
interface ILCT {
|
||||
String RTK_STATUS_NORMAL = "ILCT_RTK_STATUS_NORMAL";//rtk状态正常或恢复正常
|
||||
String RTK_OR_SLAM_CHANGE = "ILCT_RTK_OR_SLAM_CHANGE";//定位输出源发生RTK和SLAM变换
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<dimen name="dp_12">12px</dimen>
|
||||
<dimen name="dp_14">14px</dimen>
|
||||
<dimen name="dp_20">20px</dimen>
|
||||
<dimen name="dp_22">22px</dimen>
|
||||
<dimen name="dp_43">43px</dimen>
|
||||
<dimen name="dp_50">50px</dimen>
|
||||
<dimen name="dp_57">57px</dimen>
|
||||
<dimen name="dp_60">60px</dimen>
|
||||
<dimen name="dp_72">72px</dimen>
|
||||
<dimen name="dp_80">80px</dimen>
|
||||
<dimen name="dp_88">88px</dimen>
|
||||
<dimen name="module_v2n_tip_text_margin_right">26px</dimen>
|
||||
<dimen name="warning_distance_right">30px</dimen>
|
||||
|
||||
@@ -77,7 +77,7 @@ public class MogoRouteOverlayManager implements
|
||||
return;
|
||||
}
|
||||
synchronized (queue) {
|
||||
List<MessagePad.TrajectoryPoint> items = queue.getLast();
|
||||
List<MessagePad.TrajectoryPoint> items = queue.peekLast();
|
||||
if (items != null && !items.isEmpty()) {
|
||||
RouteOverlayDrawer.getInstance().drawTrajectoryList(items, location.getBearing());
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package com.mogo.module.service.routeoverlay;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_OLD_ROUTE;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Color;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.util.Pools;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
@@ -19,7 +17,6 @@ import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.common.utils.DrivingDirectionUtils;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
@@ -29,33 +26,18 @@ public class RouteOverlayDrawer {
|
||||
private static final String TAG = "MogoRouteOverlayManager";
|
||||
|
||||
// 连接线参数
|
||||
|
||||
private Handler mRenderHandler;
|
||||
IMogoOverlayManager mogoOverlayManager;
|
||||
private static volatile RouteOverlayDrawer sInstance;
|
||||
private final MogoPolylineOptions mPolylineOptions;
|
||||
private volatile IMogoPolyline mMoGoPolyline;
|
||||
// private FileWriter writer;
|
||||
private static final int COLOR_LIGHT = Color.parseColor("#BAEBF5");
|
||||
|
||||
private RouteOverlayDrawer() {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
mPolylineOptions.zIndex(75000f);
|
||||
mPolylineOptions.setGps(true);
|
||||
mPolylineOptions.width(20).useGradient(true);
|
||||
// try {
|
||||
// File log = new File(Environment.getExternalStorageDirectory(), "log.txt");
|
||||
// if (log.exists()) {
|
||||
// log.delete();
|
||||
// }
|
||||
// if (log.getParentFile() != null && !log.getParentFile().exists()) {
|
||||
// log.getParentFile().mkdirs();
|
||||
// }
|
||||
//
|
||||
// log.createNewFile();
|
||||
// writer = new FileWriter(log, false);
|
||||
// } catch (Throwable t) {
|
||||
//
|
||||
// }
|
||||
|
||||
// 渐变色
|
||||
mogoOverlayManager = MogoOverlayManager.getInstance();
|
||||
// 线条粗细,渐变,渐变色值
|
||||
@@ -191,48 +173,13 @@ public class RouteOverlayDrawer {
|
||||
RouteStrategy.INSTANCE.end();
|
||||
Strategy strategy = RouteStrategy.INSTANCE.getStrategy();
|
||||
List<Integer> colors = strategy.getColors();
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// int colorIndex = 0;
|
||||
// sb.append("=========================================\n");
|
||||
// for (MogoLatLng p : points) {
|
||||
// sb.append(p.lat);
|
||||
// sb.append(",");
|
||||
// sb.append(p.lon);
|
||||
// sb.append(",");
|
||||
// sb.append(p.acc);
|
||||
// sb.append(",");
|
||||
// sb.append(p.speed);
|
||||
// if (colorIndex < colors.size()) {
|
||||
// int color = colors.get(colorIndex);
|
||||
// sb.append(",");
|
||||
// sb.append(color);
|
||||
// sb.append(",");
|
||||
// sb.append(Color.red(color));
|
||||
// sb.append(",");
|
||||
// sb.append(Color.green(color));
|
||||
// sb.append(",");
|
||||
// sb.append(Color.blue(color));
|
||||
// sb.append(",");
|
||||
// sb.append(Color.alpha(color));
|
||||
// colorIndex ++;
|
||||
// }
|
||||
// sb.append("\n");
|
||||
// }
|
||||
// try {
|
||||
// if (writer != null) {
|
||||
// writer.write(sb.toString());
|
||||
// writer.flush();
|
||||
// }
|
||||
// } catch (Throwable t) {
|
||||
//
|
||||
// }
|
||||
boolean isLightOn = strategy instanceof ColorfulStrategy && ((ColorfulStrategy) strategy).isLightOn();
|
||||
if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()) {
|
||||
mPolylineOptions.points(points);
|
||||
mPolylineOptions.colorValues(colors);
|
||||
if (isLightOn) {
|
||||
mPolylineOptions.openBright(true);
|
||||
mPolylineOptions.brightColor(Color.parseColor("#D2F2F8"));
|
||||
mPolylineOptions.brightColor(COLOR_LIGHT);
|
||||
mPolylineOptions.brightSpeed(0.5f);
|
||||
} else {
|
||||
mPolylineOptions.openBright(false);
|
||||
@@ -243,7 +190,7 @@ public class RouteOverlayDrawer {
|
||||
mPolylineOptions.colorValues(colors);
|
||||
if (isLightOn) {
|
||||
mPolylineOptions.openBright(true);
|
||||
mPolylineOptions.brightColor(Color.parseColor("#D2F2F8"));
|
||||
mPolylineOptions.brightColor(COLOR_LIGHT);
|
||||
mPolylineOptions.brightSpeed(0.5f);
|
||||
} else {
|
||||
mPolylineOptions.openBright(false);
|
||||
|
||||
@@ -38,6 +38,10 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
||||
|
||||
private static final String TAG = "ApmCrashReportProvider";
|
||||
private static final String MAP_SDK_VERSION = "MAP_SDK_VERSION";
|
||||
private CarInfo mInfo = null;
|
||||
private String mCityCode;
|
||||
private String mLat;
|
||||
private String mLogt;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
@@ -54,27 +58,28 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
//车辆信息
|
||||
String carInfoString = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO);
|
||||
CarInfo info = null;
|
||||
|
||||
if (carInfoString != null && !carInfoString.isEmpty()) {
|
||||
info = GsonUtils.fromJson(carInfoString, CarInfo.class);
|
||||
mInfo = GsonUtils.fromJson(carInfoString, CarInfo.class);
|
||||
}
|
||||
|
||||
//车辆所在位置
|
||||
String cityCode = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_CITY_CODE);
|
||||
String lat = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LATITUDE);
|
||||
String logt = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LONGITUDE);
|
||||
// Log.d("liyz", "cityCode = " + cityCode + " --lat = " +lat + " --logt = " + logt);
|
||||
mCityCode = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_CITY_CODE);
|
||||
mLat = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LATITUDE);
|
||||
mLogt = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LONGITUDE);
|
||||
// Log.d("liyz", "cityCode = " + mCityCode + " --lat = " +mLat + " --logt = " + mLogt);
|
||||
//地图版本
|
||||
String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context);
|
||||
map.put("MAP_SDK_VERSION", mapSDKVersion);
|
||||
if (info != null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "nuber = " + info.getNumber_plate() + "--brand = " + info.getBrand() + "--modle = " + info.getModel());
|
||||
map.put("PLATE_NUMBER", info.getNumber_plate());
|
||||
map.put("BRAND", info.getBrand());
|
||||
map.put("MODEL", info.getModel());
|
||||
map.put("CITYCODE", cityCode);
|
||||
map.put("LATITUDE", lat);
|
||||
map.put("LONGITUTE", logt);
|
||||
map.put("CITYCODE", mCityCode);
|
||||
map.put("LATITUDE", mLat);
|
||||
map.put("LONGITUTE", mLogt);
|
||||
|
||||
if (mInfo != null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "nuber = " + mInfo.getNumber_plate() + "--brand = " + mInfo.getBrand() + "--modle = " + mInfo.getModel());
|
||||
map.put("PLATE_NUMBER", mInfo.getNumber_plate());
|
||||
map.put("BRAND", mInfo.getBrand());
|
||||
map.put("MODEL", mInfo.getModel());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -89,6 +94,10 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
||||
crash.config().setDeviceId(DeviceIdUtils.getDeviceId(context));
|
||||
}
|
||||
crash.addTags(MAP_SDK_VERSION, mapSDKVersion);
|
||||
crash.addTags("CITYCODE", mCityCode);
|
||||
crash.addTags("LATITUDE", mLat);
|
||||
crash.addTags("LONGITUTE", mLogt);
|
||||
|
||||
// crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址
|
||||
// crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖
|
||||
|
||||
@@ -98,6 +107,15 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
||||
dimension.put("Devices_SN_WidevineID_MD5", sn + "__" + DeviceIdUtils.getWidevineIDWithMd5(context));
|
||||
dimension.put("Devices_SN_WidevineID", sn + "__" + DeviceIdUtils.getWidevineID(context));
|
||||
dimension.put(MAP_SDK_VERSION, mapSDKVersion);
|
||||
dimension.put("CITYCODE", mCityCode);
|
||||
dimension.put("LATITUDE", mLat);
|
||||
dimension.put("LONGITUTE", mLogt);
|
||||
if (mInfo != null) {
|
||||
dimension.put("PLATE_NUMBER", mInfo.getNumber_plate());
|
||||
dimension.put("BRAND", mInfo.getBrand());
|
||||
dimension.put("MODEL", mInfo.getModel());
|
||||
}
|
||||
|
||||
HashMap<String, Double> metric = new HashMap<>();
|
||||
//指标值
|
||||
//metric.put("Devices_ID_metric", (double) 100);
|
||||
|
||||