增加了自研地图填充小地图,但是圆形失效

This commit is contained in:
董宏宇
2020-12-14 21:06:25 +08:00
parent a37be1a64a
commit 7da4d64630
6 changed files with 163 additions and 19 deletions

View File

@@ -3,9 +3,18 @@
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" withSubpackages="false" static="false" />
<package name="kotlinx.android.synthetic" withSubpackages="true" static="false" />
<package name="io.ktor" withSubpackages="true" static="false" />
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<package name="io.ktor" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
</JetCodeStyleSettings>

View File

@@ -0,0 +1,66 @@
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

@@ -79,8 +79,8 @@ public class SmallMapService extends Service {
WindowManager.LayoutParams.WRAP_CONTENT
)
.position(
getResources().getDimensionPixelOffset(R.dimen.module_mvision_view_x),
getResources().getDimensionPixelOffset(R.dimen.module_mvision_view_y)
getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_x),
getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_y)
)
.gravity(Gravity.TOP | Gravity.LEFT)
.showInWindowManager();

View File

@@ -1,7 +1,11 @@
package com.mogo.module.small.map;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
@@ -31,5 +35,52 @@ public class SmallMapView extends MogoBaseMapView {
@Override
protected void addMapView(Context context) {
Logger.d(TAG, "addMapView");
mMapView = SmallMapDelegateFactory.getMapView(context);
if (mMapView != null) {
final View mapView = mMapView.getMapView();
if (mapView != null) {
addView(mapView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
} else {
Logger.e(TAG, "create MapView instance failed.");
}
} else {
Logger.e(TAG, "create IMogoMapView instance failed.");
}
}
@Override
public void onCreate( Bundle bundle ) {
super.onCreate( bundle );
Logger.d( TAG, "onCreate" );
}
@Override
public void onResume() {
super.onResume();
Logger.d( TAG, "onResume" );
}
@Override
public void onPause() {
super.onPause();
Logger.d( TAG, "onPause" );
}
@Override
public void onDestroy() {
super.onDestroy();
Logger.d( TAG, "onDestroy" );
}
@Override
public void onSaveInstanceState( Bundle outState ) {
super.onSaveInstanceState( outState );
}
@Override
public void onLowMemory() {
super.onLowMemory();
}
}

View File

@@ -1,16 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.module.common.view.RoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rlSmallMapBorder"
android:layout_width="@dimen/module_mvision_view_width"
android:layout_height="@dimen/module_mvision_view_height"
android:layout_width="@dimen/module_small_map_border_view_width"
android:layout_height="@dimen/module_small_map_border_view_width"
android:background="#ffffff"
app:roundLayoutRadius="360dp">
<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_centerInParent="true"
android:background="#3F51B5"
app:roundLayoutRadius="360dp">
<com.mogo.module.small.map.SmallMapView
android:id="@+id/module_mvision_map_view"
android:layout_width="@dimen/module_small_map_view_width"
android:layout_height="@dimen/module_small_map_view_width" />
</com.mogo.module.common.view.RoundLayout>
<ImageView
android:id="@+id/ivMapBorder"
android:layout_width="@dimen/module_mvision_view_width"
android:layout_height="@dimen/module_mvision_view_height"
android:layout_width="@dimen/module_small_map_border_view_width"
android:layout_height="@dimen/module_small_map_border_view_width"
android:layout_centerInParent="true"
android:src="@drawable/module_small_map_view_border" />
</com.mogo.module.common.view.RoundLayout>

View File

@@ -1,12 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_mvision_view_width">400px</dimen>
<dimen name="module_mvision_view_height">400px</dimen>
<dimen name="module_mvision_view_x">1490px</dimen>
<dimen name="module_mvision_view_y">650px</dimen>
<dimen name="module_small_map_border_view_width">400px</dimen>
<dimen name="module_small_map_border_view_height">400px</dimen>
<dimen name="module_mvision_big_view_x">0px</dimen>
<dimen name="module_mvision_big_view_y">0px</dimen>
<dimen name="module_mvision_big_view_width">1920px</dimen>
<dimen name="module_mvision_big_view_height">1080px</dimen>
<dimen name="module_small_map_view_width">300px</dimen>
<dimen name="module_small_map_view_height">300px</dimen>
<dimen name="module_small_map_view_x">1490px</dimen>
<dimen name="module_small_map_view_y">650px</dimen>
<dimen name="module_small_map_big_view_x">0px</dimen>
<dimen name="module_small_map_big_view_y">0px</dimen>
<dimen name="module_small_map_big_view_width">1920px</dimen>
<dimen name="module_small_map_big_view_height">1080px</dimen>
</resources>