This commit is contained in:
wangcongtao
2020-05-06 09:59:02 +08:00
parent 7400e7cf82
commit ec373fc046
2 changed files with 25 additions and 32 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

@@ -1,10 +1,8 @@
package com.mogo.map.impl.amap.marker;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.view.View;
import android.view.animation.BounceInterpolator;
import android.view.animation.Interpolator;
import com.amap.api.maps.model.BitmapDescriptor;
@@ -442,36 +440,31 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
return;
}
if ( mMarker != null && points.size() > 0 ) {
List< LatLng > p = new ArrayList<>();
for ( int i = 0; i < points.size(); i++ ) {
p.add( ObjectUtils.fromMogo2( points.get( i ) ) );
}
mMovingPointOverlay = new MovingPointOverlay( AMapWrapper.getAMap(), mMarker );
mMovingPointOverlay.setPoints( p );
mMovingPointOverlay.setTotalDuration( duration );
mMovingPointOverlay.setMoveListener( v -> {
try {
// LatLng position = mMovingPointOverlay.getPosition();
// Point point = AMapWrapper.getAMap().getProjection().toScreenLocation( position );
// if ( point.x < 0 || point.x > WindowUtils.getScreenWidth( AbsMogoApplication.getApp() )
// || point.y < 0 || point.y > WindowUtils.getScreenHeight( AbsMogoApplication.getApp() ) ) {
// if ( mMarker.isVisible() ) {
// mMovingPointOverlay.setVisible( false );
// Logger.d( TAG, "hide moving marker" );
// }
// } else {
// if ( !mMarker.isVisible() ) {
// mMovingPointOverlay.setVisible( true );
// Logger.d( TAG, "show moving marker" );
// }
// }
} catch ( Exception e ) {
Logger.e( TAG, e, "error." );
}
} );
mMovingPointOverlay.startSmoothMove();
if ( mMarker == null ) {
return;
}
if ( points == null || points.isEmpty() ) {
return;
}
List< LatLng > newPoints = new ArrayList<>();
for ( int i = 0; i < points.size(); i++ ) {
LatLng point = ObjectUtils.fromMogo2( points.get( i ) );
if ( point == null ) {
continue;
}
newPoints.add( point );
}
if ( newPoints.isEmpty() ) {
return;
}
if ( mMovingPointOverlay == null ) {
mMovingPointOverlay = new MovingPointOverlay( AMapWrapper.getAMap(), mMarker );
}
mMovingPointOverlay.setPoints( newPoints );
mMovingPointOverlay.setTotalDuration( duration );
mMovingPointOverlay.startSmoothMove();
}
}