This commit is contained in:
wangcongtao
2020-01-12 09:46:00 +08:00
parent 63d4268eca
commit 714b974db2
13 changed files with 65 additions and 24 deletions

View File

@@ -1,6 +1,7 @@
package com.mogo.map.impl.amap.navi;
import android.content.Context;
import android.graphics.Rect;
import com.amap.api.maps.model.Polyline;
import com.amap.api.navi.AMapNavi;
@@ -170,6 +171,13 @@ public class NaviClient implements IMogoNavi {
}
}
@Override
public void setCalculatePathDisplayBounds( Rect bounds ) {
if ( mAMapNaviListener != null ) {
mAMapNaviListener.setCalculatePathDisplayBounds(bounds);
}
}
// -- end
private boolean checkAMapNavi() {

View File

@@ -1,6 +1,7 @@
package com.mogo.map.impl.amap.navi;
import android.content.Context;
import android.graphics.Rect;
import com.amap.api.maps.model.Polyline;
import com.amap.api.navi.AMapNavi;
@@ -185,4 +186,10 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
mNaviOverlayHelper.clearCalculatedOverlay();
}
}
public void setCalculatePathDisplayBounds( Rect bounds ){
if ( mNaviOverlayHelper != null ) {
mNaviOverlayHelper.setCalculatePathDisplayBounds(bounds);
}
}
}

View File

@@ -58,7 +58,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
private int mSelectedPathId;
private CalculatePathItem mSelectedCalculatePathItem;
private SoftReference< OnCalculatePathItemClickInteraction > mLineClickInteractionRef;
private OnCalculatePathItemClickInteraction mLineClickInteraction;
public NaviOverlayHelper( AMapNavi mAMapNavi, AMap mAMap, Context mContext ) {
this.mAMapNavi = mAMapNavi;
@@ -157,7 +157,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
if ( i == 0 ) {
mSelectedPathId = item.getId();
mSelectedCalculatePathItem = item;
wrapper.setStartBitmap( R.drawable.ic_search_poi_location ).setEndBitmap( R.drawable.ic_search_choice_point );
wrapper.setStartBitmap( R.drawable.ic_navi_start ).setEndBitmap( R.drawable.ic_navi_target );
mAMapNavi.selectRouteId( item.getId() );
}
wrapper.addToMap();
@@ -196,8 +196,8 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
if ( mPaths != null && !mPaths.isEmpty() ) {
for ( MogoCalculatePath path : mPaths ) {
if ( TextUtils.equals( path.getTagId(), polyline.getId() ) ) {
if ( mLineClickInteractionRef != null && mLineClickInteractionRef.get() != null ) {
mLineClickInteractionRef.get().onItemClicked( path.getTagId() );
if ( mLineClickInteraction != null ) {
mLineClickInteraction.onItemClicked( path.getTagId() );
break;
}
}
@@ -317,9 +317,12 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
}
public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
if ( mLineClickInteractionRef != null ) {
mLineClickInteractionRef.clear();
mLineClickInteraction = lineClickInteraction;
}
public void setCalculatePathDisplayBounds( Rect bounds ) {
if ( bounds != null ) {
mBoundRect = bounds;
}
mLineClickInteractionRef = new SoftReference<>( lineClickInteraction );
}
}