This commit is contained in:
wangcongtao
2020-03-19 10:29:40 +08:00
parent 3dc946a37d
commit 0061b47744
14 changed files with 31 additions and 11 deletions

2
.idea/misc.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -9,7 +9,7 @@ android {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName "${rootProject.ext.android.versionName}_${getCurrentDate()}_${getGitCommit()}"
versionName "${rootProject.ext.android.versionName}"
applicationId rootProject.ext.android.applicationId
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -20,6 +20,11 @@ android {
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
dependencies {

View File

@@ -82,7 +82,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
this.mMapView = mapView;
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView, this );
try {
new BnHooker( mMapView.getMap() );
new BnHooker( mMapView.getMap(), mapView.getContext() );
} catch ( Exception e ) {
e.printStackTrace();
}

View File

@@ -1,9 +1,12 @@
package com.mogo.map.impl.amap.hook;
import android.content.Context;
import com.amap.api.maps.AMap;
import com.autonavi.amap.mapcore.interfaces.IAMap;
import com.autonavi.base.amap.api.mapcore.IAMapDelegate;
import com.autonavi.base.amap.mapcore.interfaces.IAMapListener;
import com.mogo.map.impl.amap.navi.NaviClient;
import com.mogo.utils.logger.Logger;
import java.lang.reflect.Field;
@@ -20,11 +23,13 @@ import java.lang.reflect.Proxy;
public class BnHooker implements InvocationHandler {
private static final String TAG = "BnHooker";
private final Context mContext;
private Object host;
public BnHooker( AMap map ) throws Exception {
public BnHooker( AMap map, Context context ) throws Exception {
mContext = context;
if ( map == null ) {
return;
@@ -48,7 +53,9 @@ public class BnHooker implements InvocationHandler {
@Override
public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable {
if ( method.getName().equals( "setRenderFps" ) ) {
return method.invoke( host, 10 );
if ( !NaviClient.getInstance( mContext ).isNaviing() ) {
return method.invoke( host, 10 );
}
}
if ( method.getName().equals( "drawFrame" ) ) {
Logger.d( TAG, "drawFrame" );

View File

@@ -24,6 +24,7 @@ import com.mogo.map.navi.MogoCalculatePath;
import com.mogo.map.navi.MogoNaviListenerHandler;
import com.mogo.map.navi.MogoTraffic;
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import java.util.List;
@@ -91,7 +92,7 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
@Override
public void onInitNaviSuccess() {
MogoNaviListenerHandler.getInstance().onInitNaviSuccess();
mAMapNavi.startAimlessMode(AimLessMode.CAMERA_AND_SPECIALROAD_DETECTED);
mAMapNavi.startAimlessMode( AimLessMode.CAMERA_AND_SPECIALROAD_DETECTED );
}
@Override
@@ -168,12 +169,21 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
@Override
public void onEndEmulatorNavi() {
stopNavi();
stopNaviDelay();
}
@Override
public void onArriveDestination() {
stopNavi();
stopNaviDelay();
}
/**
* 避免导航结束语音播报被立刻打断的情况
*/
private void stopNaviDelay() {
UiThreadHandler.postDelayed( () -> {
stopNavi();
}, 5_000L );
}
@Override
@@ -236,7 +246,7 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
return null;
}
public List<MogoLatLng> getCalculatedPathPos() {
public List< MogoLatLng > getCalculatedPathPos() {
if ( mNaviOverlayHelper != null ) {
return mNaviOverlayHelper.getCalculatedPathPos();
}
@@ -244,8 +254,6 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
}
public OnCalculatePathItemClickInteraction getItemClickInteraction() {
if ( mNaviOverlayHelper != null ) {
return mNaviOverlayHelper.getItemClickInteraction();

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB