opt
This commit is contained in:
@@ -19,7 +19,6 @@ import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShareMusic;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
@@ -68,7 +67,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
// 记录其它已经缩小的Marker
|
||||
public ArrayList<String> alreadySmallMarker = new ArrayList<>();
|
||||
// 存储所有汽车marker
|
||||
public ArrayList<IMogoMarker> carMarkers = new ArrayList<>();
|
||||
// public ArrayList<IMogoMarker> carMarkers = new ArrayList<>();
|
||||
// 距离用户最近的Marker
|
||||
private IMogoMarker mNearlyMarker = null;
|
||||
// 记录上次请求数据,切换卡片时做数据处理
|
||||
@@ -126,7 +125,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
} else {
|
||||
mCurrentModuleName = moduleName;
|
||||
runOnTargetThread(() -> {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers();
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkersExcept(ModuleNames.CARD_TYPE_USER_DATA);
|
||||
drawMarkerByCurrentType(mLastDataResult);
|
||||
});
|
||||
}
|
||||
@@ -275,18 +274,23 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
if (mogoMarker == null) {
|
||||
return;
|
||||
}
|
||||
if (mLastCheckMarker != null) {
|
||||
closeMarker(mLastCheckMarker);
|
||||
}
|
||||
mLastCheckMarker = mogoMarker;
|
||||
Object object = mogoMarker.getObject();
|
||||
if (object != null) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(true);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity,
|
||||
mogoMarker.getMogoMarkerOptions());
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
mogoMarker.setToTop();
|
||||
// 在线车辆点击使用infoWindow
|
||||
if ( TextUtils.equals( mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
if ( !mogoMarker.isDestroyed() ) {
|
||||
mogoMarker.setInfoWindowAdapter( UserDataMarkerInfoWindowAdapter.getInstance(mContext) );
|
||||
mogoMarker.showInfoWindow();
|
||||
Logger.d( TAG, "打开info window" );
|
||||
}
|
||||
} else {
|
||||
Object object = mogoMarker.getObject();
|
||||
if (object != null) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(true);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions());
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
mogoMarker.setToTop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,13 +299,18 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
if (mogoMarker == null) {
|
||||
return;
|
||||
}
|
||||
Object object = mogoMarker.getObject();
|
||||
if (object != null) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(false);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity,
|
||||
mogoMarker.getMogoMarkerOptions());
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
// 在线车辆点击使用infoWindow
|
||||
if ( TextUtils.equals( mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
// mogoMarker.hideInfoWindow();
|
||||
Logger.d( TAG, "关闭info window" );
|
||||
} else {
|
||||
Object object = mogoMarker.getObject();
|
||||
if (object != null) {
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) object;
|
||||
markerShowEntity.setChecked(false);
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, mogoMarker.getMogoMarkerOptions());
|
||||
mogoMarker.setIcon(ViewUtils.fromView(markerView.getView()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,10 +396,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
case ServiceConst.CARD_TYPE_NOVELTY:
|
||||
drawNoveltyMarker(noveltyInfoList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_CARS_CHATTING:
|
||||
case ServiceConst.CARD_TYPE_USER_DATA:
|
||||
drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
|
||||
break;
|
||||
// case ServiceConst.CARD_TYPE_CARS_CHATTING:
|
||||
// case ServiceConst.CARD_TYPE_USER_DATA:
|
||||
// drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
|
||||
// break;
|
||||
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
|
||||
drawRoadConditionMarker(exploreWayList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
|
||||
break;
|
||||
@@ -406,12 +415,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private void drawAllMarker(MarkerCardResult markerCardResult) {
|
||||
List<MarkerOnlineCar> onlineCarList = markerCardResult.getOnlineCar();
|
||||
// List<MarkerOnlineCar> onlineCarList = markerCardResult.getOnlineCar();
|
||||
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
List<MarkerShareMusic> shareMusicList = markerCardResult.getShareMusic();
|
||||
List<MarkerNoveltyInfo> noveltyInfoList = markerCardResult.getNoveltyInfo();
|
||||
|
||||
drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_ALL);
|
||||
// drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_ALL);
|
||||
drawRoadConditionMarker(exploreWayList, ServiceConst.MAX_AMOUNT_ALL);
|
||||
drawShareMusicMarker(shareMusicList, ServiceConst.MAX_AMOUNT_ALL);
|
||||
drawNoveltyMarker(noveltyInfoList, ServiceConst.MAX_AMOUNT_ALL);
|
||||
@@ -450,8 +459,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
// 计算在线车辆距离当前车辆的距离,每次都与最后一次距离最近的进行比较,保留距离最近的车辆,进行卡片展示
|
||||
try {
|
||||
// 当前车辆的位置
|
||||
MogoLocation currentLocation =
|
||||
MarkerServiceHandler.getMogoLocationClient().getLastKnowLocation();
|
||||
MogoLocation currentLocation = MarkerServiceHandler.getMogoLocationClient().getLastKnowLocation();
|
||||
|
||||
// 计算车辆距离指定气泡的距离
|
||||
float calculateDistance =
|
||||
@@ -851,17 +859,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
private void removeCarMarkers(){
|
||||
for (int i = 0; i < carMarkers.size(); i++) {
|
||||
IMogoMarker marker = carMarkers.get(i);
|
||||
marker.destroy();
|
||||
}
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_USER_DATA );
|
||||
}
|
||||
|
||||
// 平滑移动
|
||||
private void startSmooth(IMogoMarker iMogoMarker, MarkerOnlineCar markerOnlineCar,
|
||||
MarkerLocation markerLocation) {
|
||||
carMarkers.add(iMogoMarker);
|
||||
|
||||
List<MarkerCarPois> poisList = markerOnlineCar.getPois();
|
||||
|
||||
if (poisList != null && poisList.size() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user