diff --git a/app/functions/abiFilters.gradle b/app/functions/abiFilters.gradle index 076f371a56..6fd6edaaba 100644 --- a/app/functions/abiFilters.gradle +++ b/app/functions/abiFilters.gradle @@ -6,7 +6,7 @@ project.android.productFlavors { externalNativeBuild { ndk { // 设置支持的SO库架构 - abiFilters "arm64-v8a","armeabi-v7a" + abiFilters "arm64-v8a" } } } @@ -15,7 +15,7 @@ project.android.productFlavors { externalNativeBuild { ndk { // 设置支持的SO库架构 - abiFilters "arm64-v8a","armeabi-v7a" + abiFilters "arm64-v8a" } } } diff --git a/foudations/httpdns-tencent/src/main/java/com/mogo/httpdns/tencent/HttpDnsIpsCache.java b/foudations/httpdns-tencent/src/main/java/com/mogo/httpdns/tencent/HttpDnsIpsCache.java index 0e3d0feca4..0c5f331c3b 100644 --- a/foudations/httpdns-tencent/src/main/java/com/mogo/httpdns/tencent/HttpDnsIpsCache.java +++ b/foudations/httpdns-tencent/src/main/java/com/mogo/httpdns/tencent/HttpDnsIpsCache.java @@ -26,7 +26,7 @@ class HttpDnsIpsCache { private static final String TAG = "HttpDnsIpsCache"; // 缓存过期时间 - public static final long INTERVAL_CACHE = 1 * 60 * 1000; + public static final long INTERVAL_CACHE = 60 * 60 * 1000; // 刷新缓存时间 public static final long TTL = ( long ) ( INTERVAL_CACHE * 0.75 ); diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/utils/ViewUtils.java b/foudations/mogo-utils/src/main/java/com/mogo/utils/ViewUtils.java similarity index 96% rename from modules/mogo-module-service/src/main/java/com/mogo/module/service/utils/ViewUtils.java rename to foudations/mogo-utils/src/main/java/com/mogo/utils/ViewUtils.java index 315b1e7a79..6cb7fec5de 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/utils/ViewUtils.java +++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/ViewUtils.java @@ -1,4 +1,4 @@ -package com.mogo.module.service.utils; +package com.mogo.utils; import android.graphics.Bitmap; import android.view.View; diff --git a/libraries/map-custom/build.gradle b/libraries/map-custom/build.gradle index 7e6927b3ad..7e906108e9 100644 --- a/libraries/map-custom/build.gradle +++ b/libraries/map-custom/build.gradle @@ -67,7 +67,7 @@ dependencies { implementation project(':foudations:mogo-commons') } - implementation 'com.zhidaoauto.machine:map:1.0.0-vr-6.5' + implementation 'com.zhidaoauto.machine:map:1.0.0-vr-6.9' } apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index 46f0fb848a..41f0249cea 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -170,6 +170,7 @@ public class AMapViewWrapper implements IMogoMapView, mMapView.registerListener( this, MapAutoApi.LISTENER_TYPE_ROTATE ); mMapView.registerListener( this, MapAutoApi.LISTENER_TYPE_3D ); mMapView.setMOnCameraChangeListener( this ); + mMapView.setOnMapStyleListener( this ); // mMapView.setOnPolylineClickListener( this ); // mMapView.setAMapNaviViewListener( this ); @@ -307,7 +308,6 @@ public class AMapViewWrapper implements IMogoMapView, break; case Type_VR: mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_VR ); - setUIMode( ui ); return; case Type_Light: mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false ); diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java index 758e7dd74c..1081ea35b3 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java @@ -26,7 +26,6 @@ import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery; import com.mogo.map.search.traffic.IMogoTrafficSearch; import com.mogo.map.uicontroller.IMogoMapUIController; import com.mogo.utils.logger.Logger; -import com.zhidaoauto.map.sdk.open.MapAutoApi; import com.zhidaoauto.map.sdk.open.MapParams; import com.zhidaoauto.map.sdk.open.NavAutoApi; import com.zhidaoauto.map.sdk.open.NavParams; @@ -92,15 +91,11 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder { @Override public IMogoMapView getMapView( Context context ) { NavAutoApi.INSTANCE.init( context, MapParams.Companion.init() -// .setCachePath( "sdcard/tiles_vr" ) - .setStyleDir( "sdcard/shmdata_asset/mogo_style" ) - .setHdmapPath( "sdcard/shmdata/hdmapData" ) .setDebugMode( true ) .setCoordinateType( MapParams.COORDINATETYPE_GCJ02 ) .setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D ) .setZoom( 16 ) - .setPointToCenter( 0.5f, 0.8f ) - .setStyleMode( MapParams.MAP_STYLE_NIGHT ) , NavParams.Companion.init() ); + .setStyleMode( MapParams.MAP_STYLE_NIGHT ), NavParams.Companion.init() ); MapAutoView mapAutoView = new MapAutoView( context ); IMogoMapView mapView = new AMapViewWrapper( mapAutoView ); return mapView; diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapView.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapView.java deleted file mode 100644 index cd00b35f7c..0000000000 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapView.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.mogo.map.impl.custom; - -import android.content.Context; - -import com.mogo.commons.debug.DebugConfig; -import com.mogo.map.IMogoMapView; -import com.mogo.map.IMogoMapViewCreator; -import com.zhidaoauto.map.sdk.open.MapAutoApi; -import com.zhidaoauto.map.sdk.open.MapParams; -import com.zhidaoauto.map.sdk.open.view.MapAutoView; - -/** - * @author congtaowang - * @since 2019-12-25 - *

- * 描述 - */ -public class CustomMapView implements IMogoMapViewCreator { - - private static final String TAG = "AMapBaseMapView"; - - private static IMogoMapView mapView; - - @Override - public IMogoMapView create( Context context ) { - if ( mapView == null ) { - MapAutoApi.INSTANCE.init( context, MapParams.Companion.init() - .setCachePath( "sdcard/tiles_vr" ) - .setDebugMode( false ) - .setCoordinateType( MapParams.COORDINATETYPE_GCJ02 ) - .setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D ) - .setZoom( 16 ) - .setPointToCenter( 0.5f, 0.8f ) ); - } - MapAutoView mapAutoView = new MapAutoView( context ); - mapView = new AMapViewWrapper( mapAutoView ); - return mapView; - } -} diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java index a3a6101a24..c950276731 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java @@ -1,18 +1,12 @@ package com.mogo.map.impl.custom.utils; -import android.content.Context; import android.graphics.Bitmap; import android.text.TextUtils; import android.view.View; -import com.autonavi.nge.guidance.NaviInfo; import com.mogo.map.MogoLatLng; import com.mogo.map.location.MogoLocation; import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.map.navi.MogoCongestionInfo; -import com.mogo.map.navi.MogoCongestionLink; -import com.mogo.map.navi.MogoNaviInfo; -import com.mogo.map.navi.MogoTraffic; import com.mogo.map.overlay.MogoPolylineOptions; import com.mogo.map.search.geo.MogoGeocodeAddress; import com.mogo.map.search.geo.MogoGeocodeResult; @@ -48,7 +42,6 @@ import com.zhidaoauto.map.sdk.open.query.SearchBound; import com.zhidaoauto.map.sdk.open.query.Tip; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; /** @@ -84,6 +77,7 @@ public class ObjectUtils { // .icons( descriptors ) // .period( opt.getPeriod() ) .rotateAngle( opt.getRotate() ) + .marker3DIcon( opt.getIcon3DRes() ) .setFlat( opt.isFlat() ) .visible( opt.isVisible() ) .infoWindowEnable( opt.isInifoWindowEnable() ) diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/MogoMarkerOptions.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/MogoMarkerOptions.java index 73c06971ca..fece6e0ea5 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/MogoMarkerOptions.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/MogoMarkerOptions.java @@ -4,6 +4,8 @@ import android.graphics.Bitmap; import android.location.Location; import android.view.View; +import androidx.annotation.RawRes; + import com.mogo.map.MogoLatLng; import com.mogo.map.location.MogoLocation; @@ -71,6 +73,8 @@ public class MogoMarkerOptions extends Observable { */ private boolean mAutoManager = true; + private @RawRes int mIcon3DRes = 0; + public MogoMarkerOptions position( MogoLatLng latLng ){ if ( latLng != null ) { latitude( latLng.lat ); @@ -212,6 +216,11 @@ public class MogoMarkerOptions extends Observable { return this; } + public MogoMarkerOptions icon3DRes(@RawRes int icon3DRes){ + this.mIcon3DRes = icon3DRes; + return this; + } + public double getLatitude() { return latitude; } @@ -309,6 +318,10 @@ public class MogoMarkerOptions extends Observable { return this; } + public int getIcon3DRes() { + return mIcon3DRes; + } + @Override public String toString() { return "MogoMarkerOptions{" + diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java index bbbdf38fa6..372ed6a04b 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java @@ -106,8 +106,8 @@ class SnapshotSetDataDrawer extends BaseDrawer { mPurseCounter++; if ( mPurseCounter >= 100 ) { mPurseCounter = 0; + purgeCloudSnapshotData( allDatumsList ); } - purgeCloudSnapshotData( allDatumsList ); for ( CloudRoadData cloudRoadData : allDatumsList ) { if ( cloudRoadData == null ) { continue; @@ -131,13 +131,12 @@ class SnapshotSetDataDrawer extends BaseDrawer { marker.setGps( false ); MogoLatLng lastPosition = mLastPositions.get( uniqueKey ); double targetPos[] = CoordinateUtils.transformFromWGSToGCJ( target.lat, target.lon ); + double lastPos[] = CoordinateUtils.transformFromWGSToGCJ( lastPosition.lat, lastPosition.lon ); if ( lastPosition != null ) { if ( lastPosition.equals( target ) ) { - marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() ); - marker.setPosition( targetPos[POS_LAT], targetPos[POS_LON] ); + marker.setPosition( lastPos[POS_LAT], lastPos[POS_LON] ); } else { List< MogoLatLng > points = new ArrayList<>(); - double lastPos[] = CoordinateUtils.transformFromWGSToGCJ( lastPosition.lat, lastPosition.lon ); points.add( new MogoLatLng( lastPos[POS_LAT], lastPos[POS_LON] ) ); points.add( new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) ); marker.startSmooth( points, 1 ); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java index 94f394ed4f..c3cbc4149e 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java @@ -21,6 +21,7 @@ import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.service.imageloader.IMogoImageLoaderListener; import com.mogo.service.imageloader.MogoImageView; import com.mogo.utils.UiThreadHandler; +import com.mogo.utils.ViewUtils; import com.mogo.utils.WindowUtils; import com.mogo.utils.logger.Logger; @@ -105,7 +106,7 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV public void onCompleted(Bitmap bitmap) { // 使用view渲染地图marker,刷新纹理的时候,需要重新用view生成纹理,然后在设置 if (mMarker != null) { - mMarker.setIcon(fromView(MapMarkerBaseView.this)); + mMarker.setIcon( ViewUtils.fromView(MapMarkerBaseView.this)); } } @@ -132,7 +133,7 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV Logger.d(TAG, "loadImageWithMarker loaded."); // 使用view渲染地图marker,刷新纹理的时候,需要重新用view生成纹理,然后在设置 if ( mMarker != null ) { - mMarker.setIcon( fromView( MapMarkerBaseView.this ) ); + mMarker.setIcon( ViewUtils.fromView( MapMarkerBaseView.this ) ); } } @@ -147,30 +148,6 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV } } - private Bitmap fromView( View view ) { - view.setDrawingCacheEnabled( true ); - processChildView( view ); - view.destroyDrawingCache(); - view.measure( MeasureSpec.makeMeasureSpec( 0, MeasureSpec.UNSPECIFIED ), MeasureSpec.makeMeasureSpec( 0, MeasureSpec.UNSPECIFIED ) ); - view.layout( 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight() ); - Bitmap bitmap = null; - return ( bitmap = view.getDrawingCache() ) != null ? bitmap.copy( Bitmap.Config.ARGB_8888, false ) : null; - } - - private void processChildView( View view ) { - if ( !( view instanceof ViewGroup ) ) { - if ( view instanceof TextView ) { - ( ( TextView ) view ).setHorizontallyScrolling( false ); - } - - } else { - for ( int var1 = 0; var1 < ( ( ViewGroup ) view ).getChildCount(); ++var1 ) { - processChildView( ( ( ViewGroup ) view ).getChildAt( var1 ) ); - } - - } - } - @Override public View getView() { return this; diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java index 6d5eb4ceb9..97073c1ef6 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java @@ -55,7 +55,7 @@ public class MapMarkerView extends MapMarkerBaseView { public void updateView( MarkerShowEntity markerShowEntity ) { try { Object bindObj = markerShowEntity.getBindObj(); - if ( MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().isVrMode() ) { + if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow_vr ); } else { ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow ); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java index 22acefa818..919eda9ac0 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java @@ -36,6 +36,7 @@ public class MapCenterPointStrategy { choosePoint.put( "e8xx", point ); choosePoint.put( "f80x", point ); choosePoint.put( "f8xx", point ); + choosePoint.put( "f8Amap", point ); sCommonStrategies.put( Scene.CHOOSE_POINT, choosePoint ); } @@ -49,6 +50,7 @@ public class MapCenterPointStrategy { final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.575D ); navi.put( "f80x", f80x ); navi.put( "f8xx", f80x ); + navi.put( "f8Amap", f80x ); sCommonStrategies.put( Scene.NAVI, navi ); } @@ -62,6 +64,7 @@ public class MapCenterPointStrategy { final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.683333333333D ); naviWithRoadEvent.put( "f80x", f80x ); naviWithRoadEvent.put( "f8xx", f80x ); + naviWithRoadEvent.put( "f8Amap", f80x ); sCommonStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent ); } @@ -75,6 +78,7 @@ public class MapCenterPointStrategy { final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.5D ); aimless.put( "f80x", f80x ); aimless.put( "f8xx", f80x ); + aimless.put( "f8Amap", f80x ); sCommonStrategies.put( Scene.AIMLESS, aimless ); } @@ -88,6 +92,7 @@ public class MapCenterPointStrategy { final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.599074074D ); aimlessWithRoadEvent.put( "f80x", f80x ); aimlessWithRoadEvent.put( "f8xx", f80x ); + aimlessWithRoadEvent.put( "f8Amap", f80x ); sCommonStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent ); } @@ -102,6 +107,7 @@ public class MapCenterPointStrategy { final MapCenterPoint f80x = new MapCenterPoint( 0.703125D, 0.6083333D ); calculatePath.put( "f80x", f80x ); calculatePath.put( "f8xx", f80x ); + calculatePath.put( "f8Amap", f80x ); sCommonStrategies.put( Scene.CALCULATE_PATH, calculatePath ); } @@ -116,6 +122,7 @@ public class MapCenterPointStrategy { final MapCenterPoint f80x = new MapCenterPoint( 0.733594D, 0.5D ); categorySearch.put( "f80x", f80x ); categorySearch.put( "f8xx", f80x ); + categorySearch.put( "f8Amap", f80x ); sCommonStrategies.put( Scene.CATEGORY_SEARCH, categorySearch ); } @@ -130,6 +137,7 @@ public class MapCenterPointStrategy { final MapCenterPoint f80x = new MapCenterPoint( 0.6963541D, 0.65D ); categoryV2XEvent.put( "f80x", f80x ); categoryV2XEvent.put( "f8xx", f80x ); + categoryV2XEvent.put( "f8Amap", f80x ); sCommonStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent ); } @@ -138,88 +146,110 @@ public class MapCenterPointStrategy { { // 选点场景,定位中心点 Map< String, MapCenterPoint > choosePoint = new HashMap<>(); - choosePoint.put( "d80x", new MapCenterPoint( 0.5D, 0.5D ) ); - choosePoint.put( "em4", new MapCenterPoint( 0.5D, 0.5D ) ); - choosePoint.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) ); - choosePoint.put( "f80x", new MapCenterPoint( 0.5D, 0.5D ) ); - choosePoint.put( "f8xx", new MapCenterPoint( 0.5D, 0.5D ) ); + MapCenterPoint point = new MapCenterPoint( 0.5D, 0.5D ); + choosePoint.put( "d80x", point ); + choosePoint.put( "em4", point ); + choosePoint.put( "e8xx", point ); + choosePoint.put( "f80x", point ); + choosePoint.put( "f8xx", point ); + choosePoint.put( "f8Amap", point ); sVrStrategies.put( Scene.CHOOSE_POINT, choosePoint ); } { // 导航场景,定位视图右下角偏下 Map< String, MapCenterPoint > navi = new HashMap<>(); - navi.put( "d80x", new MapCenterPoint( 0.5D, 0.573333333333D ) ); - navi.put( "em4", new MapCenterPoint( 0.5D, 0.573333333333D ) ); - navi.put( "e8xx", new MapCenterPoint( 0.5D, 0.573333333333D ) ); - navi.put( "f80x", new MapCenterPoint( 0.5D, 0.575D ) ); - navi.put( "f8xx", new MapCenterPoint( 0.5D, 0.575D ) ); + MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.573333333333D ); + navi.put( "d80x", point1 ); + navi.put( "em4", point1 ); + navi.put( "e8xx", point1 ); + MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.575D ); + navi.put( "f80x", point2 ); + navi.put( "f8xx", point2 ); + navi.put( "f8Amap", point2 ); sVrStrategies.put( Scene.NAVI, navi ); } { // 导航场景 vs 道路事件展示场景,定位视图右下角偏下 Map< String, MapCenterPoint > naviWithRoadEvent = new HashMap<>(); - naviWithRoadEvent.put( "d80x", new MapCenterPoint( 0.5D, 0.73936170212766D ) ); - naviWithRoadEvent.put( "em4", new MapCenterPoint( 0.5D, 0.73936170212766D ) ); - naviWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.5D, 0.73936170212766D ) ); - naviWithRoadEvent.put( "f80x", new MapCenterPoint( 0.5D, 0.683333333333D ) ); - naviWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.5D, 0.683333333333D ) ); + MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.73936170212766D ); + naviWithRoadEvent.put( "d80x", point1 ); + naviWithRoadEvent.put( "em4", point1 ); + naviWithRoadEvent.put( "e8xx", point1 ); + MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.683333333333D ); + naviWithRoadEvent.put( "f80x", point2 ); + naviWithRoadEvent.put( "f8xx", point2 ); + naviWithRoadEvent.put( "f8Amap", point2 ); sVrStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent ); } { // 巡航场景 Map< String, MapCenterPoint > aimless = new HashMap<>(); - aimless.put( "d80x", new MapCenterPoint( 0.5D, 0.5D ) ); - aimless.put( "em4", new MapCenterPoint( 0.5D, 0.5D ) ); - aimless.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) ); - aimless.put( "f80x", new MapCenterPoint( 0.5D, 0.8D ) ); - aimless.put( "f8xx", new MapCenterPoint( 0.5D, 0.8D ) ); + MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.575D ); + aimless.put( "d80x", point1 ); + aimless.put( "em4", point1 ); + aimless.put( "e8xx", point1 ); + MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.8D ); + aimless.put( "f80x", point2 ); + aimless.put( "f8xx", point2 ); + aimless.put( "f8Amap", point2 ); sVrStrategies.put( Scene.AIMLESS, aimless ); } { // 巡航场景 vs 道路事件展示场景 Map< String, MapCenterPoint > aimlessWithRoadEvent = new HashMap<>(); - aimlessWithRoadEvent.put( "d80x", new MapCenterPoint( 0.5D, 0.68617 ) ); - aimlessWithRoadEvent.put( "em4", new MapCenterPoint( 0.5D, 0.68617 ) ); - aimlessWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.5D, 0.68617 ) ); - aimlessWithRoadEvent.put( "f80x", new MapCenterPoint( 0.5D, 0.599074074D ) ); - aimlessWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.5D, 0.599074074D ) ); + MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.68617 ); + aimlessWithRoadEvent.put( "d80x", point1 ); + aimlessWithRoadEvent.put( "em4", point1 ); + aimlessWithRoadEvent.put( "e8xx", point1 ); + MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.599074074D ); + aimlessWithRoadEvent.put( "f80x", point2 ); + aimlessWithRoadEvent.put( "f8xx", point2 ); + aimlessWithRoadEvent.put( "f8Amap", point2 ); sVrStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent ); } { // 规划路线,定位视图右边 Map< String, MapCenterPoint > calculatePath = new HashMap<>(); - calculatePath.put( "d80x", new MapCenterPoint( 0.5D, 0.610833D ) ); - calculatePath.put( "em4", new MapCenterPoint( 0.5D, 0.610833D ) ); - calculatePath.put( "e8xx", new MapCenterPoint( 0.5D, 0.610833D ) ); - calculatePath.put( "f80x", new MapCenterPoint( 0.5D, 0.6083333D ) ); - calculatePath.put( "f8xx", new MapCenterPoint( 0.5D, 0.6083333D ) ); + MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.610833D ); + calculatePath.put( "d80x", point1 ); + calculatePath.put( "em4", point1 ); + calculatePath.put( "e8xx", point1 ); + MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.6083333D ); + calculatePath.put( "f80x", point2 ); + calculatePath.put( "f8xx", point2 ); + calculatePath.put( "f8Amap", point2 ); sVrStrategies.put( Scene.CALCULATE_PATH, calculatePath ); } { // 分类搜索,定位视图右边 Map< String, MapCenterPoint > categorySearch = new HashMap<>(); - categorySearch.put( "d80x", new MapCenterPoint( 0.5D, 0.5D ) ); - categorySearch.put( "em4", new MapCenterPoint( 0.5D, 0.5D ) ); - categorySearch.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) ); - categorySearch.put( "f80x", new MapCenterPoint( 0.5D, 0.5D ) ); - categorySearch.put( "f8xx", new MapCenterPoint( 0.5D, 0.5D ) ); + MapCenterPoint point = new MapCenterPoint( 0.5D, 0.5D ); + categorySearch.put( "d80x", point ); + categorySearch.put( "em4", point ); + categorySearch.put( "e8xx", point ); + categorySearch.put( "f80x", point ); + categorySearch.put( "f8xx", point ); + categorySearch.put( "f8Amap", point ); sVrStrategies.put( Scene.CATEGORY_SEARCH, categorySearch ); } { // V2X,场景视图右边 Map< String, MapCenterPoint > categoryV2XEvent = new HashMap<>(); - categoryV2XEvent.put( "d80x", new MapCenterPoint( 0.5, 0.7D ) ); - categoryV2XEvent.put( "em4", new MapCenterPoint( 0.5, 0.7D ) ); - categoryV2XEvent.put( "e8xx", new MapCenterPoint( 0.5, 0.7D ) ); - categoryV2XEvent.put( "f80x", new MapCenterPoint( 0.5, 0.65D ) ); - categoryV2XEvent.put( "f8xx", new MapCenterPoint( 0.5, 0.65D ) ); + MapCenterPoint point1 = new MapCenterPoint( 0.5, 0.7D ); + categoryV2XEvent.put( "d80x",point1 ); + categoryV2XEvent.put( "em4",point1 ); + categoryV2XEvent.put( "e8xx",point1 ); + MapCenterPoint point2 = new MapCenterPoint( 0.5, 0.65D ); + categoryV2XEvent.put( "f80x", point2 ); + categoryV2XEvent.put( "f8xx", point2 ); + categoryV2XEvent.put( "f8Amap", point2 ); sVrStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent ); } } @@ -239,7 +269,7 @@ public class MapCenterPointStrategy { return; } Map> strategies = sCommonStrategies; - if ( MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().isVrMode() ) { + if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { strategies = sVrStrategies; } if ( !strategies.containsKey( scene ) ) { diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MyLocationUtil.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MyLocationUtil.java index 1adcc4500f..b6919646fa 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MyLocationUtil.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MyLocationUtil.java @@ -20,6 +20,7 @@ import com.mogo.map.uicontroller.CarCursorOption; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.R; import com.mogo.utils.UiThreadHandler; +import com.mogo.utils.ViewUtils; import com.mogo.utils.glide.GlideApp; /** @@ -101,31 +102,6 @@ public class MyLocationUtil { View root = LayoutInflater.from(context).inflate(R.layout.module_common_my_location, null, false); ImageView iv = root.findViewById(R.id.module_map_amap_my_location_iv); iv.setImageBitmap(res); - return fromView(root); - } - - - private static Bitmap fromView( View view ) { - view.setDrawingCacheEnabled( true ); - processChildView( view ); - view.destroyDrawingCache(); - view.measure( View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED ), View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED ) ); - view.layout( 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight() ); - Bitmap bitmap = null; - return ( bitmap = view.getDrawingCache() ) != null ? bitmap.copy( Bitmap.Config.ARGB_8888, false ) : null; - } - - private static void processChildView( View view ) { - if ( !( view instanceof ViewGroup ) ) { - if ( view instanceof TextView ) { - ( ( TextView ) view ).setHorizontallyScrolling( false ); - } - - } else { - for ( int var1 = 0; var1 < ( ( ViewGroup ) view ).getChildCount(); ++var1 ) { - processChildView( ( ( ViewGroup ) view ).getChildAt( var1 ) ); - } - - } + return ViewUtils.fromView(root); } } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index 612e36b511..e23f125b4e 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -285,8 +285,12 @@ public class EntranceFragment extends MvpFragment + android:visibility="gone" /> implements private boolean mIsControllerByOthersStatus = false; - private boolean mIsFirstLoadCustomMap = true; - @Override protected int getLayoutId() { return R.layout.module_map_fragment_map; @@ -59,43 +50,10 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements @Override public void changeTo2dMode() { -// if ( !isVrMode() ) { -// return; -// } -// afterMapModeChanged(); -// MogoApisHandler.getInstance().getApis().getAdasControllerApi().showADAS(); -// MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false ); } @Override public void changeToVRMode() { -// if ( isVrMode() ) { -// return; -// } -// if ( mIsFirstLoadCustomMap ) { -//// initMapView(); -//// mMogoMap = mMogoMapView.getMap(); -//// if ( mMogoMap.getUIController() != null ) { -//// mMogoMap.getUIController().showMyLocation( true ); -//// mMogoMap.getUIController().recoverLockMode();// 启动锁车 -//// } -//// mIsFirstLoadCustomMap = false; -// } -// afterMapModeChanged(); -// MogoApisHandler.getInstance().getApis().getAdasControllerApi().closeADAS(); -// MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true ); - } - - private void afterMapModeChanged() { - MapCenterPointStrategy.resetByChangeMode(); - final EnumMapUI mapUI = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getCurrentSkinMode(); - MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().changeMapMode( mapUI ); - MogoApisHandler.getInstance().getApis().getRefreshStrategyControllerApi().restartAutoRefreshAtTime( 0 ); - } - - @Override - public boolean isVrMode() { - return mMogoMapView.isVrMode(); } @Override diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFrameController.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFrameController.java index beceedd146..76970d36aa 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFrameController.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFrameController.java @@ -44,14 +44,6 @@ class MapFrameController implements IMogoMapFrameController { } - @Override - public boolean isVrMode() { - if ( mController != null ) { - return mController.isVrMode(); - } - return false; - } - @Override public void destroy() { mController = null; diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java index 1c38e58bb0..94dfbab032 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java @@ -4,7 +4,6 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.graphics.BitmapFactory; import android.location.Location; import android.net.ConnectivityManager; import android.os.Handler; @@ -15,12 +14,10 @@ import android.view.MotionEvent; import androidx.annotation.NonNull; -import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.network.ParamsProvider; import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.storage.SpStorage; -import com.mogo.commons.utils.MortonCode; import com.mogo.commons.voice.AIAssist; import com.mogo.commons.voice.IMogoVoiceCmdCallBack; import com.mogo.map.IDestroyable; @@ -28,27 +25,23 @@ import com.mogo.map.MogoLatLng; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; import com.mogo.map.location.MogoLocation; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.map.navi.IMogoAimlessModeListener; import com.mogo.map.navi.IMogoCarLocationChangedListener2; import com.mogo.map.navi.IMogoNavi; import com.mogo.map.navi.IMogoNaviListener; import com.mogo.map.navi.MogoCongestionInfo; import com.mogo.map.navi.MogoTraffic; +import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.map.uicontroller.IMogoMapUIController; -import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.MogoModule; import com.mogo.module.common.MogoModulePaths; -import com.mogo.module.common.entity.CloudLocationInfo; import com.mogo.module.common.entity.MarkerResponse; import com.mogo.module.common.map.MapCenterPointStrategy; import com.mogo.module.common.map.Scene; -import com.mogo.module.common.utils.CoordinateSystemTransformationUtil; import com.mogo.module.service.autopilot.AutoPilotRemoteController; +import com.mogo.module.service.handler.MainLooperHandler; +import com.mogo.module.service.handler.RefreshWorkThreadHandler; import com.mogo.module.service.intent.IntentHandlerFactory; -import com.mogo.module.service.launchercard.LauncherCardRefresher; -import com.mogo.module.service.location.MogoRTKLocation; import com.mogo.module.service.marker.MapMarkerManager; import com.mogo.module.service.network.RefreshCallback; import com.mogo.module.service.network.RefreshModel; @@ -61,14 +54,8 @@ import com.mogo.module.service.refresh.CustomRefreshStrategy; import com.mogo.module.service.refresh.RefreshObject; import com.mogo.module.service.strategy.CarIconDisplayStrategy; import com.mogo.module.service.ttsConfig.TtsConfigModleData; -import com.mogo.module.service.utils.SimpleLocationCorrectStrategy; -import com.mogo.module.service.vrmode.VrModeController; -import com.mogo.module.service.websocket.LocationResult; -import com.mogo.module.service.websocket.OnePerSecondSendContent; +import com.mogo.module.service.uploadintime.SnapshotUploadInTime; import com.mogo.service.adas.IMogoADASController; -import com.mogo.service.adas.entity.ADASRecognizedResult; -import com.mogo.service.connection.IMogoOnWebSocketMessageListener; -import com.mogo.service.connection.WebSocketMsgType; import com.mogo.service.fragmentmanager.FragmentStackTransactionListener; import com.mogo.service.fragmentmanager.IMogoFragmentManager; import com.mogo.service.intent.IMogoIntentListener; @@ -81,20 +68,11 @@ import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.IMogoStatusManager; import com.mogo.service.statusmanager.StatusDescriptor; import com.mogo.utils.NetworkUtils; -import com.mogo.utils.UiThreadHandler; import com.mogo.utils.WorkThreadHandler; import com.mogo.utils.logger.Logger; import com.mogo.utils.network.RequestOptions; import com.mogo.utils.network.utils.GsonUtil; -import com.zhidao.carchattingprovider.CallChattingProviderConstant; -import com.zhidao.carchattingprovider.ICallChatResponse; -import com.zhidao.carchattingprovider.ICallProviderResponse; -import com.zhidao.carchattingprovider.ICarsChattingProvider; -import org.jetbrains.annotations.NotNull; -import org.json.JSONObject; - -import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -123,7 +101,7 @@ public class MogoServices implements IMogoMapListener, IDestroyable { private boolean mInternalUnWakeupRegisterStatus = false; - private ICarsChattingProvider carsChattingProvider; + private Location mLastCarLocation; private MogoServices() { @@ -185,7 +163,6 @@ public class MogoServices implements IMogoMapListener, private IMogoNavi mNavi; private IMogoRegisterCenter mRegisterCenter; - private ICallProviderResponse mCallProviderResponse; /** * 地图视图初始化 @@ -199,41 +176,42 @@ public class MogoServices implements IMogoMapListener, */ private boolean mLoopRequest = false; - private Handler mHandler = new Handler( Looper.getMainLooper() ) { + private Handler mHandler = new MainLooperHandler( Looper.getMainLooper() ) { + @Override - public void handleMessage( @NonNull Message msg ) { - super.handleMessage( msg ); - switch ( msg.what ) { - case ServiceConst.MSG_TYPE_REFRESH_DECREASE: - if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) { - invokeAutoRefreshStrategy(); - return; - } - mRefreshRemainingTime -= ServiceConst.DECREASE_INTERVAL; - if ( mRefreshRemainingTime <= 0 ) { - Logger.d( TAG, "move to center and refresh data." ); - invokeAutoRefresh(); - } else { - mHandler.sendEmptyMessageDelayed( msg.what, ServiceConst.DECREASE_INTERVAL ); - } - break; - case ServiceConst.MSG_LOOP_REQUEST: - if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) { - return; - } - if ( mLoopRequest ) { - Logger.d( TAG, "补偿刷新触发" ); - invokeAutoRefresh(); - } - break; - case ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH: - handleCalculationNotHomeCompanyDistanceForPush( msg.arg1 ); - break; + protected void handleRefreshDecrease( Message msg ) { + if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) { + invokeAutoRefreshStrategy(); + return; + } + mRefreshRemainingTime -= ServiceConst.DECREASE_INTERVAL; + if ( mRefreshRemainingTime <= 0 ) { + Logger.d( TAG, "move to center and refresh data." ); + invokeAutoRefresh(); + } else { + mHandler.sendEmptyMessageDelayed( msg.what, ServiceConst.DECREASE_INTERVAL ); } } + @Override + protected void handleLoopRequestMessage( Message msg ) { + if ( mStatusManager.isSearchUIShow() || mStatusManager.isV2XShow() ) { + return; + } + if ( mLoopRequest ) { + Logger.d( TAG, "补偿刷新触发" ); + invokeAutoRefresh(); + } + } }; + public RefreshModel getRefreshModel() { + if ( mRefreshModel == null ) { + mRefreshModel = new RefreshModel( mContext ); + } + return mRefreshModel; + } + /** * 自动刷新:锁车、缩放比例:16、半径 2KM */ @@ -243,10 +221,10 @@ public class MogoServices implements IMogoMapListener, mUiController.recoverLockMode(); return; } - mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false); - mUiController.changeZoom(ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL); + mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false ); + mUiController.changeZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL ); // mUiController.setLockZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL ); - mStatusManager.setUserInteractionStatus(TAG, true, false); + mStatusManager.setUserInteractionStatus( TAG, true, false ); mUiController.recoverLockMode(); notifyRefreshData( mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback ); } @@ -314,17 +292,7 @@ public class MogoServices implements IMogoMapListener, */ private int mCurrentLimit = -1; - private boolean mIsMainPageFirstResume = true; - - private boolean mIsFirstAccOn = true; - private IMogoStatusChangedListener statusChangedListener = new StatusChangedAdapter() { - @Override - public void onUserInteracted( boolean userInteracted ) { - if ( userInteracted ) { - restartAutoRefreshAtTime( ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT ); - } - } @Override public void onSearchUIShow( boolean visible ) { @@ -338,113 +306,24 @@ public class MogoServices implements IMogoMapListener, } } } - - @Override - public void onMainPageResumeStatusChanged( boolean resume ) { - if ( resume ) { - registerInternalUnWakeupWords(); - if ( !mIsMainPageFirstResume ) { - restartAutoRefreshAtTime( 2_000L ); - } - mIsMainPageFirstResume = false; - LauncherCardRefresher.getInstance(mContext).stop(); - playAppTts(); - } else { - unregisterInternalUnWakeupWords(); - stopAutoRefreshStrategy(); - } - VrModeController.getInstance().onMainPageResumeStatusChanged( resume ); - } - - @Override - public void onMainPageIsBackgroundStatusChanged(boolean isBackground) { - if (isBackground) { - closeAllPanel(); - } - } - - @Override - public void onSeekHelpingStatusChanged( boolean isSeekingHelping ) { - CarIconDisplayStrategy.getInstance().changeCarIconStatus( isSeekingHelping ); - notifySeekHelpingStatusChanged( isSeekingHelping ); - } - - @Override - public void onAccStatusChanged( boolean accOn ) { - if ( accOn ) { - if ( mIsFirstAccOn ) { - mIsFirstAccOn = false; - return; - } - initLocationServiceProcess( mContext ); - mADASController.showADAS(); - MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).start(); - MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers(); - UiThreadHandler.postDelayed( () -> { - refreshStrategy(); - }, 3_000L ); - } else { - MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( mContext ).stop(); - MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers(); - } - } - - @Override - public void onTopViewStatusChanged(boolean visible) { - if (visible) { - return; - } - try { - MapMarkerManager.getInstance().onCloseCurrentSelectedMarker(); - } catch (Exception e) { - Logger.e(TAG, e, "onTopViewStatusChanged"); - } - } - - @Override - public void onVrModeChanged( boolean isVrMode ) { - VrModeController.getInstance().onVrModeChanged( isVrMode ); - } }; /** * 每次onResume的时候 在独立app里面播放系统配置的tts语音 */ - private void playAppTts() { - if (DebugConfig.isLauncher()) { + public void playAppTts() { + if ( DebugConfig.isLauncher() ) { return; } mTtsModle.playTts(); } - /** - * 关闭所有模块的控制面板 - */ - private void closeAllPanel() { - - if ( mCallProviderResponse == null ) { - mCallProviderResponse = new ICallChatResponse() { - @Override - public void hideUserWindowError(@NotNull String errorMsg) { - } - }; - } - MogoApisHandler.getInstance().getApis().getShareManager().dismissShareDialog(); - MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().hidePanel(); - MogoApisHandler.getInstance().getApis().getAdasControllerApi().setSettingStatus(false); - MogoApisHandler.getInstance().getApis().getEventPanelManager().hidePanel(); - if ( carsChattingProvider == null ) { - carsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation(); - } - if ( carsChattingProvider != null ) { - carsChattingProvider.hideUserWindow(TAG, mContext, mCallProviderResponse); - } - } public void preInit( Context context ) { mContext = context; mRefreshModel = new RefreshModel( context ); + mTtsModle = new TtsConfigModleData(); mMogoMapService = MarkerServiceHandler.getMapService(); mUiController = mMogoMapService.getMapUIController(); mNavi = mMogoMapService.getNavi( context ); @@ -456,6 +335,8 @@ public class MogoServices implements IMogoMapListener, mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEEK_HELPING, statusChangedListener ); mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.ACC_STATUS, statusChangedListener ); mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.VR_MODE, statusChangedListener ); + mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.TOP_VIEW, statusChangedListener ); + mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListener ); mStatusManager.setAIAssistReady( TAG, AIAssist.getInstance( mContext ).hasFlush() ); } @@ -515,53 +396,11 @@ public class MogoServices implements IMogoMapListener, Intent intent = new Intent( "com.freedom.ser.ACTION" ); intent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES ); mContext.sendBroadcast( intent ); - MogoRTKLocation.getInstance().registerRTKLocationListener( cloudLocationInfos -> { - Logger.i( TAG, "cloudLocationInfos size : " + cloudLocationInfos.size() ); - startSendCarLocationAndAdasRecognizedResult2Server( cloudLocationInfos ); - } ); -// SimpleLocationCorrectStrategy.getInstance().setRecordLocationListener((history, correct,valid,err) -> { -// // todo 打点 -// Logger.d("SimpleCorrect","correct: "+correct); -// Logger.d("SimpleCorrect","valid: "+valid); -// Logger.d("SimpleCorrect","err: "+err); -// ArrayList optionList = new ArrayList<>(); -//// for (CloudLocationInfo h : history) { -//// MogoMarkerOptions options = new MogoMarkerOptions(); -//// options.position(LocationParseUtil.cloudLocationToMogoLatLng(h)); -//// options.icon(BitmapFactory.decodeResource(context.getResources(), -//// R.drawable.bg_map_marker_blue)); -//// optionList.add(options); -//// } -// -// for (CloudLocationInfo v : valid) { -// MogoMarkerOptions options = new MogoMarkerOptions(); -// options.position(LocationParseUtil.cloudLocationToMogoLatLng(v)); -// options.icon(BitmapFactory.decodeResource(context.getResources(), -// R.drawable.bg_map_marker_oragne)); -// optionList.add(options); -// } -// -// for (CloudLocationInfo c : correct) { -// MogoMarkerOptions options = new MogoMarkerOptions(); -// options.position(LocationParseUtil.cloudLocationToMogoLatLng(c)); -// options.icon(BitmapFactory.decodeResource(context.getResources(), -// R.drawable.bg_map_marker_green)); -// optionList.add(options); -// } -// -// for (CloudLocationInfo e : err) { -// MogoMarkerOptions options = new MogoMarkerOptions(); -// options.position(LocationParseUtil.cloudLocationToMogoLatLng(e)); -// options.icon(BitmapFactory.decodeResource(context.getResources(), -// R.drawable.bg_map_marker_red)); -// optionList.add(options); -// } -// MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(context).addMarkers("MogoServices", optionList, false); -// }); + SnapshotUploadInTime.getInstance().start( mContext ); } - private void initLocationServiceProcess( Context context ) { + public void initLocationServiceProcess( Context context ) { try { Intent intent = new Intent(); intent.setAction( "com.zhidao.locationinfo.service.uploaddataservice" ); @@ -574,125 +413,34 @@ public class MogoServices implements IMogoMapListener, } - private List< List< Double > > coors = new ArrayList<>(); - private CloudLocationInfo mLastInfo; - private void startSendCarLocationAndAdasRecognizedResult2Server( List< CloudLocationInfo > cloudLocationInfo ) { -// Location lastCarLocation = mLastCarLocation; - CloudLocationInfo lastInfo = null; - // 如果数组内容不为空,就用数组最后一个值 - if ( cloudLocationInfo != null && !cloudLocationInfo.isEmpty() ) { - lastInfo = cloudLocationInfo.get( cloudLocationInfo.size() - 1 ); - mLastInfo = lastInfo; - } - if ( lastInfo == null ) { - lastInfo = mLastInfo; - } - LocationResult locationResult = null; - if ( lastInfo != null ) { - // 定位点预测纠偏 - lastInfo = SimpleLocationCorrectStrategy.getInstance().correct( lastInfo ); - locationResult = new LocationResult(); - if ( lastInfo != null ) { -// List coor = new ArrayList<>( ); -// double pos[] = CoordinateUtils.transformFromWGSToGCJ( lastInfo.getLat(), lastInfo.getLon() ); -// coor.add( pos[1]); -// coor.add(pos[0] ); -// coors.add( coor ); -// if ( coors.size()>50 ) { -// Logger.d( "Print-coor", GsonUtil.jsonFromObject( coors ) ); -// coors.clear(); -// } -// moveMarker( lastInfo.getLat(), lastInfo.getLon() ); - locationResult.lastCoordinate = lastInfo; - locationResult.mortonCode = MortonCode.wrapEncodeMorton( lastInfo.getLon(), lastInfo.getLat() ); - } - locationResult.coordinates = new ArrayList<>(); - locationResult.sn = com.mogo.commons.network.Utils.getSn(); - if ( cloudLocationInfo == null ) { - locationResult.coordinates.addAll( new ArrayList<>() ); - } else { - locationResult.coordinates.addAll( cloudLocationInfo ); - } - } - List< ADASRecognizedResult > recognizedResults = MarkerServiceHandler.getADASController().getLastADASRecognizedResult(); - OnePerSecondSendContent content = new OnePerSecondSendContent(); - content.self = locationResult; - content.adas = recognizedResults; - - Logger.d( TAG, GsonUtil.jsonFromObject( content ) ); - MarkerServiceHandler.getApis().getWebSocketManagerApi( mContext ).sendMsg( content, new IMogoOnWebSocketMessageListener() { - @Override - public WebSocketMsgType getDownLinkType() { - return null; - } - - @Override - public WebSocketMsgType getUpLinkType() { - return WebSocketMsgType.MSG_TYPE_UPLINK_CAR_DATA; - } - } ); - } - - private IMogoMarker marker = null; - - private void moveMarker( double lat, double lon ) { - List< Double > coor = new ArrayList<>(); - double pos[] = CoordinateSystemTransformationUtil.transformWgsToGcj( lat, lon ); - coor.add( pos[1] ); - coor.add( pos[0] ); - coors.add( coor ); - if ( coors.size() > 50 ) { - Logger.d( "Print-coor", GsonUtil.jsonFromObject( coors ) ); - coors.clear(); - } - if ( marker == null ) { - marker = MogoApisHandler.getInstance().getApis() - .getMapServiceApi().getMarkerManager( mContext ) - .addMarker( TAG, new MogoMarkerOptions() - .latitude( lat ) - .longitude( lon ) - .gps( true ) - .icon( BitmapFactory.decodeResource( mContext.getResources(), R.drawable.bg_map_marker_blue ) ) ) - ; - } - if ( marker != null ) { - marker.setPosition( lat, lon ); - } - } - private void initWorkThread() { - mThreadHandler = new Handler( WorkThreadHandler.getInstance().getLooper() ) { + mThreadHandler = new RefreshWorkThreadHandler( WorkThreadHandler.getInstance().getLooper() ) { @Override - public void handleMessage( Message msg ) { - super.handleMessage( msg ); - Logger.d( TAG, "current thread: %s, msg = %s", Thread.currentThread(), msg.what ); - if ( msg.what == ServiceConst.MSG_MAP_CHANGED ) { - if ( msg.obj instanceof RefreshObject ) { - RefreshObject ro = ( ( RefreshObject ) msg.obj ); - if ( invokeRefreshWhenTranslationByUser( ro.mLonLat ) ) { - notifyRefreshData( ro.mLonLat, ro.mRadius, ro.mCallback ); - mLastCustomRefreshCenterLocation = ro.mLonLat; - } + protected void handleMapChangedMessage( Message msg ) { + if ( msg.obj instanceof RefreshObject ) { + RefreshObject ro = ( ( RefreshObject ) msg.obj ); + if ( invokeRefreshWhenTranslationByUser( ro.mLonLat ) ) { + notifyRefreshData( ro.mLonLat, ro.mRadius, ro.mCallback ); + mLastCustomRefreshCenterLocation = ro.mLonLat; } - } else if ( msg.what == ServiceConst.MSG_REQUEST_DATA ) { - if ( msg.obj instanceof RefreshObject ) { - RefreshObject ro = ( ( RefreshObject ) msg.obj ); - if ( ro.mLonLat == null ) { - invokeAutoRefreshStrategy(); - Logger.w( TAG, "lonLat is null." ); - return; - } - mRefreshModel.refreshExplorerWayData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback ); -// MapMarkerManager.getInstance().getOnlineCarDataByAutoRefreshStrategy( ro.mLonLat ); + } + } - Logger.i(TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount); - } - } else if ( msg.what == ServiceConst.MSG_LOCK_CAR ) { - if ( mStatusManager.isSearchUIShow() ) { + @Override + protected void handleRequestDataMessage( Message msg ) { + if ( msg.obj instanceof RefreshObject ) { + RefreshObject ro = ( ( RefreshObject ) msg.obj ); + if ( ro.mLonLat == null ) { + invokeAutoRefreshStrategy(); + Logger.w( TAG, "lonLat is null." ); return; } - mStatusManager.setUserInteractionStatus( TAG, true, false ); - mUiController.recoverLockMode(); + mRefreshModel.refreshExplorerWayData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback ); + if ( !DebugConfig.isNeedUploadCoordinatesDurationInTime() ) { + MapMarkerManager.getInstance().getOnlineCarDataByAutoRefreshStrategy( ro.mLonLat ); + } + + Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount ); } } }; @@ -730,9 +478,9 @@ public class MogoServices implements IMogoMapListener, filter.addAction( MogoReceiver.ACTION_TXZ_BLOCK_SEARCH ); filter.addAction( ConnectivityManager.CONNECTIVITY_ACTION ); try { - context.getApplicationContext().registerReceiver(mAIAssistReceiver, filter); - } catch (Exception e) { - Logger.e(TAG, e, "error. "); + context.getApplicationContext().registerReceiver( mAIAssistReceiver, filter ); + } catch ( Exception e ) { + Logger.e( TAG, e, "error. " ); } } @@ -793,22 +541,22 @@ public class MogoServices implements IMogoMapListener, } } - private void stopAutoRefreshStrategy() { + public void stopAutoRefreshStrategy() { stopAutoRefreshStrategy( true ); } - private void stopAutoRefreshStrategy(boolean stopOnlineCarRefresh) { - mHandler.removeMessages(ServiceConst.MSG_TYPE_REFRESH_DECREASE); - if (stopOnlineCarRefresh) { + private void stopAutoRefreshStrategy( boolean stopOnlineCarRefresh ) { + mHandler.removeMessages( ServiceConst.MSG_TYPE_REFRESH_DECREASE ); + if ( stopOnlineCarRefresh ) { MapMarkerManager.getInstance().stopAutoRefresh(); } } @Override - public void onLockMap(boolean isLock) { - mThreadHandler.removeMessages(ServiceConst.MSG_LOCK_CAR); - if (!isLock) { - mThreadHandler.sendEmptyMessageDelayed(ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT); + public void onLockMap( boolean isLock ) { + mThreadHandler.removeMessages( ServiceConst.MSG_LOCK_CAR ); + if ( !isLock ) { + mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_LOCK_CAR, ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT ); } } @@ -859,8 +607,8 @@ public class MogoServices implements IMogoMapListener, // 手动平移 Message msg = Message.obtain(); msg.what = ServiceConst.MSG_MAP_CHANGED; - msg.obj = new RefreshObject(mCustomRefreshCallback, getQueryRadius(), latLng, 0); - mThreadHandler.sendMessage(msg); + msg.obj = new RefreshObject( mCustomRefreshCallback, getQueryRadius(), latLng, 0 ); + mThreadHandler.sendMessage( msg ); } } @@ -893,30 +641,30 @@ public class MogoServices implements IMogoMapListener, if ( factor == 0.0f ) { return false; } - float distance = Utils.calculateLineDistance(latLng, mLastCustomRefreshCenterLocation); - return distance > (factor / 2); - } catch (Exception e) { - Logger.e(TAG, e, "warming. "); + float distance = Utils.calculateLineDistance( latLng, mLastCustomRefreshCenterLocation ); + return distance > ( factor / 2 ); + } catch ( Exception e ) { + Logger.e( TAG, e, "warming. " ); return false; } } @Override - public void onLocationChanged(MogoLocation location) { + public void onLocationChanged( MogoLocation location ) { - if (!DebugConfig.isMapBased()) { + if ( !DebugConfig.isMapBased() ) { return; } - if (!mStatusManager.isMainPageLaunched()) { + if ( !mStatusManager.isMainPageLaunched() ) { return; } - if (!mStatusManager.isMainPageOnResume()) { + if ( !mStatusManager.isMainPageOnResume() ) { return; } - if (mStatusManager.isV2XShow()) { + if ( mStatusManager.isV2XShow() ) { return; } @@ -977,21 +725,21 @@ public class MogoServices implements IMogoMapListener, /** * 刷新数据 */ - private void notifyRefreshData(MogoLatLng latLng, int radius, RefreshCallback callback) { + private void notifyRefreshData( MogoLatLng latLng, int radius, RefreshCallback callback ) { - if (!DebugConfig.isMapBased()) { + if ( !DebugConfig.isMapBased() ) { return; } - if (!mStatusManager.isMainPageLaunched()) { + if ( !mStatusManager.isMainPageLaunched() ) { return; } - if (!mStatusManager.isMainPageOnResume()) { + if ( !mStatusManager.isMainPageOnResume() ) { return; } - if (mStatusManager.isSearchUIShow()) { + if ( mStatusManager.isSearchUIShow() ) { return; } int amount = 20; @@ -1004,21 +752,6 @@ public class MogoServices implements IMogoMapListener, } } - private void notifySeekHelpingStatusChanged( boolean seekHelpingStatus ) { - Intent intent = new Intent( "com.mogo.launcher.adas.app" ); - try { - JSONObject data = new JSONObject(); - data.put( "object", "辅助驾驶" ); - data.put( "action", seekHelpingStatus ? "2" : "1" ); - data.put( "des", "自身故障报警" ); - data.put( "v2x_warning_type", "20007" );// 后台返回 - intent.putExtra( "data", data.toString() ); - mContext.sendBroadcast( intent ); - } catch ( Exception e ) { - Logger.e( TAG, e, "error." ); - } - } - public void restartAutoRefreshAtTime( long time ) { restartAutoRefreshAtTime( time, true ); } @@ -1031,26 +764,26 @@ public class MogoServices implements IMogoMapListener, } } - private void restartAutoRefreshAtTime(long time, boolean stopOnlineCarRefresh) { - if (time < 0) { - Logger.w(TAG, "refresh request case time < 0, set to 0 and go on."); + private void restartAutoRefreshAtTime( long time, boolean stopOnlineCarRefresh ) { + if ( time < 0 ) { + Logger.w( TAG, "refresh request case time < 0, set to 0 and go on." ); time = 0; } - stopAutoRefreshStrategy(stopOnlineCarRefresh); + stopAutoRefreshStrategy( stopOnlineCarRefresh ); mRefreshRemainingTime = time; long delay = ServiceConst.DECREASE_INTERVAL; - if (mRefreshRemainingTime < ServiceConst.DECREASE_INTERVAL) { + if ( mRefreshRemainingTime < ServiceConst.DECREASE_INTERVAL ) { delay = mRefreshRemainingTime; } - if (time == 0) { + if ( time == 0 ) { invokeAutoRefresh(); } else { - mHandler.sendEmptyMessageDelayed(ServiceConst.MSG_TYPE_REFRESH_DECREASE, delay); + mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_TYPE_REFRESH_DECREASE, delay ); } } public void refreshStrategy() { - mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false); + mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false ); mUiController.recoverLockMode();// 锁车代替移到中心点 restartAutoRefreshAtTime( 0 ); } @@ -1075,11 +808,6 @@ public class MogoServices implements IMogoMapListener, mContext.sendBroadcast( intent ); } - @Override - public void onUpdateCongestion( MogoCongestionInfo info ) { - - } - @Override public void onIntentReceived( String command, Intent intent ) { @@ -1099,7 +827,7 @@ public class MogoServices implements IMogoMapListener, /** * 注册桌面免唤醒指令 */ - private void registerInternalUnWakeupWords() { + public void registerInternalUnWakeupWords() { if ( mInternalUnWakeupRegisterStatus ) { return; } @@ -1112,7 +840,7 @@ public class MogoServices implements IMogoMapListener, /** * 注销桌面免唤醒指令 */ - private void unregisterInternalUnWakeupWords() { + public void unregisterInternalUnWakeupWords() { if ( !mInternalUnWakeupRegisterStatus ) { return; } @@ -1191,67 +919,13 @@ public class MogoServices implements IMogoMapListener, /** * 延时一分钟发起计算导航目的地推送策略 */ - private void scheduleCalculationNotHomeCompanyDistanceForPush( int time, long delay ) { + public void scheduleCalculationNotHomeCompanyDistanceForPush( int time, long delay ) { Message msg = Message.obtain(); msg.what = ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH; msg.arg1 = time; mHandler.sendMessageDelayed( msg, delay ); } - /** - * 发起计算导航目的地推送策略 - * - * @param time 第x次重试 - */ - private void handleCalculationNotHomeCompanyDistanceForPush( final int time ) { - if ( time > 3 ) { - return; - } - String json = SpStorage.getNavigationTarget(); - if ( !TextUtils.isEmpty( json ) ) { - try { - NavigationTargetInfo info = GsonUtil.objectFromJson( json, NavigationTargetInfo.class ); - - Logger.d( TAG, "info = %s", info ); - - HomeCompanyDistanceForPushData data = new HomeCompanyDistanceForPushData(); - data.lat = Double.valueOf( info.getToPoiLatitude() ); - data.lon = Double.valueOf( info.getToPoiLongitude() ); - - final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build(); - query.put( "data", GsonUtil.jsonFromObject( data ) ); - mRefreshModel.getRefreshApiService().calculationNotHomeCompanyDistanceForPush( query ) - .subscribeOn( Schedulers.io() ) - .observeOn( AndroidSchedulers.mainThread() ) - .subscribe( new SubscribeImpl< HomeCompanyDistanceForPushResponse >( RequestOptions.create( mContext ) ) { - @Override - public void onSuccess( HomeCompanyDistanceForPushResponse o ) { - super.onSuccess( o ); - if ( o != null && o.result != null ) { - Logger.d( TAG, "calculationNotHomeCompanyDistanceForPush result %s", o.result.pushFlag ); - } - } - - @Override - public void onError( Throwable e ) { - super.onError( e ); - Logger.d( TAG, "re scheduleCalculationNotHomeCompanyDistanceForPush after 30s" ); - // 延时30s重试 - scheduleCalculationNotHomeCompanyDistanceForPush( time + 1, 30_000L ); - } - - @Override - public void onError( String message, int code ) { - super.onError( message, code ); - } - } ); - } catch ( Exception e ) { - Logger.e( TAG, e, "handleCalculationNotHomeCompanyDistanceForPush" ); - } - - } - } - @Override public void destroy() { Logger.d( TAG, "MogoServices do nothings." ); @@ -1260,4 +934,13 @@ public class MogoServices implements IMogoMapListener, public Location getLastCarLocation() { return mLastCarLocation; } + + @Override + public void onMapModeChanged( EnumMapUI ui ) { + if ( ui == EnumMapUI.Type_VR ) { + MapCenterPointStrategy.resetByChangeMode(); + } else { + MapCenterPointStrategy.resetByChangeMode(); + } + } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java index 34dbd925e4..0dea8a3efe 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java @@ -1,7 +1,25 @@ package com.mogo.module.service; +import android.content.Intent; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.commons.AbsMogoApplication; +import com.mogo.module.common.MogoApisHandler; +import com.mogo.module.service.launchercard.LauncherCardRefresher; +import com.mogo.module.service.marker.MapMarkerManager; +import com.mogo.module.service.strategy.CarIconDisplayStrategy; +import com.mogo.module.service.vrmode.VrModeController; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; +import com.mogo.utils.UiThreadHandler; +import com.mogo.utils.logger.Logger; +import com.zhidao.carchattingprovider.CallChattingProviderConstant; +import com.zhidao.carchattingprovider.ICallChatResponse; +import com.zhidao.carchattingprovider.ICallProviderResponse; +import com.zhidao.carchattingprovider.ICarsChattingProvider; + +import org.jetbrains.annotations.NotNull; +import org.json.JSONObject; public /** @@ -12,6 +30,15 @@ public */ abstract class StatusChangedAdapter implements IMogoStatusChangedListener { + private static final String TAG = "StatusChangedAdapter"; + + private boolean mIsMainPageFirstResume = true; + + private ICallProviderResponse mCallProviderResponse; + private ICarsChattingProvider mCarsChattingProvider; + + private boolean mIsFirstAccOn = true; + @Override public final void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) { switch ( descriptor ) { @@ -42,19 +69,111 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener { } } - public abstract void onUserInteracted( boolean userInteracted ); + public void onUserInteracted( boolean userInteracted ) { + if ( userInteracted ) { + MogoServices.getInstance().restartAutoRefreshAtTime( ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT ); + } + } public abstract void onSearchUIShow( boolean visible ); - public abstract void onMainPageResumeStatusChanged( boolean resume ); + public void onMainPageResumeStatusChanged( boolean resume ) { + if ( resume ) { + MogoServices.getInstance().registerInternalUnWakeupWords(); + if ( !mIsMainPageFirstResume ) { + MogoServices.getInstance().restartAutoRefreshAtTime( 2_000L ); + } + mIsMainPageFirstResume = false; + LauncherCardRefresher.getInstance( AbsMogoApplication.getApp() ).stop(); + MogoServices.getInstance().playAppTts(); + } else { + MogoServices.getInstance().unregisterInternalUnWakeupWords(); + MogoServices.getInstance().stopAutoRefreshStrategy(); + } + VrModeController.getInstance().onMainPageResumeStatusChanged( resume ); + } - public abstract void onMainPageIsBackgroundStatusChanged( boolean isBackground ); + public void onMainPageIsBackgroundStatusChanged( boolean isBackground ) { + if ( isBackground ) { + closeAllPanel(); + } + } - public abstract void onSeekHelpingStatusChanged( boolean isSeekingHelping ); + /** + * 关闭所有模块的控制面板 + */ + private void closeAllPanel() { - public abstract void onAccStatusChanged( boolean accOn ); + if ( mCallProviderResponse == null ) { + mCallProviderResponse = new ICallChatResponse() { + @Override + public void hideUserWindowError( @NotNull String errorMsg ) { + } + }; + } + MogoApisHandler.getInstance().getApis().getShareManager().dismissShareDialog(); + MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().hidePanel(); + MogoApisHandler.getInstance().getApis().getAdasControllerApi().setSettingStatus( false ); + MogoApisHandler.getInstance().getApis().getEventPanelManager().hidePanel(); + if ( mCarsChattingProvider == null ) { + mCarsChattingProvider = ( ICarsChattingProvider ) ARouter.getInstance().build( CallChattingProviderConstant.CAR_CALL_PROVIDER ).navigation(); + } + if ( mCarsChattingProvider != null ) { + mCarsChattingProvider.hideUserWindow( TAG, AbsMogoApplication.getApp(), mCallProviderResponse ); + } + } - public abstract void onVrModeChanged( boolean isVrMode ); + public void onSeekHelpingStatusChanged( boolean isSeekingHelping ) { + CarIconDisplayStrategy.getInstance().changeCarIconStatus( isSeekingHelping ); + notifySeekHelpingStatusChanged( isSeekingHelping ); + } - public abstract void onTopViewStatusChanged( boolean visible ); + private void notifySeekHelpingStatusChanged( boolean seekHelpingStatus ) { + Intent intent = new Intent( "com.mogo.launcher.adas.app" ); + try { + JSONObject data = new JSONObject(); + data.put( "object", "辅助驾驶" ); + data.put( "action", seekHelpingStatus ? "2" : "1" ); + data.put( "des", "自身故障报警" ); + data.put( "v2x_warning_type", "20007" );// 后台返回 + intent.putExtra( "data", data.toString() ); + AbsMogoApplication.getApp().sendBroadcast( intent ); + } catch ( Exception e ) { + Logger.e( TAG, e, "error." ); + } + } + + public void onAccStatusChanged( boolean accOn ) { + if ( accOn ) { + if ( mIsFirstAccOn ) { + mIsFirstAccOn = false; + return; + } + MogoServices.getInstance().initLocationServiceProcess( AbsMogoApplication.getApp() ); + MogoApisHandler.getInstance().getApis().getAdasControllerApi().showADAS(); + MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() ).start(); + MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers(); + UiThreadHandler.postDelayed( () -> { + MogoServices.getInstance().refreshStrategy(); + }, 3_000L ); + } else { + MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() ).stop(); + MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers(); + } + } + + public void onVrModeChanged( boolean isVrMode ) { + VrModeController.getInstance().onVrModeChanged( isVrMode ); + } + + public void onTopViewStatusChanged( boolean visible ) { + if ( visible ) { + return; + } + try { + MapMarkerManager.getInstance().onCloseCurrentSelectedMarker(); + } catch ( Exception e ) { + Logger.e( TAG, e, "onTopViewStatusChanged" ); + } + } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/MainLooperHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/MainLooperHandler.java new file mode 100644 index 0000000000..b506241386 --- /dev/null +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/MainLooperHandler.java @@ -0,0 +1,120 @@ +package com.mogo.module.service.handler; + +import android.os.Handler; +import android.os.Looper; +import android.os.Message; +import android.text.TextUtils; + +import com.mogo.commons.AbsMogoApplication; +import com.mogo.commons.network.ParamsProvider; +import com.mogo.commons.network.SubscribeImpl; +import com.mogo.commons.storage.SpStorage; +import com.mogo.module.service.MogoServices; +import com.mogo.module.service.ServiceConst; +import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushData; +import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushResponse; +import com.mogo.module.service.onlinecar.panel.NavigationTargetInfo; +import com.mogo.utils.logger.Logger; +import com.mogo.utils.network.RequestOptions; +import com.mogo.utils.network.utils.GsonUtil; + +import java.util.Map; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; + +public +/** + * @author congtaowang + * @since 2020/12/14 + * + * 描述 + */ +abstract class MainLooperHandler extends Handler { + + private static final String TAG = "MainLooperHandler"; + + public MainLooperHandler( Looper looper ) { + super( looper ); + } + + @Override + public final void handleMessage( Message msg ) { + super.handleMessage( msg ); + + switch ( msg.what ) { + case ServiceConst.MSG_TYPE_REFRESH_DECREASE: + handleRefreshDecrease( msg ); + break; + case ServiceConst.MSG_LOOP_REQUEST: + handleLoopRequestMessage( msg ); + break; + case ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH: + handleScheduleCalculateNotHomeCompanyDistanceForPushMessage( msg ); + break; + } + } + + protected abstract void handleRefreshDecrease( Message msg ); + + protected abstract void handleLoopRequestMessage( Message msg ); + + protected void handleScheduleCalculateNotHomeCompanyDistanceForPushMessage( Message msg ) { + handleCalculationNotHomeCompanyDistanceForPush( msg.arg1 ); + } + + + /** + * 发起计算导航目的地推送策略 + * + * @param time 第x次重试 + */ + private void handleCalculationNotHomeCompanyDistanceForPush( final int time ) { + if ( time > 3 ) { + return; + } + String json = SpStorage.getNavigationTarget(); + if ( !TextUtils.isEmpty( json ) ) { + try { + NavigationTargetInfo info = GsonUtil.objectFromJson( json, NavigationTargetInfo.class ); + + Logger.d( TAG, "info = %s", info ); + + HomeCompanyDistanceForPushData data = new HomeCompanyDistanceForPushData(); + data.lat = Double.valueOf( info.getToPoiLatitude() ); + data.lon = Double.valueOf( info.getToPoiLongitude() ); + + final Map< String, Object > query = new ParamsProvider.Builder( AbsMogoApplication.getApp() ).build(); + query.put( "data", GsonUtil.jsonFromObject( data ) ); + MogoServices.getInstance().getRefreshModel().getRefreshApiService().calculationNotHomeCompanyDistanceForPush( query ) + .subscribeOn( Schedulers.io() ) + .observeOn( AndroidSchedulers.mainThread() ) + .subscribe( new SubscribeImpl< HomeCompanyDistanceForPushResponse >( RequestOptions.create( AbsMogoApplication.getApp() ) ) { + @Override + public void onSuccess( HomeCompanyDistanceForPushResponse o ) { + super.onSuccess( o ); + if ( o != null && o.result != null ) { + Logger.d( TAG, "calculationNotHomeCompanyDistanceForPush result %s", o.result.pushFlag ); + } + } + + @Override + public void onError( Throwable e ) { + super.onError( e ); + Logger.d( TAG, "re scheduleCalculationNotHomeCompanyDistanceForPush after 30s" ); + // 延时30s重试 + MogoServices.getInstance().scheduleCalculationNotHomeCompanyDistanceForPush( time + 1, 30_000L ); + } + + @Override + public void onError( String message, int code ) { + super.onError( message, code ); + } + } ); + } catch ( Exception e ) { + Logger.e( TAG, e, "handleCalculationNotHomeCompanyDistanceForPush" ); + } + + } + } +} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/RefreshWorkThreadHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/RefreshWorkThreadHandler.java new file mode 100644 index 0000000000..043d49971f --- /dev/null +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/handler/RefreshWorkThreadHandler.java @@ -0,0 +1,64 @@ +package com.mogo.module.service.handler; + +import android.os.Handler; +import android.os.Looper; +import android.os.Message; + +import com.mogo.commons.debug.DebugConfig; +import com.mogo.module.common.MogoApisHandler; +import com.mogo.module.service.ServiceConst; +import com.mogo.module.service.marker.MapMarkerManager; +import com.mogo.module.service.refresh.RefreshObject; +import com.mogo.utils.logger.Logger; + +public +/** + * @author congtaowang + * @since 2020/12/14 + * + * 描述 + */ +abstract class RefreshWorkThreadHandler extends Handler { + + private static final String TAG = "RefreshWorkThreadHandler"; + + public RefreshWorkThreadHandler( Looper looper ) { + super( looper ); + } + + @Override + public final void handleMessage( Message msg ) { + super.handleMessage( msg ); + if ( msg.what == ServiceConst.MSG_MAP_CHANGED ) { + try { + handleMapChangedMessage( msg ); + } catch ( Exception e ) { + Logger.e( TAG, e, "handleMapChangedMessage" ); + } + } else if ( msg.what == ServiceConst.MSG_REQUEST_DATA ) { + try { + handleRequestDataMessage( msg ); + } catch ( Exception e ) { + Logger.e( TAG, e, "handleRequestDataMessage" ); + } + } else if ( msg.what == ServiceConst.MSG_LOCK_CAR ) { + try { + handleLockCarMessage( msg ); + } catch ( Exception e ) { + Logger.e( TAG, e, "handleLockCarMessage" ); + } + } + } + + protected abstract void handleMapChangedMessage( Message msg ); + + protected abstract void handleRequestDataMessage( Message msg ); + + protected void handleLockCarMessage( Message msg ) { + if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSearchUIShow() ) { + return; + } + MogoApisHandler.getInstance().getApis().getStatusManagerApi().setUserInteractionStatus( TAG, true, false ); + MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().recoverLockMode(); + } +} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java index 7b06835deb..9ab2c99113 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java @@ -71,6 +71,10 @@ public class MogoRTKLocation { rtkLocationListener = locationListener; } + public void unregisterRTKLocationListener(){ + rtkLocationListener = null; + } + public void init() { locationManager = (LocationManager) AbsMogoApplication.getApp().getApplicationContext().getSystemService(Context.LOCATION_SERVICE); String provider = locationManager.getBestProvider(getCriteria(), true); diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java index 726980727f..2b7d073ed3 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java @@ -35,7 +35,6 @@ import com.mogo.module.service.R; import com.mogo.module.service.ServiceConst; import com.mogo.module.service.network.RefreshCallback; import com.mogo.module.service.network.RefreshModel; -import com.mogo.module.service.utils.ViewUtils; import com.mogo.module.service.vrmode.VrModeController; import com.mogo.service.adas.IMogoADASControlStatusChangedListener; import com.mogo.service.connection.IMogoOnMessageListener; @@ -45,6 +44,7 @@ import com.mogo.service.module.IMogoBizActionDoneListener; import com.mogo.utils.ResourcesHelper; import com.mogo.utils.ThreadPoolService; import com.mogo.utils.UiThreadHandler; +import com.mogo.utils.ViewUtils; import com.mogo.utils.WorkThreadHandler; import com.zhidao.carchattingprovider.ICallChatResponse; import com.mogo.utils.logger.Logger; @@ -160,7 +160,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, if ( data == null ) { return; } - if ( !MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().isVrMode() ) { + if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { // return; } @@ -275,7 +275,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, mogoMarker.setToTop(); } } - if ( !MarkerServiceHandler.getApis().getMapFrameControllerApi().isVrMode() ) { + if ( !MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode() ) { MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false ); MarkerServiceHandler.getMapUIController().moveToCenter( mogoMarker.getPosition(), DebugConfig.isRoadEventAnimated() ); } @@ -654,7 +654,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, || MarkerServiceHandler.getMogoStatusManager().isV2XShow() || !MarkerServiceHandler.getMogoStatusManager().isMainPageLaunched() || !MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() - || MarkerServiceHandler.getApis().getMapFrameControllerApi().isVrMode(); + || MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode(); } private void runOnTargetThread( Runnable runnable ) { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotUploadInTime.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotUploadInTime.java new file mode 100644 index 0000000000..660a736b93 --- /dev/null +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotUploadInTime.java @@ -0,0 +1,119 @@ +package com.mogo.module.service.uploadintime; + +import android.content.Context; + +import com.mogo.commons.utils.MortonCode; +import com.mogo.module.common.entity.CloudLocationInfo; +import com.mogo.module.service.MarkerServiceHandler; +import com.mogo.module.service.location.MogoRTKLocation; +import com.mogo.module.service.utils.SimpleLocationCorrectStrategy; +import com.mogo.module.service.websocket.LocationResult; +import com.mogo.module.service.websocket.OnePerSecondSendContent; +import com.mogo.service.adas.entity.ADASRecognizedResult; +import com.mogo.service.connection.IMogoOnWebSocketMessageListener; +import com.mogo.service.connection.WebSocketMsgType; +import com.mogo.utils.logger.Logger; +import com.mogo.utils.network.utils.GsonUtil; + +import java.util.ArrayList; +import java.util.List; + +public +/** + * @author congtaowang + * @since 2020/12/14 + * + * 实时上报坐标、识别物体 + */ +class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener { + + private static final String TAG = "SnapshotUploadInTime"; + + private static volatile SnapshotUploadInTime sInstance; + private Context mContext; + + private SnapshotUploadInTime() { + } + + public static SnapshotUploadInTime getInstance() { + if ( sInstance == null ) { + synchronized ( SnapshotUploadInTime.class ) { + if ( sInstance == null ) { + sInstance = new SnapshotUploadInTime(); + } + } + } + return sInstance; + } + + public synchronized void release() { + sInstance = null; + } + + private Object readResolve() { + // 阻止反序列化,必须实现 Serializable 接口 + return sInstance; + } + + public void start( Context context ) { + mContext = context.getApplicationContext(); + MogoRTKLocation.getInstance().registerRTKLocationListener( this ); + } + + public void stop() { + MogoRTKLocation.getInstance().unregisterRTKLocationListener(); + MogoRTKLocation.getInstance().stop(); + } + + @Override + public void onLocationChanged( List< CloudLocationInfo > cloudLocationInfos ) { + startSendCarLocationAndAdasRecognizedResult2Server( cloudLocationInfos ); + } + + private CloudLocationInfo mLastInfo; + + private void startSendCarLocationAndAdasRecognizedResult2Server( List< CloudLocationInfo > cloudLocationInfo ) { + CloudLocationInfo lastInfo = null; + // 如果数组内容不为空,就用数组最后一个值 + if ( cloudLocationInfo != null && !cloudLocationInfo.isEmpty() ) { + lastInfo = cloudLocationInfo.get( cloudLocationInfo.size() - 1 ); + mLastInfo = lastInfo; + } + if ( lastInfo == null ) { + lastInfo = mLastInfo; + } + LocationResult locationResult = null; + if ( lastInfo != null ) { + // 定位点预测纠偏 + lastInfo = SimpleLocationCorrectStrategy.getInstance().correct( lastInfo ); + locationResult = new LocationResult(); + if ( lastInfo != null ) { + locationResult.lastCoordinate = lastInfo; + locationResult.mortonCode = MortonCode.wrapEncodeMorton( lastInfo.getLon(), lastInfo.getLat() ); + } + locationResult.coordinates = new ArrayList<>(); + locationResult.sn = com.mogo.commons.network.Utils.getSn(); + if ( cloudLocationInfo == null ) { + locationResult.coordinates.addAll( new ArrayList<>() ); + } else { + locationResult.coordinates.addAll( cloudLocationInfo ); + } + } + List< ADASRecognizedResult > recognizedResults = MarkerServiceHandler.getADASController().getLastADASRecognizedResult(); + OnePerSecondSendContent content = new OnePerSecondSendContent(); + content.self = locationResult; + content.adas = recognizedResults; + + MarkerServiceHandler.getApis().getWebSocketManagerApi( mContext ).sendMsg( content, new IMogoOnWebSocketMessageListener() { + @Override + public WebSocketMsgType getDownLinkType() { + return null; + } + + @Override + public WebSocketMsgType getUpLinkType() { + return WebSocketMsgType.MSG_TYPE_UPLINK_CAR_DATA; + } + } ); + } +} diff --git a/modules/mogo-module-service/src/main/res/raw/taxi.n3d b/modules/mogo-module-service/src/main/res/raw/taxi.n3d new file mode 100644 index 0000000000..8352a248bc Binary files /dev/null and b/modules/mogo-module-service/src/main/res/raw/taxi.n3d differ diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XMarkerManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XMarkerManager.java index 03aa780f49..21e184ed1f 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XMarkerManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XMarkerManager.java @@ -23,7 +23,6 @@ import com.mogo.module.common.entity.V2XRoadEventEntity; import com.mogo.module.common.utils.CarSeries; import com.mogo.module.service.ServiceConst; import com.mogo.module.service.Utils; -import com.mogo.module.service.utils.ViewUtils; import com.mogo.module.v2x.MoGoV2XServicePaths; import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; @@ -33,6 +32,7 @@ import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager; import com.mogo.module.v2x.marker.V2XMarkerAdapter; import com.mogo.module.v2x.utils.EventTypeUtils; import com.mogo.module.v2x.utils.MarkerUtils; +import com.mogo.utils.ViewUtils; import com.mogo.utils.logger.Logger; import java.util.List; diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarInfoView.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarInfoView.kt index 6ed65b7a18..c991f860a6 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarInfoView.kt +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarInfoView.kt @@ -8,10 +8,10 @@ import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.module.common.entity.MarkerOnlineCar import com.mogo.module.common.entity.MarkerShowEntity -import com.mogo.module.service.utils.ViewUtils import com.mogo.module.v2x.R import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity import com.mogo.module.common.entity.V2XPoiTypeEnum +import com.mogo.utils.ViewUtils import kotlinx.android.synthetic.main.view_marker_car.view.* import kotlinx.android.synthetic.main.view_marker_car_info.view.* import kotlinx.android.synthetic.main.view_marker_car_info.view.ivCar diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarView.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarView.kt index d283ff7692..232c147a5b 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarView.kt +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerCarView.kt @@ -7,10 +7,10 @@ import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.module.common.entity.MarkerOnlineCar import com.mogo.module.common.entity.MarkerShowEntity -import com.mogo.module.service.utils.ViewUtils import com.mogo.module.v2x.R import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity import com.mogo.module.common.entity.V2XPoiTypeEnum +import com.mogo.utils.ViewUtils import kotlinx.android.synthetic.main.view_marker_car.view.* /** diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerRoadEventView.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerRoadEventView.kt index 8e8a638d1b..1e3ac99c1f 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerRoadEventView.kt +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/marker/V2XMarkerRoadEventView.kt @@ -9,8 +9,8 @@ import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.module.common.entity.MarkerExploreWay import com.mogo.module.common.entity.V2XPoiTypeEnum import com.mogo.module.common.entity.V2XRoadEventEntity -import com.mogo.module.service.utils.ViewUtils import com.mogo.module.v2x.R +import com.mogo.utils.ViewUtils import kotlinx.android.synthetic.main.view_marker_event_car.view.* /** diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/obu/OptimalSpeedMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/obu/OptimalSpeedMarker.java index f0b34492f8..8554d90316 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/obu/OptimalSpeedMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/obu/OptimalSpeedMarker.java @@ -3,10 +3,10 @@ package com.mogo.module.v2x.scenario.scene.obu; import com.mogo.map.MogoLatLng; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.module.service.utils.ViewUtils; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.marker.OptimalSpeedMarkerView; import com.mogo.module.v2x.scenario.view.IV2XMarker; +import com.mogo.utils.ViewUtils; import com.mogo.utils.logger.Logger; import static com.mogo.module.v2x.V2XConst.MODULE_NAME; @@ -24,7 +24,7 @@ class OptimalSpeedMarker implements IV2XMarker { Logger.d(MODULE_NAME, "绘制绿波marker===" + entity); MogoMarkerOptions optionsRipple = new MogoMarkerOptions() .latitude(entity.getLat()) - .longitude(entity.getLon()).anchor(0.5f,0.9f).icon(ViewUtils.fromView(new OptimalSpeedMarkerView(V2XServiceManager.getContext()))); + .longitude(entity.getLon()).anchor(0.5f,0.9f).icon( ViewUtils.fromView(new OptimalSpeedMarkerView(V2XServiceManager.getContext()))); optimalMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_OPTIMAL_SPEED_MARKER, optionsRipple); optimalMarker.setClickable(false); } diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/map/IMogoMapFrameController.java b/services/mogo-service-api/src/main/java/com/mogo/service/map/IMogoMapFrameController.java index 834c4802db..6bc08593b5 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/map/IMogoMapFrameController.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/map/IMogoMapFrameController.java @@ -23,6 +23,4 @@ interface IMogoMapFrameController extends IProvider, IDestroyable { * 切换到自研vr */ void changeToVRMode(); - - boolean isVrMode(); } diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java index 95b8661d44..cd1289b9b7 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java @@ -215,7 +215,7 @@ public class MogoADASController implements IMogoADASController { return; } } - if ( MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().isVrMode() ) { + if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { return; } Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );