Merge remote-tracking branch 'origin/feature/v1.0.2' into feature/v1.0.2
This commit is contained in:
@@ -4,6 +4,7 @@ import com.amap.api.maps.model.Marker;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -19,11 +20,12 @@ public class AMapMarkerClickHandler {
|
||||
}
|
||||
if ( marker.getObject() instanceof IMogoMarker ) {
|
||||
IMogoMarker mogoMarker = ( ( IMogoMarker ) marker.getObject() );
|
||||
MogoMarkersHandler.getInstance().onMarkerClicked( mogoMarker );
|
||||
final IMogoMarkerClickListener listener = mogoMarker.getOnMarkerClickListener();
|
||||
Logger.d( "AMapMarkerWrapper", "marker 点击回调:%s -> %s", mogoMarker, marker );
|
||||
if ( listener != null ) {
|
||||
return listener.onMarkerClicked( mogoMarker );
|
||||
listener.onMarkerClicked( mogoMarker );
|
||||
}
|
||||
return MogoMarkersHandler.getInstance().onMarkerClicked( mogoMarker );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Trace;
|
||||
@@ -15,6 +16,7 @@ import android.view.animation.Interpolator;
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.AMapUtils;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.CustomRenderer;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
@@ -36,6 +38,7 @@ import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.impl.amap.hook.BnHooker;
|
||||
import com.mogo.map.impl.amap.marker.AMapMarkerWrapper;
|
||||
import com.mogo.map.impl.amap.message.AMapMessageListener;
|
||||
import com.mogo.map.impl.amap.message.AMapMessageManager;
|
||||
@@ -51,6 +54,9 @@ import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import retrofit2.http.HEAD;
|
||||
|
||||
/**
|
||||
@@ -81,6 +87,11 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
public AMapNaviViewWrapper( AMapNaviView mapView ) {
|
||||
this.mMapView = mapView;
|
||||
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView, this );
|
||||
try {
|
||||
new BnHooker( mMapView.getMap() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void initMapView() {
|
||||
@@ -372,7 +383,6 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
mMapView.zoomOut();
|
||||
}
|
||||
Logger.i( TAG, "mapview zoom = " + mMapView.getMap().getCameraPosition().zoom );
|
||||
Logger.i( TAG, "scalePerPixel = " + getMap().getScalePerPixel() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,12 +469,20 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
mMapView.getMap().setMyLocationEnabled( true );
|
||||
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
|
||||
style.interval( 1000 );
|
||||
style.interval( 500 );
|
||||
style.anchor( 0.5F, 0.5F );
|
||||
style.strokeColor( Color.TRANSPARENT );
|
||||
style.strokeWidth( 0 );
|
||||
style.radiusFillColor( Color.TRANSPARENT );
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
mMapView.getMap().setOnMyLocationChangeListener(
|
||||
new AMap.OnMyLocationChangeListener() {
|
||||
@Override
|
||||
public void onMyLocationChange( Location location ) {
|
||||
Logger.d( TAG, location.toString() );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.mogo.map.impl.amap.hook;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.autonavi.base.amap.api.mapcore.IAMapDelegate;
|
||||
import com.autonavi.base.amap.mapcore.interfaces.IAMapListener;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-12
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class BnHooker implements InvocationHandler {
|
||||
|
||||
private static final String TAG = "BnHooker";
|
||||
|
||||
private Object host;
|
||||
|
||||
public BnHooker( AMap map ) throws Exception {
|
||||
|
||||
|
||||
if ( map == null ) {
|
||||
return;
|
||||
}
|
||||
Field field = AMap.class.getDeclaredField( "a" );
|
||||
field.setAccessible( true );
|
||||
host = field.get( map );
|
||||
Object object = Proxy.newProxyInstance( BnHooker.class.getClassLoader(),
|
||||
new Class[]{com.amap.api.col.n3.ft.a.class, IAMapDelegate.class, IAMapListener.class},
|
||||
this
|
||||
);
|
||||
field.set( map, object );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable {
|
||||
if ( method.getName().equals( "setRenderFps" ) ) {
|
||||
return method.invoke( host, 10 );
|
||||
}
|
||||
return method.invoke( host, args );
|
||||
}
|
||||
}
|
||||
@@ -325,10 +325,10 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
return;
|
||||
}
|
||||
|
||||
ScaleAnimation animationScale = new ScaleAnimation(fromX, toX, fromY, toY);
|
||||
animationScale.setDuration(duration);
|
||||
animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);
|
||||
animationScale.setInterpolator(interpolator);
|
||||
ScaleAnimation animationScale = new ScaleAnimation( fromX, toX, fromY, toY );
|
||||
animationScale.setDuration( duration );
|
||||
animationScale.setFillMode( Animation.FILL_MODE_FORWARDS );
|
||||
animationScale.setInterpolator( interpolator );
|
||||
|
||||
mMarker.setAnimation( animationScale );
|
||||
mMarker.startAnimation();
|
||||
|
||||
@@ -91,7 +91,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
|
||||
|
||||
Reference in New Issue
Block a user