diff --git a/.idea/misc.xml b/.idea/misc.xml index e082ea7475..733acb1920 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,10 +1,14 @@ + + + + - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 87bfe5dff1..35ae13fe20 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" diff --git a/app/functions/httpdns.gradle b/app/functions/httpdns.gradle index 176938bc92..0da084c406 100644 --- a/app/functions/httpdns.gradle +++ b/app/functions/httpdns.gradle @@ -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') } } \ No newline at end of file diff --git a/foudations/httpdns-noop/src/main/java/com/mogo/httpdns/noop/HttpDnsNoop.java b/foudations/httpdns-noop/src/main/java/com/mogo/httpdns/noop/HttpDnsNoop.java index fdf50007aa..5cd0e7df49 100644 --- a/foudations/httpdns-noop/src/main/java/com/mogo/httpdns/noop/HttpDnsNoop.java +++ b/foudations/httpdns-noop/src/main/java/com/mogo/httpdns/noop/HttpDnsNoop.java @@ -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 ); } } diff --git a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketConstant.java b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketConstant.java index f0e5ec13b7..df1706b0c5 100644 --- a/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketConstant.java +++ b/foudations/mogo-base-websocket-sdk/src/main/java/com/mogo/base/websocket/WebSocketConstant.java @@ -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"; diff --git a/libraries/map-custom/build.gradle b/libraries/map-custom/build.gradle index f355e8380f..b54e6b7372 100644 --- a/libraries/map-custom/build.gradle +++ b/libraries/map-custom/build.gradle @@ -67,7 +67,7 @@ dependencies { implementation project(':foudations:mogo-commons') } - implementation 'com.zhidaoauto.machine:map:1.0.0-vr-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' } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index aec9e0f31a..27fd4f0f76 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -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" ); + } + } } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java index 2dd9320480..5660221fb5 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java @@ -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; } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java index a9d388951a..8b4516726c 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java @@ -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 ); + } + } } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java index a0ccbae772..38a8427a1a 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java @@ -238,7 +238,16 @@ public interface IMogoMapUIController { } - default void testGpsData(){ + default void testGpsData() { + + } + + /** + * 自研地图是否匹配道路 + * + * @param enable + */ + default void rtkEnable( boolean enable ) { } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java index 68868c9f4f..e3a0c0e25c 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java @@ -283,4 +283,11 @@ public class MogoMapUIController implements IMogoMapUIController { mDelegate.changeBearing( bearing ); } } + + @Override + public void rtkEnable( boolean enable ) { + if ( mDelegate != null ) { + mDelegate.rtkEnable( enable ); + } + } } diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/constant/HttpConstants.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/constant/HttpConstants.kt index 9778b0b1c2..dd539098ab 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/constant/HttpConstants.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/constant/HttpConstants.kt @@ -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 { diff --git a/modules/mogo-module-common/build.gradle b/modules/mogo-module-common/build.gradle index 99e827b866..e6efc88b0b 100644 --- a/modules/mogo-module-common/build.gradle +++ b/modules/mogo-module-common/build.gradle @@ -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 diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java index 2bed0dae80..2e3b93492d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java @@ -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); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java index 2026a34c70..9b06caa126 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java @@ -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; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java index c3e9f0b981..64c1533873 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java @@ -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; diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerAdapter.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerAdapter.java index 8a130a1f59..7ec3052510 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerAdapter.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerAdapter.java @@ -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 ); } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java index c3cbc4149e..f01929b1e5 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerBaseView.java @@ -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); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java index 2bacde6a7e..627b15f3a9 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java @@ -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 ); + } + } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java index 694414bf7b..9201252762 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerView.java @@ -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; } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java index 7e8a557f30..022550f286 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java @@ -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; diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_services_marker_vr_bkg_checked.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_services_marker_vr_bkg_checked.png new file mode 100644 index 0000000000..b82a2b5226 Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_services_marker_vr_bkg_checked.png differ diff --git a/modules/mogo-module-common/src/main/res/layout/module_common_bezier_layout.xml b/modules/mogo-module-common/src/main/res/layout/module_common_bezier_layout.xml new file mode 100644 index 0000000000..f5838417a5 --- /dev/null +++ b/modules/mogo-module-common/src/main/res/layout/module_common_bezier_layout.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index 850cef0236..0a604bf00c 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -839,11 +839,16 @@ public class EntranceFragment extends MvpFragment 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(); } + } } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/VrModeNavInfoView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/VrModeNavInfoView.java index 43b17f467a..cee3d0dce0 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/VrModeNavInfoView.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/VrModeNavInfoView.java @@ -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; } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java index b27e21bfd1..962100bdfc 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java @@ -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"); diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/CameraLiveNoticeHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/CameraLiveNoticeHelper.java index 98112de258..36c04a5a06 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/CameraLiveNoticeHelper.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/CameraLiveNoticeHelper.java @@ -100,7 +100,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener @@ -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" /> diff --git a/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml b/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml index 9c14f81fb8..4dacff9734 100644 --- a/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml +++ b/modules/mogo-module-extensions/src/main/res/layout/merge_vertical_traffic_light_in_vr.xml @@ -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" /> 60px 100px 30px - 30px + 15px 70px 22px 78px 66px - 43px + 23px + 30px + 20px 40px 20px 17px 36px + 60px 21px - 21px + 11px 400px 300px diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/EventDispatchCenter.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/EventDispatchCenter.java index f9c9b3e85f..9f2b9ccc07 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/EventDispatchCenter.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/EventDispatchCenter.java @@ -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; diff --git a/modules/mogo-module-obu/src/main/java/com/zhidao/mogo/module/obu/MockUtil.kt b/modules/mogo-module-obu/src/main/java/com/zhidao/mogo/module/obu/MockUtil.kt index b67be3a6fe..ff4743d73e 100644 --- a/modules/mogo-module-obu/src/main/java/com/zhidao/mogo/module/obu/MockUtil.kt +++ b/modules/mogo-module-obu/src/main/java/com/zhidao/mogo/module/obu/MockUtil.kt @@ -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 } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java index b1402fee9b..fd8276d2da 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java @@ -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 ); } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java index 59406a8a9a..4070427fd0 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java @@ -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( "你已离开鹰眼模式" ); + } } } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java index 321bcbf68a..bcb6785d5f 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java @@ -383,6 +383,10 @@ public class MockIntentHandler implements IntentHandler { centerMarker.destroy(); } break; + case 38: + MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController() + .rtkEnable( false ); + break; } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java index 90e726234d..7b2d457dab 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java @@ -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 ); } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotUploadInTime.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotUploadInTime.java index 5409333c6c..78b861f954 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotUploadInTime.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotUploadInTime.java @@ -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(); diff --git a/modules/mogo-module-smp/src/main/AndroidManifest.xml b/modules/mogo-module-smp/src/main/AndroidManifest.xml index 32b078729c..33c6adff88 100644 --- a/modules/mogo-module-smp/src/main/AndroidManifest.xml +++ b/modules/mogo-module-smp/src/main/AndroidManifest.xml @@ -2,10 +2,10 @@ - + \ No newline at end of file diff --git a/modules/mogo-module-smp/src/main/java/com/amap/api/col/n3/le2.java b/modules/mogo-module-smp/src/main/java/com/amap/api/col/n3/le2.java new file mode 100644 index 0000000000..cd406be8a7 --- /dev/null +++ b/modules/mogo-module-smp/src/main/java/com/amap/api/col/n3/le2.java @@ -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 a = new HashSet(); + public HashMap> b = new HashMap(); + + public a() { + } + } +} diff --git a/modules/mogo-module-smp/src/main/java/com/amap/api/col/n3/lg2.java b/modules/mogo-module-smp/src/main/java/com/amap/api/col/n3/lg2.java new file mode 100644 index 0000000000..347f98ddc6 --- /dev/null +++ b/modules/mogo-module-smp/src/main/java/com/amap/api/col/n3/lg2.java @@ -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; + } + } +} diff --git a/modules/mogo-module-smp/src/main/java/com/android/internal/policy/MyPhoneLayoutInflater.java b/modules/mogo-module-smp/src/main/java/com/android/internal/policy/MyPhoneLayoutInflater.java new file mode 100644 index 0000000000..4a2d262764 --- /dev/null +++ b/modules/mogo-module-smp/src/main/java/com/android/internal/policy/MyPhoneLayoutInflater.java @@ -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); + } +} \ No newline at end of file diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java index dec53d8d38..f0b81e2222 100644 --- a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java @@ -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(); } diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java index 10fb9139b9..9dc29557a2 100644 --- a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java @@ -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(); + } + } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java index f269856f7b..d94f0c7d15 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java @@ -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 { private HeartLikeView ivEventZan; private ViewGroup mViewGroup; - + private WindowManagerView mWindowManagerView; // 上传事件的用户信息 private MarkerUserInfo mUserInfo; @@ -312,7 +316,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { e.printStackTrace(); } } - + /* * 展示事件的图片/视频资源 * */ @@ -364,6 +368,53 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { } } + 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; + } + /** * 为了给车聊聊更多的信息需要重新查询一次 * diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java index 41e131b359..154e90da24 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java @@ -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(); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java index 853faca1d0..def8a1c7ac 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/road/V2XRoadVideoCarScenario.java @@ -59,7 +59,7 @@ public class V2XRoadVideoCarScenario extends AbsV2XScenario 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); diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml index c4f2fd14aa..d0d64e7d06 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml @@ -36,7 +36,7 @@ -