opt
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.service.utils;
|
||||
package com.mogo.utils;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.View;
|
||||
@@ -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()
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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() )
|
||||
|
||||
@@ -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{" +
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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<Integer, Map<String, MapCenterPoint>> strategies = sCommonStrategies;
|
||||
if ( MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().isVrMode() ) {
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
strategies = sVrStrategies;
|
||||
}
|
||||
if ( !strategies.containsKey( scene ) ) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,8 +285,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
if (!mApis.getRefreshStrategyControllerApi().restartAutoRefreshAtTime(0)) {
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
if ( !mApis.getStatusManagerApi().isVrMode() ) {
|
||||
if (!mApis.getRefreshStrategyControllerApi().restartAutoRefreshAtTime(0)) {
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
} else {
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
}
|
||||
@@ -510,6 +514,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
adasNoticeHelper.enterVrMode();
|
||||
mCameraLiveNoticeHelper.enterVrMode();
|
||||
TrafficLightPanelManager.getInstance().showNavPanel();
|
||||
|
||||
mMApUIController.changeMapMode( EnumMapUI.Type_VR );
|
||||
}
|
||||
|
||||
private void exitVrMode(){
|
||||
@@ -529,6 +535,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
adasNoticeHelper.exitVrMode();
|
||||
mCameraLiveNoticeHelper.exitVrMode();
|
||||
TrafficLightPanelManager.getInstance().hideNavPanel();
|
||||
|
||||
mMApUIController.changeMapMode( EnumMapUI.CarUp_2D );
|
||||
}
|
||||
|
||||
private void debugCrashWarn(){
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/main_bitmap_splash_bg"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="visible" />
|
||||
android:visibility="gone" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_splash_container"
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
@@ -15,13 +14,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.map.MyLocationUtil;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapFrameController;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
@@ -40,8 +33,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > 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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<MogoMarkerOptions> 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<Double> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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" );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
BIN
modules/mogo-module-service/src/main/res/raw/taxi.n3d
Normal file
BIN
modules/mogo-module-service/src/main/res/raw/taxi.n3d
Normal file
Binary file not shown.
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.*
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.*
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<MogoLatLng> {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,4 @@ interface IMogoMapFrameController extends IProvider, IDestroyable {
|
||||
* 切换到自研vr
|
||||
*/
|
||||
void changeToVRMode();
|
||||
|
||||
boolean isVrMode();
|
||||
}
|
||||
|
||||
@@ -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() ) );
|
||||
|
||||
Reference in New Issue
Block a user