增加了将Marker回调到卡片的操作

This commit is contained in:
董宏宇
2020-01-09 14:54:59 +08:00
parent 5b601b19ed
commit 4600817725
4 changed files with 37 additions and 2 deletions

View File

@@ -198,6 +198,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
@Override
public boolean onMarkerClicked( IMogoMarker marker ) {
switch2( marker.getOwner() );
mMogoModuleHandler.onMarkerReceive(marker.getOwner(),marker);
return false;
}

View File

@@ -3,6 +3,7 @@ package com.mogo.module.main.cards;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.service.module.IMogoModuleProvider;
@@ -72,4 +73,12 @@ public interface MogoModulesHandler extends IMogoMapListener,
* 销毁
*/
void destroy();
/**
* 卡片接收到Marker传入数据
* @param cardType
* @param marker
*/
void onMarkerReceive(String cardType, IMogoMarker marker);
}

View File

@@ -14,6 +14,7 @@ import com.mogo.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.MogoNaviInfo;
@@ -437,4 +438,15 @@ public class MogoModulesManager implements MogoModulesHandler,
mMapLoadedCallback = null;
mEnableModuleName = null;
}
@Override
public void onMarkerReceive(String cardType, IMogoMarker marker) {
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
if (value.getModuleName().equals(cardType)) {
if (value.getMarkerClickListener() != null) {
value.getMarkerClickListener().onMarkerClicked(marker);
}
}
}
}
}

View File

@@ -77,6 +77,8 @@ public class MarkerServiceHandler {
public void onMsgReceived(MarkerResponse response) {
Logger.e(TAG, "===" + response);
getMarkerManager().removeMarkers();
// 解析不同的Marker类型然后对应的进行绘制
if (response != null && response.getResult() != null) {
MarkerCardResult markerCardResult = response.getResult();
@@ -165,9 +167,18 @@ public class MarkerServiceHandler {
}
}
/**
* 绘制Marker
*
* @param markerTag Marker类型
* http://gitlab.zhidaoauto.com/ecos/yycp-service/CarLauncher-Docs/blob/master/%E5%8D%A1%E7%89%87%E7%B1%BB%E5%9E%8B%E5%AE%9A%E4%B9%89.md
* @param markerLocation 要绘制Marker的位置信息
* @param optionsList 要加入的Marker集合
*/
public static void drawMapMarker(String markerTag, MarkerLocation markerLocation,
ArrayList<MogoMarkerOptions> optionsList) {
Logger.e(markerTag, "=====绘制Marker====");
Logger.e(markerTag, "绘制Marker====markerTag" + markerTag);
MapMarkerView mapMarkerView = new MapMarkerView(mContext);
@@ -180,6 +191,8 @@ public class MarkerServiceHandler {
optionsList.add(options);
}
//TODO 这里是用来测试的
public static void drawMapMarker() {
Logger.e(TAG, "=====绘制Marker====");
@@ -187,7 +200,7 @@ public class MarkerServiceHandler {
MogoMarkerOptions options = new MogoMarkerOptions()
.icon(mapMarkerView)
.owner(TAG)
.owner("CARD_TYPE_USER_DATA")
.latitude(39.574525d + new Random().nextDouble())
.longitude(116.21733d + new Random().nextDouble());
IMogoMarker marker = getMarkerManager().addMarker(TAG, options);