Merge branch 'qa_merge_shunyi_vr_map' into dev2

This commit is contained in:
wangcongtao
2021-01-14 14:17:59 +08:00
12 changed files with 89 additions and 57 deletions

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)) {