marker在vr模式下的立体效果实现
This commit is contained in:
@@ -19,6 +19,30 @@ import java.util.Map;
|
||||
*/
|
||||
public class AMapMarkerClickHandler {
|
||||
|
||||
private static volatile AMapMarkerClickHandler sInstance;
|
||||
|
||||
private AMapMarkerClickHandler(){}
|
||||
|
||||
public static AMapMarkerClickHandler getInstance(){
|
||||
if( sInstance == null ){
|
||||
synchronized( AMapMarkerClickHandler.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new AMapMarkerClickHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release(){
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public boolean handleMarkerClicked( Marker marker ) {
|
||||
if ( marker == null ) {
|
||||
return false;
|
||||
|
||||
@@ -162,7 +162,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
private void initListeners() {
|
||||
|
||||
mMapView.setOnMarkClickListener( this );
|
||||
mMarkerClickHandler = new AMapMarkerClickHandler();
|
||||
mMarkerClickHandler = AMapMarkerClickHandler.getInstance();
|
||||
mMapView.setOnMapLoadedListener( this );
|
||||
mMapView.setOnMapTouchListener( this );
|
||||
mMapView.setOnMapClickListener( this );
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.map.impl.custom.marker;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.map.impl.custom.AMapMarkerClickHandler;
|
||||
import com.mogo.map.marker.IMogoInfoWindowAdapter;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter;
|
||||
@@ -9,6 +10,8 @@ import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
@@ -22,7 +25,13 @@ public final class AMapInfoWindowAdapter implements InfoWindowAdapter {
|
||||
IMogoMarker mogoMarker = ( ( IMogoMarker ) marker.getMObject() );
|
||||
IMogoInfoWindowAdapter delegate = mogoMarker.getInfoWindowAdapter();
|
||||
if ( delegate != null ) {
|
||||
return delegate.getInfoWindow( mogoMarker );
|
||||
final View infoView = delegate.getInfoWindow( mogoMarker );
|
||||
if ( infoView != null ) {
|
||||
infoView.setOnClickListener( view -> {
|
||||
AMapMarkerClickHandler.getInstance().handleMarkerClicked( marker );
|
||||
} );
|
||||
}
|
||||
return infoView;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user