完成了小水滴的Marker样式分类绘制

This commit is contained in:
董宏宇
2020-01-14 19:03:02 +08:00
parent 6acdfa3772
commit 58456245f7
10 changed files with 106 additions and 61 deletions

View File

@@ -231,7 +231,7 @@ public class MarkerServiceHandler {
}
}
getMapUIController().changeZoom(10);
getMapUIController().changeZoom(12);
}
/**
@@ -239,22 +239,25 @@ public class MarkerServiceHandler {
*/
public static IMogoMarker drawMapMarker(MarkerShowEntity markerShowEntity) {
Logger.e(TAG, "绘制Marker====markerTag" + markerShowEntity);
try {
if (markerShowEntity.getMarkerLocation() != null) {
View markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity);
if (markerShowEntity.getMarkerLocation() != null) {
View markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity);
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(markerShowEntity.getMarkerType())
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
options.icon(markerView);
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(markerShowEntity.getMarkerType())
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
options.icon(markerView);
IMogoMarker marker = getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
marker.setOnMarkerClickListener(mogoMarkerClickListener);
marker.setObject(markerShowEntity);
return marker;
} else {
Logger.e(TAG, "Location 必须进行初始化!!!!!");
IMogoMarker marker = getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
marker.setOnMarkerClickListener(mogoMarkerClickListener);
marker.setObject(markerShowEntity);
return marker;
} else {
Logger.e(TAG, "Location 必须进行初始化!!!!!");
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}

View File

@@ -47,4 +47,9 @@ public class ServiceConst {
*/
public static final String CARD_TYPE_USER_DATA = "CARD_TYPE_USER_DATA";
/**
* 卡片 新鲜事
*/
public static final String CARD_TYPE_NOVELTY = "CARD_TYPE_NOVELTY";
}

View File

@@ -29,7 +29,7 @@ public abstract class MapMarkerBaseView extends ConstraintLayout {
protected Context mContext;
protected MogoImageView ivUserHead;
protected ImageView ivIconForeground;
protected ImageView ivIcon;
protected ImageView ivCar;
public MapMarkerBaseView(Context context) {

View File

@@ -51,7 +51,7 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
protected void initView(Context context) {
LayoutInflater.from(context).inflate(R.layout.view_map_marker_info, this);
ivUserHead = findViewById(R.id.ivUserHead);
ivIconForeground = findViewById(R.id.ivIconForeground);
ivIcon = findViewById(R.id.ivIcon);
llMarkerContent = findViewById(R.id.llMarkerContent);
ivReverseTriangle = findViewById(R.id.ivReverseTriangle);
ivCar = findViewById(R.id.ivCar);
@@ -66,10 +66,10 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
switch (markerShowEntity.getMarkerType()) {
case ServiceConst
.CARD_TYPE_CARS_CHATTING:
ivIconForeground.setVisibility(View.GONE);
ivIcon.setVisibility(View.GONE);
case ServiceConst
.CARD_TYPE_USER_DATA:
ivIconForeground.setVisibility(View.GONE);
ivIcon.setVisibility(View.GONE);
if (bindObj instanceof MarkerOnlineCar) {
if (((MarkerOnlineCar) bindObj).getUserInfo().getGenderValue() == 0) {
@@ -102,7 +102,6 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
}
}
// ivIconForeground.setVisibility(View.VISIBLE);
llMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_purple_info);
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_purple);
break;

View File

@@ -48,7 +48,7 @@ public class MapMarkerView extends MapMarkerBaseView {
LayoutInflater.from(context).inflate(R.layout.view_map_marker, this);
ivUserHead = findViewById(R.id.ivUserHead);
ivIconForeground = findViewById(R.id.ivIconForeground);
ivIcon = findViewById(R.id.ivIcon);
ivCar = findViewById(R.id.ivCar);
ivBg = findViewById(R.id.ivBg);
}
@@ -58,12 +58,10 @@ public class MapMarkerView extends MapMarkerBaseView {
Object bindObj = markerShowEntity.getBindObj();
switch (markerShowEntity.getMarkerType()) {
case ServiceConst
.CARD_TYPE_CARS_CHATTING:
ivIconForeground.setVisibility(View.GONE);
case ServiceConst
.CARD_TYPE_USER_DATA:
ivIconForeground.setVisibility(View.GONE);
case ServiceConst.CARD_TYPE_CARS_CHATTING:
case ServiceConst.CARD_TYPE_USER_DATA:
ivUserHead.setVisibility(View.VISIBLE);
ivIcon.setVisibility(View.GONE);
if (bindObj instanceof MarkerOnlineCar) {
if (((MarkerOnlineCar) bindObj).getUserInfo().getGenderValue() == 0) {
@@ -73,32 +71,48 @@ public class MapMarkerView extends MapMarkerBaseView {
}
}
loadImageWithMarker(markerShowEntity);
ivCar.setImageResource(R.drawable.icon_map_marker_car_blue);
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
break;
case ServiceConst
.CARD_TYPE_ROAD_CONDITION:
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
ivUserHead.setVisibility(View.GONE);
ivIcon.setVisibility(View.VISIBLE);
ivUserHead.setImageResource(R.drawable.icon_map_marker_road_block_up);
ivBg.setImageResource(R.drawable.bg_map_marker_blue);
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
break;
case ServiceConst
.CARD_TYPE_SHARE_MUSIC:
case ServiceConst.CARD_TYPE_NOVELTY:
ivUserHead.setVisibility(View.GONE);
ivIcon.setVisibility(View.VISIBLE);
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up);
ivBg.setImageResource(R.drawable.bg_map_marker_blue);
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
break;
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
ivUserHead.setVisibility(View.GONE);
ivIcon.setVisibility(View.VISIBLE);
if (bindObj instanceof MarkerShareMusic) {
// 2 为书籍听书3 为新闻,1 为qq音乐,int
switch (((MarkerShareMusic) bindObj).getShareType()) {
case 1:
ivUserHead.setImageResource(R.drawable.icon_map_marker_misic);
ivIcon.setImageResource(R.drawable.icon_map_marker_misic);
break;
case 2:
ivUserHead.setImageResource(R.drawable.icon_map_marker_book);
ivIcon.setImageResource(R.drawable.icon_map_marker_book);
break;
case 3:
ivUserHead.setImageResource(R.drawable.icon_map_marker_news);
ivIcon.setImageResource(R.drawable.icon_map_marker_news);
break;
}
}
// ivIconForeground.setVisibility(View.VISIBLE);
ivBg.setImageResource(R.drawable.bg_map_marker_purple);
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
break;
}
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
} catch (Exception e) {
e.printStackTrace();