完成了小地图的描边

This commit is contained in:
董宏宇
2020-12-17 14:21:38 +08:00
parent e2abb2fba4
commit faf7438bb0
6 changed files with 51 additions and 77 deletions

View File

@@ -1,66 +0,0 @@
package com.mogo.module.small.map;
import android.content.Context;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.IMogoMapApiBuilder;
import com.mogo.map.IMogoMapView;
import com.mogo.map.impl.automap.navi.AutoNaviClient;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.navi.IMogoAimless;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.search.drive.IMogoRoadSearch;
import com.mogo.map.search.geo.IMogoGeoSearch;
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
import com.mogo.map.search.poisearch.IMogoPoiSearch;
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
import com.mogo.map.search.traffic.IMogoTrafficSearch;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.utils.AppUtils;
/**
* @author donghongyu
* @since 2020/12/14
* <p>
* 描述
*/
class SmallMapDelegateFactory {
private static final String TAG = "MogoMapDelegateFactory";
private static IMogoMapApiBuilder sApiBuilder;
private static IMogoMapApiBuilder getApiBuilder() {
if ( sApiBuilder == null ) {
synchronized ( SmallMapDelegateFactory.class ) {
if ( sApiBuilder == null ) {
sApiBuilder = ARouter.getInstance().navigation( IMogoMapApiBuilder.class );
}
}
}
return sApiBuilder;
}
public static IMogoAimless getAimless( Context context ) {
return getApiBuilder().getAimless( context );
}
public static void createMapViewInstance( Context context ) {
getApiBuilder().createMapView( context );
}
public static void destroy() {
getApiBuilder().destroy();
}
public static IMogoMapView getMapView(Context context ) {
return getApiBuilder().getMapView( context );
}
public static IMogoTrafficSearch getTrafficSearch() {
return getApiBuilder().getTrafficSearch();
}
}

View File

@@ -20,6 +20,9 @@ import com.amap.api.maps.model.MyLocationStyle;
import com.mogo.module.common.view.RoundLayout;
import com.mogo.module.small.map.animation.DirectionRotateAnimation;
import java.io.InputStream;
import java.net.URL;
/**
* 小地图的方向View
*
@@ -60,12 +63,15 @@ public class SmallMapDirectionView extends RoundLayout {
mTextureMapView.onCreate(null);
mAMap = mTextureMapView.getMap();
// mAMap.setMapType(AMap.MAP_TYPE_NIGHT);//夜景地图aMap是地图控制器对象。
mAMap.setMapType(AMap.MAP_TYPE_NIGHT);//夜景地图aMap是地图控制器对象。
URL small_map_style = getClass().getResource("/assets/small_map_style.data");
URL small_map_style_extra = getClass().getResource("/assets/small_map_style_extra.data");
mAMap.setCustomMapStyle(new CustomMapStyleOptions()
.setEnable(true)
.setStyleDataPath("file:///android_asset/small_map_style.data")
.setStyleExtraPath("file:///android_asset/small_map_style_extra.data")
.setStyleDataPath(small_map_style.getPath())
.setStyleExtraPath(small_map_style_extra.getPath())
);
myLocationStyle = new MyLocationStyle();//初始化定位蓝点样式类myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);//连续定位、且将视角移动到地图中心点定位点依照设备方向旋转并且会跟随设备移动。1秒1次定位如果不设置myLocationType默认也会执行此种模式。

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!---->
<item>
<shape android:shape="rectangle">
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<corners android:radius="720px" />
<gradient
android:angle="180"
android:endColor="#7997ff"
android:startColor="#284190"
android:type="linear"
android:useLevel="true" />
</shape>
</item>
<!-- 中心背景 -->
<item>
<shape android:shape="rectangle">
<solid android:color="#3F51B5" />
<corners android:radius="720px" />
</shape>
</item>
</layer-list>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
</selector>

View File

@@ -5,10 +5,17 @@
android:layout_height="@dimen/module_small_map_border_view_width"
app:roundLayoutRadius="360dp">
<View
android:layout_width="@dimen/module_small_map_view_border_width"
android:layout_height="@dimen/module_small_map_view_border_height"
android:layout_centerInParent="true"
android:background="@drawable/bg_module_small_map_view_border" />
<com.mogo.module.common.view.RoundLayout
android:id="@+id/rlSmallMapBorder"
android:layout_width="@dimen/module_small_map_view_width"
android:layout_height="@dimen/module_small_map_view_width"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:roundLayoutRadius="360dp">

View File

@@ -3,8 +3,11 @@
<dimen name="module_small_map_border_view_width">400px</dimen>
<dimen name="module_small_map_border_view_height">400px</dimen>
<dimen name="module_small_map_view_width">260px</dimen>
<dimen name="module_small_map_view_height">260px</dimen>
<dimen name="module_small_map_view_border_width">260px</dimen>
<dimen name="module_small_map_view_border_height">260px</dimen>
<dimen name="module_small_map_view_width">250px</dimen>
<dimen name="module_small_map_view_height">250px</dimen>
<dimen name="module_small_map_view_x">1490px</dimen>
<dimen name="module_small_map_view_y">650px</dimen>