diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java index c4640c4a4c..a6c8f73d09 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java @@ -54,6 +54,7 @@ import java.util.Map; import ch.hsr.geohash.GeoHash; import kotlin.Pair; +import me.jessyan.autosize.utils.AutoSizeUtils; import mogo.telematics.pad.MessagePad; /** @@ -270,7 +271,7 @@ public class AMapCustomView LatLng latLng = new LatLng(center.getLat(), center.getLon()); markerOption.position(latLng); - markerOption.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_small_v2x_road_construction)); + markerOption.icon(BitmapDescriptorFactory.fromBitmap(getV2XBitmap())); markerOptionsList.add(markerOption); } } @@ -292,6 +293,16 @@ public class AMapCustomView }); } + private Bitmap getV2XBitmap() { + V2XMarkerView marker = new V2XMarkerView(getContext()); + marker.measure(View.MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(mContext, 229), View.MeasureSpec.EXACTLY), + View.MeasureSpec.makeMeasureSpec(AutoSizeUtils.dp2px(mContext, 96), View.MeasureSpec.EXACTLY)); + marker.layout(0, 0, marker.getMeasuredWidth(), marker.getMeasuredHeight()); + Bitmap bitmap = Bitmap.createBitmap(marker.getWidth(), marker.getHeight(), Bitmap.Config.ARGB_8888); + marker.draw(new Canvas(bitmap)); + return bitmap; + } + public void clearV2XMarkers() { if (currMarkerList != null) { for (Marker marker : currMarkerList) { diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/V2XMarkerView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/V2XMarkerView.kt new file mode 100644 index 0000000000..a776a29073 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/V2XMarkerView.kt @@ -0,0 +1,23 @@ +package com.mogo.eagle.core.function.smp + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.function.map.R +import kotlinx.android.synthetic.main.view_maker_with_count.view.* + +class V2XMarkerView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout ( + context, + attrs, + defStyleAttr +) { + + init { + LayoutInflater.from(context).inflate(R.layout.layout_v2x_maker, this, true) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/layout_v2x_maker.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/layout_v2x_maker.xml new file mode 100644 index 0000000000..8a5ee087ea --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/layout_v2x_maker.xml @@ -0,0 +1,36 @@ + + + + + + + + \ No newline at end of file diff --git a/core/mogo-core-res/src/main/function-hmi-res/drawable-xhdpi/icon_v2x_marker.png b/core/mogo-core-res/src/main/function-hmi-res/drawable-xhdpi/icon_v2x_marker.png new file mode 100644 index 0000000000..534677fd8d Binary files /dev/null and b/core/mogo-core-res/src/main/function-hmi-res/drawable-xhdpi/icon_v2x_marker.png differ