diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiNaviFragment.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiNaviFragment.java index 8899f882a0..4038351737 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiNaviFragment.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiNaviFragment.java @@ -81,8 +81,8 @@ public class TaxiNaviFragment extends BaseTaxiUIFragment implements AMapNaviView aMap.setCustomMapStyle( new CustomMapStyleOptions() .setEnable(true) - .setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext())) - .setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext())) + .setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext(), "small_map_style.data")) + .setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "small_map_style_extra.data")) ); //设置希望展示的地图缩放级别 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 4ec37c14e2..6f7be4186e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -11,6 +11,8 @@ import android.view.WindowManager.LayoutParams import android.view.animation.* import androidx.lifecycle.lifecycleScope import com.alibaba.android.arouter.facade.annotation.Route +import com.alibaba.android.arouter.launcher.ARouter +import com.mogo.commons.mvp.BaseFragment import com.mogo.commons.mvp.MvpFragment import com.mogo.commons.voice.AIAssist import com.mogo.eagle.core.data.bindingcar.AdUpgradeStateHelper @@ -48,6 +50,7 @@ import com.mogo.eagle.core.function.hmi.ui.bindingcar.ModifyBindingCarDialog import com.mogo.eagle.core.function.hmi.ui.bindingcar.ToBindingCarDialog import com.mogo.eagle.core.function.hmi.ui.bindingcar.UpgradeAppDialog import com.mogo.eagle.core.function.hmi.ui.camera.CameraListView +import com.mogo.eagle.core.function.hmi.ui.camera.RoadVideoDialog import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView @@ -123,6 +126,12 @@ import java.util.* private var adUpgradeDialog: AdUpgradeDialog?=null + private var roadVideoDialog: RoadVideoDialog? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + } + override fun vipIdentification(visible: Boolean) { ThreadUtils.runOnUiThread { if (visible) { @@ -256,6 +265,15 @@ import java.util.* } } + override fun showVideoDialog(url: String, isFlvUrl: Boolean) { + context?.let { + if (roadVideoDialog == null) { + roadVideoDialog = RoadVideoDialog(it) + } + roadVideoDialog?.show(url, isFlvUrl) + } + } + /** * 设置 V2X 通知 代理View */ @@ -1123,6 +1141,29 @@ import java.util.* } } + override fun showSmallFragment() { + // 加载 小地图 图层 + val fragmentSmpMap = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_SMP) + .navigation() as BaseFragment + activity?.supportFragmentManager?.beginTransaction() + ?.setCustomAnimations(R.anim.slide_in, R.anim.fade_out)?.apply { + if (!fragmentSmpMap.isAdded) { + add(R.id.module_main_id_smp_fragment, fragmentSmpMap, fragmentSmpMap.tagName) + } else { + show(fragmentSmpMap) + }.commitAllowingStateLoss() + } + } + + override fun hideSmallFragment() { + val fragmentSmpMap = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_SMP) + .navigation() as BaseFragment + activity?.supportFragmentManager?.beginTransaction() + ?.setCustomAnimations(R.anim.slide_in, R.anim.fade_out) + ?.hide(fragmentSmpMap) + ?.commitAllowingStateLoss() + } + override fun onDestroy() { super.onDestroy() CallerLogger.d("$M_HMI$TAG", "onDestroy") diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadVideoDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadVideoDialog.kt new file mode 100644 index 0000000000..fc8c71d8a7 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadVideoDialog.kt @@ -0,0 +1,119 @@ +package com.mogo.eagle.core.function.hmi.ui.camera + +import android.content.Context +import android.graphics.PorterDuff +import android.graphics.PorterDuffColorFilter +import android.view.View +import androidx.core.content.ContextCompat +import androidx.lifecycle.LifecycleObserver +import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer +import com.mogo.module.common.dialog.BaseFloatDialog +import com.shuyu.gsyvideoplayer.GSYVideoManager +import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder +import com.shuyu.gsyvideoplayer.model.VideoOptionModel +import com.shuyu.gsyvideoplayer.player.IjkPlayerManager +import com.shuyu.gsyvideoplayer.player.PlayerFactory +import com.shuyu.gsyvideoplayer.utils.GSYVideoType +import kotlinx.android.synthetic.main.road_video_dialog.* +import kotlinx.android.synthetic.main.view_camera_list.view.* +import tv.danmaku.ijk.media.player.IjkMediaPlayer + + +/** + * @brief 道路视频Dialog + * @author chenfufeng + */ +class RoadVideoDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver { + + private val TAG = "RoadVideoDialog" + + private var mVideoUrl: String = "" + + private val gsyVideoOptionBuilder by lazy { + GSYVideoOptionBuilder() + } + + init { + setContentView(R.layout.road_video_dialog) + setCanceledOnTouchOutside(true) + + roadVideoClose.setOnClickListener { + stopLive() + dismiss() + } + + initVideoPlayer() + } + + fun show(url: String, isFlvUrl: Boolean) { + show() + if (!isFlvUrl) { + // 打开指定ip的摄像头直播流 + CallerMonitorManager.openCameraStream(url, { flvUrl -> + gsyVideoPlay(flvUrl) + }) { + ToastUtils.showShort(it.message) + } + } else { + gsyVideoPlay(url) + } + } + + override fun dismiss() { + super.dismiss() + stopLive() + } + + private fun initVideoPlayer() { + val list: MutableList = ArrayList() + list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "reconnect", 3)) + GSYVideoManager.instance().optionModelList = list + GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL) + PlayerFactory.setPlayManager(IjkPlayerManager::class.java) + roadVideoPlayer.setPlayListener(object : SimpleVideoPlayer.PlayListener { + override fun onPlayEvent(event: Int) { + CallerLogger.d("${SceneConstant.M_HMI}$TAG", "onPlayEvent: event is:$event") + when (event) { + SimpleVideoPlayer.PLAY_EVT_PLAY_LOADING -> { + // 会出现临时中断后又可以继续播放,需要停掉倒计时 + + } + SimpleVideoPlayer.PLAY_EVT_PLAY_BEGIN -> { + roadVideoPB.visibility = View.GONE + roadVideoPlayer.visibility = View.VISIBLE + } + else -> { + CallerLogger.w("${SceneConstant.M_HMI}$TAG", "播放视频异常,event is:$event") + } + } + } + }) + roadVideoPB.indeterminateDrawable.colorFilter = PorterDuffColorFilter( + ContextCompat.getColor(context, R.color.notice_blue), + PorterDuff.Mode.MULTIPLY + ) + } + + private fun gsyVideoPlay(flvUrl: String) { + gsyVideoOptionBuilder.setUrl(flvUrl) + .setCacheWithPlay(false) + .setAutoFullWithSize(false) + .setIsTouchWigetFull(false) + .setIsTouchWiget(false) + .setPlayTag(TAG).build(roadVideoPlayer) + roadVideoPlayer.startButton.performClick() + } + + private fun stopLive() { + try { + GSYVideoManager.releaseAllVideos() + } catch (e: Exception) { + e.printStackTrace() + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java index f94885870e..6b6f9a3244 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java @@ -228,7 +228,6 @@ public class MainActivity extends MvpActivity implement final long start = System.currentTimeMillis(); MogoModulesManager.getInstance().init(this); - IMogoHosListenerRegister listenerRegister = CallerMapUIServiceManager.INSTANCE.getHostListenerRegister(); if (listenerRegister != null) { listenerRegister.registerHostMapListener(EventDispatchCenter.getInstance()); @@ -303,10 +302,9 @@ public class MainActivity extends MvpActivity implement // 加载 HMI 图层 BaseFragment fragmentHdMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI).navigation(); addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_waring_fragment); - - // 加载 小地图 图层 - BaseFragment fragmentSmpMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_SMP).navigation(); - addFragment(fragmentSmpMap, fragmentSmpMap.getTagName(), R.id.module_main_id_smp_fragment); +// // 加载 小地图 图层 +// BaseFragment fragmentSmpMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_SMP).navigation(); +// addFragment(fragmentSmpMap, fragmentSmpMap.getTagName(), R.id.module_main_id_smp_fragment); } /** diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/road_video_dialog.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/road_video_dialog.xml new file mode 100644 index 0000000000..937c3505fe --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/road_video_dialog.xml @@ -0,0 +1,43 @@ + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java index 1926fa72c6..8f20d0e56a 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java @@ -3,33 +3,23 @@ package com.mogo.eagle.core.function.map; import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAP; import android.content.Context; -import android.graphics.BitmapFactory; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.alibaba.android.arouter.facade.annotation.Route; -import com.amap.api.maps.AMap; -import com.amap.api.maps.TextureMapView; -import com.amap.api.maps.model.BitmapDescriptorFactory; -import com.amap.api.maps.model.LatLng; -import com.amap.api.maps.model.MarkerOptions; -import com.amap.api.maps.UiSettings; import com.mogo.commons.mvp.MvpFragment; import com.mogo.eagle.core.data.constants.MoGoFragmentPaths; import com.mogo.eagle.core.data.map.CenterLine; -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener; import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider; import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager; import com.mogo.eagle.core.function.call.map.CallerHDMapManager; -import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager; import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager; -import com.mogo.eagle.core.function.overview.Infrastructure; +import com.mogo.eagle.core.function.overview.InfStructureManager; import com.mogo.eagle.core.function.overview.ViewModelExtKt; import com.mogo.eagle.core.function.overview.vm.OverViewModel; -import com.mogo.eagle.core.function.smp.AMapCustomView; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.IMogoMap; import com.mogo.map.IMogoUiSettings; @@ -38,15 +28,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController; import com.zhidaoauto.map.sdk.open.MapAutoApi; import com.zhidaoauto.map.sdk.open.business.PointCloudHelper; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import ch.hsr.geohash.GeoHash; -import mogo.telematics.pad.MessagePad; - - /** * @author donghongyu * @since 2021-11-09 @@ -56,19 +37,12 @@ import mogo.telematics.pad.MessagePad; */ @Route(path = MoGoFragmentPaths.PATH_FRAGMENT_MAP) public class MapFragment extends MvpFragment - implements MapView, IMoGoMapFragmentProvider, IMoGoSkinModeChangeListener - , IMoGoAutopilotPlanningListener { + implements MapView, IMoGoMapFragmentProvider, IMoGoSkinModeChangeListener { private static final String TAG = "MapFragment"; private MogoMapView mMogoMapView; private IMogoMap mMogoMap; - private AMapCustomView mAMapCustomView; - // 每个GeoHash网格对应的新基建Bean - private Map> infMap = new HashMap(); - // 全局路径规划中的GeoHash网格 - private Map> pathMap = new HashMap(); - private Map posInfMap = new HashMap(); private final boolean mIsControllerByOthersStatus = false; @@ -111,10 +85,8 @@ public class MapFragment extends MvpFragment if (mMogoMap != null) { mMogoMap.getUIController().showMyLocation(true); } - mAMapCustomView = findViewById(R.id.module_gaode_id_map); // 添加换肤监听 CallerSkinModeListenerManager.INSTANCE.addListener(TAG, this); - CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this); } @NonNull @@ -210,8 +182,6 @@ public class MapFragment extends MvpFragment MapPointCloudSubscriber.Companion.getInstance(); } - private boolean isFirst = true; - private void queryInfStructure() { OverViewModel viewModel = ViewModelExtKt.obtainViewModel(this, OverViewModel.class); // viewModel.getInfStructures().observe(this.getViewLifecycleOwner(), infrastructures -> { @@ -229,12 +199,7 @@ public class MapFragment extends MvpFragment // } // }); - viewModel.getInfStructuresMap().observe(this.getViewLifecycleOwner(), map -> { - if (!infMap.isEmpty()) { - infMap.clear(); - } - infMap.putAll(map); - }); + viewModel.getInfStructuresMap().observe(this.getViewLifecycleOwner(), InfStructureManager.INSTANCE::saveData); viewModel.fetchInfStructures(); } @@ -357,50 +322,6 @@ public class MapFragment extends MvpFragment PointCloudHelper.INSTANCE.setIsDrawPointCloud(isDrawPointCloud); } - @Override - public void onAutopilotTrajectory(@NonNull List trajectoryInfos) { - } - - @Override - public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) { - if (globalPathResp != null) { - if (!pathMap.isEmpty()) { - pathMap.clear(); - } - String geoHash; - ArrayList infList; - for (MessagePad.Location location : globalPathResp.getWayPointsList()) { - geoHash = GeoHash.withCharacterPrecision(location.getLatitude(), location.getLongitude(), 7).toBase32(); - // 网格内的轨迹点只取一次 - if (!pathMap.containsKey(geoHash)) { - // 从缓存的新基建数据中去取对应geoHash的新基建数据集合 - infList = infMap.get(geoHash); - if (infList != null) { - pathMap.put(geoHash, infList); - } - } - } - // 绘制新基建数据 - if (!posInfMap.isEmpty()) { - posInfMap.clear(); - } - ArrayList markerOptionsList = new ArrayList(); - for (ArrayList structureList : pathMap.values()) { - for (Infrastructure structure : structureList) { - MarkerOptions markerOption = new MarkerOptions(); - LatLng latLng = new LatLng(Double.valueOf(structure.getLat()), - Double.valueOf(structure.getLon())); - markerOption.position(latLng); - markerOption.icon(BitmapDescriptorFactory.fromBitmap( - BitmapFactory.decodeResource(getResources(), R.drawable.icon_shexiangtou_nor) - )); - posInfMap.put(latLng, structure); - markerOptionsList.add(markerOption); - } - } - } - } - /** * 设置地图是否是Debug模式 * @param debugMode 是否开启Debug模式 diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/InfStructureManager.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/InfStructureManager.kt new file mode 100644 index 0000000000..7be615c9fe --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/InfStructureManager.kt @@ -0,0 +1,21 @@ +package com.mogo.eagle.core.function.overview + +/** + * 本地数据库查询出来的红绿灯、摄像头等数据 + */ +object InfStructureManager { + + // 每个GeoHash网格对应的新基建Bean + private val _infMap by lazy { + HashMap>() + } + + fun saveData(map: HashMap>) { + if (_infMap.isNotEmpty()) { + _infMap.clear() + } + _infMap.putAll(map) + } + + fun getData(): Map> = _infMap +} \ No newline at end of file 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 3767918f08..7b2d63b436 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 @@ -19,8 +19,10 @@ import com.amap.api.maps.CameraUpdate; import com.amap.api.maps.CameraUpdateFactory; import com.amap.api.maps.CoordinateConverter; import com.amap.api.maps.UiSettings; +import com.amap.api.maps.model.BitmapDescriptorFactory; import com.amap.api.maps.model.CustomMapStyleOptions; import com.amap.api.maps.model.LatLng; +import com.amap.api.maps.model.MarkerOptions; import com.amap.api.maps.model.Polyline; import com.amap.api.navi.AMapNavi; import com.amap.api.navi.AMapNaviListener; @@ -53,8 +55,11 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager; +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; import com.mogo.eagle.core.function.map.R; +import com.mogo.eagle.core.function.overview.InfStructureManager; +import com.mogo.eagle.core.function.overview.Infrastructure; import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView; import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; @@ -65,8 +70,11 @@ import com.zhidao.support.adas.high.AdasManager; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import ch.hsr.geohash.GeoHash; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; @@ -97,6 +105,10 @@ public class AMapCustomView private TextView overLayerView; private boolean calculate = false; + // 全局路径规划中的GeoHash网格 + private Map> pathMap = new HashMap(); + private Map posInfMap = new HashMap(); + public AMapCustomView(Context context) { this(context, null); } @@ -298,6 +310,8 @@ public class AMapCustomView Log.d(TAG, "全局路径" + list.size() + ",起点:" + sList.toString() + ",终点:" + eList.toString() + ",经点:" + mWayPointList.toString()); //指定路径绘制导航路线 mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList, strategy); + + drawInfrastructureMarkers(globalPathResp); } }; @@ -601,7 +615,7 @@ public class AMapCustomView mAMapNavi.startNavi(NaviType.GPS); UiThreadHandler.postDelayed(() -> { mAMapNaviView.displayOverview(); - }, 20000); + }, 2000); //停止导航测试代码 // UiThreadHandler.postDelayed(() -> { // mAMapNavi.stopNavi(); @@ -681,4 +695,52 @@ public class AMapCustomView } + private void drawInfrastructureMarkers(MessagePad.GlobalPathResp globalPathResp) { + if (globalPathResp != null) { + if (!pathMap.isEmpty()) { + pathMap.clear(); + } + String geoHash; + ArrayList infList; + for (MessagePad.Location location : globalPathResp.getWayPointsList()) { + geoHash = GeoHash.withCharacterPrecision(location.getLatitude(), location.getLongitude(), 7).toBase32(); + // 网格内的轨迹点只取一次 + if (!pathMap.containsKey(geoHash)) { + // 从缓存的新基建数据中去取对应geoHash的新基建数据集合 + infList = InfStructureManager.INSTANCE.getData().get(geoHash); + if (infList != null) { + pathMap.put(geoHash, infList); + } + } + } + // 绘制新基建数据 + if (!posInfMap.isEmpty()) { + posInfMap.clear(); + } + ArrayList markerOptionsList = new ArrayList(); + for (ArrayList structureList : pathMap.values()) { + for (Infrastructure structure : structureList) { + MarkerOptions markerOption = new MarkerOptions(); + LatLng latLng = new LatLng(Double.valueOf(structure.getLat()), + Double.valueOf(structure.getLon())); + markerOption.position(latLng); + markerOption.icon(BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(getResources(), R.drawable.video_nor) + )); + posInfMap.put(latLng, structure); + markerOptionsList.add(markerOption); + } + } + mAMap.addMarkers(markerOptionsList, false); + mAMap.setOnMarkerClickListener(marker -> { + Infrastructure infrastructure = posInfMap.get(marker.getPosition()); + // 如果是摄像头 + if (0 == infrastructure.getCategory() && infrastructure.getIp() != null) { + CallerHmiManager.INSTANCE.showVideoDialog(infrastructure.getIp()); + return true; + } + return false; + }); + } + } } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java index 0e4e1d8aa9..1636cbfdd0 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapFragment.java @@ -16,6 +16,8 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager; import com.mogo.eagle.core.function.map.R; +import com.mogo.eagle.core.function.overview.ViewModelExtKt; +import com.mogo.eagle.core.function.overview.vm.OverViewModel; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import org.jetbrains.annotations.NotNull; @@ -36,6 +38,7 @@ public class SmallMapFragment extends BaseFragment IMoGoAutopilotStatusListener { private final String TAG = "SmallMapFragment"; protected AMapCustomView mAMapCustomView; +// private OverViewModel mViewModel; @Override public void onAttach(Context context) { @@ -83,24 +86,14 @@ public class SmallMapFragment extends BaseFragment public void drawablePolyline(List coordinates) { if (mAMapCustomView != null) { mAMapCustomView.convert(coordinates); - UiThreadHandler.post(new Runnable() { - @Override - public void run() { - mAMapCustomView.drawablePolyline(); - } - }); + UiThreadHandler.post(() -> mAMapCustomView.drawablePolyline()); } } @Override public void clearPolyline() { if (mAMapCustomView != null) { - UiThreadHandler.post(new Runnable() { - @Override - public void run() { - mAMapCustomView.clearPolyline(); - } - }); + UiThreadHandler.post(() -> mAMapCustomView.clearPolyline()); } } @@ -112,6 +105,21 @@ public class SmallMapFragment extends BaseFragment } } + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); +// queryInfStructure(); + } + +// private void queryInfStructure() { +// mViewModel = ViewModelExtKt.obtainViewModel(this, OverViewModel.class); +// mViewModel.getInfStructuresMap().observe(this.getViewLifecycleOwner(), map -> { +// mAMapCustomView.updateInfStructures(map); +// }); +// // 本地数据库查询 +// mViewModel.fetchInfStructures(); +// } + @Override public void onPause() { super.onPause(); diff --git a/core/function-impl/mogo-core-function-map/src/main/res/anim/fade_out.xml b/core/function-impl/mogo-core-function-map/src/main/res/anim/fade_out.xml new file mode 100644 index 0000000000..67dc9715c7 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/res/anim/fade_out.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/anim/slide_in.xml b/core/function-impl/mogo-core-function-map/src/main/res/anim/slide_in.xml new file mode 100644 index 0000000000..c4f5ed5f0f --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/res/anim/slide_in.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-xhdpi-2560x1440/video_nor.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-xhdpi-2560x1440/video_nor.png new file mode 100755 index 0000000000..0259cb33eb Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-xhdpi-2560x1440/video_nor.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-xhdpi/icon_shexiangtou_nor.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-xhdpi/icon_shexiangtou_nor.png deleted file mode 100644 index c19426f7c8..0000000000 Binary files a/core/function-impl/mogo-core-function-map/src/main/res/drawable-xhdpi/icon_shexiangtou_nor.png and /dev/null differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-xhdpi/video_nor.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-xhdpi/video_nor.png new file mode 100755 index 0000000000..0259cb33eb Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-xhdpi/video_nor.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/module_map_fragment_map.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/module_map_fragment_map.xml index 3cbe53d174..80ea65bf7c 100644 --- a/core/function-impl/mogo-core-function-map/src/main/res/layout/module_map_fragment_map.xml +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/module_map_fragment_map.xml @@ -1,20 +1,13 @@ + android:layout_height="match_parent" + > - - + android:visibility="visible"/> \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/module_small_map_fragment.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/module_small_map_fragment.xml index 518457be06..8ed1c15374 100644 --- a/core/function-impl/mogo-core-function-map/src/main/res/layout/module_small_map_fragment.xml +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/module_small_map_fragment.xml @@ -6,10 +6,8 @@ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/module_small_map_view.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/module_small_map_view.xml index dea017f753..a8a1ede8d9 100644 --- a/core/function-impl/mogo-core-function-map/src/main/res/layout/module_small_map_view.xml +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/module_small_map_view.xml @@ -2,19 +2,19 @@ ) + + fun showVideoDialog(url: String, isFlvUrl: Boolean) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index 5335ce979e..bb74231f76 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -300,6 +300,14 @@ object CallerHmiManager : CallerBase() { waringProviderApi?.hideToolsView() } + fun showSmallFragment() { + waringProviderApi?.showSmallFragment() + } + + fun hideSmallFragment() { + waringProviderApi?.hideSmallFragment() + } + /** *注册工控机升级提示圆点View的回调 * @param 提示圆点View @@ -349,4 +357,8 @@ object CallerHmiManager : CallerBase() { waringProviderApi?.showIPCReportWindow(reportList) } + @JvmOverloads + fun showVideoDialog(url: String, isFlvUrl: Boolean = false) { + waringProviderApi?.showVideoDialog(url, isFlvUrl) + } } \ No newline at end of file