修复了在线车辆的气泡样式

This commit is contained in:
董宏宇
2020-01-15 10:23:43 +08:00
parent 28d6c6e7d0
commit 99a3e39cb6
5 changed files with 28 additions and 42 deletions

View File

@@ -153,6 +153,8 @@ public class MarkerServiceHandler {
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker lastMarkerShowEntity" + lastMarkerShowEntity);
lastMarkerShowEntity.setChecked(false);
lastMarkerShowEntity.setHighlighted(false);
drawMapMarkerItem(lastMarkerShowEntity);
lastMarker.remove();
@@ -163,6 +165,7 @@ public class MarkerServiceHandler {
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker markerShowEntity" + markerShowEntity);
markerShowEntity.setChecked(true);
markerShowEntity.setHighlighted(true);
lastMarker = drawMapMarkerItem(markerShowEntity);
@@ -181,6 +184,7 @@ public class MarkerServiceHandler {
// 将上次选中 Marker 设置为未选中状态
MarkerShowEntity lastMarkerShowEntity = (MarkerShowEntity) lastMarker.getObject();
lastMarkerShowEntity.setChecked(false);
lastMarkerShowEntity.setHighlighted(false);
drawMapMarkerItem(lastMarkerShowEntity);
}
lastMarker = null;
@@ -203,6 +207,11 @@ public class MarkerServiceHandler {
public static void drawMapMarker(MarkerResponse response) {
lastMarker = null;
getMarkerManager().removeMarkers();
if (markerShowEntities == null) {
markerShowEntities = new ArrayList<>();
} else {
markerShowEntities.clear();
}
// 解析不同的Marker类型然后对应的进行绘制
if (response != null && response.getResult() != null) {
@@ -307,15 +316,15 @@ public class MarkerServiceHandler {
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
options.icon(markerView);
options.alpha(0.8f);
IMogoMarker marker = getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
marker.setOnMarkerClickListener(mogoMarkerClickListener);
marker.setObject(markerShowEntity);
if (markerShowEntities == null) {
markerShowEntities = new ArrayList<>();
if (markerShowEntities != null) {
markerShowEntities.add(markerShowEntity);
}
markerShowEntities.add(markerShowEntity);
return marker;
} else {
Logger.e(TAG, "Location 必须进行初始化!!!!!");
@@ -340,6 +349,11 @@ public class MarkerServiceHandler {
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
options.icon(markerView);
if (markerShowEntity.isHighlighted()) {
options.alpha(1f);
} else {
options.alpha(0.8f);
}
IMogoMarker marker = getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
marker.setOnMarkerClickListener(mogoMarkerClickListener);
@@ -354,23 +368,4 @@ public class MarkerServiceHandler {
}
return null;
}
//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("CARD_TYPE_USER_DATA", options);
// marker.setOnMarkerClickListener(mogoMarkerClickListener);
// marker.setObject("我是Marker上面绑定的数据");
//
// getMapUIController().changeZoom(8);
}
}

View File

@@ -67,7 +67,7 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
case ServiceConst.CARD_TYPE_CARS_CHATTING:
case ServiceConst.CARD_TYPE_USER_DATA:
ivUserHead.setVisibility(View.VISIBLE);
ivIcon.setVisibility(View.GONE);
ivIcon.setVisibility(View.INVISIBLE);
if (bindObj instanceof MarkerOnlineCar) {
if (((MarkerOnlineCar) bindObj).getUserInfo().getGenderValue() == 0) {
@@ -83,7 +83,7 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
break;
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
ivUserHead.setVisibility(View.GONE);
ivUserHead.setVisibility(View.INVISIBLE);
ivIcon.setVisibility(View.VISIBLE);
ivUserHead.setImageResource(R.drawable.icon_map_marker_road_block_up);
@@ -92,7 +92,7 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
break;
case ServiceConst.CARD_TYPE_NOVELTY:
ivUserHead.setVisibility(View.GONE);
ivUserHead.setVisibility(View.INVISIBLE);
ivIcon.setVisibility(View.VISIBLE);
ivIcon.setImageResource(R.drawable.icon_map_marker_road_check);
@@ -101,7 +101,7 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
break;
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
ivUserHead.setVisibility(View.GONE);
ivUserHead.setVisibility(View.INVISIBLE);
ivIcon.setVisibility(View.VISIBLE);
if (bindObj instanceof MarkerShareMusic) {

View File

@@ -56,18 +56,11 @@ public class MapMarkerView extends MapMarkerBaseView {
public void updateView(MarkerShowEntity markerShowEntity) {
try {
Object bindObj = markerShowEntity.getBindObj();
if (markerShowEntity.isHighlighted()) {
ivBg.setAlpha(1f);
} else {
ivBg.setAlpha(0.7f);
}
switch (markerShowEntity.getMarkerType()) {
case ServiceConst.CARD_TYPE_CARS_CHATTING:
case ServiceConst.CARD_TYPE_USER_DATA:
ivUserHead.setVisibility(View.VISIBLE);
ivIcon.setVisibility(View.GONE);
ivIcon.setVisibility(View.INVISIBLE);
if (bindObj instanceof MarkerOnlineCar) {
if (((MarkerOnlineCar) bindObj).getUserInfo().getGenderValue() == 0) {
@@ -81,7 +74,7 @@ public class MapMarkerView extends MapMarkerBaseView {
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
break;
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
ivUserHead.setVisibility(View.GONE);
ivUserHead.setVisibility(View.INVISIBLE);
ivIcon.setVisibility(View.VISIBLE);
ivUserHead.setImageResource(R.drawable.icon_map_marker_road_block_up);
@@ -89,7 +82,7 @@ public class MapMarkerView extends MapMarkerBaseView {
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
break;
case ServiceConst.CARD_TYPE_NOVELTY:
ivUserHead.setVisibility(View.GONE);
ivUserHead.setVisibility(View.INVISIBLE);
ivIcon.setVisibility(View.VISIBLE);
ivIcon.setImageResource(R.drawable.icon_map_marker_road_check);
@@ -97,7 +90,7 @@ public class MapMarkerView extends MapMarkerBaseView {
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
break;
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
ivUserHead.setVisibility(View.GONE);
ivUserHead.setVisibility(View.INVISIBLE);
ivIcon.setVisibility(View.VISIBLE);
if (bindObj instanceof MarkerShareMusic) {

View File

@@ -23,7 +23,6 @@
android:layout_height="@dimen/dp_85"
android:layout_gravity="center"
android:src="@drawable/bg_map_marker_blue"
android:alpha="0.8"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -21,7 +21,6 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clMarkerContent"
android:layout_width="wrap_content"
android:maxWidth="@dimen/dp_366"
android:layout_height="@dimen/dp_74"
android:background="@drawable/bg_map_marker_blue_info"
app:layout_constraintEnd_toEndOf="parent"
@@ -63,10 +62,10 @@
android:singleLine="true"
android:textColor="#ffffff"
android:textSize="@dimen/sp_32"
app:layout_constraintBottom_toBottomOf="@+id/ivIcon"
app:layout_constraintBottom_toBottomOf="@+id/ivUserHead"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/ivIcon"
app:layout_constraintTop_toTopOf="@+id/ivIcon"
app:layout_constraintStart_toEndOf="@+id/ivUserHead"
app:layout_constraintTop_toTopOf="@+id/ivUserHead"
tools:text="诗一样的女子诗诗一样的女子诗诗一样的女子诗" />
</androidx.constraintlayout.widget.ConstraintLayout >