Merge branch 'feature/v1.0.0' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into feature/v1.0.0
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">
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-1015:47
|
||||
* desc : 用来跟Marker View 绑定使用,内容、状态等设置
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MarkerShowEntity {
|
||||
|
||||
// false - 没选中,true - 选中
|
||||
private boolean isChecked;
|
||||
// icon 地址,例如:头像,唱片图片,探路缩略
|
||||
private String iconUrl;
|
||||
// 要展示的文本
|
||||
private String textContent;
|
||||
// Marker 类型
|
||||
private String markerType;
|
||||
|
||||
// 绑定 MarkerView 的数据
|
||||
private Object bindObj;
|
||||
|
||||
//Marker 经纬度位置信息
|
||||
private MarkerLocation markerLocation;
|
||||
|
||||
public boolean isChecked() {
|
||||
return isChecked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
isChecked = checked;
|
||||
}
|
||||
|
||||
public String getIconUrl() {
|
||||
return iconUrl;
|
||||
}
|
||||
|
||||
public void setIconUrl(String iconUrl) {
|
||||
this.iconUrl = iconUrl;
|
||||
}
|
||||
|
||||
public String getTextContent() {
|
||||
return textContent;
|
||||
}
|
||||
|
||||
public void setTextContent(String textContent) {
|
||||
this.textContent = textContent;
|
||||
}
|
||||
|
||||
public String getMarkerType() {
|
||||
return markerType;
|
||||
}
|
||||
|
||||
public void setMarkerType(String markerType) {
|
||||
this.markerType = markerType;
|
||||
}
|
||||
|
||||
|
||||
public Object getBindObj() {
|
||||
return bindObj;
|
||||
}
|
||||
|
||||
public void setBindObj(Object bindObj) {
|
||||
this.bindObj = bindObj;
|
||||
}
|
||||
|
||||
public MarkerLocation getMarkerLocation() {
|
||||
return markerLocation;
|
||||
}
|
||||
|
||||
public void setMarkerLocation(MarkerLocation markerLocation) {
|
||||
this.markerLocation = markerLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerShowEntity{" +
|
||||
"isChecked=" + isChecked +
|
||||
", iconUrl='" + iconUrl + '\'' +
|
||||
", textContent='" + textContent + '\'' +
|
||||
", markerType='" + markerType + '\'' +
|
||||
", bindObj=" + bindObj +
|
||||
", markerLocation=" + markerLocation +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<dimen name="card_common_margin_left">@dimen/dp_15</dimen>
|
||||
<dimen name="dp_m_60">-30.0000px</dimen>
|
||||
<dimen name="dp_m_30">-15.0000px</dimen>
|
||||
<dimen name="dp_m_20">-10.0000px</dimen>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- Your custom size defind by references, can be writted in anywhere, any module, any values/*.xml, for example: -->
|
||||
<dimen name="card_common_margin_left">@dimen/dp_15</dimen>
|
||||
|
||||
<!-- dp and sp values, must be defind in this file! -->
|
||||
<!-- view size,you can add if there is no one -->
|
||||
<dimen name="dp_m_60">-60px</dimen>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- Your custom size defind by references, can be writted in anywhere, any module, any values/*.xml, for example: -->
|
||||
<dimen name="card_common_margin_left">@dimen/dp_15</dimen>
|
||||
|
||||
<!-- dp and sp values, must be defind in this file! -->
|
||||
<!-- view size,you can add if there is no one -->
|
||||
<dimen name="dp_m_60">-60px</dimen>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -16,15 +17,15 @@ import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShareMusic;
|
||||
import com.mogo.module.service.marker.MapMarkerInfoView;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.marker.MapMarkerAdapter;
|
||||
import com.mogo.module.service.marker.MapMarkerView;
|
||||
import com.mogo.module.service.marker.MarkerInfoWindowAdapter;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
@@ -47,10 +48,9 @@ public class MarkerServiceHandler {
|
||||
private static IMogoNavi mNavi;
|
||||
private static IMogoMapUIController mMapUIController;
|
||||
|
||||
private static IMogoRegisterCenter mMogoRegisterCenter;
|
||||
private static IMogoStatusManager mMogoStatusManager;
|
||||
private static IMogoImageloader mImageloader;
|
||||
private static IMogoSocketManager mMogoSocketManager;
|
||||
private static MarkerInfoWindowAdapter markerInfoWindowAdapter;
|
||||
|
||||
private static Context mContext;
|
||||
|
||||
@@ -58,10 +58,9 @@ public class MarkerServiceHandler {
|
||||
mContext = context;
|
||||
mMapService = (IMogoMapService) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation(context);
|
||||
mImageloader = (IMogoImageloader) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_IMAGE_LOADER).navigation(context);
|
||||
mMogoRegisterCenter = (IMogoRegisterCenter) ARouter.getInstance().build(MogoServicePaths.PATH_REGISTER_CENTER).navigation(context);
|
||||
mMogoStatusManager = (IMogoStatusManager) ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation(context);
|
||||
mMarkerManager = mMapService.getMarkerManager(context);
|
||||
mNavi = mMapService.getNavi(context);
|
||||
markerInfoWindowAdapter = new MarkerInfoWindowAdapter(context, getNavi(), getImageloader());
|
||||
mMapUIController = mMapService.getMapUIController();
|
||||
|
||||
mogoMarkerClickListener = new MoGoMarkerClickListener();
|
||||
@@ -78,7 +77,9 @@ public class MarkerServiceHandler {
|
||||
@Override
|
||||
public void onMsgReceived(MarkerResponse response) {
|
||||
Logger.e(TAG, "===" + response);
|
||||
drawMapMarker(response);
|
||||
if (!getMogoStatusManager().isSearchUIShow()) {
|
||||
drawMapMarker(response);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -107,6 +108,10 @@ public class MarkerServiceHandler {
|
||||
return mMogoSocketManager;
|
||||
}
|
||||
|
||||
public static IMogoStatusManager getMogoStatusManager() {
|
||||
return mMogoStatusManager;
|
||||
}
|
||||
|
||||
|
||||
private static IMogoMarker lastMarker;
|
||||
|
||||
@@ -119,37 +124,19 @@ public class MarkerServiceHandler {
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
Logger.e(TAG, "点击了大而全中的Marker");
|
||||
if (lastMarker != null) {
|
||||
MapMarkerView mapMarkerView = new MapMarkerView(mContext);
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.icon(mapMarkerView)
|
||||
.owner(lastMarker.getOwner())
|
||||
.latitude(lastMarker.getPosition().getLat())
|
||||
.longitude(lastMarker.getPosition().getLng());
|
||||
|
||||
IMogoMarker newMarker = getMarkerManager().addMarker(lastMarker.getOwner(), options);
|
||||
newMarker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
newMarker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
newMarker.setObject(lastMarker.getObject());
|
||||
// 设置未选中状态
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) marker.getObject();
|
||||
markerShowEntity.setChecked(false);
|
||||
drawMapMarker(markerShowEntity);
|
||||
|
||||
lastMarker.destroy();
|
||||
}
|
||||
|
||||
// 绘制选中的状态
|
||||
MarkerShowEntity markerShowEntity = (MarkerShowEntity) marker.getObject();
|
||||
markerShowEntity.setChecked(true);
|
||||
lastMarker = drawMapMarker(markerShowEntity);
|
||||
|
||||
//
|
||||
MapMarkerInfoView mapMarkerInfoView = new MapMarkerInfoView(mContext);
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.icon(mapMarkerInfoView)
|
||||
.owner(marker.getOwner())
|
||||
.latitude(marker.getPosition().getLat())
|
||||
.longitude(marker.getPosition().getLng());
|
||||
|
||||
IMogoMarker newMarker = getMarkerManager().addMarker(marker.getOwner(), options);
|
||||
newMarker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
newMarker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
newMarker.setObject(marker.getObject());
|
||||
|
||||
lastMarker = newMarker;
|
||||
marker.destroy();
|
||||
return false;
|
||||
}
|
||||
@@ -174,40 +161,60 @@ public class MarkerServiceHandler {
|
||||
if (carChat != null) {
|
||||
for (MarkerCarChat markerCarChat : carChat) {
|
||||
MarkerLocation markerLocation = markerCarChat.getLocation();
|
||||
drawMapMarker(
|
||||
markerCarChat.getType(),
|
||||
markerCarChat,
|
||||
markerLocation);
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setBindObj(markerCarChat);
|
||||
markerShowEntity.setMarkerLocation(markerLocation);
|
||||
markerShowEntity.setMarkerType(markerCarChat.getType());
|
||||
markerShowEntity.setTextContent(markerCarChat.getUserInfo().getUserName());
|
||||
markerShowEntity.setIconUrl(markerCarChat.getUserInfo().getUserHead());
|
||||
|
||||
drawMapMarker(markerShowEntity);
|
||||
}
|
||||
}
|
||||
|
||||
if (onlineCar != null) {
|
||||
for (MarkerOnlineCar markerOnlineCar : onlineCar) {
|
||||
MarkerLocation markerLocation = markerOnlineCar.getLocation();
|
||||
drawMapMarker(
|
||||
markerOnlineCar.getType(),
|
||||
markerOnlineCar,
|
||||
markerLocation);
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setBindObj(markerOnlineCar);
|
||||
markerShowEntity.setMarkerLocation(markerLocation);
|
||||
markerShowEntity.setMarkerType(markerOnlineCar.getType());
|
||||
markerShowEntity.setTextContent(markerOnlineCar.getUserInfo().getUserName());
|
||||
markerShowEntity.setIconUrl(markerOnlineCar.getUserInfo().getUserHead());
|
||||
|
||||
drawMapMarker(markerShowEntity);
|
||||
}
|
||||
}
|
||||
|
||||
if (exploreWay != null) {
|
||||
for (MarkerExploreWay markerExploreWay : exploreWay) {
|
||||
MarkerLocation markerLocation = markerExploreWay.getLocation();
|
||||
drawMapMarker(
|
||||
markerExploreWay.getType(),
|
||||
markerExploreWay,
|
||||
markerLocation);
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setBindObj(markerExploreWay);
|
||||
markerShowEntity.setMarkerLocation(markerLocation);
|
||||
markerShowEntity.setMarkerType(markerExploreWay.getType());
|
||||
markerShowEntity.setTextContent(markerExploreWay.getUserInfo().getUserName());
|
||||
markerShowEntity.setIconUrl(markerExploreWay.getUserInfo().getUserHead());
|
||||
|
||||
drawMapMarker(markerShowEntity);
|
||||
}
|
||||
}
|
||||
|
||||
if (shareMusic != null) {
|
||||
for (MarkerShareMusic markerShareMusic : shareMusic) {
|
||||
MarkerLocation markerLocation = markerShareMusic.getLocation();
|
||||
drawMapMarker(
|
||||
markerShareMusic.getType(),
|
||||
markerShareMusic,
|
||||
markerLocation);
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setBindObj(markerShareMusic);
|
||||
markerShowEntity.setMarkerLocation(markerLocation);
|
||||
markerShowEntity.setMarkerType(markerShareMusic.getType());
|
||||
markerShowEntity.setTextContent(markerShareMusic.getMediaName());
|
||||
markerShowEntity.setIconUrl(markerShareMusic.getMediaImg());
|
||||
|
||||
drawMapMarker(markerShowEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,28 +224,22 @@ 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 bindObject 绑定的对应的数据
|
||||
* @param markerLocation 要绘制Marker的位置信息
|
||||
*/
|
||||
public static void drawMapMarker(String markerTag,
|
||||
Object bindObject,
|
||||
MarkerLocation markerLocation) {
|
||||
Logger.e(TAG, "绘制Marker====markerTag:" + markerTag);
|
||||
MapMarkerView mapMarkerView = new MapMarkerView(mContext);
|
||||
public static IMogoMarker drawMapMarker(MarkerShowEntity markerShowEntity) {
|
||||
Logger.e(TAG, "绘制Marker====markerTag:" + markerShowEntity);
|
||||
View markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity);
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner(markerTag)
|
||||
.latitude(markerLocation.getLat())
|
||||
.longitude(markerLocation.getLon());
|
||||
options.icon(mapMarkerView);
|
||||
.owner(markerShowEntity.getMarkerType())
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
options.icon(markerView);
|
||||
|
||||
IMogoMarker marker = getMarkerManager().addMarker(markerTag, options);
|
||||
marker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
IMogoMarker marker = getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
|
||||
marker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
marker.setObject(bindObject);
|
||||
marker.setObject(markerShowEntity);
|
||||
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +255,6 @@ public class MarkerServiceHandler {
|
||||
.latitude(39.574525d + new Random().nextDouble())
|
||||
.longitude(116.21733d + new Random().nextDouble());
|
||||
IMogoMarker marker = getMarkerManager().addMarker("CARD_TYPE_USER_DATA", options);
|
||||
marker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
marker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
marker.setObject("我是Marker上面绑定的数据");
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-1015:55
|
||||
* desc : 地图Marker的适配器
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerAdapter {
|
||||
|
||||
/**
|
||||
* 获取 MarkerShowEntity 填充好的 MarkerView
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param markerShowEntity 要填充的数据
|
||||
* @return MarkerView
|
||||
*/
|
||||
public static View getMarkerView(Context context, MarkerShowEntity markerShowEntity) {
|
||||
if (markerShowEntity.isChecked()) {
|
||||
MapMarkerInfoView mapMarkerInfoView = new MapMarkerInfoView(context);
|
||||
mapMarkerInfoView.updateView(markerShowEntity);
|
||||
return mapMarkerInfoView;
|
||||
} else {
|
||||
MapMarkerView mapMarkerView = new MapMarkerView(context);
|
||||
mapMarkerView.updateView(markerShowEntity);
|
||||
return mapMarkerView;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,24 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.LinearLayout;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.imageloader.IMogoImageLoaderListener;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -18,6 +28,14 @@ import com.mogo.module.service.R;
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerInfoView extends ConstraintLayout {
|
||||
private String TAG = "MapMarkerInfoView";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private MogoImageView ivUserHead;
|
||||
private ImageView ivIconForeground;
|
||||
private TextView tvMarkerContent;
|
||||
|
||||
public MapMarkerInfoView(Context context) {
|
||||
super(context);
|
||||
initView(context);
|
||||
@@ -33,11 +51,54 @@ public class MapMarkerInfoView extends ConstraintLayout {
|
||||
initView(context);
|
||||
}
|
||||
|
||||
|
||||
private void initView(Context context) {
|
||||
|
||||
mContext = context;
|
||||
LayoutInflater.from(context).inflate(R.layout.view_map_marker_info, this);
|
||||
ivUserHead = findViewById(R.id.ivUserHead);
|
||||
ivIconForeground = findViewById(R.id.ivIconForeground);
|
||||
tvMarkerContent = findViewById(R.id.tvMarkerContent);
|
||||
}
|
||||
|
||||
public void updateView(MarkerShowEntity markerShowEntity) {
|
||||
try {
|
||||
switch (markerShowEntity.getMarkerType()) {
|
||||
case ServiceConst
|
||||
.CARD_TYPE_CARS_CHATTING:
|
||||
case ServiceConst
|
||||
.CARD_TYPE_USER_DATA:
|
||||
ivIconForeground.setVisibility(View.GONE);
|
||||
break;
|
||||
case ServiceConst
|
||||
.CARD_TYPE_ROAD_CONDITION:
|
||||
case ServiceConst
|
||||
.CARD_TYPE_SHARE_MUSIC:
|
||||
ivIconForeground.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
tvMarkerContent.setText(markerShowEntity.getTextContent());
|
||||
MarkerServiceHandler
|
||||
.getImageloader()
|
||||
.displayImage(markerShowEntity.getIconUrl(), ivUserHead, WindowUtils.dip2px(mContext, 50), WindowUtils.dip2px(mContext, 50),
|
||||
new IMogoImageLoaderListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(Bitmap bitmap) {
|
||||
// 刷新图标
|
||||
Logger.d(TAG, "loaded.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.imageloader.IMogoImageLoaderListener;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -17,6 +27,13 @@ import com.mogo.module.service.R;
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerView extends ConstraintLayout {
|
||||
private String TAG = "MapMarkerView";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private MogoImageView ivUserHead;
|
||||
private ImageView ivIconForeground;
|
||||
|
||||
public MapMarkerView(Context context) {
|
||||
super(context);
|
||||
initView(context);
|
||||
@@ -34,9 +51,50 @@ public class MapMarkerView extends ConstraintLayout {
|
||||
|
||||
|
||||
private void initView(Context context) {
|
||||
|
||||
mContext = context;
|
||||
LayoutInflater.from(context).inflate(R.layout.view_map_marker, this);
|
||||
|
||||
ivUserHead = findViewById(R.id.ivUserHead);
|
||||
ivIconForeground = findViewById(R.id.ivIconForeground);
|
||||
}
|
||||
|
||||
public void updateView(MarkerShowEntity markerShowEntity) {
|
||||
try {
|
||||
switch (markerShowEntity.getMarkerType()) {
|
||||
case ServiceConst
|
||||
.CARD_TYPE_CARS_CHATTING:
|
||||
case ServiceConst
|
||||
.CARD_TYPE_USER_DATA:
|
||||
ivIconForeground.setVisibility(View.GONE);
|
||||
break;
|
||||
case ServiceConst
|
||||
.CARD_TYPE_ROAD_CONDITION:
|
||||
case ServiceConst
|
||||
.CARD_TYPE_SHARE_MUSIC:
|
||||
ivIconForeground.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
MarkerServiceHandler
|
||||
.getImageloader()
|
||||
.displayImage(markerShowEntity.getIconUrl(), ivUserHead, WindowUtils.dip2px(mContext, 50), WindowUtils.dip2px(mContext, 50),
|
||||
new IMogoImageLoaderListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(Bitmap bitmap) {
|
||||
// 刷新图标
|
||||
Logger.d(TAG, "loaded.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.map.marker.IMogoInfoWindowAdapter;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-0818:11
|
||||
* desc :
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MarkerInfoWindowAdapter implements IMogoInfoWindowAdapter {
|
||||
|
||||
private static final String TAG = "MarkerInfoWindowAdapter";
|
||||
|
||||
private Context mContext;
|
||||
private IMogoNavi mNavi;
|
||||
private IMogoImageloader mImageloader;
|
||||
|
||||
public MarkerInfoWindowAdapter(Context mContext, IMogoNavi mNavi, IMogoImageloader iMogoImageloader) {
|
||||
this.mContext = mContext;
|
||||
this.mNavi = mNavi;
|
||||
this.mImageloader = iMogoImageloader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getInfoWindow(IMogoMarker marker) {
|
||||
Logger.e(TAG,"getInfoWindow====");
|
||||
MapMarkerInfoView mapMarkerInfoView = new MapMarkerInfoView(mContext);
|
||||
return mapMarkerInfoView;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.mogo.service.imageloader.MogoImageView
|
||||
android:id="@+id/ivIcon"
|
||||
android:id="@+id/ivUserHead"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:layout_gravity="center"
|
||||
@@ -50,8 +50,10 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:src="@drawable/icon_map_marker_music_play"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</merge >
|
||||
@@ -44,6 +44,8 @@
|
||||
android:id="@+id/ivIconForeground"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:src="@drawable/icon_map_marker_music_play"
|
||||
|
||||
Reference in New Issue
Block a user