diff --git a/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml b/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml index a32dea82da..0bab6f9d11 100644 --- a/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml +++ b/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml @@ -28,7 +28,7 @@ android:layout_height="@dimen/dp_269" android:layout_marginStart="@dimen/dp_10" app:layout_constraintLeft_toLeftOf="parent" - app:layout_constraintTop_toTopOf="parent"/> + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintEnd_toEndOf="@+id/viewLimitingVelocity" + app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity" + app:layout_goneMarginEnd="40dp" + app:layout_goneMarginTop="@dimen/dp_236" /> + + + + + + @@ -200,8 +220,7 @@ android:layout_marginLeft="@dimen/dp_10" android:layout_marginTop="-24dp" app:layout_constraintLeft_toLeftOf="parent" - app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status" - /> + app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status" /> + app:layout_constraintLeft_toRightOf="@id/module_mogo_och_arrived_tv" /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toRightOf="@id/toolsView" /> + app:layout_constraintLeft_toRightOf="@id/switch_visual_view" /> @@ -305,7 +324,7 @@ + android:layout_height="match_parent" /> + app:layout_constraintStart_toStartOf="parent" /> \ No newline at end of file diff --git a/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java b/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java index 54049cdb98..f4ce741997 100644 --- a/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java +++ b/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java @@ -31,6 +31,7 @@ import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView; import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView; import com.mogo.eagle.core.function.view.MapBizView; import com.mogo.eagle.core.function.smp.view.SmallMapView; +import com.mogo.eagle.core.function.view.MapRoamView; import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener; import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; @@ -56,6 +57,7 @@ public abstract class BaseTaxiTabFragment + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toBottomOf="@+id/taxi_speed_contain"> + app:layout_constraintEnd_toEndOf="@+id/viewLimitingVelocity" + app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity" + app:layout_goneMarginEnd="40dp" + app:layout_goneMarginTop="@dimen/dp_236" /> + + + + + + + android:layout_height="@dimen/dp_144" + android:layout_marginStart="@dimen/dp_19" + android:layout_marginBottom="@dimen/dp_16" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" /> + app:layout_constraintLeft_toRightOf="@id/module_mogo_och_operation_status" /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toRightOf="@id/toolsView" /> + app:layout_constraintLeft_toRightOf="@id/switch_visual_view" /> @@ -349,7 +368,7 @@ + android:layout_height="match_parent" /> + app:layout_constraintStart_toStartOf="parent" /> \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index b56c984701..f238912b93 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,7 +8,7 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' -apply from: rootProject.file('gradle/bytex/bytex.gradle') +//apply from: rootProject.file('gradle/bytex/bytex.gradle') Properties properties = new Properties() properties.load(project.rootProject.file("gradle.properties").newDataInputStream()) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListAdapter.kt index 1086700744..bc6654f8f2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListAdapter.kt @@ -27,7 +27,7 @@ class CameraListAdapter : Adapter { } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CameraListHolder { - var view = LayoutInflater.from(parent.context) + val view = LayoutInflater.from(parent.context) .inflate(R.layout.item_camera_info, parent, false) return CameraListHolder(view) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadCrossLiveView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadCrossLiveView.kt index 4c6a5645e1..e2458d54fc 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadCrossLiveView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/RoadCrossLiveView.kt @@ -1,26 +1,179 @@ package com.mogo.eagle.core.function.hmi.ui.camera import android.content.Context +import android.graphics.PorterDuff +import android.graphics.PorterDuffColorFilter +import android.os.Handler +import android.os.Looper +import android.os.Message import android.util.AttributeSet import android.view.LayoutInflater +import android.view.View import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.content.ContextCompat +import com.mogo.eagle.core.data.road.RoadCameraLive +import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener +import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager +import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI +import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer +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 com.zhidaoauto.map.data.road.RoadCross +import kotlinx.android.synthetic.main.view_road_cross_live.view.roadCrossLiveClose +import kotlinx.android.synthetic.main.view_road_cross_live.view.roadCrossLivePB +import kotlinx.android.synthetic.main.view_road_cross_live.view.roadCrossLivePlayer +import tv.danmaku.ijk.media.player.IjkMediaPlayer class RoadCrossLiveView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : ConstraintLayout(context, attrs, defStyleAttr) { +) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoMapRoadListener { + + companion object { + private const val TAG = "RoadCrossLiveView" + private const val CLOSE_VIEW_DELAY_TIME = 10_000L + } + + @Volatile + private var curLiveDevice: String? = null + + private val gsyVideoOptionBuilder by lazy { + GSYVideoOptionBuilder() + } + + private val handler = object : Handler(Looper.getMainLooper()) { + override fun handleMessage(msg: Message) { + super.handleMessage(msg) + if (this@RoadCrossLiveView.visibility == View.VISIBLE) { + closeView() + } + } + } init { - LayoutInflater.from(context).inflate(R.layout.view_road_cross_live, this, true) + val res = when (CallerSkinModeListenerManager.getMode()) { + 0 -> R.layout.view_road_cross_live + 1 -> R.layout.view_road_cross_live_light + else -> R.layout.view_road_cross_live + } + LayoutInflater.from(context).inflate(res, this, true) + initVideoPlayer() + roadCrossLivePB.indeterminateDrawable.colorFilter = PorterDuffColorFilter( + ContextCompat.getColor(context, R.color.notice_blue), + PorterDuff.Mode.MULTIPLY + ) + roadCrossLiveClose.setOnClickListener { + HmiActionLog.hmiAction("关闭路侧视频流", "") + closeView() + } + + } + + private fun initVideoPlayer() { + val list: MutableList = ArrayList() + list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "reconnect", 3)) + GSYVideoManager.instance().optionModelList = list + GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_16_9) + PlayerFactory.setPlayManager(IjkPlayerManager::class.java) + roadCrossLivePlayer.outLinePixel = 12f + roadCrossLivePlayer.setPlayListener(object : SimpleVideoPlayer.PlayListener { + override fun onPlayEvent(event: Int) { + CallerLogger.d("$M_HMI$TAG", "onPlayEvent: event is:$event") + when (event) { + SimpleVideoPlayer.PLAY_EVT_PLAY_LOADING -> { + // 会出现临时中断后又可以继续播放,需要停掉倒计时 + } + + SimpleVideoPlayer.PLAY_EVT_PLAY_BEGIN -> { + roadCrossLivePB.visibility = View.GONE + roadCrossLivePlayer.visibility = View.VISIBLE + } + + else -> { + CallerLogger.w("$M_HMI$TAG", "播放视频异常,event is:$event") + } + } + } + }) } override fun onAttachedToWindow() { super.onAttachedToWindow() + CallerMapRoadListenerManager.addListener(TAG, this) + } + + override fun onRoadChange(cross: Boolean, roadCross: RoadCross?) { + super.onRoadChange(cross, roadCross) + // 离开路口,进入路段,发送handler3秒后隐藏播放器 + if (!cross) { + handler.sendEmptyMessageDelayed(0, CLOSE_VIEW_DELAY_TIME) + } + } + + override fun onRoadCrossClick() { + super.onRoadCrossClick() + if (this.visibility == View.VISIBLE) { + return + } + resetView() + } + + override fun onCrossLiveInfo(info: RoadCameraLive) { + super.onCrossLiveInfo(info) + if (curLiveDevice != null && curLiveDevice == info.ip) { + CallerLogger.w("$M_HMI$TAG", "播放视频异常,当前播放设备与上次相同,ip:${info.ip}") + return + } + curLiveDevice = info.ip + ThreadUtils.runOnUiThread { + HmiActionLog.hmiAction("触发marker点击,播放路侧视频流", info.toString()) + gsyVideoPlay(info.imageUrl, info.liveUrl) + } + } + + private fun gsyVideoPlay(img: String, live: String) { + resetView() + gsyVideoOptionBuilder.setUrl(live) + .setCacheWithPlay(false) + .setAutoFullWithSize(false) + .setIsTouchWigetFull(false) + .setIsTouchWiget(false) + .setPlayTag(TAG).build(roadCrossLivePlayer) + roadCrossLivePlayer.startButton.performClick() + } + + /** + * 重置视图,播放下一个 + */ + private fun resetView() { + this.visibility = View.VISIBLE + roadCrossLivePB.visibility = View.VISIBLE + roadCrossLivePlayer.onVideoReset() + } + + /** + * 隐藏view,释放视频控制器 + */ + private fun closeView() { + this.visibility = View.GONE + roadCrossLivePlayer.visibility = View.GONE + curLiveDevice = null + GSYVideoManager.releaseAllVideos() } override fun onDetachedFromWindow() { super.onDetachedFromWindow() + CallerMapRoadListenerManager.removeListener(TAG) + closeView() } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 734ef44762..2f91d7394b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -419,8 +419,6 @@ internal class DebugSettingView @JvmOverloads constructor( * 状态中心 */ tbStatusCenter.setOnCheckedChangeListener { buttonView, isChecked -> - val cross = RoadCross() -// CallerMapRoadListenerManager.invokeRoadChange(0, cross) if (isChecked) { buttonView.setCompoundDrawables(null, null, iconDown, null) //展示状态中心 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_empty.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_empty.xml new file mode 100644 index 0000000000..8e1b504558 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_empty.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live.png new file mode 100644 index 0000000000..42af8a287b Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live_close.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live_close.png new file mode 100644 index 0000000000..d592593a94 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_live_close.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_logo.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_logo.png new file mode 100644 index 0000000000..77e13291f0 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_logo.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_xiaozhi.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_xiaozhi.png new file mode 100644 index 0000000000..09be529bb4 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_road_cross_xiaozhi.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live.xml index 77d9ef65f8..2b14e7825f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live.xml @@ -1,6 +1,82 @@ + android:layout_height="match_parent" + android:background="@drawable/bg_road_cross_live"> + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live_light.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live_light.xml new file mode 100644 index 0000000000..77d9ef65f8 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_road_cross_live_light.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml index 6fc9b21ea4..3c93ad9148 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml @@ -23,6 +23,8 @@ #2C2E30 #2D3E5F #D4D8DC + #50E8E4 + #252B3F #27FFFFFF #1E111111 #FF213757 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml index 89388ccc15..12e5014d93 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml @@ -127,4 +127,6 @@ 正在为您探查前方道路 自动探索关闭按钮 + + 蘑菇为您实时护航中,请放心驾驶! diff --git a/core/function-impl/mogo-core-function-map/build.gradle b/core/function-impl/mogo-core-function-map/build.gradle index 98174911b9..fc45801307 100644 --- a/core/function-impl/mogo-core-function-map/build.gradle +++ b/core/function-impl/mogo-core-function-map/build.gradle @@ -70,6 +70,7 @@ dependencies { implementation rootProject.ext.dependencies.androidxroomktx implementation rootProject.ext.dependencies.view_model_scope implementation rootProject.ext.dependencies.lifecycle_extension + implementation rootProject.ext.dependencies.androidxrecyclerview implementation project(':foudations:mogo-commons') implementation project(':core:mogo-core-res') diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/RoadCrossCameraManager.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/RoadCrossCameraManager.kt index d543ce1d30..75c4f9b6e8 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/RoadCrossCameraManager.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/RoadCrossCameraManager.kt @@ -2,7 +2,9 @@ package com.mogo.eagle.core.function.business.roadcross import android.annotation.SuppressLint import android.content.Context -import android.util.Log +import android.os.Handler +import android.os.Looper +import android.os.Message import com.mogo.commons.debug.DebugConfig import com.mogo.eagle.core.data.deva.chain.ChainConstant import com.mogo.eagle.core.data.road.CameraDeviceInfo @@ -14,6 +16,7 @@ import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.view.CameraMarkerView import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP +import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.map.overlay.core.Level import com.mogo.map.overlay.point.Point @@ -26,6 +29,7 @@ class RoadCrossCameraManager : IMoGoMapRoadListener { companion object { private const val TAG = "RoadCrossCameraManager" + private const val REMOVE_MARKER_DELAY_TIME = 10_000L val instance: RoadCrossCameraManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { RoadCrossCameraManager() @@ -42,18 +46,24 @@ class RoadCrossCameraManager : IMoGoMapRoadListener { private val overlayManager = CallerMapUIServiceManager.getOverlayManager() + private val handler = object :Handler(Looper.getMainLooper()){ + override fun handleMessage(msg: Message) { + super.handleMessage(msg) + overlayManager?.removeAllPointsInOwner(TAG) + } + } + fun init(context: Context?) { mContext = context CallerMapRoadListenerManager.addListener(TAG, this) } - //todo 记录方法执行时间 private var distance: Double by Delegates.observable(0.0) { _, _, newV -> if (!isCameraRequest && newV < 100) { isCameraRequest = true - val roadCrossEnd = CallerMapRoadListenerManager.getCrossInfo()?.cross_id_end - Log.d( - "emArrow", + val roadCrossEnd = CallerMapRoadListenerManager.getCrossEndInfo() + CallerLogger.d( + "$M_MAP$TAG", "触发接口调用 dis: $distance , roadCrossEnd: ${roadCrossEnd ?: "null"} " ) if (roadCrossEnd != null) { @@ -69,8 +79,10 @@ class RoadCrossCameraManager : IMoGoMapRoadListener { } roadCrossCameraList = it.deviceInfoList // 地图上打marker(注意marker方向),marker点击获取对应ip - it.deviceInfoList.forEach { deviceInfo -> - addCameraDeviceMarker(deviceInfo) + ThreadUtils.runOnUiThread { + it.deviceInfoList.forEach { deviceInfo -> + addCameraDeviceMarker(deviceInfo) + } } }, onError = { @@ -80,12 +92,12 @@ class RoadCrossCameraManager : IMoGoMapRoadListener { traceError("roadCross is null") } } else { - Log.d("emArrow", "distance:$distance") + CallerLogger.d("$M_MAP$TAG", "distance:$distance") } } private fun addCameraDeviceMarker(cameraDeviceInfo: CameraDeviceInfo) { - Log.d("emArrow","add marker:${cameraDeviceInfo.deviceIp}") + CallerLogger.d("$M_MAP$TAG", "add marker:${cameraDeviceInfo.deviceIp}") mContext?.let { val builder = Point.Options.Builder(TAG, Level.MAP_MARKER) @@ -100,16 +112,16 @@ class RoadCrossCameraManager : IMoGoMapRoadListener { .longitude(cameraDeviceInfo.lon) .latitude(cameraDeviceInfo.lat) .onClick { id -> - Log.d("emArrow", "Marker click :$id") + CallerLogger.d("$M_MAP$TAG", "Marker click :$id") + CallerMapRoadListenerManager.invokeRoadCrossClick() ndeRoadCameraNetWorkModel.singleRequestCrossLive(id, onSuccess = { live -> CallerMapRoadListenerManager.invokeRoadCrossLive(live) }, - onError = {errorMsg -> + onError = { errorMsg -> traceError(" ${cameraDeviceInfo.deviceIp} click request error :$errorMsg") }) } - CallerLogger.d("$M_MAP$TAG", "new road cross camera=$overlayManager") overlayManager?.showOrUpdatePoint(builder.build()) } } @@ -135,32 +147,21 @@ class RoadCrossCameraManager : IMoGoMapRoadListener { override fun onRoadChange(cross: Boolean, roadCross: RoadCross?) { super.onRoadChange(cross, roadCross) - val data = CameraDeviceInfo("172.18.1.60", 112.582913287, 26.9320508672) //todo emArrow test - addCameraDeviceMarker(data) - val data1 = CameraDeviceInfo("172.18.1.42", 112.582947017, 26.9328373092) - addCameraDeviceMarker(data1) - val data2 = CameraDeviceInfo("172.18.1.72", 112.582421, 26.932519) - addCameraDeviceMarker(data2) - // 出路口 if (!cross) { // 停止请求摄像头数据 ndeRoadCameraNetWorkModel.cancelRequest("roadCross") // 清除marker - roadCrossCameraList?.let { - it.forEach { camera -> - Log.d("emArrow","remove marker:${camera.deviceIp}") - overlayManager?.removePoint(camera.deviceIp) - } - } + CallerLogger.d("$M_MAP$TAG", "remove marker") + handler.sendEmptyMessageDelayed(0, REMOVE_MARKER_DELAY_TIME) // 释放控制 isCameraRequest = false - Log.d("emArrow", "经过路口,释放控制") + CallerLogger.d("$M_MAP$TAG", "经过路口,释放控制") } } private fun traceError(msg: String) { - if(DebugConfig.isDebug()){ + if (DebugConfig.isDebug()) { ToastUtils.showLong(msg) } val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/INDERoadCameraApiService.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/INDERoadCameraApiService.kt index 2b85b89edb..32b7724535 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/INDERoadCameraApiService.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/INDERoadCameraApiService.kt @@ -23,7 +23,8 @@ interface INDERoadCameraApiService { @Header("MogoReqTime") time: String, @Query("roadUniqueId") roadId: String, @Query("lon") lon: Double, - @Query("lat") lat: Double + @Query("lat") lat: Double, + @Query("cityCode") cityCode: String ): BaseResponse> // 单ip查询设备直播流与缩略图 @@ -33,7 +34,8 @@ interface INDERoadCameraApiService { @Header("MogoReqTime") time: String, @Query("ip") ip: String, @Query("lon") lon: Double, - @Query("lat") lat: Double + @Query("lat") lat: Double, + @Query("cityCode") cityCode: String ): BaseResponse // 批量ip查询设备直播流与缩略图 diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/NDERoadCameraNetWorkModel.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/NDERoadCameraNetWorkModel.kt index 299ab9e6c9..5a406db1cf 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/NDERoadCameraNetWorkModel.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/roadcross/net/NDERoadCameraNetWorkModel.kt @@ -5,6 +5,7 @@ import com.mogo.eagle.core.data.BaseResponse import com.mogo.eagle.core.data.road.RoadCameraLive import com.mogo.eagle.core.data.road.RoadCrossCamera import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager +import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.network.MoGoRetrofitFactory import com.mogo.eagle.core.network.apiCall import com.mogo.eagle.core.network.cancel @@ -40,14 +41,15 @@ class NDERoadCameraNetWorkModel private constructor() { pair.second, crossID, loc.longitude, - loc.latitude + loc.latitude, + CallerMapUIServiceManager.getCityCode() ?: "" ) } } onSuccess { - if(it.result.isNotEmpty()){ + if (it.result.isNotEmpty()) { onSuccess.invoke(it.result[0]) - }else{ + } else { onError.invoke("getRoadCrossInfo empty camera info") } } @@ -71,7 +73,8 @@ class NDERoadCameraNetWorkModel private constructor() { pair.second, ip, loc.longitude, - loc.latitude + loc.latitude, + CallerMapUIServiceManager.getCityCode() ?: "" ) } } @@ -92,10 +95,12 @@ class NDERoadCameraNetWorkModel private constructor() { loader { apiCall { val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() + val cityCode = CallerMapUIServiceManager.getCityCode() ?: "" val map = mutableMapOf( "lon" to loc.longitude, "lat" to loc.latitude, - "ipList" to list + "ipList" to list, + "cityCode" to cityCode ) val pair = getAuth(BATCH_LIVE) getNetWorkApi().cameraLiveBatchRequest(pair.first, pair.second, map) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/CameraMarkerView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/CameraMarkerView.kt index 75bb869254..0a75e46c92 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/CameraMarkerView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/CameraMarkerView.kt @@ -4,9 +4,9 @@ import android.content.Context import android.util.AttributeSet import android.view.ViewGroup import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener -import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager import com.mogo.eagle.core.function.map.R +import com.mogo.eagle.core.utilcode.util.ThreadUtils import me.jessyan.autosize.utils.AutoSizeUtils @@ -27,7 +27,7 @@ class CameraMarkerView(context: Context, attrs: AttributeSet? = null, defStyleAt ) ) } - modeChange(CallerMoGoUiSettingManager.getDayMode()) + modeChange(CallerSkinModeListenerManager.getMode()) } override fun onAttachedToWindow() { @@ -36,7 +36,9 @@ class CameraMarkerView(context: Context, attrs: AttributeSet? = null, defStyleAt } override fun onSkinModeChange(skinMode: Int) { - modeChange(skinMode) + ThreadUtils.runOnUiThread { + modeChange(skinMode) + } } private fun modeChange(mode: Int) { diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt index b084403520..2785c8369c 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt @@ -15,6 +15,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84Lis import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP +import com.mogo.map.MogoMap import com.mogo.map.MogoMapView import com.mogo.map.overlay.line.Polyline import com.mogo.map.overlay.point.Point @@ -59,10 +60,14 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, //设置倾斜手势是否可用。 it.setTiltGesturesEnabled(false) //设置双指缩放手势是否可用。 - it.setZoomGesturesEnabled(false) //true todo emArrow test + it.setZoomGesturesEnabled(false) } } + override fun getInstanceTag(): String { + return MogoMap.DEFAULT + } + fun getUI(): IMogoMapUIController? { return map?.uiController } @@ -109,10 +114,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, } override fun onChassisLocationWGS84(gnssInfo: MogoLocation) { - // 跟新地图控件 112.582776,26.931655 -// gnssInfo.longitude = 112.582776 -// gnssInfo.latitude = 26.931655 //todo emArrow test -// gnssInfo.heading = 15.0 + // 跟新地图控件 setExtraGPSData(gnssInfo) accLimit = gnssInfo.acceleration < accThreshold } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapRoamView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapRoamView.kt new file mode 100644 index 0000000000..6928c87050 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapRoamView.kt @@ -0,0 +1,119 @@ +package com.mogo.eagle.core.function.view + +import android.annotation.SuppressLint +import android.content.Context +import android.os.Bundle +import android.util.AttributeSet +import android.util.Log +import androidx.lifecycle.LifecycleObserver +import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener +import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager +import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager +import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager +import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider +import com.mogo.map.MogoMap.Companion.MAP_ROAM +import com.mogo.map.MogoMapView +import com.mogo.map.uicontroller.IMogoMapUIController +import com.mogo.map.uicontroller.VisualAngleMode + + +class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, attrs), + IMoGoSkinModeChangeListener, + LifecycleObserver, IMoGoMapRoadListener { + + companion object { + private const val TAG = "MapRoamView" + } + + override fun onCreate(bundle: Bundle?) { + super.onCreate(bundle) + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + initMapView() + CallerSkinModeListenerManager.addListener(TAG, this) + CallerMapRoadListenerManager.addListener(TAG, this) + } + + private fun initMapView() { + map?.uiController?.showMyLocation(false) + map?.uiSettings?.let { + it.setAllGesturesEnabled(false) + //设置指南针是否可见。 + it.setCompassEnabled(false) + //设置室内地图楼层切换控件是否可见。 + it.setIndoorSwitchEnabled(false) + //设置定位按钮是否可见。 + it.setMyLocationButtonEnabled(false) + //设置比例尺控件是否可见 + it.setScaleControlsEnabled(false) + } + } + + override fun getInstanceTag(): String { + return MAP_ROAM + } + + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + } + + override fun onResume() { + super.onResume() + } + + override fun onPause() { + super.onPause() + } + + private fun getUI(): IMogoMapUIController? { + return map?.uiController + } + + override fun onSkinModeChange(skinMode: Int) { + if (skinMode == 0) { + getUI()?.stepInDayMode(false) + } else if (skinMode == 1) { + getUI()?.stepInDayMode(true) + } + } + + @SuppressLint("ObsoleteSdkInt") + override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { + super.onSizeChanged(w, h, oldw, oldh) + this.outlineProvider = TextureVideoViewOutlineProvider(12f) + this.clipToOutline = true + } + + fun openRoam() { + this.onResume() + // 更新地图视角 - 高视角 + getUI()?.changeMapVisualAngle(VisualAngleMode.MAP_STYLE_VR_ANGLE_TOP, null) + // 更新路口位置 + val latLng = CallerMapRoadListenerManager.getStopLineLatLng() + Log.i("emArrow","$TAG 开始漫游 latLng:${latLng.toString()}") + latLng?.let { + val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() + loc.latitude = latLng.first + loc.longitude = latLng.second + setExtraGPSData(loc) + } + // 开始漫游 + + } + + fun closeRoam(){ + this.onPause() + + } + + override fun onDestroy() { + // 先取消注册数据,再onDestroy + CallerSkinModeListenerManager.removeListener(TAG) + CallerMapRoadListenerManager.removeListener(TAG) + super.onDestroy() + } + +} diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamListAdapter.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamListAdapter.kt new file mode 100644 index 0000000000..53c3eb2c53 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamListAdapter.kt @@ -0,0 +1,60 @@ +package com.mogo.eagle.core.function.view + +import android.content.Context +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.ProgressBar +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import com.mogo.eagle.core.function.map.R +import kotlin.random.Random + + +class RoadCrossRoamListAdapter(private val mContext: Context) : RecyclerView.Adapter() { + + private val items: MutableList = mutableListOf() + + init { + items.add("前方路况拥堵分析") + items.add("路口危险车辆分析") + items.add("路口交通事故分析") + items.add("路口行人碰撞分析") + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { + val view: View = LayoutInflater.from(mContext).inflate(R.layout.item_road_cross_roam_tip, parent, false) + return ViewHolder(view) + } + + override fun getItemCount(): Int { + return items.size + } + + override fun onBindViewHolder(holder: ViewHolder, position: Int) { + val item = items[position] + holder.textView.text = item + // 随机决定是否显示ProgressBar +// if (Random.nextBoolean()) { // 50%的几率显示ProgressBar + holder.progressBar.visibility = View.VISIBLE + holder.checkIcon.visibility = View.GONE + + val r = Random.nextInt(3,6) + // 模拟加载完成 + holder.itemView.postDelayed({ + holder.progressBar.visibility = View.GONE + holder.checkIcon.visibility = View.VISIBLE + },r * 1000L) +// } else { +// holder.progressBar.visibility = View.GONE +// holder.checkIcon.visibility = View.VISIBLE +// } + } + + class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + var textView: TextView = itemView.findViewById(R.id.tvRoadItemTip) + var progressBar: ProgressBar = itemView.findViewById(R.id.pbRoadItemTip) + var checkIcon: ImageView = itemView.findViewById(R.id.ivRoadItemTip) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamView.kt new file mode 100644 index 0000000000..fd7f563fcd --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/RoadCrossRoamView.kt @@ -0,0 +1,124 @@ +package com.mogo.eagle.core.function.view + +import android.animation.ObjectAnimator +import android.animation.ValueAnimator +import android.content.Context +import android.graphics.Rect +import android.util.AttributeSet +import android.util.Log +import android.view.LayoutInflater +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener +import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager +import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager +import com.mogo.eagle.core.function.map.R +import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.zhidaoauto.map.data.road.StopLine +import kotlinx.android.synthetic.main.view_road_cross_roam.view.ivCoverRoam +import kotlinx.android.synthetic.main.view_road_cross_roam.view.ivRoadRoamClose +import kotlinx.android.synthetic.main.view_road_cross_roam.view.lvRoadCrossRoamTip +import kotlinx.android.synthetic.main.view_road_cross_roam.view.mapRoamView +import kotlin.properties.Delegates + +class RoadCrossRoamView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoMapRoadListener { + + companion object { + private const val TAG = "RoadCrossRoamView" + } + + private var showState by Delegates.observable(false) { _, oldV, newV -> + if (oldV != newV) { + updateView(newV) + } + } + + private var animator: ObjectAnimator? = null + + init { + val res = when (CallerSkinModeListenerManager.getMode()) { + 0 -> R.layout.view_road_cross_roam + 1 -> R.layout.view_road_cross_roam_light + else -> R.layout.view_road_cross_roam + } + LayoutInflater.from(context).inflate(res, this, true) + lvRoadCrossRoamTip.layoutManager = LinearLayoutManager(context) + lvRoadCrossRoamTip.addItemDecoration(object : RecyclerView.ItemDecoration() { + override fun getItemOffsets( + outRect: Rect, + view: View, + parent: RecyclerView, + state: RecyclerView.State + ) { + super.getItemOffsets(outRect, view, parent, state) + outRect.bottom = 24 + } + }) + ivRoadRoamClose.setOnClickListener { + detachView() + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerMapRoadListenerManager.addListener(TAG, this) + } + + private fun updateView(state: Boolean) { + // 切换线程 + ThreadUtils.runOnUiThread { + if (state) { + attachView() + } else { + detachView() + } + } + } + + override fun onStopLineInfo(info: StopLine) { + super.onStopLineInfo(info) + showState = info.distance < 200 && info.distance > 100 + Log.i("emArrow","showState $showState , distance:${info.distance}") + } + + private fun attachView() { + this.visibility = View.VISIBLE + mapRoamView.openRoam() + lvRoadCrossRoamTip.adapter = RoadCrossRoamListAdapter(context) + // 创建横向移动的动画 + if (animator == null) { + animator = + ObjectAnimator.ofFloat( + ivCoverRoam, + "translationX", + -120f, + 540f + ) + } + animator?.duration = 1500 // 设置动画持续时间,单位为毫秒 + animator?.repeatCount = ValueAnimator.INFINITE // 设置动画无限重复 + animator?.repeatMode = ValueAnimator.RESTART // 设置动画来回移动 + animator?.start() + } + + private fun detachView() { + mapRoamView.closeRoam() + lvRoadCrossRoamTip.adapter = null + animator?.cancel() + this.visibility = View.GONE + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + animator?.cancel() + CallerMapRoadListenerManager.removeListener(TAG) + } + + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_cross_roam.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_cross_roam.png new file mode 100644 index 0000000000..205b0efaae Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_cross_roam.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_roam_xiaozhi.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_roam_xiaozhi.png new file mode 100644 index 0000000000..5380e77405 Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/bg_road_roam_xiaozhi.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_cover_road_roam.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_cover_road_roam.png new file mode 100644 index 0000000000..7e10b9506c Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_cover_road_roam.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_close.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_close.png new file mode 100644 index 0000000000..3e9242089b Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_close.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_progress.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_progress.png new file mode 100644 index 0000000000..e77f8fb2b5 Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_progress.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_tip.png b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_tip.png new file mode 100644 index 0000000000..f678d1bdb4 Binary files /dev/null and b/core/function-impl/mogo-core-function-map/src/main/res/drawable-nodpi/icon_road_roam_tip.png differ diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/item_road_cross_roam_tip.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/item_road_cross_roam_tip.xml new file mode 100644 index 0000000000..ea672c1bd6 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/item_road_cross_roam_tip.xml @@ -0,0 +1,37 @@ + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam.xml new file mode 100644 index 0000000000..e7a728e41a --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam_light.xml b/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam_light.xml new file mode 100644 index 0000000000..77d9ef65f8 --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/res/layout/view_road_cross_roam_light.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/res/values/strings.xml b/core/function-impl/mogo-core-function-map/src/main/res/values/strings.xml index d32a85d33b..8a72f3e813 100644 --- a/core/function-impl/mogo-core-function-map/src/main/res/values/strings.xml +++ b/core/function-impl/mogo-core-function-map/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ mogo-core-function-map + 前方即将进入全息路口\n为您全面扫描潜在风险 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/road/IMoGoMapRoadListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/road/IMoGoMapRoadListener.kt index 1110d437a1..43f8394d74 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/road/IMoGoMapRoadListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/road/IMoGoMapRoadListener.kt @@ -17,5 +17,6 @@ interface IMoGoMapRoadListener { fun onCrossLiveInfo(info: RoadCameraLive) {} + fun onRoadCrossClick() {} } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt index 4cd26da1c5..17c4344fcd 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapRoadListenerManager.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.call.map +import android.util.Log import com.mogo.eagle.core.data.deva.chain.ChainConstant import com.mogo.eagle.core.data.road.RoadCameraLive import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener @@ -38,7 +39,7 @@ object CallerMapRoadListenerManager : CallerBase() { mStopLine?.let { listener.onStopLineInfo(it) } - if(mCross != -1 && mRoadCross != null){ + if (mCross != -1 && mRoadCross != null) { listener.onRoadChange(mRoadChange, mRoadCross) } } @@ -57,8 +58,16 @@ object CallerMapRoadListenerManager : CallerBase() { } } - fun getCrossInfo(): RoadCross? { - return mRoadCross + fun getCrossEndInfo(): String? { + return mRoadCross?.cross_id_end + } + + fun getStopLineLatLng(): Pair? { + return if (mStopLine == null) { + null + } else { + Pair(mStopLine!!.points[0].latitude, mStopLine!!.points[0].longitude) + } } @ChainLog( @@ -77,13 +86,19 @@ object CallerMapRoadListenerManager : CallerBase() { } + fun invokeRoadCrossClick() { + M_LISTENERS.forEach { entry -> + entry.value.onRoadCrossClick() + } + } + @ChainLog( linkChainLog = ChainConstant.CHAIN_TYPE_STATUS, linkCode = ChainConstant.CHAIN_SOURCE_MAP, nodeAliasCode = ChainConstant.CHAIN_CODE_HD_MAP_ROAD_LIVE, paramIndexes = [0] ) - fun invokeRoadCrossLive(info: RoadCameraLive){ + fun invokeRoadCrossLive(info: RoadCameraLive) { M_LISTENERS.forEach { entry -> entry.value.onCrossLiveInfo(info) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt index a103e18f3f..e3776ecf71 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/setting/CallerSkinModeListenerManager.kt @@ -25,4 +25,8 @@ object CallerSkinModeListenerManager : CallerBase() } } + fun getMode():Int{ + return CallerMoGoUiSettingManager.getDayMode() + } + } \ No newline at end of file diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt index b86812d443..1a001491fb 100644 --- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt +++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/SimpleVideoPlayer.kt @@ -42,6 +42,11 @@ class SimpleVideoPlayer : StandardGSYVideoPlayer { */ var enableshowProgressDialog = true + /** + * 圆角尺寸 + */ + var outLinePixel = 0f + interface PlayListener { fun onPlayEvent(event: Int) } @@ -152,10 +157,10 @@ class SimpleVideoPlayer : StandardGSYVideoPlayer { } @Suppress("SENSELESS_COMPARISON") - private var runnable = object :Runnable { + private var runnable = object : Runnable { override fun run() { // 外层对象倍回收 延时继续运行 慎重删除 - if(this@SimpleVideoPlayer==null){ + if (this@SimpleVideoPlayer == null) { return } updateTimer++ @@ -216,22 +221,42 @@ class SimpleVideoPlayer : StandardGSYVideoPlayer { } override fun touchDoubleUp() { - if(enableDoubleClick) { + if (enableDoubleClick) { super.touchDoubleUp() } } - override fun showProgressDialog(deltaX: Float, seekTime: String?, seekTimePosition: Int, totalTime: String?, totalTimeDuration: Int) { - if(enableshowProgressDialog) { - super.showProgressDialog(deltaX, seekTime, seekTimePosition, totalTime, totalTimeDuration) + override fun showProgressDialog( + deltaX: Float, + seekTime: String?, + seekTimePosition: Int, + totalTime: String?, + totalTimeDuration: Int + ) { + if (enableshowProgressDialog) { + super.showProgressDialog( + deltaX, + seekTime, + seekTimePosition, + totalTime, + totalTimeDuration + ) } } override fun dismissProgressDialog() { - if(enableshowProgressDialog) { + if (enableshowProgressDialog) { super.dismissProgressDialog() } } + @SuppressLint("ObsoleteSdkInt") + override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { + super.onSizeChanged(w, h, oldw, oldh) + if (!mIfCurrentIsFullscreen && outLinePixel > 0) { + this.outlineProvider = TextureVideoViewOutlineProvider(outLinePixel) + this.clipToOutline = true + } + } } \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/logics/location/MyLocationStyle.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/logics/location/MyLocationStyle.kt index 003b407bde..9c6dcc51f4 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/logics/location/MyLocationStyle.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/logics/location/MyLocationStyle.kt @@ -45,6 +45,7 @@ class MyLocationStyle( private var is3D: Boolean = false private var carId: Int = 0 private var isDisplayAnim: Boolean = true + private var showSelfMarker:Boolean = true // 前置调用/或后置更新draw private var mMarker: Marker? = null private var lastExecuteTime = -1L @@ -236,6 +237,9 @@ class MyLocationStyle( options.animMarkerRes(guangquanResId, mMapController) } mMarker = mMarkerController?.addSelfCar(options) + if(!showSelfMarker){ + mMarker?.setVisible(false) + } carId = resId if (CompileConfig.DEBUG) { Log.i( @@ -335,10 +339,12 @@ class MyLocationStyle( fun hideCar() { + showSelfMarker = false mMarker?.setVisible(false) } fun showCar() { + showSelfMarker = true mMarker?.setVisible(true) } diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/renders/marker/BitmapDescriptorFactory.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/renders/marker/BitmapDescriptorFactory.kt index 78c0d6e665..c3558c4288 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/renders/marker/BitmapDescriptorFactory.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/renders/marker/BitmapDescriptorFactory.kt @@ -70,7 +70,7 @@ object BitmapDescriptorFactory { View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED) ) view.layout(0, 0, view.measuredWidth, view.measuredHeight) - val bitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888); + val bitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888) val canvas = Canvas(bitmap) // canvas.drawColor(Color.WHITE); view.draw(canvas); diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt index da6ff519fa..e26b3a4341 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/MogoMap.kt @@ -10,6 +10,7 @@ class MogoMap private constructor() { private const val TAG = "MogoMap" const val DEFAULT = "Default" + const val MAP_ROAM = "MapRoam" //漫游地图实例 @JvmStatic val mapInstance by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt index ea1b279ba8..78b3717fd5 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.kt @@ -36,7 +36,6 @@ import com.mogo.map.listener.MogoMapListenerHandler.Companion.mogoMapListenerHan import com.mogo.map.uicontroller.* import com.mogo.map.uicontroller.VisualAngleMode.MODE_MEDIUM_SIGHT import com.mogo.map.utils.MapTraceUtil -import com.mogo.map.utils.MogoMapUtils import com.mogo.map.utils.MogoMapUtils.getLatLngBounds import com.mogo.map.utils.ObjectUtils import com.zhidaoauto.map.data.point.LonLatPoint @@ -387,18 +386,22 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle override fun showMyLocation(visible: Boolean) { d(M_MAP + TAG, "showMyLocation1 $visible") // 如果是VR模式 - if (isVrMold) { - return - } +// if (isVrMold) { +// return +// } // 不是VR模式情况强制刷新下 if (checkAMapView()) { val style = mMapView.getMapAutoViewHelper()!! .getMyLocationStyle() - if (visible) { - // 强制刷新一遍车标 - style!!.myLocationIcon(mCarCursorOption!!.carCursorRes) + style?.let { + if (visible) { + // 强制刷新一遍车标 + it.myLocationIcon(mCarCursorOption!!.carCursorRes) + }else{ + it.hideCar() + } + mMapView.getMapAutoViewHelper()!!.setMyLocationStyle(style) } - mMapView.getMapAutoViewHelper()!!.setMyLocationStyle(style!!) } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.kt b/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.kt index 4d7c0a0c29..bebd043d44 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.kt +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapWrapper.kt @@ -83,7 +83,7 @@ class AMapWrapper(map: MapAutoViewHelper?, mapView: MapAutoView, controller: IMo return AMapPolylineWrapper(options.id, delegate, mMapView) } - var batchMarkerOptions = BatchMarkerOptions() + private val batchMarkerOptions = BatchMarkerOptions() @SuppressLint("NewApi") override fun updateBatchMarkerPosition(optionsArrayList: HashMap?) { diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.kt b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.kt index 36e0efdfca..ff227c23ef 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.kt +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapView.kt @@ -52,6 +52,10 @@ open class MogoMapView : MogoBaseMapView, ILifeCycle { } } + override fun getInstanceTag(): String { + return "" + } + /** * 子类实现 * 代码StyleParams和XML初始化设置同时仅支持一种 @@ -61,10 +65,6 @@ open class MogoMapView : MogoBaseMapView, ILifeCycle { protected val styleParams: MapStyleParams? protected get() = null - override fun getInstanceTag(): String { - return MogoMap.DEFAULT - } - override fun onCreate(bundle: Bundle?) { super.onCreate(bundle) d(TAG, "onCreate") diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java deleted file mode 100644 index e69de29bb2..0000000000