This commit is contained in:
unknown
2021-01-06 16:32:29 +08:00
53 changed files with 935 additions and 309 deletions

6
.idea/misc.xml generated
View File

@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ASMIdeaPluginConfiguration">
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ASMPluginConfiguration">
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -484,6 +484,7 @@ dependencies {
implementation rootProject.ext.dependencies.moduleextensions
implementation rootProject.ext.dependencies.modulemap
implementation rootProject.ext.dependencies.moduleSmallMap
implementation rootProject.ext.dependencies.httpdnsnoop
} else {
implementation project(':foudations:mogo-commons')
implementation project(':foudations:mogo-base-websocket-sdk')
@@ -501,6 +502,7 @@ dependencies {
implementation project(':modules:mogo-module-extensions')
implementation project(':modules:mogo-module-map')
implementation project(':modules:mogo-module-smp')
implementation project(':foudations:httpdns-noop')
}
apply from: "./functions/basedmap.gradle"
@@ -513,7 +515,7 @@ dependencies {
apply from: "./functions/crashreport.gradle"
apply from: "./functions/widgets.gradle"
apply from: "./functions/tts.gradle"
apply from: "./functions/httpdns.gradle"
// apply from: "./functions/httpdns.gradle"
apply from: "./functions/backwidget.gradle"
apply from: "./functions/mediaui.gradle"
apply from: "./functions/bizguide.gradle"

View File

@@ -8,10 +8,10 @@ project.dependencies {
d8xxImplementation rootProject.ext.dependencies.httpdnsnoop
d80xImplementation rootProject.ext.dependencies.httpdnsnoop
em4Implementation rootProject.ext.dependencies.httpdnsnoop
e8xxImplementation rootProject.ext.dependencies.httpdnstencent
f8xxImplementation rootProject.ext.dependencies.httpdnstencent
f80xImplementation rootProject.ext.dependencies.httpdnstencent
f8AmapImplementation rootProject.ext.dependencies.httpdnstencent
e8xxImplementation rootProject.ext.dependencies.httpdnsnoop
f8xxImplementation rootProject.ext.dependencies.httpdnsnoop
f80xImplementation rootProject.ext.dependencies.httpdnsnoop
f8AmapImplementation rootProject.ext.dependencies.httpdnsnoop
em3Implementation rootProject.ext.dependencies.httpdnsnoop
} else {
bydautoImplementation project(':foudations:httpdns-noop')
@@ -20,10 +20,10 @@ project.dependencies {
d8xxImplementation project(':foudations:httpdns-noop')
d80xImplementation project(':foudations:httpdns-noop')
em4Implementation project(':foudations:httpdns-noop')
e8xxImplementation project(':foudations:httpdns-tencent')
f8xxImplementation project(':foudations:httpdns-tencent')
f80xImplementation project(':foudations:httpdns-tencent')
f8AmapImplementation project(':foudations:httpdns-tencent')
e8xxImplementation project(':foudations:httpdns-noop')
f8xxImplementation project(':foudations:httpdns-noop')
f80xImplementation project(':foudations:httpdns-noop')
f8AmapImplementation project(':foudations:httpdns-noop')
em3Implementation project(':foudations:httpdns-noop')
}
}

View File

@@ -26,13 +26,13 @@ class HttpDnsNoop implements IMogoHttpDns {
@Override
public String getCachedHttpDnsIps( String host,int type ) {
return null;
return host;
}
@Override
public void getHttpDnsIp( String host,int type, boolean useCache, IHttpDnsCallback callback ) {
if ( callback != null ) {
callback.onParsed( null );
callback.onParsed( host );
}
}

View File

@@ -8,11 +8,11 @@ import com.mogo.commons.debug.DebugConfig;
@Keep
public class WebSocketConstant {
private static final String HOST_DEV = "ws://62.234.196.121";
private static final String HOST_QA = "ws://62.234.196.121";
private static final String HOST_DEMO = "ws://62.234.196.121";
private static final String HOST_DEV = "ws://119.45.249.167";
private static final String HOST_QA = "ws://119.45.249.167";
private static final String HOST_DEMO = "ws://119.45.249.167";
@Keep
private static final String HOST_RELEASE = "ws://62.234.196.121";
private static final String HOST_RELEASE = "ws://119.45.249.167";
// private static final String PORT = ":14001/ws";
@Keep
public static final String PATH = "/ws";

View File

@@ -67,7 +67,7 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.5.4'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.7.7'
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.5-log-1'
}

View File

@@ -26,6 +26,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.utils.TipToast;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
@@ -70,7 +71,7 @@ public class AMapViewWrapper implements IMogoMapView,
private IMogoMap mIMap;
private AMapMarkerClickHandler mMarkerClickHandler;
private EnumMapUI mCurrentUIMode;
private EnumMapUI mCurrentCarUIMode;
private boolean mIsCarLocked = false;
private int mLockZoom = 16;
@@ -85,6 +86,10 @@ public class AMapViewWrapper implements IMogoMapView,
private Location mLastDriveLocationShadow = null;
private EnumMapUI mCurrentUI;
private boolean mIsLightStyle = false;
private boolean mMapLoaded = false;
private boolean mIsFirstLocated = true;
private boolean mIsDelayed = false;
public AMapViewWrapper( MapAutoView mMapView ) {
startTime = System.currentTimeMillis();
@@ -216,8 +221,6 @@ public class AMapViewWrapper implements IMogoMapView,
if ( mMapView != null ) {
mMapView.onCreate( bundle );
Logger.d( TAG, "map onCreate" );
initMapView();
initMyLocation();
}
}
@@ -241,6 +244,12 @@ public class AMapViewWrapper implements IMogoMapView,
public void onDestroy() {
if ( mMapView != null ) {
mMapView.onDestroy();
mMapView.setOnMarkClickListener( null );
mMapView.setOnMapLoadedListener( null );
mMapView.setOnMapTouchListener( null );
mMapView.setOnMapClickListener( null );
mMapView.getLocationClient().unRegisterListener( this );
mMapView.setMOnCameraChangeListener( null );
Logger.d( TAG, "map onDestroy" );
}
}
@@ -297,13 +306,13 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public MapControlResult changeZoom( float zoom ) {
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return MapControlResult.ERROR;
}
Logger.d( TAG, "changeZoom %s", zoom );
if ( DebugConfig.isDebug() ) {
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
}
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return MapControlResult.ERROR;
}
getMap().changeZoom( zoom );
return MapControlResult.SUCCESS;
}
@@ -313,6 +322,7 @@ public class AMapViewWrapper implements IMogoMapView,
if ( ui == null ) {
return;
}
Logger.d( TAG, "设置的样式 = %s", ui );
if ( checkAMapView() ) {
switch ( ui ) {
case CarUp_2D:
@@ -326,10 +336,12 @@ public class AMapViewWrapper implements IMogoMapView,
case Type_Light:
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_DAY );
mIsLightStyle = true;
break;
case Type_Night:
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_NIGHT );
mIsLightStyle = false;
break;
case Type_AUTO_LIGHT_Night:
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( true );
@@ -341,11 +353,11 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void moveToCenter( MogoLatLng latLng ) {
moveToCenter( latLng, true );
}
private void setUIMode( EnumMapUI ui ) {
this.mCurrentUIMode = ui;
this.mCurrentCarUIMode = ui;
if ( mMapView.getMapAutoViewHelper() != null ) {
switch ( ui ) {
case CarUp_2D:
@@ -353,6 +365,9 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.getMapAutoViewHelper().setMapViewPerspective( MapAutoApi.MAP_PERSPECTIVE_UP_CAR );
break;
case NorthUP_2D:
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return;
}
mMapView.getMapAutoViewHelper().setMapViewPerspective( MapAutoApi.MAP_PERSPECTIVE_UP_NORTH );
break;
}
@@ -436,6 +451,9 @@ public class AMapViewWrapper implements IMogoMapView,
// if ( DebugConfig.isDebug() ) {
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
// }
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return;
}
Logger.d( TAG, "锁车" );
// mMapView.getMapAutoViewHelper().setZoom(mLockZoom);
mMapView.getMapAutoViewHelper().setLockMode( true );
@@ -572,6 +590,10 @@ public class AMapViewWrapper implements IMogoMapView,
if ( !checkAMapView() ) {
return;
}
if ( mCurrentUI == EnumMapUI.Type_VR ) {
Logger.w( TAG, "vr 模式下忽略该设置" );
return;
}
Logger.i( TAG, "showBounds:%s -%s-%s- %b ", tag, carPosition.toString(), bound.toShortString(), lockCarPosition );
try {
if ( DebugConfig.isDebug() ) {
@@ -606,7 +628,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public EnumMapUI getCurrentUiMode() {
return mCurrentUIMode;
return mCurrentCarUIMode;
}
@Override
@@ -690,7 +712,23 @@ public class AMapViewWrapper implements IMogoMapView,
}
NaviClient.getInstance( getContext() ).syncCarLocation( sysLocation );
MapStyleController.getInstance().onLocationChanged( location, this );
if ( checkAMapView() && mMapLoaded ) {
// 地图初始化完成后每隔5s自动判断当前地图的模式
if ( mIsFirstLocated ) {
if ( !mIsDelayed ) {
mIsDelayed = true;
UiThreadHandler.postDelayed( () -> {
Logger.d( TAG, "倒计时结束" );
mIsFirstLocated = false;
}, 5_000L );
}
} else {
mIsFirstLocated = true;
mIsDelayed = false;
Logger.d( TAG, "同步定位" );
MapStyleController.getInstance().onLocationChanged( location, this );
}
}
}
@Override
@@ -705,6 +743,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onMapLoaded() {
Logger.i( TAG, "autoop--onMapLoaded: " );
MogoMapListenerHandler.getInstance().onMapLoaded();
mMapLoaded = true;
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
if ( cameraPosition != null ) {
Trace.beginSection( "timer.onCameraChangeFinish" );
@@ -714,9 +753,8 @@ public class AMapViewWrapper implements IMogoMapView,
cameraPosition.getBearing() );
Trace.endSection();
}
getMap().getUIController().setAnchorRate( 0.01f );
getMap().getUIController().setAnchorScale( 1.2f, 2.7f );
initMapView();
initMyLocation();
}
@Override
@@ -737,17 +775,17 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onMapStatusChanged( int type, int value ) {
Logger.i( TAG, "mapop--onMapStatusChanged-: " + type + "," + value );
// Logger.i( TAG, "mapop--onMapStatusChanged-: " + type + "," + value );
}
@Override
public void onCameraChange( int type, int value ) {
Logger.i( TAG, "mapop--onCameraChange-: " + type + "," + value );
// Logger.i( TAG, "mapop--onCameraChange-: " + type + "," + value );
}
@Override
public void onCameraChangeFinish( @Nullable CameraPosition cameraPosition ) {
Logger.i( TAG, "mapop--onCameraChangeFinish-: " + cameraPosition + "cost:" + ( System.currentTimeMillis() - startTime ) );
// Logger.i( TAG, "mapop--onCameraChangeFinish-: " + cameraPosition + "cost:" + ( System.currentTimeMillis() - startTime ) );
if ( cameraPosition != null ) {
Trace.beginSection( "timer.onCameraChangeFinish" );
MogoMapListenerHandler.getInstance().onMapChanged( ObjectUtils.fromAMap( cameraPosition.getTarget() ),
@@ -773,8 +811,15 @@ public class AMapViewWrapper implements IMogoMapView,
}
//目前切换完vr之后会立即回调其他样式这里做一个判断
// private boolean mVrModeAutoChangedFlag = false;
@Override
public void onChangeMapStyle( int i ) {
EnumMapUI last = mCurrentUI;
Logger.d( TAG, "currentMapStyle = %s", i );
if ( i == MapAutoApi.MAP_STYLE_DAY
|| i == MapAutoApi.MAP_STYLE_DAY_NAV ) {
mCurrentUI = EnumMapUI.Type_Light;
@@ -783,11 +828,30 @@ public class AMapViewWrapper implements IMogoMapView,
mCurrentUI = EnumMapUI.Type_Night;
} else if ( i == MapAutoApi.MAP_STYLE_VR ) {
mCurrentUI = EnumMapUI.Type_VR;
} else if ( i == MapAutoApi.MAP_PERSPECTIVE_2D ) {
mCurrentUI = EnumMapUI.CarUp_2D;
} else if ( i == MapAutoApi.MAP_PERSPECTIVE_3D ) {
mCurrentUI = EnumMapUI.CarUp_3D;
}
// else if ( i == MapAutoApi.MAP_PERSPECTIVE_2D ) {
// mCurrentUI = EnumMapUI.CarUp_2D;
// } else if ( i == MapAutoApi.MAP_PERSPECTIVE_3D ) {
// mCurrentUI = EnumMapUI.CarUp_3D;
// }
if ( last == mCurrentUI ) {
Logger.d( TAG, "currentUI is same as last = %s", mCurrentUI );
return;
}
// vr 模式切换到普通模式下,保持之前的白天模式 wtf.
if ( last == EnumMapUI.Type_VR && mCurrentUI != last ) {
if ( mIsLightStyle ) {
changeMapMode( EnumMapUI.Type_Light );
return;
}
// if ( mVrModeAutoChangedFlag ) {
// mVrModeAutoChangedFlag = false;
// return;
// }
}
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
if ( mCurrentUI != null ) {
UiThreadHandler.post( () -> {
try {
@@ -809,16 +873,32 @@ public class AMapViewWrapper implements IMogoMapView,
public void onStyleAutoChanged( boolean isVrMode ) {
if ( isVrMode ) {
if ( mCurrentUI != EnumMapUI.Type_VR ) {
changeZoom( 20 );
changeMapMode( EnumMapUI.Type_VR );
Logger.d( TAG, "自动切换为vr模式" );
// mVrModeAutoChangedFlag = true;
changeMapMode( EnumMapUI.Type_VR );
}
} else {
if ( mCurrentUI == EnumMapUI.Type_VR ) {
changeZoom( 16 );
changeMapMode( EnumMapUI.Type_Night );
Logger.d( TAG, "自动切换为2D模式" );
if ( mIsLightStyle ) {
changeMapMode( EnumMapUI.Type_Light );
} else {
changeMapMode( EnumMapUI.Type_Night );
}
}
}
}
private boolean mRtkEnable = false;
@Override
public void rtkEnable( boolean enable ) {
try {
mRtkEnable = !mRtkEnable;
TipToast.shortTip( mRtkEnable ? "已开启gps道路匹配" : "已开启rtk道路匹配" );
mMapView.getLocationClient().rtkEnable( mRtkEnable );
} catch ( Exception e ) {
Logger.e( TAG, e, "rtkEnable" );
}
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.map.impl.custom;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.CoordinatesTransformer;
import com.mogo.map.IMogoMapApiBuilder;
import com.mogo.map.IMogoMapView;
@@ -92,14 +93,20 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
@Override
public IMogoMapView getMapView( Context context ) {
NavAutoApi.INSTANCE.init( context, MapParams.Companion.init()
.setDebugMode( true )
.setDebugMode( DebugConfig.isDebug() )
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
.setZoom( 16 )
.setPointToCenter( 0.734375f, 0.5f )
.setStyleMode( MapParams.MAP_STYLE_NIGHT ), NavParams.Companion.init() );
MapAutoView mapAutoView = new MapAutoView( context );
IMogoMapView mapView = new AMapViewWrapper( mapAutoView );
MapAutoView mapAutoView = new MapAutoView(context);
Logger.w(TAG, "mapAutoView==" + mapAutoView);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
return mapView;
}

View File

@@ -7,14 +7,12 @@ import android.view.View;
import android.view.animation.Interpolator;
import com.mogo.map.MogoLatLng;
import com.mogo.map.MogoMap;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.utils.logger.Logger;
import java.util.List;
@@ -291,4 +289,11 @@ public class AMapUIController implements IMogoMapUIController {
public void setAnchorRate( float rate ) {
}
@Override
public void rtkEnable( boolean enable ) {
if ( mClient != null ) {
mClient.rtkEnable( enable );
}
}
}

View File

@@ -238,7 +238,16 @@ public interface IMogoMapUIController {
}
default void testGpsData(){
default void testGpsData() {
}
/**
* 自研地图是否匹配道路
*
* @param enable
*/
default void rtkEnable( boolean enable ) {
}
}

View File

@@ -283,4 +283,11 @@ public class MogoMapUIController implements IMogoMapUIController {
mDelegate.changeBearing( bearing );
}
}
@Override
public void rtkEnable( boolean enable ) {
if ( mDelegate != null ) {
mDelegate.rtkEnable( enable );
}
}
}

View File

@@ -7,7 +7,7 @@ class HttpConstants {
companion object {
const val DEV_BASE_URL_OWNER = "http://dzt-test.zhidaozhixing.com/"
const val RELEASE_BASE_URL_OWNER = "http://dzt.zhidaohulian.com/"
const val RELEASE_BASE_URL_OWNER = "http://dzt.zhidaozhixing.com/"
const val SHOW_BASE_URL_OWNER = "http://dzt-show.zhidaozhixing.com/"
fun getBaseUrl(): String {

View File

@@ -12,7 +12,6 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
@@ -34,6 +33,7 @@ dependencies {
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.callchatprovider
api "com.mogo.libs:hook:1.0"
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogomap
api rootProject.ext.dependencies.mogomapapi

View File

@@ -73,11 +73,27 @@ public class BezierAnimationView extends RelativeLayout implements View.OnClickL
runnable.run();
}
public void bezierAnimationStart(){
runnable = new Runnable() {
@Override
public void run() {
try {
Log.d("点赞--", "");
bezierAnimation(resource);
handler.postDelayed(this, 500);
} catch (Exception e) {
e.printStackTrace();
}
}
};
runnable.run();
}
private void bezierAnimation(int resource) {
final ImageView imageView = new ImageView(context);
imageView.setBackgroundResource(animation_drawable[resource]);
RelativeLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(ALIGN_BOTTOM);
// params.addRule(ALIGN_BOTTOM);
params.addRule(CENTER_HORIZONTAL);
imageView.setLayoutParams(params);
addView(imageView);

View File

@@ -104,8 +104,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
if ( mIsVrMode ) {
marker.getMogoMarkerOptions().set3DMode( true );
marker.use3DResource( getVrModel() );
} else {
marker.getMogoMarkerOptions().set3DMode( false );
marker.setIcon( ViewUtils.fromView( inflateView( recognizedListResult, machineVision, 0 ) ) );
}
}
@@ -200,8 +202,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
.position( new MogoLatLng( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon ) );
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
options.set3DMode( true );
options.icon3DRes( getVrModel() );
} else {
options.set3DMode( false );
options.icon( inflateView( recognizedListResult, machineVision, curSpeed ) );
}
@@ -209,7 +213,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
}
private int getVrModel() {
return R.raw.taxi;
return R.raw.carred;
}
private View inflateView( ADASRecognizedListResult data, boolean machineVision, double curSpeed ) {
@@ -225,7 +229,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
// safeType
// ) );
iv.setImageResource( R.drawable.icon_map_marker_car_type_taxi );
iv.setImageResource( R.drawable.icon_map_marker_car_gray );
return rootView;
}

View File

@@ -71,13 +71,12 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
// 云端 marker 缓存
private Map< String, IMogoMarker > mCloudSnapshotMarkersCaches = new ConcurrentHashMap<>();
private int mPurseCounter = 0;
private Map< String, MogoLatLng > mLastPositions = new ConcurrentHashMap<>();
private boolean mIsVrMode = false;
private long mLastReceiveTime = 0L;
private long mAnimationDuration = 500L;
/**
* 其他车辆、rsu 车辆数据
@@ -86,6 +85,12 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
*/
public void renderSnapshotData( MogoSnapshotSetData data,
boolean machineVision ) {
if ( mLastReceiveTime != 0 ) {
mAnimationDuration = SystemClock.elapsedRealtime() - mLastReceiveTime;
} else {
mAnimationDuration = 500L;
}
mLastReceiveTime = SystemClock.elapsedRealtime();
if ( data == null || (
( data.getAllList() == null || data.getAllList().isEmpty() ) &&
( data.getNearList() == null || data.getNearList().isEmpty() ) ) ) {
@@ -95,17 +100,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
filterData( data.getAllList() );
List< CloudRoadData > allDatumsList = new ArrayList<>();
allDatumsList.addAll( data.getAllList() );
// allDatumsList.addAll( data.getNearList() );
// if ( machineVision ) {
// allDatumsList.addAll( data.getAllList() );
// allDatumsList.addAll( data.getNearList() );
// } else {
// allDatumsList.addAll( data.getAllList() );
// }
mPurseCounter++;
if ( mPurseCounter >= 100 ) {
mPurseCounter = 0;
}
purgeCloudSnapshotData( allDatumsList );
for ( CloudRoadData cloudRoadData : allDatumsList ) {
if ( cloudRoadData == null ) {
@@ -119,7 +113,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
}
}
IMogoMarker marker = null;
String uniqueKey = cloudRoadData.getUniqueKey();
if ( TextUtils.isEmpty( uniqueKey ) ) {
@@ -142,8 +135,11 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
if ( mIsVrMode ) {
Logger.d( TAG, "3D模型" );
marker.getMogoMarkerOptions().set3DMode( true );
marker.use3DResource( getVrModel( cloudRoadData ) );
} else {
Logger.d( TAG, "2D贴图" );
marker.getMogoMarkerOptions().set3DMode( false );
marker.setIcon( ViewUtils.fromView( inflateView( cloudRoadData, machineVision, 0 ) ) );
}
@@ -154,12 +150,14 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
// double lastPos[] = transformGcj02ToFitMap( lastPosition.lat, lastPosition.lon );
if ( lastPosition != null ) {
if ( lastPosition.equals( target ) ) {
Logger.d( TAG, "保持位置 - %s", uniqueKey );
marker.setPosition( lastPosition.lat, lastPosition.lon );
} else {
List< MogoLatLng > points = new ArrayList<>();
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
points.add( new MogoLatLng( target.lat, target.lon ) );
marker.startSmoothInMs( points, SystemClock.elapsedRealtime() - mLastReceiveTime );
marker.startSmoothInMs( points, mAnimationDuration );
Logger.d( TAG, "平滑移动 - %s duration = %s", uniqueKey, mAnimationDuration );
}
} else {
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
@@ -167,7 +165,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
}
}
mLastPositions.put( uniqueKey, target );
mLastReceiveTime = SystemClock.elapsedRealtime();
}
}
@@ -257,8 +254,12 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
// .position( new MogoLatLng( coor[POS_LAT], coor[POS_LON] ) );
.position( new MogoLatLng( data.getLat(), data.getLon() ) );
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
options.set3DMode( true );
Logger.d( TAG, "3D模型" );
options.icon3DRes( getVrModel( data ) );
} else {
options.set3DMode( false );
Logger.d( TAG, "2D贴图" );
options.icon( inflateView( data, machineVision, curSpeed ) );
}
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_CLOUD_DATA, options );
@@ -267,9 +268,9 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
private int getVrModel( CloudRoadData data ) {
switch ( data.getFromType() ) {
case CloudRoadData.FROM_ADAS:
return R.raw.taxi;
// return R.raw.taxi;
case CloudRoadData.FROM_ROAD_UNIT:
return R.raw.bus;
// return R.raw.bus;
case CloudRoadData.FROM_MY_LOCATION:
default:
return R.raw.carred;
@@ -296,9 +297,9 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
private int get2DModel( CloudRoadData data ) {
switch ( data.getFromType() ) {
case CloudRoadData.FROM_ADAS:
return R.drawable.icon_map_marker_car_type_taxi;
// return R.drawable.icon_map_marker_car_type_taxi;
case CloudRoadData.FROM_ROAD_UNIT:
return R.drawable.icon_map_marker_car_type_bus;
// return R.drawable.icon_map_marker_car_type_bus;
case CloudRoadData.FROM_MY_LOCATION:
default:
return R.drawable.icon_map_marker_car_gray;

View File

@@ -50,10 +50,10 @@ public class MapMarkerAdapter {
* @return MarkerView
*/
public static IMarkerView getMarkerInfoWindowView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
if ( markerShowEntity.isChecked() ) {
return new MapMarkerInfoView( context, markerShowEntity, options );
} else {
return new MapMarkerView( context, markerShowEntity, options );
}
// if ( markerShowEntity.isChecked() ) {
// return new MapMarkerInfoView( context, markerShowEntity, options );
// } else {
// }
return new MapMarkerView( context, markerShowEntity, options );
}
}

View File

@@ -90,7 +90,9 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV
}
private void loadPoiTypeIconInUiThread(String url,int res) {
if (mMarker != null) {
mMarker.setIcon( ViewUtils.fromView(MapMarkerBaseView.this));
}
if (!url.isEmpty()) {
ivIcon.setPlaceHolder(res);
ivIcon.setFailureHolder(res);

View File

@@ -52,7 +52,11 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
public MapMarkerInfoView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
super( context );
mOptions = options;
updateView( markerShowEntity );
try {
updateView( markerShowEntity );
} catch ( Exception e ) {
e.printStackTrace();
}
}
@Override
@@ -60,7 +64,7 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_layout_info, this );
ivUserHead = findViewById( R.id.ivUserHead );
// ivIcon = findViewById( R.id.ivIcon );
ivIcon = findViewById(R.id.ivIcon);
ivIcon = findViewById( R.id.ivIcon );
clMarkerContent = findViewById( R.id.clMarkerContent );
ivReverseTriangle = findViewById( R.id.ivReverseTriangle );
ivCar = findViewById( R.id.ivCar );
@@ -69,84 +73,80 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
@Override
public void updateView( MarkerShowEntity markerShowEntity ) {
try {
Object bindObj = markerShowEntity.getBindObj();
Object bindObj = markerShowEntity.getBindObj();
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 );
}
clMarkerContent.setBackgroundResource( R.drawable.bg_map_marker_yellow_info );
ivReverseTriangle.setImageResource( R.drawable.bg_shape_reverse_yellow );
switch ( markerShowEntity.getMarkerType() ) {
case ModuleNames.CARD_TYPE_CARS_CHATTING:
case ModuleNames.CARD_TYPE_USER_DATA:
ivUserHead.setVisibility( View.VISIBLE );
ivIcon.setVisibility( View.INVISIBLE );
loadImageWithMarker( markerShowEntity );
ivCar.setImageResource( R.drawable.icon_map_marker_car_gray );
//ivCar.setRotation(new Random().nextInt(360));
ivCar.setRotation( ( float ) markerShowEntity.getMarkerLocation().getAngle() );
break;
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
case ModuleNames.CARD_TYPE_NOVELTY:
ivUserHead.setVisibility( View.INVISIBLE );
ivIcon.setVisibility( View.VISIBLE );
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
// 根据poiType获取对应的图片
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType(poiType);
if (poiWrapper != null) {
// 加载图片
loadPoiTypeIcon(poiWrapper.getIconInfoUrl(),poiWrapper.getIconInfoRes());
}else{
Logger.e(TAG, "未能根据poiType获取对应poi信息无法渲染info marker====" + poiType);
}
}
break;
case ModuleNames.CARD_TYPE_SHARE_MUSIC:
ivUserHead.setVisibility( View.INVISIBLE );
ivIcon.setVisibility( View.VISIBLE );
if ( bindObj instanceof MarkerShareMusic ) {
// 2 为书籍听书3 为新闻,1 为qq音乐,int
switch ( ( ( MarkerShareMusic ) bindObj ).getShareType() ) {
case 1:
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
break;
case 2:
ivIcon.setImageResource( R.drawable.icon_map_marker_book );
break;
case 3:
ivIcon.setImageResource( R.drawable.icon_map_marker_news );
break;
default:
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
break;
}
}
break;
default:
break;
}
if ( !TextUtils.isEmpty( markerShowEntity.getTextContent() ) ) {
String content;
if ( markerShowEntity.getTextContent().length() > 8 ) {
content = markerShowEntity.getTextContent().substring( 0, 7 ) + "...";
} else {
content = markerShowEntity.getTextContent();
}
tvMarkerContent.setText( content );
}
} catch ( Exception e ) {
e.printStackTrace();
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 );
}
clMarkerContent.setBackgroundResource( R.drawable.bg_map_marker_yellow_info );
ivReverseTriangle.setImageResource( R.drawable.bg_shape_reverse_yellow );
switch ( markerShowEntity.getMarkerType() ) {
case ModuleNames.CARD_TYPE_CARS_CHATTING:
case ModuleNames.CARD_TYPE_USER_DATA:
ivUserHead.setVisibility( View.VISIBLE );
ivIcon.setVisibility( View.INVISIBLE );
loadImageWithMarker( markerShowEntity );
ivCar.setImageResource( R.drawable.icon_map_marker_car_gray );
//ivCar.setRotation(new Random().nextInt(360));
ivCar.setRotation( ( float ) markerShowEntity.getMarkerLocation().getAngle() );
break;
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
case ModuleNames.CARD_TYPE_NOVELTY:
ivUserHead.setVisibility( View.INVISIBLE );
ivIcon.setVisibility( View.VISIBLE );
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
// 根据poiType获取对应的图片
String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType( poiType );
if ( poiWrapper != null ) {
// 加载图片
loadPoiTypeIcon( poiWrapper.getIconInfoUrl(), poiWrapper.getIconInfoRes() );
} else {
Logger.e( TAG, "未能根据poiType获取对应poi信息无法渲染info marker====" + poiType );
}
}
break;
case ModuleNames.CARD_TYPE_SHARE_MUSIC:
ivUserHead.setVisibility( View.INVISIBLE );
ivIcon.setVisibility( View.VISIBLE );
if ( bindObj instanceof MarkerShareMusic ) {
// 2 为书籍听书3 为新闻,1 为qq音乐,int
switch ( ( ( MarkerShareMusic ) bindObj ).getShareType() ) {
case 1:
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
break;
case 2:
ivIcon.setImageResource( R.drawable.icon_map_marker_book );
break;
case 3:
ivIcon.setImageResource( R.drawable.icon_map_marker_news );
break;
default:
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
break;
}
}
break;
default:
break;
}
if ( !TextUtils.isEmpty( markerShowEntity.getTextContent() ) ) {
String content;
if ( markerShowEntity.getTextContent().length() > 8 ) {
content = markerShowEntity.getTextContent().substring( 0, 7 ) + "...";
} else {
content = markerShowEntity.getTextContent();
}
tvMarkerContent.setText( content );
}
}
}

View File

@@ -24,11 +24,11 @@ import com.mogo.utils.logger.Logger;
* desc : 地图Marker图标
* version: 1.0
*/
public class
MapMarkerView extends MapMarkerBaseView {
public class MapMarkerView extends MapMarkerBaseView {
private String TAG = "MapMarkerView";
private FrameLayout clMarkerTopView;
private MarkerShowEntity mMarkerShowEntity;
public MapMarkerView( Context context ) {
super( context );
@@ -45,7 +45,12 @@ MapMarkerView extends MapMarkerBaseView {
public MapMarkerView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
super( context );
mOptions = options;
updateView( markerShowEntity );
mMarkerShowEntity = markerShowEntity;
try {
updateView( markerShowEntity );
} catch ( Exception e ) {
e.printStackTrace();
}
}
@Override
@@ -55,37 +60,35 @@ MapMarkerView extends MapMarkerBaseView {
} else {
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_layout, this );
}
ivIcon = findViewById( R.id.ivIcon );
clMarkerTopView = findViewById( R.id.clMarkerTopView );
ivIcon = findViewById( R.id.ivIcon );
ivCar = findViewById( R.id.ivCar );
}
@Override
public void updateView( MarkerShowEntity markerShowEntity ) {
try {
Object bindObj = markerShowEntity.getBindObj();
switch ( markerShowEntity.getMarkerType() ) {
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
case ModuleNames.CARD_TYPE_NOVELTY:
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
// 根据poiType获取对应的图片
String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType( poiType );
if ( poiWrapper != null ) {
// 加载图片
loadPoiTypeIcon( poiWrapper.getIconUrl(), poiWrapper.getIconRes() );
} else {
Logger.e( TAG, "未能根据poiType获取对应poi信息无法渲染marker====" + poiType );
}
Object bindObj = markerShowEntity.getBindObj();
switch ( markerShowEntity.getMarkerType() ) {
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
case ModuleNames.CARD_TYPE_NOVELTY:
if ( mMarkerShowEntity != null && mMarkerShowEntity.isChecked() ) {
clMarkerTopView.setBackgroundResource( R.drawable.module_services_marker_vr_bkg_checked );
}
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
// 根据poiType获取对应的图片
String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType( poiType );
if ( poiWrapper != null ) {
// 加载图片
loadPoiTypeIcon( poiWrapper.getIconUrl(), poiWrapper.getIconRes() );
} else {
Logger.e( TAG, "未能根据poiType获取对应poi信息无法渲染marker====" + poiType );
}
break;
default:
break;
}
} catch ( Exception e ) {
e.printStackTrace();
}
break;
default:
break;
}
}

View File

@@ -270,7 +270,10 @@ public class MapCenterPointStrategy {
if ( controller == null ) {
return;
}
Logger.e( TAG, "scene"+scene );
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
Logger.w( TAG, "vr 模式下忽略该设置" );
return;
}
Map< Integer, Map< String, MapCenterPoint > > strategies = sCommonStrategies;
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
strategies = sVrStrategies;

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#890">
<com.mogo.module.common.animation.BezierAnimationView
android:id="@+id/bezier_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#7810" />
</RelativeLayout>

View File

@@ -839,11 +839,16 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
handler.post(() -> seekHelpGroup.setVisibility(View.GONE));
}
} else if (descriptor == StatusDescriptor.VR_MODE) {
if (isTrue) {
enterVrMode();
} else {
exitVrMode();
try {
if (isTrue) {
enterVrMode();
} else {
exitVrMode();
}
} catch( Exception e ){
e.printStackTrace();
}
}
}

View File

@@ -16,6 +16,8 @@ import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.view.VerticalTrafficLightView;
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_GRAY;
/**
* vr模式下导航信息封装
*
@@ -28,14 +30,14 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
private final VerticalTrafficLightView turnAroundLight, turnLeftLight, straightLight, turnRightLight;
private final ImageView ivTurnIcon;
private final TextView tvDistance,tvDistanceUnit, tvNextRoad;
private final TextView tvDistance, tvDistanceUnit, tvNextRoad;
private final TextView tvCurrentSpeed;
private final Handler handler = new Handler(this);
public VrModeNavInfoView(Context context) {
this(context,null);
this(context, null);
}
public VrModeNavInfoView(Context context, AttributeSet attrs) {
@@ -72,7 +74,7 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
}
public void refreshLimitSpeed(int limitSpeed) {
if(getVisibility() != View.VISIBLE){
if (getVisibility() != View.VISIBLE) {
return;
}
handler.removeMessages(MSG_HIDE_LIMIT_SPEED);
@@ -91,6 +93,14 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
private int[] lightArray = new int[4];
private String[] surplusTimeArray = new String[4];
/**
* 将红绿灯状态全部置灰,相当于隐藏红绿灯状态
*/
public void hideTrafficLightStatus() {
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT);
refreshTrafficLightStatus(new int[]{TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY}, new String[]{"", "", "", ""});
}
/**
* 刷新红绿灯显示状态
*
@@ -107,12 +117,15 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
turnRightLight.setTrafficLightStatus(laneLight[3], surplusTime[3]);
// todo 再根据当前所在车道,置灰不需关注的灯
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT);
handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT, HIDE_TRAFFIC_LIGHT_DELAY);
}
/**
* 根据所在车道,控制红绿灯展示
*/
public void refreshLaneStatus(){
public void refreshLaneStatus() {
}
@@ -136,16 +149,24 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
public boolean isVisible() {
return navGroup.getVisibility() == View.VISIBLE;
}
private static final int MSG_HIDE_LIMIT_SPEED = 1001;
private static final long HIDE_LIMIT_SPEED_DELAY = 5000;
private static final int MSG_HIDE_TRAFFIC_LIGHT = 1002;
private static final long HIDE_TRAFFIC_LIGHT_DELAY = 1000;
@Override
public boolean handleMessage(Message msg) {
if (!isAttachedToWindow()||getVisibility() != View.VISIBLE) {
if (!isAttachedToWindow() || getVisibility() != View.VISIBLE) {
return false;
}
if (msg.what == MSG_HIDE_LIMIT_SPEED) {
tvLimitSpeed.setVisibility(View.GONE);
return true;
} else if (msg.what == MSG_HIDE_TRAFFIC_LIGHT) {
hideTrafficLightStatus();
return true;
}
return false;
}

View File

@@ -158,8 +158,9 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
String obuLightAction = intent.getStringExtra("action");
if ("1".equals(obuLightAction)) {
// 隐藏红绿灯
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
vrModeNavInfoView.hideTrafficLightStatus();
// handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
// handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
} else {
// 红绿灯处理
String data = intent.getStringExtra("data");

View File

@@ -100,7 +100,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
* @param roadData
*/
private void addVrCameraMarker(CloudRoadData roadData) {
Log.d(TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
Log.e(TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
removeCameraMarker();
MogoMarkerOptions options = new MogoMarkerOptions()
@@ -127,7 +127,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
* @param roadData
*/
private void addNormalCameraMarker(CloudRoadData roadData) {
Log.d(TAG, "addNormalCameraMarker --lat = " + roadData.getLat() + " --lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
Log.e(TAG, "addNormalCameraMarker --lat = " + roadData.getLat() + " --lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
removeCameraMarker();
if (mMogoMarker != null) {
@@ -178,7 +178,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
if (TextUtils.equals(mCurrentUuid, mCloudRoadData.getUuid())) {
if (isVrMode == isVrModeMarker) {
// do nothing.
Log.e(TAG, "-------------1------------");
Log.d(TAG, "-------------1------------");
} else {
if (isVrMode) {
Log.d(TAG, "-------------2------------");

View File

@@ -199,6 +199,16 @@ public class TopViewAnimHelper {
if (params == null) {
throw new IllegalArgumentException("method addTopView params LayoutParams is null");
}
if (isOuting) {
if (motionViewCache != null) {
motionViewCache.statusListener.beforeViewRemoveAnim(motionViewCache.view);
motionViewCache.statusListener.onViewRemoved(motionViewCache.view);
}
motionViewCache = new MotionViewCache(view, params, statusListener);
// return;
}
if (!viewCaches.contains(view)) {
// 判断此view是否已经增加到了顶部view如果增加过就不增加了
currentAnimatingView = view;
@@ -278,6 +288,9 @@ public class TopViewAnimHelper {
// 顶部view还没有内容需要整体下移
viewCaches.add(view);
topContainer.addView(view, params);
LayoutParams p = topContainer.getLayoutParams();
p.height = params.height;
topContainer.setLayoutParams(p);
Logger.d(TAG, "整体进入==== view.visibility: " + view.getVisibility() + " view" +
".position: (" + view.getX() + ", " + view.getY() + ") params.width: " + params.width + " params.height: " + params.height);
if (statusListenerMap.get(view) != null) {
@@ -333,6 +346,7 @@ public class TopViewAnimHelper {
}
Logger.d("TopViewAnimHelper", "startTopOutAnim=====");
if (!isTopViewOut && viewCaches.contains(view)) {
isOuting = true;
// 顶部view仅剩一个view需要整体上移
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewRemoveAnim(view);
@@ -341,7 +355,7 @@ public class TopViewAnimHelper {
NoMapTopViewShaderHelper.getInstance().hideShader();
topContainer.animate().translationY(-topContainer.getTranslationY()).setListener(mainAnimListener).start();
topContainer.animate().translationY(0).setListener(mainAnimListener).start();
checkCameraModePosition(false);
@@ -389,6 +403,7 @@ public class TopViewAnimHelper {
}
Logger.d("TopViewAnimHelper", "hideNaviView=====");
animNavInfoView.setTranslationY(0);
animNavInfoView.setVisibility(View.GONE);
vrModeNavInfoView.stopNav();
int scene = 0;
@@ -441,6 +456,7 @@ public class TopViewAnimHelper {
listener.onViewRemoved(child);
}
}
topContainer.setTranslationY(0);
topContainer.removeAllViews();
hideNaviView();
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS);
@@ -496,6 +512,11 @@ public class TopViewAnimHelper {
}
topContainer.removeAllViews();
currentAnimatingView = null;
isOuting = false;
// if (motionViewCache != null) {
// startTopInAnim(motionViewCache.view, motionViewCache.params, motionViewCache.statusListener);
// motionViewCache = null;
// }
} else {
listener = statusListenerMap.get(currentAnimatingView);
if (listener != null) {
@@ -516,4 +537,21 @@ public class TopViewAnimHelper {
}
};
private MotionViewCache motionViewCache = null;
private boolean isOuting = false;
private static class MotionViewCache {
private final View view;
private final LayoutParams params;
private final IMogoTopViewStatusListener statusListener;
public MotionViewCache(View view, LayoutParams params, IMogoTopViewStatusListener statusListener) {
this.view = view;
this.params = params;
this.statusListener = statusListener;
}
}
}

View File

@@ -29,6 +29,7 @@
android:id="@+id/module_ext_id_tv_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_ext_navi_in_vr_nav_common_margin_top"
android:layout_marginStart="@dimen/module_ext_navi_in_vr_speed_margin_start"
android:text="--"
android:textColor="#fff"
@@ -53,6 +54,8 @@
android:id="@+id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode"
android:layout_width="@dimen/module_ext_navi_in_vr_navi_icon_size"
android:layout_height="@dimen/module_ext_navi_in_vr_navi_icon_size"
android:layout_marginTop="@dimen/module_ext_navi_in_vr_nav_common_margin_top"
android:layout_marginStart="@dimen/module_ext_navi_in_vr_limit_speed_margin_start"
android:src="@drawable/tc_11"
app:layout_constraintBottom_toTopOf="@id/module_ext_id_navi_in_vr_traffic_bg"
app:layout_constraintLeft_toLeftOf="@id/module_ext_id_navi_in_vr_traffic_bg"
@@ -65,6 +68,7 @@
android:text="200"
android:textColor="#f1f1f1"
android:textSize="@dimen/module_ext_navi_in_vr_next_info_txt_size"
app:layout_constraintBottom_toTopOf="@id/module_map_id_navi_next_info_road_in_vr_mode"
app:layout_constraintLeft_toRightOf="@id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode"
app:layout_constraintTop_toTopOf="@id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode" />
@@ -85,6 +89,7 @@
android:text="北三环东路辅路"
android:textColor="#f1f1f1"
android:textSize="@dimen/module_ext_navi_in_vr_next_info_road_txt_size"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_navi_next_info_distance_in_vr_mode"
app:layout_constraintTop_toBottomOf="@id/module_map_id_navi_next_info_distance_in_vr_mode" />
@@ -94,6 +99,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/module_ext_navi_in_vr_limit_speed_margin_end"
android:layout_marginTop="@dimen/module_ext_navi_in_vr_limit_speed_margin_top"
android:background="@drawable/module_ext_vr_mode_limit_speed_bg"
android:gravity="center"
android:text="80"
@@ -148,14 +154,14 @@
android:layout_height="wrap_content"
app:constraint_referenced_ids="module_ext_id_tv_speed,module_ext_id_tv_speed_unit"
android:visibility="gone"
tools:visibility="gone" />
tools:visibility="visible" />
<androidx.constraintlayout.widget.Group
android:id="@+id/module_ext_id_group_navi_in_vr_nav_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible"
tools:visibility="gone"
app:constraint_referenced_ids="module_map_id_navi_next_info_road_turn_icon_in_vr_mode,module_map_id_navi_next_info_distance_in_vr_mode,module_map_id_navi_next_info_distance_unit_in_vr_mode,module_map_id_navi_next_info_road_in_vr_mode" />
<!-- 除了上面两个group以外的其他view的group方便整体控制显示隐藏不包含limitSpeed需要单独控制它的显示隐藏 -->

View File

@@ -23,12 +23,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12"
android:layout_marginTop="@dimen/module_ext_navi_in_vr_traffic_light_left_time_margin_top"
android:textColor="#fff"
app:layout_constraintHorizontal_chainStyle="packed"
android:textSize="@dimen/module_ext_navi_in_vr_traffic_light_left_time_txt_size"
app:layout_constraintLeft_toLeftOf="@id/module_ext_id_traffic_light_icon"
app:layout_constraintRight_toLeftOf="@id/module_ext_id_traffic_light_left_time_unit"
app:layout_constraintTop_toBottomOf="@id/module_ext_id_traffic_light_icon" />
app:layout_constraintTop_toTopOf="@id/module_ext_id_traffic_light_icon" />
<TextView
android:id="@+id/module_ext_id_traffic_light_left_time_unit"

View File

@@ -226,18 +226,21 @@
<dimen name="module_ext_navi_in_vr_traffic_bg_margin_bottom">60px</dimen>
<dimen name="module_ext_navi_in_vr_speed_text_size">100px</dimen>
<dimen name="module_ext_navi_in_vr_speed_unit_size">30px</dimen>
<dimen name="module_ext_navi_in_vr_speed_unit_margin_start">30px</dimen>
<dimen name="module_ext_navi_in_vr_speed_unit_margin_start">15px</dimen>
<dimen name="module_ext_navi_in_vr_speed_margin_start">70px</dimen>
<dimen name="module_ext_navi_in_vr_speed_margin_top">22px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_size">78px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_margin_end">66px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_margin_top">43px</dimen>
<dimen name="module_ext_navi_in_vr_nav_common_margin_top">23px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_margin_top">30px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_margin_start">20px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_text_size">40px</dimen>
<dimen name="module_ext_navi_in_vr_bg_corner">20px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_margin_top">17px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_txt_size">36px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_margin_top">60px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_unit_size">21px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_no_time_margin_top">21px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_no_time_margin_top">11px</dimen>
<dimen name="module_video_window_width_content">400px</dimen>
<dimen name="module_video_window_height_content">300px</dimen>

View File

@@ -159,14 +159,14 @@ public class EventDispatchCenter implements
this.mMapLoadedCallback = callback;
}
private boolean mIsMapLoaded = false;
// private boolean mIsMapLoaded = false;
@Override
public void onMapLoaded() {
if ( mIsMapLoaded ) {
return;
}
mIsMapLoaded = true;
// if ( mIsMapLoaded ) {
// return;
// }
// mIsMapLoaded = true;
if ( mMapLoadedCallback != null ) {
mMapLoadedCallback.run();
mMapLoadedCallback = null;

View File

@@ -45,7 +45,7 @@ class MockUtil:Handler.Callback {
if (msg.what == 1001) {
Logger.d(TAG,"准备添加调试view")
val api = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
api.windowManagerApi.addView(view, 500, 300, false)
api.windowManagerApi.addView(view, 800, 300, false)
}
return false
}

View File

@@ -103,8 +103,8 @@ public class MogoServiceProvider implements IMogoModuleProvider {
MogoRTKLocation.getInstance().init();
}
MogoServices.getInstance().preInit( context );
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
UiThreadHandler.postDelayed( () -> {
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
}, 5_000L );
}

View File

@@ -326,6 +326,7 @@ public class MogoServices implements IMogoMapListener,
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() );
}
public void init( Context context ) {
@@ -337,9 +338,9 @@ public class MogoServices implements IMogoMapListener,
registerInternalUnWakeupWords();
mRegisterCenter = MarkerServiceHandler.getRegisterCenter();
mRegisterCenter.registerMogoMapListener( ServiceConst.TYPE, this );
mRegisterCenter.registerMogoLocationListener( ServiceConst.TYPE, this );
mRegisterCenter.registerMogoNaviListener( ServiceConst.TYPE, this );
mRegisterCenter.registerMogoMapListener( ServiceConst.TYPE, this );
mRegisterCenter.registerMogoAimlessModeListener( ServiceConst.TYPE, this );
mRegisterCenter.registerCarLocationChangedListener( ServiceConst.TYPE, this );
@@ -927,18 +928,26 @@ public class MogoServices implements IMogoMapListener,
return mLastCarLocation;
}
private boolean mLastStatusIsVr = false;
@Override
public void onMapModeChanged( EnumMapUI ui ) {
if ( ui == EnumMapUI.Type_VR ) {
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
MapCenterPointStrategy.resetByChangeMode();
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
AIAssist.getInstance( mContext ).speakTTSVoice( "你已进入鹰眼模式" );
if ( !mLastStatusIsVr ) {
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
MapCenterPointStrategy.resetByChangeMode();
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
AIAssist.getInstance( mContext ).speakTTSVoice( "你已进入鹰眼模式" );
mLastStatusIsVr = true;
}
} else {
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false );
MapCenterPointStrategy.resetByChangeMode();
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
AIAssist.getInstance( mContext ).speakTTSVoice( "你已离开鹰眼模式" );
if ( mLastStatusIsVr ) {
mLastStatusIsVr = false;
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false );
MapCenterPointStrategy.resetByChangeMode();
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
AIAssist.getInstance( mContext ).speakTTSVoice( "你已离开鹰眼模式" );
}
}
}
}

View File

@@ -383,6 +383,10 @@ public class MockIntentHandler implements IntentHandler {
centerMarker.destroy();
}
break;
case 38:
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
.rtkEnable( false );
break;
}
}

View File

@@ -161,13 +161,16 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
if ( data == null ) {
return;
}
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
// return;
}
if ( MogoServices.getInstance().getLastCarLocation() != null ) {
data.curSpeed = MogoServices.getInstance().getLastCarLocation().getSpeed();
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) {
return;
}
// if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
//// return;
// }
//
// if ( MogoServices.getInstance().getLastCarLocation() != null ) {
// data.curSpeed = MogoServices.getInstance().getLastCarLocation().getSpeed();
// }
SnapshotSetDataDrawer.getInstance().renderSnapshotData( data, false );
// VrModeController.getInstance().renderMogoSnapshotSetData( data );
}

View File

@@ -90,13 +90,13 @@ class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener {
locationResult.lastCoordinate = lastInfo;
locationResult.mortonCode = MortonCode.wrapEncodeMorton( lastInfo.getLon(), lastInfo.getLat() );
}
locationResult.coordinates = new ArrayList<>();
// 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 );
}
// if ( cloudLocationInfo == null ) {
// locationResult.coordinates.addAll( new ArrayList<>() );
// } else {
// locationResult.coordinates.addAll( cloudLocationInfo );
// }
}
List< ADASRecognizedResult > recognizedResults = MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
OnePerSecondSendContent content = new OnePerSecondSendContent();

View File

@@ -2,10 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.small.map">
<application>
<!--<application>
<service
android:name=".SmallMapService"
android:exported="false"
android:process=":smallMap"/>
</application>
/>
</application>-->
</manifest>

View File

@@ -0,0 +1,186 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.amap.api.col.n3;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.LayoutInflater.Factory;
import android.view.View;
import android.view.ViewStub;
import com.android.internal.policy.MyPhoneLayoutInflater;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.HashSet;
public final class le2 extends ContextThemeWrapper {
private Resources a = lg.a();
private Theme b;
private LayoutInflater c;
private ClassLoader d;
private int e;
private static final String[] f = new String[]{"android.widget", "android.webkit", "android.app"};
private le2.a g = new le2.a();
private Factory h = new Factory() {
public final View onCreateView(String var1, Context var2, AttributeSet var3) {
return le2.this.a(var1, var2, var3);
}
};
public le2(Context var1, int var2, ClassLoader var3) {
super(var1, var2);
this.d = var3;
this.b = lg.b();
this.e = var2;
super.onApplyThemeResource(this.b, this.e, true);
(new StringBuilder("classloader:")).append(this.d);
}
public final Resources getResources() {
return this.a != null ? this.a : super.getResources();
}
public final void a(int var1) {
if (var1 != this.e) {
this.e = var1;
super.onApplyThemeResource(this.b, this.e, true);
}
}
public final Theme getTheme() {
return this.b != null ? this.b : super.getTheme();
}
public final Object getSystemService(String var1) {
if ("layout_inflater".equals(var1)) {
if (this.c == null) {
// 这里构建一个自己对的布局填充器
// 与已经被修改的context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)
// 隔离从而保证高德地图SDK能正常初始化
LayoutInflater var2 = new MyPhoneLayoutInflater(getBaseContext());
this.c = var2.cloneInContext(this);
this.c.setFactory(this.h);
this.c = this.c.cloneInContext(this);
}
return this.c;
} else {
return super.getSystemService(var1);
}
}
private final View a(String var1, Context var2, AttributeSet var3) {
if (this.g.a.contains(var1)) {
return null;
} else {
Constructor var4;
if ((var4 = (Constructor) this.g.b.get(var1)) == null) {
Class var5 = null;
boolean var6 = false;
String var7 = "api.navi";
label71:
{
label70:
{
Throwable var10000;
label79:
{
boolean var10001;
try {
if (var1.contains(var7)) {
var5 = this.d.loadClass(var1);
} else {
String[] var17;
int var8 = (var17 = f).length;
int var9 = 0;
while (var9 < var8) {
String var10 = var17[var9];
try {
var5 = this.d.loadClass(var10 + "." + var1);
break;
} catch (Throwable var13) {
++var9;
}
}
}
if (var5 == null) {
break label71;
}
} catch (Throwable var15) {
var10000 = var15;
var10001 = false;
break label79;
}
if (var5 == ViewStub.class) {
break label71;
}
try {
if (var5.getClassLoader() != this.d) {
break label71;
}
break label70;
} catch (Throwable var14) {
var10000 = var14;
var10001 = false;
}
}
Throwable var18 = var10000;
(new StringBuilder("load view err:")).append(Log.getStackTraceString(var18));
break label71;
}
var6 = true;
}
if (!var6) {
this.g.a.add(var1);
return null;
}
try {
var4 = var5.getConstructor(Context.class, AttributeSet.class);
this.g.b.put(var1, var4);
} catch (Throwable var12) {
(new StringBuilder("create view err:")).append(Log.getStackTraceString(var12));
}
}
try {
View var16 = null;
if (var4 != null) {
var16 = (View) var4.newInstance(var2, var3);
}
return var16;
} catch (Throwable var11) {
(new StringBuilder("create view err:")).append(Log.getStackTraceString(var11));
return null;
}
}
}
public static class a {
public HashSet<String> a = new HashSet();
public HashMap<String, Constructor<?>> b = new HashMap();
public a() {
}
}
}

View File

@@ -0,0 +1,40 @@
package com.amap.api.col.n3;
import android.content.Context;
import android.content.res.XmlResourceParser;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* 这里是为了解决 使用换肤框架后,高德地图初始化有问题加入的
* 问题原因是:
* skin 框架会替换 LayoutInflater 中的 setFactory2 从而导致高德 le 中的 setFactory 失效。
* 解决方案为:
* 直接通过内存地址替换整个 ArtMethod来将需要修改的高德SDK中的方法指向我们修改过后的方法。
*/
public class lg2 extends lg {
static le2 b;
public static View a(Context var0, int var1, ViewGroup var2) {
XmlResourceParser var9 = a().getXml(var1);
if (!a) {
return LayoutInflater.from(var0).inflate(var9, var2);
} else {
try {
if (b == null) {
b = new le2(var0, c == -1 ? 0 : c, lg.class.getClassLoader());
}
b.a(c == -1 ? 0 : c);
View var3 = LayoutInflater.from(b).inflate(var9, var2);
return var3;
} catch (Throwable var7) {
var7.printStackTrace();
np.c(var7, "ResourcesUtil", "selfInflate(Activity activity, int resource, ViewGroup root)");
} finally {
var9.close();
}
return null;
}
}
}

View File

@@ -0,0 +1,60 @@
package com.android.internal.policy;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
/**
* @author donghongyu
* @date 12/25/20 5:12 PM
*/
public class MyPhoneLayoutInflater extends LayoutInflater {
private static final String[] sClassPrefixList = {
"android.widget.",
"android.webkit.",
"android.app."
};
/**
* Instead of instantiating directly, you should retrieve an instance
* through {@link Context#getSystemService}
*
* @param context The Context in which in which to find resources and other
* application-specific things.
* @see Context#getSystemService
*/
public MyPhoneLayoutInflater(Context context) {
super(context);
}
protected MyPhoneLayoutInflater(LayoutInflater original, Context newContext) {
super(original, newContext);
}
/**
* Override onCreateView to instantiate names that correspond to the
* widgets known to the Widget factory. If we don't find a match,
* call through to our super class.
*/
@Override
protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
for (String prefix : sClassPrefixList) {
try {
View view = createView(name, prefix, attrs);
if (view != null) {
return view;
}
} catch (ClassNotFoundException e) {
// In this case we want to let the base class take a crack
// at it.
}
}
return super.onCreateView(name, attrs);
}
public LayoutInflater cloneInContext(Context newContext) {
return new MyPhoneLayoutInflater(this, newContext);
}
}

View File

@@ -37,6 +37,7 @@ public class SmallMapDirectionView extends RelativeLayout {
private AMapNaviView mAMapNaviView;
private DirectionRotateAnimation mRotateAnimation;
private int lastAngle = 0;
private int zoomLevel = 15;
public SmallMapDirectionView(Context context) {
this(context, null);
@@ -133,19 +134,19 @@ public class SmallMapDirectionView extends RelativeLayout {
options.setNaviArrowVisible(false);
// 通过路线是否自动置灰,仅支持驾车导航
options.setAfterRouteAutoGray(false);
options.setZoom(((int) 9));
//options.setZoom(((int) 9));
//options.setPointToCenter(0.7D, 0.5D);
// 2D模式
options.setTilt(0);
// 黑夜模式
// options.setNaviNight(true);
// options.setNaviNight(true);
// 自定义地图样式
options.setCustomMapStylePath(styleFilePath);
mAMapNaviView.setViewOptions(options);
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(12);
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
aMap.moveCamera(cameraUpdate);
aMap.setOnCameraChangeListener(new AMap.OnCameraChangeListener() {
@@ -175,55 +176,53 @@ public class SmallMapDirectionView extends RelativeLayout {
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(12);
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
aMap.moveCamera(cameraUpdate);
}
});
try {
// 判断是否有样式文件存在
File styleExit = new File(styleFilePath);
if (!styleExit.exists()) {
FileUtils.copy(
context.getAssets().open("small_map_style.data"),
styleFilePath,
new FileUtils.FileCopyListener() {
//File styleExit = new File(styleFilePath);
FileUtils.copy(
context.getAssets().open("small_map_style.data"),
styleFilePath,
new FileUtils.FileCopyListener() {
@Override
public void onStart() {
Log.w("FileCopyListener", "onStart=");
@Override
public void onStart() {
Log.w("FileCopyListener", "onStart=");
}
@Override
public void onFail(Exception e) {
Log.w("FileCopyListener", "onFail=");
e.printStackTrace();
}
@Override
public void onProcess(int process) {
Log.w("FileCopyListener", "onProcess=" + process);
}
@Override
public void onFinish(String toPath) {
Log.w("FileCopyListener", "onFinish toPath=" + toPath);
// 高德地图有bug所以需要多次调用设置皮肤才能成功
if (options != null) {
options.setCustomMapStylePath(styleFilePath);
mAMapNaviView.setViewOptions(options);
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(12);
aMap.moveCamera(cameraUpdate);
}
}
);
}
@Override
public void onFail(Exception e) {
Log.w("FileCopyListener", "onFail=");
e.printStackTrace();
}
@Override
public void onProcess(int process) {
Log.w("FileCopyListener", "onProcess=" + process);
}
@Override
public void onFinish(String toPath) {
Log.w("FileCopyListener", "onFinish toPath=" + toPath);
// 高德地图有bug所以需要多次调用设置皮肤才能成功
if (options != null) {
options.setCustomMapStylePath(styleFilePath);
mAMapNaviView.setViewOptions(options);
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
aMap.moveCamera(cameraUpdate);
}
}
);
} catch (IOException e) {
e.printStackTrace();
}

View File

@@ -1,22 +1,30 @@
package com.mogo.module.small.map;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.AbsMogoApplication;
import com.amap.api.col.n3.lg;
import com.amap.api.col.n3.lg2;
import com.mogo.hook.HookManager;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.wm.WindowManagerView;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.map.IMogoSmallMapProvider;
import com.mogo.service.module.ModuleType;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.logger.Logger;
import java.lang.reflect.Method;
/**
* @author donghongyu
@@ -26,9 +34,11 @@ import com.mogo.service.statusmanager.StatusDescriptor;
public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusChangedListener {
private final String TAG = "SmallVisionProvider";
private Intent mSmallMapServiceIntent;
private Context mContext;
private WindowManagerView mWindowManagerView;
private SmallMapDirectionView mSmallMapDirectionView;
@Override
public Fragment createFragment(Context context, Bundle data) {
return null;
@@ -76,22 +86,22 @@ public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusCh
public void onDestroy() {
Log.d(TAG, "小地图模块销毁……");
hidePanel();
// 释放组件内存
mSmallMapDirectionView = null;
mWindowManagerView = null;
}
@Override
public void showPanel() {
Log.d(TAG, "小地图模块触发展示……");
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
mSmallMapServiceIntent = new Intent(mContext, SmallMapService.class);
mContext.startService(mSmallMapServiceIntent);
}
addSmallMapView();
}
@Override
public void hidePanel() {
Log.d(TAG, "小地图模块触发隐藏……");
if (mSmallMapServiceIntent != null) {
AbsMogoApplication.getApp().stopService(mSmallMapServiceIntent);
if (mWindowManagerView != null && mWindowManagerView.isShowing()) {
mWindowManagerView.dismiss();
}
}
@@ -122,4 +132,44 @@ public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusCh
}
}
}
/**
* 添加小地图View
*/
private void addSmallMapView() {
Logger.d(TAG, "addSmallMapView");
try {
// 替换高德地图的方法,解决因为加入换肤框架导致地图初始化失败
Method srcMethod = lg.class.getDeclaredMethod("a", Context.class, int.class, ViewGroup.class);
Method destMethod = lg2.class.getDeclaredMethod("a", Context.class, int.class, ViewGroup.class);
HookManager.get().hookMethod(srcMethod, destMethod);
Logger.d(TAG, "hook 高德地图成功");
} catch (Exception e) {
e.printStackTrace();
}
// 初始化小地图控件
if (mSmallMapDirectionView == null) {
mSmallMapDirectionView = new SmallMapDirectionView(mContext);
}
if (mWindowManagerView == null) {
mWindowManagerView = new WindowManagerView.Builder(mContext)
.contentView(mSmallMapDirectionView)
.size(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT
)
.position(
mContext.getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_x),
mContext.getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_y)
)
.gravity(Gravity.TOP | Gravity.LEFT)
.showInWindowManager();
}
mWindowManagerView.show();
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.module.v2x.adapter.holder;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
@@ -10,11 +11,13 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.animation.BezierAnimationView;
import com.mogo.module.common.entity.MarkerExploreWay;
@@ -23,6 +26,7 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.wm.WindowManagerView;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
@@ -81,7 +85,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private HeartLikeView ivEventZan;
private ViewGroup mViewGroup;
private WindowManagerView mWindowManagerView;
// 上传事件的用户信息
private MarkerUserInfo mUserInfo;
@@ -312,7 +316,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
e.printStackTrace();
}
}
/*
* 展示事件的图片/视频资源
* */
@@ -364,6 +368,53 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
}
private void bezierAnimation(int[] loc) {
if (mWindowManagerView == null) {
Log.d(TAG, "bezierAnimation:null");
mWindowManagerView = new WindowManagerView.Builder(mContext.getApplicationContext())
.contentView(R.layout.module_common_bezier_layout)
.size(WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT)
.position(loc[0], loc[1])
.gravity(Gravity.TOP | Gravity.LEFT)
.showInWindowManager();
}
try {
if (mWindowManagerView.isShowing()) {
return;
}
mWindowManagerView.show();
} catch (Exception e) {
e.printStackTrace();
}
BezierAnimationView bezierAnimationView = mWindowManagerView.findViewById(R.id.bezier_view);
bezierAnimationView.bezierAnimationStart();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// mWindowManagerView.dismiss();
}
}, 2000);
}
public int[] getLocation(View v) {
int[] loc = new int[4];
int[] location = new int[2];
v.getLocationOnScreen(location);
loc[0] = location[0];
loc[1] = location[1];
int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
v.measure(w, h);
loc[2] = v.getMeasuredWidth();
loc[3] = v.getMeasuredHeight();
//base = computeWH();
return loc;
}
/**
* 为了给车聊聊更多的信息需要重新查询一次
*

View File

@@ -1,6 +1,7 @@
package com.mogo.module.v2x.scenario.impl;
import android.content.Intent;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@@ -91,7 +92,7 @@ public class V2XScenarioManager implements IV2XScenarioManager {
mV2XScenario = new V2XIllegalParkScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
mV2XScenario = new V2XEventUgcScenario();
mV2XScenario = V2XServiceManager.getMoGoStatusManager().isVrMode() ? null : new V2XEventUgcScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW:
mV2XScenario = new V2XVoiceCallLiveScenario();

View File

@@ -59,7 +59,7 @@ public class V2XRoadVideoCarScenario extends AbsV2XScenario<V2XEventShowEntity>
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources()
.getDimension(R.dimen.v2x_video_window_height));
.getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode()? R.dimen.dp_394:R.dimen.v2x_video_window_height));
V2XServiceManager
.getMogoTopViewManager()
.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this);

View File

@@ -36,7 +36,7 @@
<TextView
android:id="@+id/tvEventTypeTitle"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_40"
android:layout_height="@dimen/dp_35"
android:layout_marginStart="@dimen/dp_31"
android:layout_marginBottom="@dimen/dp_42"
android:background="@drawable/bg_v2x_event_type_red_vr"

View File

@@ -37,7 +37,7 @@
<TextView
android:id="@+id/tvImgTextContent"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_40"
android:layout_height="@dimen/dp_35"
android:layout_marginTop="15dp"
android:background="@drawable/bg_v2x_event_type_orange_vr"
android:gravity="center"

View File

@@ -140,20 +140,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:background="#2651A6"
android:padding="@dimen/dp_10"
android:text="折行显示文案测试数据"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_22"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnTriggerParkEvent"
android:layout_width="wrap_content"

View File

@@ -120,5 +120,4 @@
<dimen name="v2x_driving_heigt">46px</dimen>
<dimen name="v2x_recommond_route_size">26px</dimen>
</resources>

View File

@@ -179,6 +179,9 @@ public class MogoADASController implements IMogoADASController {
}
private void invokeCallbackPerSecond( List< RectInfo > data ) {
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) {
return;
}
List< RectInfo > newRef = data;
List< ADASRecognizedListResult > recognizedListResults = AdasObjectUtils.regroupData( newRef );
if ( recognizedListResults == null || recognizedListResults.isEmpty() ) {
@@ -323,6 +326,10 @@ public class MogoADASController implements IMogoADASController {
return;
}
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
return;
}
try {
AutopilotServiceManage.getInstance().showAdas();
} catch ( Exception e ) {

View File

@@ -4,7 +4,7 @@ include ':app2'
include ':foudations:httpdns-base'
include ':foudations:httpdns-tencent'
include ':foudations:httpdns-noop'
include ':modules:mogo-modules-mvision'
//include ':modules:mogo-modules-mvision'
include ':foudations:mogo-base-websocket-sdk'
include ':tts:tts-base'
include ':tts:tts-di'