Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -94,11 +94,14 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
|
||||
private BnHooker bnHooker;
|
||||
|
||||
private Location mLastDriveLocationShadow = null;
|
||||
private Marker mMyLocationMarker;
|
||||
|
||||
public AMapNaviViewWrapper( AMapNaviView mapView ) {
|
||||
this.mMapView = mapView;
|
||||
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView.getContext(), this );
|
||||
try {
|
||||
bnHooker = new BnHooker( mMapView.getMap(), mapView.getContext() );
|
||||
bnHooker = new BnHooker( mMapView.getMap() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -281,11 +284,12 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
if ( motionEvent.getAction() == MotionEvent.ACTION_DOWN ) {
|
||||
changeMyLocationType2UnFollow();
|
||||
}
|
||||
|
||||
try {
|
||||
bnHooker.print();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
if ( motionEvent.getAction() != MotionEvent.ACTION_UP ) {
|
||||
try {
|
||||
bnHooker.clearAllMessages();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,7 +585,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
private void changeMyLocationType2UnFollow(){
|
||||
private void changeMyLocationType2UnFollow() {
|
||||
if ( mCurrentUIMode == null ) {
|
||||
return;
|
||||
}
|
||||
@@ -892,9 +896,35 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public void onMyLocationChange( Location location ) {
|
||||
if ( ( int ) location.getSpeed() > 0 ) {
|
||||
mLastDriveLocationShadow = location;
|
||||
} else {
|
||||
if ( ( int ) location.getBearing() == 0
|
||||
&& mCurrentUIMode == EnumMapUI.NorthUP_2D
|
||||
&& mLastDriveLocationShadow != null ) {
|
||||
if ( mMyLocationMarker == null ) {
|
||||
initMyLocationMarker();
|
||||
}
|
||||
if ( mMyLocationMarker != null ) {
|
||||
mMyLocationMarker.setRotateAngle( 360 - mLastDriveLocationShadow.getBearing() );
|
||||
}
|
||||
}
|
||||
}
|
||||
NaviClient.getInstance( getContext() ).syncCarLocation( location );
|
||||
}
|
||||
|
||||
private void initMyLocationMarker() {
|
||||
List< Marker > markers = mMapView.getMap().getMapScreenMarkers();
|
||||
if ( markers != null ) {
|
||||
for ( Marker marker : markers ) {
|
||||
if ( marker != null && marker.getObject() == null ) {
|
||||
this.mMyLocationMarker = marker;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
return mCurrentUIMode;
|
||||
|
||||
@@ -17,10 +17,8 @@ import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.AMapUtils;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.MapView;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.CameraPositionCreator;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
@@ -94,7 +92,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
this.mMapView = mapView;
|
||||
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView.getContext(), this );
|
||||
try {
|
||||
new BnHooker( mMapView.getMap(), mapView.getContext() );
|
||||
new BnHooker( mMapView.getMap() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -206,7 +204,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public void onCreate( Bundle bundle ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable( ) ) );
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onCreate( bundle );
|
||||
Logger.d( TAG, "map onCreate" );
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
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.ae.gmap.GLMapEngine;
|
||||
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;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
@@ -25,13 +21,10 @@ import java.util.List;
|
||||
public class BnHooker implements InvocationHandler {
|
||||
|
||||
private static final String TAG = "BnHooker";
|
||||
private final Context mContext;
|
||||
|
||||
private Object host;
|
||||
|
||||
public BnHooker( AMap map, Context context ) throws Exception {
|
||||
|
||||
mContext = context;
|
||||
public BnHooker( AMap map ) throws Exception {
|
||||
|
||||
if ( map == null ) {
|
||||
return;
|
||||
@@ -53,15 +46,18 @@ public class BnHooker implements InvocationHandler {
|
||||
|
||||
}
|
||||
|
||||
public void print() throws Exception {
|
||||
public void clearAllMessages() throws Exception {
|
||||
Method method = host.getClass().getDeclaredMethod( "getGLMapEngine" );
|
||||
method.setAccessible( true );
|
||||
GLMapEngine glMapEngine = ( GLMapEngine ) method.invoke( host );
|
||||
glMapEngine.clearAllMessages( 0 );
|
||||
clearMessageList( "mStateMessageList", glMapEngine );
|
||||
clearMessageList( "mAnimateStateMessageList", glMapEngine );
|
||||
}
|
||||
|
||||
Field stateMessageListField = glMapEngine.getClass().getDeclaredField( "mStateMessageList" );
|
||||
private void clearMessageList( String filedName, Object obj ) throws Exception {
|
||||
Field stateMessageListField = obj.getClass().getDeclaredField( filedName );
|
||||
stateMessageListField.setAccessible( true );
|
||||
List valList = ( List ) stateMessageListField.get( glMapEngine );
|
||||
List valList = ( List ) stateMessageListField.get( obj );
|
||||
valList.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -1022,6 +1022,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
public void onCloseCurrentSelectedMarker(){
|
||||
if ( mLastCheckMarker != null && !mLastCheckMarker.isDestroyed()) {
|
||||
closeMarker( mLastCheckMarker );
|
||||
mLastCheckMarker = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user