Merge remote-tracking branch 'origin/qa_merge_shunyi_vr_map' into qa_merge_shunyi_vr_map

This commit is contained in:
tongchenfei
2021-01-13 17:19:13 +08:00
16 changed files with 138 additions and 60 deletions

View File

@@ -34,7 +34,7 @@ ext {
// 地图
amapnavi3dmap : "com.amap.api:navi-3dmap:7.2.0_3dmap7.2.0",
amapsearch : "com.amap.api:search:7.1.0",
amaplocation : "com.amap.api:location:4.9.0",
amaplocation : "com.amap.api:location:5.2.0",
// json 转换
gson : "com.google.code.gson:gson:2.8.4",
// 内存泄漏检测

View File

@@ -76,7 +76,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
private static final String TAG = "AMapNaviViewWrapper";
private final AMapNaviView mMapView;
private AMapNaviView mMapView;
private IMogoMap mIMap;
private AMapMarkerClickHandler mMarkerClickHandler;
@@ -239,8 +239,10 @@ public class AMapNaviViewWrapper implements IMogoMapView,
public void onDestroy() {
if ( mMapView != null ) {
mMapView.onDestroy();
mMapView = null;
AMapUIController.release();
AMapWrapper.release();
AMapMessageManager.getInstance().unregisterAMapMessageListener( this );
Logger.d( TAG, "map onDestroy" );
}
}

View File

@@ -67,8 +67,8 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.8.1'
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.5-log-1'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.8.7'
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -41,6 +41,7 @@ import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory;
import com.zhidaoauto.map.sdk.open.camera.LatLngBounds;
import com.zhidaoauto.map.sdk.open.location.LocationListener;
import com.zhidaoauto.map.sdk.open.location.MyLocationStyle;
import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean;
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
import com.zhidaoauto.map.sdk.open.marker.Marker;
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener;
@@ -51,6 +52,7 @@ import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;
import java.util.List;
@@ -912,4 +914,35 @@ public class AMapViewWrapper implements IMogoMapView,
Logger.e( TAG, e, "rtkEnable" );
}
}
@Override
public void syncLocation2Map( JSONObject data ) {
if ( !checkAMapView() ) {
return;
}
if ( data == null ) {
Logger.d( TAG, "停止使用rtk定位数据" );
mMapView.getLocationClient().stopAutoPilotRTK();
return;
}
double lon = data.optDouble( "lon", -1 );
double lat = data.optDouble( "lat", -1 );
double alt = data.optDouble( "alt", -1 );
double heading = data.optDouble( "heading", -1 );
double acceleration = data.optDouble( "acceleration", -1 );
double yawRate = data.optDouble( "yawRate", -1 );
if ( lon == -1 ) {
return;
}
RTKAutopilotLocationBean bean = new RTKAutopilotLocationBean();
bean.setYaw_rate( yawRate );
bean.setHeading( heading );
bean.setHeading( heading );
bean.setAcceleration( acceleration );
bean.setAlt( alt );
bean.setLon( lon );
bean.setLat( lat );
mMapView.getLocationClient().updateRTKAutoPilotLocation( bean );
Logger.d( TAG, "使用rtk定位数据" );
}
}

View File

@@ -14,6 +14,8 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import org.json.JSONObject;
import java.util.List;
/**
@@ -296,4 +298,11 @@ public class AMapUIController implements IMogoMapUIController {
mClient.rtkEnable( enable );
}
}
@Override
public void syncLocation2Map( JSONObject data ) {
if ( mClient != null ) {
mClient.syncLocation2Map( data );
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -13,6 +13,8 @@ import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
import org.json.JSONObject;
import java.util.List;
/**
@@ -254,4 +256,8 @@ public interface IMogoMapUIController {
default void destroy(){
}
default void syncLocation2Map( JSONObject data ){
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.map;
import android.graphics.Point;
import android.graphics.Rect;
import android.location.Location;
import android.util.Log;
import android.view.View;
import android.view.animation.Interpolator;
@@ -14,6 +15,8 @@ import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.utils.logger.Logger;
import org.json.JSONObject;
import java.util.List;
/**
@@ -55,6 +58,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void setTrafficEnabled( boolean visible ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setTrafficEnabled( visible );
}
@@ -62,6 +66,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MapControlResult changeZoom( boolean zoom ) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.changeZoom( zoom );
}
@@ -70,6 +75,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MapControlResult changeZoom( float zoom ) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.changeZoom( zoom );
}
@@ -78,8 +84,8 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void changeMapMode( EnumMapUI mode ) {
initDelegate();
if ( mDelegate != null ) {
Logger.d( "whatthefuck-MogoMapUIController", "%s", this );
Logger.d( TAG, "set type: %s", mode.name() );
mDelegate.changeMapMode( mode );
}
@@ -88,6 +94,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void moveToCenter( MogoLatLng latLng, boolean animate ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.moveToCenter( latLng, animate );
}
@@ -95,6 +102,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void showMyLocation( boolean visible ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.showMyLocation( visible );
}
@@ -102,6 +110,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void emphasizeMyLocation() {
initDelegate();
if ( mDelegate != null ) {
mDelegate.emphasizeMyLocation();
}
@@ -109,6 +118,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void showMyLocation( View view ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.showMyLocation( view );
}
@@ -116,6 +126,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void recoverLockMode() {
initDelegate();
if ( mDelegate != null ) {
mDelegate.recoverLockMode();
}
@@ -123,6 +134,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void loseLockMode() {
initDelegate();
if ( mDelegate != null ) {
mDelegate.loseLockMode();
}
@@ -130,6 +142,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void setLockZoom( int var1 ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setLockZoom( var1 );
}
@@ -137,6 +150,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void displayOverview( Rect bounds ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.displayOverview( bounds );
}
@@ -144,6 +158,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public float getScalePerPixel() {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getScalePerPixel();
}
@@ -152,6 +167,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public float getZoomLevel() {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getZoomLevel();
}
@@ -160,6 +176,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getCameraNorthEastPosition() {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getCameraNorthEastPosition();
}
@@ -168,6 +185,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getCameraSouthWestPosition() {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getCameraSouthWestPosition();
}
@@ -176,6 +194,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getWindowCenterLocation() {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getWindowCenterLocation();
}
@@ -184,6 +203,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void setPointToCenter( double mapCenterX, double mapCenterY ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setPointToCenter( mapCenterX, mapCenterY );
}
@@ -191,6 +211,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public Point getLocationPointInScreen( MogoLatLng latLng ) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getLocationPointInScreen( latLng );
}
@@ -199,6 +220,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getLocationMogoLatLngInScreen( Point point ) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getLocationMogoLatLngInScreen( point );
}
@@ -207,6 +229,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator, long duration ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.startJumpAnimation( marker, high, interpolator, duration );
}
@@ -214,6 +237,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void setRenderFps( int fps ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setRenderFps( fps );
}
@@ -221,6 +245,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.showBounds( tag, carPosition, lonLats, bound, lockCarPosition );
}
@@ -228,6 +253,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void forceRender() {
initDelegate();
if ( mDelegate != null ) {
mDelegate.forceRender();
}
@@ -235,6 +261,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.calculateLineDistance( p1, p2 );
}
@@ -243,6 +270,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public EnumMapUI getCurrentUiMode() {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getCurrentUiMode();
}
@@ -251,6 +279,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void changeMyLocation( Location location ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.changeMyLocation( location );
}
@@ -258,6 +287,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public boolean isCarLocked() {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.isCarLocked();
}
@@ -266,6 +296,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void setCarCursorOption( CarCursorOption option ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setCarCursorOption( option );
}
@@ -273,6 +304,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MapCameraPosition getMapCameraPosition() {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getMapCameraPosition();
}
@@ -281,6 +313,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void changeBearing( float bearing ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.changeBearing( bearing );
}
@@ -288,15 +321,23 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void rtkEnable( boolean enable ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.rtkEnable( enable );
}
}
@Override
public void syncLocation2Map( JSONObject data ) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.syncLocation2Map( data );
}
}
@Override
public void destroy() {
mDelegate = null;
release();
}
private void initDelegate() {

View File

@@ -367,6 +367,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mMogoStatusManager.setMainPageLaunchedStatus( TAG, false );
mMogoStatusManager.setMainPageIsBackgroundStatus( TAG, false );
mMogoFragmentManager.unregisterMainFragmentStackTransactionListener();
mMogoFragmentManager.destroy();
mMogoFragmentManager = null;
mServiceApis.getMapServiceApi().getMapViewInstanceHandler().destroy();
mServiceApis.getMapServiceApi().getMapUIController().destroy();

View File

@@ -2,20 +2,16 @@ package com.mogo.module.service.intent;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationManager;
import android.text.TextUtils;
import android.view.View;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.R;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.carinfo.CarStateInfo;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.network.utils.GsonUtil;
import org.json.JSONObject;
public
/**
* @author congtaowang
@@ -56,53 +52,27 @@ class ADASStatusIntentHandler implements IntentHandler {
MarkerServiceHandler.getMogoStatusManager().setADASUIShow( ServiceConst.TYPE, status == 1 );
}
// 由于adas可能调高此处的调用频率存在anr风险且此处没有作用所以暂时注释掉
// else {
// String msg = intent.getStringExtra( "adasMsg" );
// if ( TextUtils.isEmpty( msg ) ) {
// return;
// }
// CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class );
// if ( stateInfo != null ) {
// changeCarHeadstockDirection( context, stateInfo.getValues().getHeading() );
// // changeMyLocation( stateInfo.getValues() );
// }
// }
}
private void changeCarHeadstockDirection( final Context context, final double degree ) {
if ( MarkerServiceHandler.getNavi().isNaviing() ) {
return;
else {
String msg = intent.getStringExtra( "adasMsg" );
if ( TextUtils.isEmpty( msg ) ) {
return;
}
CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class );
if ( stateInfo != null && stateInfo.getValues() != null ) {
JSONObject data = new JSONObject();
try {
data.putOpt( "lon", stateInfo.getValues().getLon() );
data.putOpt( "lat", stateInfo.getValues().getLat() );
data.putOpt( "alt", stateInfo.getValues().getAlt() );
data.putOpt( "heading", stateInfo.getValues().getHeading() );
data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() );
data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() );
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController()
.syncLocation2Map( data );
} catch ( Exception e ) {
e.printStackTrace();
}
}
}
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
return;
}
if ( !MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
return;
}
if ( MarkerServiceHandler.getMogoStatusManager().isSeekHelping() ) {
return;
}
if ( MarkerServiceHandler.getMapUIController().getCurrentUiMode() != EnumMapUI.NorthUP_2D ) {
return;
}
UiThreadHandler.post( () -> {
MarkerServiceHandler.getMapUIController().showMyLocation( inflateCursorView( context, degree ) );
} );
}
private View inflateCursorView( Context context, double degree ) {
View view = View.inflate( context, R.layout.map_amap_cursor, null );
view.setRotation( ( float ) degree );
return view;
}
private void changeMyLocation( CarStateInfo.ValuesBean valuesBean ) {
if ( valuesBean == null ) {
return;
}
Location location = new Location( LocationManager.GPS_PROVIDER );
location.setAltitude( valuesBean.getAlt() );
location.setLatitude( valuesBean.getLat() );
location.setLongitude( valuesBean.getLon() );
}
}

View File

@@ -387,6 +387,10 @@ public class MockIntentHandler implements IntentHandler {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
.rtkEnable( false );
break;
case 39:
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
.syncLocation2Map( null );
break;
}
}

View File

@@ -72,6 +72,7 @@ public class MogoReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
Logger.d( TAG, action );
if (TextUtils.equals(VOICE_ACTION, action)) {
String cmd = intent.getStringExtra(PARAM_COMMAND);
if (!TextUtils.isEmpty(cmd)) {

View File

@@ -78,4 +78,6 @@ public interface IMogoFragmentManager extends IProvider {
void initMessageHistoryContainerId( int layoutId );
int getMessageHistoryContainerId();
void destroy();
}

View File

@@ -50,7 +50,7 @@ public class FragmentStack {
return sInstance;
}
public synchronized void release() {
public static synchronized void release() {
sInstance = null;
}
@@ -201,4 +201,8 @@ public class FragmentStack {
}
invokeCallback();
}
public void destroy(){
mFragmentManager = null;
}
}

View File

@@ -74,6 +74,11 @@ public class MogoFragmentManager implements IMogoFragmentManager {
return FragmentStack.getInstance().getMessageHistoryContainerId();
}
@Override
public void destroy() {
FragmentStack.getInstance().destroy();
}
@Override
public void init( Context context ) {