进行marker封装

This commit is contained in:
董宏宇
2020-01-09 18:44:37 +08:00
parent 2ed6b944c4
commit addf3ea68b

View File

@@ -75,61 +75,7 @@ public class MarkerServiceHandler {
@Override
public void onMsgReceived(MarkerResponse response) {
Logger.e(TAG, "===" + response);
getMarkerManager().removeMarkers();
// 解析不同的Marker类型然后对应的进行绘制
if (response != null && response.getResult() != null) {
MarkerCardResult markerCardResult = response.getResult();
List<MarkerCarChat> carChat = markerCardResult.getCarChat();
List<MarkerOnlineCar> onlineCar = markerCardResult.getOnlineCar();
List<MarkerExploreWay> exploreWay = markerCardResult.getExploreWay();
List<MarkerShareMusic> shareMusic = markerCardResult.getShareMusic();
if (carChat != null) {
for (MarkerCarChat markerCarChat : carChat) {
MarkerLocation markerLocation = markerCarChat.getLocation();
drawMapMarker(
markerCarChat.getType(),
markerCarChat,
markerLocation);
}
}
if (onlineCar != null) {
for (MarkerOnlineCar markerOnlineCar : onlineCar) {
MarkerLocation markerLocation = markerOnlineCar.getLocation();
drawMapMarker(
markerOnlineCar.getType(),
markerOnlineCar,
markerLocation);
}
}
if (exploreWay != null) {
for (MarkerExploreWay markerExploreWay : exploreWay) {
MarkerLocation markerLocation = markerExploreWay.getLocation();
drawMapMarker(
markerExploreWay.getType(),
markerExploreWay,
markerLocation);
}
}
if (shareMusic != null) {
for (MarkerShareMusic markerShareMusic : shareMusic) {
MarkerLocation markerLocation = markerShareMusic.getLocation();
drawMapMarker(
markerShareMusic.getType(),
markerShareMusic,
markerLocation);
}
}
}
getMapUIController().changeZoom(10);
drawMapMarker(response);
}
});
}
@@ -173,6 +119,65 @@ public class MarkerServiceHandler {
}
/**
* 绘制Marker
*/
public static void drawMapMarker(MarkerResponse response) {
getMarkerManager().removeMarkers();
// 解析不同的Marker类型然后对应的进行绘制
if (response != null && response.getResult() != null) {
MarkerCardResult markerCardResult = response.getResult();
List<MarkerCarChat> carChat = markerCardResult.getCarChat();
List<MarkerOnlineCar> onlineCar = markerCardResult.getOnlineCar();
List<MarkerExploreWay> exploreWay = markerCardResult.getExploreWay();
List<MarkerShareMusic> shareMusic = markerCardResult.getShareMusic();
if (carChat != null) {
for (MarkerCarChat markerCarChat : carChat) {
MarkerLocation markerLocation = markerCarChat.getLocation();
drawMapMarker(
markerCarChat.getType(),
markerCarChat,
markerLocation);
}
}
if (onlineCar != null) {
for (MarkerOnlineCar markerOnlineCar : onlineCar) {
MarkerLocation markerLocation = markerOnlineCar.getLocation();
drawMapMarker(
markerOnlineCar.getType(),
markerOnlineCar,
markerLocation);
}
}
if (exploreWay != null) {
for (MarkerExploreWay markerExploreWay : exploreWay) {
MarkerLocation markerLocation = markerExploreWay.getLocation();
drawMapMarker(
markerExploreWay.getType(),
markerExploreWay,
markerLocation);
}
}
if (shareMusic != null) {
for (MarkerShareMusic markerShareMusic : shareMusic) {
MarkerLocation markerLocation = markerShareMusic.getLocation();
drawMapMarker(
markerShareMusic.getType(),
markerShareMusic,
markerLocation);
}
}
}
getMapUIController().changeZoom(10);
}
/**
* 绘制Marker
*
@@ -197,7 +202,6 @@ public class MarkerServiceHandler {
marker.setInfoWindowAdapter(markerInfoWindowAdapter);
marker.setOnMarkerClickListener(mogoMarkerClickListener);
marker.setObject(bindObject);
}