diff --git a/.idea/misc.xml b/.idea/misc.xml index f4d5deeca6..e082ea7475 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,10 +4,7 @@ - + - - \ No newline at end of file diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java index 139eb28c22..32b0bddc35 100644 --- a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapView.java @@ -1,6 +1,7 @@ package com.mogo.module.small.map; import android.content.Context; +import android.os.Build; import android.os.Bundle; import android.util.AttributeSet; import android.view.View; @@ -8,6 +9,7 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; import com.mogo.map.MogoBaseMapView; import com.mogo.utils.logger.Logger; @@ -32,6 +34,7 @@ public class SmallMapView extends MogoBaseMapView { super(context, attrs, defStyleAttr); } + @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override protected void addMapView(Context context) { Logger.d(TAG, "addMapView"); @@ -39,6 +42,8 @@ public class SmallMapView extends MogoBaseMapView { if (mMapView != null) { final View mapView = mMapView.getMapView(); if (mapView != null) { + mapView.setOutlineProvider(new TextureVideoViewOutlineProvider(360)); + mapView.setClipToOutline(true); addView(mapView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); } else { Logger.e(TAG, "create MapView instance failed."); diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java index a1d8f9c769..6c18a05d75 100644 --- a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallVisionProvider.java @@ -73,7 +73,6 @@ public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusCh @Override public void showPanel() { Log.d(TAG, "小地图模块触发展示……"); - if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { mSmallMapServiceIntent = new Intent(mContext, SmallMapService.class); mContext.startService(mSmallMapServiceIntent); @@ -83,10 +82,8 @@ public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusCh @Override public void hidePanel() { Log.d(TAG, "小地图模块触发隐藏……"); - if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { - if (mSmallMapServiceIntent != null) { - AbsMogoApplication.getApp().stopService(mSmallMapServiceIntent); - } + if (mSmallMapServiceIntent != null) { + AbsMogoApplication.getApp().stopService(mSmallMapServiceIntent); } } diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/TextureVideoViewOutlineProvider.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/TextureVideoViewOutlineProvider.java new file mode 100644 index 0000000000..45f82de108 --- /dev/null +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/TextureVideoViewOutlineProvider.java @@ -0,0 +1,35 @@ +package com.mogo.module.small.map; + +import android.graphics.Outline; +import android.graphics.Rect; +import android.os.Build; +import android.util.Log; +import android.view.View; +import android.view.ViewOutlineProvider; + +import androidx.annotation.RequiresApi; + +/** + * @author donghongyu + * @date 12/15/20 8:47 PM + */ +@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) +public class TextureVideoViewOutlineProvider extends ViewOutlineProvider { + private float mRadius; + + public TextureVideoViewOutlineProvider(float radius) { + this.mRadius = radius; + } + + @Override + public void getOutline(View view, Outline outline) { + Log.w("OutlineProvider", "======getOutline======"); + Rect rect = new Rect(); + view.getGlobalVisibleRect(rect); + int leftMargin = 0; + int topMargin = 0; + Rect selfRect = new Rect(leftMargin, topMargin, + rect.right - rect.left - leftMargin, rect.bottom - rect.top - topMargin); + outline.setRoundRect(selfRect, mRadius); + } +} \ No newline at end of file diff --git a/modules/mogo-module-smp/src/main/res/drawable-xhdpi/module_small_map_view_border.png b/modules/mogo-module-smp/src/main/res/drawable-xhdpi/module_small_map_view_border.png index cc2c540c8b..1c4bf333ca 100644 Binary files a/modules/mogo-module-smp/src/main/res/drawable-xhdpi/module_small_map_view_border.png and b/modules/mogo-module-smp/src/main/res/drawable-xhdpi/module_small_map_view_border.png differ diff --git a/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml b/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml index 346805d461..b3703a522f 100644 --- a/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml +++ b/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml @@ -3,7 +3,6 @@ xmlns:app="http://schemas.android.com/apk/res-auto" 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">