This commit is contained in:
zhongchao
2022-11-10 11:58:05 +08:00
parent a836c31728
commit 5322d03ec1
75 changed files with 68 additions and 369 deletions

View File

@@ -24,19 +24,15 @@ public class MapMarkerAdapter {
* @param markerShowEntity 要填充的数据
* @return MarkerView
*/
public static IMarkerView getMarkerView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
public static IMarkerView getMarkerView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) {
if ( TextUtils.equals( markerShowEntity.getMarkerType(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
if (TextUtils.equals(markerShowEntity.getMarkerType(), ModuleNames.CARD_TYPE_USER_DATA)) {
return OnlineCarMarkerView.getInstance();
} else {
if ( MogoStatusManager.getInstance().isVrMode() ) {
return new EmptyMarkerView( context );
if (MogoStatusManager.getInstance().isVrMode()) {
return new EmptyMarkerView(context);
} else {
if ( markerShowEntity.isChecked() ) {
return new MapMarkerInfoView( context, markerShowEntity, options );
} else {
return new MapMarkerView( context, markerShowEntity, options );
}
return new MapMarkerView(context, markerShowEntity, options);
}
}

View File

@@ -1,125 +0,0 @@
package com.mogo.eagle.core.function.impl.marker;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.R;
import com.mogo.module.common.marker.PoiWrapper;
import com.mogo.module.common.utils.CloudPoiManager;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-01-0619:55
* desc : 地图Marker图标带文本信息
* version: 1.0
*/
public class MapMarkerInfoView extends MapMarkerBaseView {
private String TAG = "MapMarkerInfoView";
private TextView tvMarkerContent;
private LinearLayout clMarkerContent;
private ImageView ivReverseTriangle;
public MapMarkerInfoView(Context context) {
super(context);
}
public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public MapMarkerInfoView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) {
super(context);
mOptions = options;
try {
updateView(markerShowEntity);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void initView(Context context) {
LayoutInflater.from(context).inflate(R.layout.modudle_services_marker_layout_info, this);
ivUserHead = findViewById(R.id.ivUserHead);
// ivIcon = findViewById( R.id.ivIcon );
ivIcon = findViewById(R.id.ivIcon);
clMarkerContent = findViewById(R.id.clMarkerContent);
ivReverseTriangle = findViewById(R.id.ivReverseTriangle);
ivCar = findViewById(R.id.ivCar);
tvMarkerContent = findViewById(R.id.tvMarkerContent);
}
@Override
public void updateView(MarkerShowEntity markerShowEntity) {
Object bindObj = markerShowEntity.getBindObj();
if (MogoStatusManager.getInstance().isVrMode()) {
ivCar.setImageResource(R.drawable.icon_map_marker_location_yellow_vr);
} else {
ivCar.setImageResource(R.drawable.icon_map_marker_location_yellow);
}
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_yellow_info);
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_yellow);
switch (markerShowEntity.getMarkerType()) {
case ModuleNames.CARD_TYPE_USER_DATA:
ivUserHead.setVisibility(View.VISIBLE);
ivIcon.setVisibility(View.INVISIBLE);
loadImageWithMarker(markerShowEntity);
ivCar.setImageResource(R.drawable.icon_map_marker_car_gray);
//ivCar.setRotation(new Random().nextInt(360));
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
break;
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
ivUserHead.setVisibility(View.INVISIBLE);
ivIcon.setVisibility(View.VISIBLE);
if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) {
// 根据poiType获取对应的图片
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType(poiType);
if (poiWrapper != null) {
// 加载图片
loadPoiTypeIcon(poiWrapper.getIconInfoUrl(), poiWrapper.getIconInfoRes());
} else {
CallerLogger.INSTANCE.e(TAG, "未能根据poiType获取对应poi信息无法渲染info marker====" + poiType);
}
}
break;
default:
break;
}
if (!TextUtils.isEmpty(markerShowEntity.getTextContent())) {
String content;
if (markerShowEntity.getTextContent().length() > 8) {
content = markerShowEntity.getTextContent().substring(0, 7) + "...";
} else {
content = markerShowEntity.getTextContent();
}
tvMarkerContent.setText(content);
}
}
}

View File

@@ -8,14 +8,14 @@ import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.PoiWrapper;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.marker.PoiWrapper;
import com.mogo.module.common.utils.CloudPoiManager;
import com.mogo.eagle.core.data.config.CloudPoiManager;
/**
* author : donghongyu

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="0"
android:endColor="#FFCC00"
android:startColor="#FFA417" />
<corners android:radius="90dp" />
<padding
android:bottom="@dimen/dp_6"
android:left="@dimen/dp_6"
android:right="@dimen/dp_40"
android:top="@dimen/dp_6" />
</shape >

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/shape_id" >
<!-- 倒三角 -->
<rotate
android:fromDegrees="45"
android:pivotX="135%"
android:pivotY="15%"
android:toDegrees="45" >
<shape android:shape="rectangle" >
<solid android:color="#feb712" />
</shape >
</rotate >
</item >
</layer-list >