rc
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -5,7 +5,7 @@
|
||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -199,6 +199,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -21,8 +22,6 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.receiver.MogoReceiver;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
@@ -445,6 +444,16 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
}
|
||||
|
||||
@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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,13 @@ import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.service.entity.MarkerCarChat;
|
||||
import com.mogo.module.service.entity.MarkerCardResult;
|
||||
import com.mogo.module.service.entity.MarkerExploreWay;
|
||||
import com.mogo.module.service.entity.MarkerLocation;
|
||||
import com.mogo.module.service.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.service.entity.MarkerResponse;
|
||||
import com.mogo.module.service.entity.MarkerShareMusic;
|
||||
import com.mogo.module.service.marker.MapMarkerView;
|
||||
import com.mogo.module.service.marker.MarkerInfoWindowAdapter;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -20,6 +26,8 @@ import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
@@ -32,7 +40,7 @@ import java.util.Random;
|
||||
public class MarkerServiceHandler {
|
||||
private static final String TAG = "MarkerServiceHandler";
|
||||
|
||||
private static MogoMarkerClickListener mogoMarkerClickListener;
|
||||
private static MoGoMarkerClickListener mogoMarkerClickListener;
|
||||
|
||||
private static IMogoMapService mMapService;
|
||||
private static IMogoMarkerManager mMarkerManager;
|
||||
@@ -54,8 +62,7 @@ public class MarkerServiceHandler {
|
||||
markerInfoWindowAdapter = new MarkerInfoWindowAdapter(context, getNavi(), getImageloader());
|
||||
mMapUIController = mMapService.getMapUIController();
|
||||
|
||||
|
||||
mogoMarkerClickListener = new MogoMarkerClickListener();
|
||||
mogoMarkerClickListener = new MoGoMarkerClickListener();
|
||||
|
||||
// 长连接
|
||||
mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
|
||||
@@ -67,14 +74,58 @@ public class MarkerServiceHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MarkerResponse obj) {
|
||||
Logger.e("donghongyu", "===" + obj);
|
||||
public void onMsgReceived(MarkerResponse response) {
|
||||
Logger.e(TAG, "===" + response);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
drawMapMarker();
|
||||
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();
|
||||
|
||||
ArrayList<MogoMarkerOptions> optionsList = new ArrayList<>();
|
||||
|
||||
if (carChat != null) {
|
||||
for (MarkerCarChat markerCarChat : carChat) {
|
||||
MarkerLocation markerLocation = markerCarChat.getLocation();
|
||||
drawMapMarker(markerCarChat.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (onlineCar != null) {
|
||||
for (MarkerOnlineCar markerOnlineCar : onlineCar) {
|
||||
MarkerLocation markerLocation = markerOnlineCar.getLocation();
|
||||
drawMapMarker(markerOnlineCar.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (exploreWay != null) {
|
||||
for (MarkerExploreWay markerExploreWay : exploreWay) {
|
||||
MarkerLocation markerLocation = markerExploreWay.getLocation();
|
||||
drawMapMarker(markerExploreWay.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (shareMusic != null) {
|
||||
for (MarkerShareMusic markerShareMusic : shareMusic) {
|
||||
MarkerLocation markerLocation = markerShareMusic.getLocation();
|
||||
drawMapMarker(markerShareMusic.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
List<IMogoMarker> iMogoMarkers = getMarkerManager().addMarkers(TAG, optionsList, true);
|
||||
for (IMogoMarker iMogoMarker : iMogoMarkers) {
|
||||
iMogoMarker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
iMogoMarker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -106,7 +157,7 @@ public class MarkerServiceHandler {
|
||||
/**
|
||||
* 地图上的Marker点击回调
|
||||
*/
|
||||
static class MogoMarkerClickListener implements IMogoMarkerClickListener {
|
||||
static class MoGoMarkerClickListener implements IMogoMarkerClickListener {
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
@@ -117,14 +168,39 @@ public class MarkerServiceHandler {
|
||||
}
|
||||
|
||||
|
||||
public static void drawMapMarker() {
|
||||
TipToast.shortTip("绘制Marker");
|
||||
/**
|
||||
* 绘制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====markerTag:" + markerTag);
|
||||
|
||||
MapMarkerView mapMarkerView = new MapMarkerView(mContext);
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.icon(mapMarkerView)
|
||||
.owner(TAG)
|
||||
.owner(markerTag)
|
||||
.latitude(markerLocation.getLat())
|
||||
.longitude(markerLocation.getLon());
|
||||
|
||||
optionsList.add(options);
|
||||
}
|
||||
|
||||
|
||||
//TODO 这里是用来测试的
|
||||
public static void drawMapMarker() {
|
||||
Logger.e(TAG, "=====绘制Marker====");
|
||||
|
||||
MapMarkerView mapMarkerView = new MapMarkerView(mContext);
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.icon(mapMarkerView)
|
||||
.owner("CARD_TYPE_USER_DATA")
|
||||
.latitude(39.574525d + new Random().nextDouble())
|
||||
.longitude(116.21733d + new Random().nextDouble());
|
||||
IMogoMarker marker = getMarkerManager().addMarker(TAG, options);
|
||||
@@ -132,5 +208,8 @@ public class MarkerServiceHandler {
|
||||
marker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
|
||||
getMapUIController().changeZoom(false);
|
||||
|
||||
getMapUIController().changeZoom(10);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user