This commit is contained in:
zhongchao
2022-01-24 20:35:03 +08:00
692 changed files with 3066 additions and 14200 deletions

View File

@@ -4,75 +4,83 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'android-aspectjx'
apply plugin: 'bugly'
apply plugin: 'apm-plugin'
if (!isAndroidTestBuild()) {
apply plugin: 'apm-plugin'
}
//apply ByteX宿主
apply plugin: 'bytex'
ByteX {
enable true
enableInDebug true
logLevel "DEBUG"
if (!isAndroidTestBuild()) {
apply plugin: 'bytex'
ByteX {
enable true
enableInDebug true
logLevel "DEBUG"
}
}
apply plugin: 'bytex.threadOpt'
if (!isAndroidTestBuild()) {
apply plugin: 'bytex.threadOpt'
thread_opt {
enable true
enableInDebug true
rxJavaIoReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getIoPool@@()Ljava/util/concurrent/ExecutorService;'
rxJavaComputationReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getCpuPool@@()Ljava/util/concurrent/ExecutorService;'
coroutineIoReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getIoPool@@()Ljava/util/concurrent/ExecutorService;'
coroutineDefaultReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getCpuPool@@()Ljava/util/concurrent/ExecutorService;'
}
thread_opt {
enable true
enableInDebug true
rxJavaIoReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getIoPool@@()Ljava/util/concurrent/ExecutorService;'
rxJavaComputationReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getCpuPool@@()Ljava/util/concurrent/ExecutorService;'
coroutineIoReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getIoPool@@()Ljava/util/concurrent/ExecutorService;'
coroutineDefaultReplacer 'com/mogo/eagle/core/utilcode/util/ThreadUtils@@getCpuPool@@()Ljava/util/concurrent/ExecutorService;'
/**
* 方便使用systrace工具在工程侧打点便于分析工程侧性能问题
*/
apply plugin: 'bytex.systrace'
systrace {
/**
* 交付时要关闭,会有性能损耗
*/
enable false
enableInDebug false
/**
* - 是否使用[Trace.beginAsyncSection(String, int)/Trace.endAsyncSection(String, int)]进行打点
* - 默认使用[Trace.beginSection(String)/Trace.endSection()]进行打点
*/
isTraceAsync false
/**
* - 是否在运行时只针对主线程打点,其它线程不打
*/
isOnlyMainThread false
/**
* - 是否忽略对类的静态构造方法打点
* - 默认不忽略
*/
isIgnoreClinitMethod false
/**
* - 是否忽略对类中的简单方法打点
* 简单方法定义:
* - 空方法
* - get/set 方法
* - 单独的方法,方法体内没有调用其它方法
* - 默认不忽略
*/
isIgnoreSampleMethod false
/**
* - 针对特定类集合,配置打点白名单,在此集合中的类中的所有方法不打点
* - 支持正则表达式
*/
whiteListForClass = []
/**
* - 针对特定包名集合,配置打点白名单,所有类以此包名为前缀的类不打点
* - 支持正则表达式
*/
whiteListForPackage = []
}
}
/**
* 方便使用systrace工具在工程侧打点便于分析工程侧性能问题
*/
apply plugin: 'bytex.systrace'
systrace {
/**
* 交付时要关闭,会有性能损耗
*/
enable false
enableInDebug false
/**
* - 是否使用[Trace.beginAsyncSection(String, int)/Trace.endAsyncSection(String, int)]进行打点
* - 默认使用[Trace.beginSection(String)/Trace.endSection()]进行打点
*/
isTraceAsync false
/**
* - 是否在运行时只针对主线程打点,其它线程不打
*/
isOnlyMainThread false
/**
* - 是否忽略对类的静态构造方法打点
* - 默认不忽略
*/
isIgnoreClinitMethod false
/**
* - 是否忽略对类中的简单方法打点
* 简单方法定义:
* - 空方法
* - get/set 方法
* - 单独的方法,方法体内没有调用其它方法
* - 默认不忽略
*/
isIgnoreSampleMethod false
/**
* - 针对特定类集合,配置打点白名单,在此集合中的类中的所有方法不打点
* - 支持正则表达式
*/
whiteListForClass = []
/**
* - 针对特定包名集合,配置打点白名单,所有类以此包名为前缀的类不打点
* - 支持正则表达式
*/
whiteListForPackage = []
}
/*apply plugin: 'chain.log.hook'
hooklog{
@@ -146,6 +154,10 @@ android {
targetCompatibility 1.8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
@@ -199,6 +211,10 @@ android {
packagingOptions {
exclude 'META-INF/io.netty.versions.properties'
}
useLibrary 'android.test.runner'
useLibrary 'android.test.base'
useLibrary 'android.test.mock'
}
repositories {
@@ -236,31 +252,38 @@ dependencies {
apply from: "./functions/tts.gradle"
apply from: "./functions/och.gradle"
androidTestImplementation rootProject.ext.dependencies.androidx_test_core
androidTestImplementation rootProject.ext.dependencies.androidx_test_core_ktx
androidTestImplementation rootProject.ext.dependencies.androidx_unit_ext
androidTestImplementation rootProject.ext.dependencies.androidx_unit_ext_ktx
androidTestImplementation rootProject.ext.dependencies.androidx_runner
androidTestImplementation rootProject.ext.dependencies.androidx_espresso_core
}
ApmPlugin {
// 是否进行插桩
enable true
// 是否在Debug包插桩默认不插桩
enableInDebug true
// DEBUG("DEBUG"), INFO("INFO"), WARN("WARN"), ERROR("ERROR");
// INFO 级别Log会汇总所有被插桩处理的类供查看路径 app/build/ByteX/ApmPlugin
logLevel "DEBUG"
// 启动分析开关监控App启动耗时需要同时开启pageLoadSwitch
startSwitch = true
// 页面响应开关监控Activity的生命周期耗时
pageLoadSwitch = true
// 网络监控开关监控okhttp3的网络请求
okHttp3Switch = true
// 白名单下的包进行插桩,需要填写要插装类所在的包名,支持前缀配置
whiteList = [
"com.mogo"
]
// 黑名单包下类不进行插桩,可以配置包名和类名,没有可以填空
blackList = [
if (!isAndroidTestBuild()) {
ApmPlugin {
// 是否进行插桩
enable true
// 是否在Debug包插桩默认不插桩
enableInDebug true
// DEBUG("DEBUG"), INFO("INFO"), WARN("WARN"), ERROR("ERROR");
// INFO 级别Log会汇总所有被插桩处理的类供查看路径 app/build/ByteX/ApmPlugin
logLevel "DEBUG"
// 启动分析开关监控App启动耗时需要同时开启pageLoadSwitch
startSwitch = true
// 页面响应开关监控Activity的生命周期耗时
pageLoadSwitch = true
// 网络监控开关:监控okhttp3的网络请求
okHttp3Switch = true
// 白名单下的包进行插桩,需要填写要插装类所在的包名,支持前缀配置
whiteList = [
"com.mogo"
]
// 黑名单包下类不进行插桩,可以配置包名和类名,没有可以填空
blackList = [
]
]
}
}
android.applicationVariants.all { variant ->
@@ -298,10 +321,20 @@ def getWorkingBranchName() {
*/
def getWorkingBranchHash() {
def workingBranchHash = ""
def proc = "git log -n1 --format=format:\"%h\"".execute()
def proc = "git log -n1 --format=format:%h".execute()
proc.in.eachLine { line -> workingBranchHash = line }
proc.err.eachLine { line -> println line }
proc.waitFor()
println "Working branch hash: " + workingBranchHash
return workingBranchHash
return "\"${workingBranchHash}\""
}
boolean isAndroidTestBuild() {
for (String s : gradle.startParameter.taskNames) {
if (s.contains("AndroidTest")) {
return true
}
}
return false
}

View File

@@ -0,0 +1,145 @@
package com.mogo.functions.test
import androidx.lifecycle.lifecycleScope
import androidx.test.core.app.ActivityScenario
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult
import com.mogo.eagle.core.function.hmi.ui.MoGoHmiFragment
import com.mogo.eagle.core.function.main.MainLauncherActivity
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.text.SimpleDateFormat
import java.util.*
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import kotlin.random.Random
@RunWith(AndroidJUnit4::class)
@LargeTest
class AutoPilotBadCaseTest {
lateinit var launch: ActivityScenario<MainLauncherActivity>
@Before
fun launch() {
launch = ActivityScenario.launch(MainLauncherActivity::class.java)
}
@ExperimentalCoroutinesApi @Test
fun showBadCaseEntrance1(): Unit = runBlocking(Dispatchers.Main) {
val f = ensureMoGoHmiFragmentShow()
var index = 0
(1 until 50)
.map { it }
.asFlow()
.onEach {
delay(TimeUnit.SECONDS.toMillis(5))
f.onAutopilotRecordResult(AutoPilotRecordResult().also {
it.diskFree = 100 + index
it.duration = 60.0
it.fileName = "/user/general/record_$index.log"
it.id = 10 + index
it.key = "yyy_$index"
it.stat = 100
it.type = 1
it.timestamp = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(Date())
index++
})
}
.flowOn(Dispatchers.Default)
.collect()
delay(TimeUnit.HOURS.toMillis(2))
}
@ExperimentalCoroutinesApi @Test
fun showBadCaseEntrance2():Unit = runBlocking(Dispatchers.Main) {
val f = ensureMoGoHmiFragmentShow()
var index = 0
(1 until 50)
.map { it }
.asFlow()
.onEach {
if (index in 1..4) {
delay(TimeUnit.SECONDS.toMillis(15))
} else {
delay(Random(20).nextLong())
}
f.onAutopilotRecordResult(AutoPilotRecordResult().also {
it.diskFree = 100 + index
it.duration = 60.0
it.fileName = "/user/general/record_$index.log"
it.id = 10 + index
it.key = "yyy_$index"
it.stat = 100
it.type = 1
it.timestamp = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(Date())
index++
})
if (index == 5) {
f.lifecycleScope.cancel()
}
}
.flowOn(Dispatchers.Default)
.collect()
delay(TimeUnit.HOURS.toMillis(2))
}
@ExperimentalCoroutinesApi @Test
fun showBadCaseEntrance3(): Unit = runBlocking(Dispatchers.Main) {
val f = ensureMoGoHmiFragmentShow()
var index = 0
(1 until 50)
.map { it }
.asFlow()
.onEach {
delay(TimeUnit.SECONDS.toMillis(20))
f.onAutopilotRecordResult(AutoPilotRecordResult().also {
it.diskFree = 100 + index
it.duration = 60.0
it.fileName = "/user/general/record_$index.log"
it.id = 10 + index
it.key = "yyy_$index"
it.stat = 100
it.type = 1
it.timestamp = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(Date())
index++
})
}
.flowOn(Dispatchers.Default)
.collect()
delay(TimeUnit.HOURS.toMillis(2))
}
private suspend fun ensureMoGoHmiFragmentShow(): MoGoHmiFragment = suspendCancellableCoroutine {
launch.onActivity { itx ->
val executor = Executors.newSingleThreadScheduledExecutor()
executor.scheduleAtFixedRate({
var find =
itx.supportFragmentManager.fragments.find { it is MoGoHmiFragment } as? MoGoHmiFragment
while (find == null) {
find =
itx.supportFragmentManager.fragments.find { it is MoGoHmiFragment } as? MoGoHmiFragment
}
while (!find.isResumed) {
Thread.sleep(500)
}
it.resumeWith(Result.success(find))
try {
Thread.sleep(500)
executor.shutdownNow()
} catch (e: Throwable) {
e.printStackTrace()
}
}, 50, 500, TimeUnit.MILLISECONDS)
}
}
}

View File

@@ -114,7 +114,7 @@ ext {
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
mogoobu : 'com.zhidao.support.obu:mogoobu:1.0.0.19',
mogoami : 'com.zhidao.support.obu.ami:mogoami:1.0.0.10',
adasHigh : 'com.zhidao.support.adas:high:1.2.1.2_bate3',
adasHigh : 'com.zhidao.support.adas:high:1.2.1.2_bate6',
// google
googlezxing : "com.google.zxing:core:3.3.3",
@@ -246,7 +246,16 @@ ext {
life_cycle_scope : "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0",
view_model_scope : "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0",
live_data_scope : "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0"
live_data_scope : "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0",
//========================== Unit Test ======================
androidx_test_core : "androidx.test:core:1.2.1",
androidx_test_core_ktx : "androidx.test:core-ktx:1.2.0",
androidx_unit_ext : "androidx.test.ext:junit:1.1.2",
androidx_unit_ext_ktx : "androidx.test.ext:junit-ktx:1.1.2",
androidx_runner : "androidx.test:runner:1.3.0",
androidx_espresso_core : "androidx.test.espresso:espresso-core:3.3.0",
]
}

View File

@@ -13,7 +13,6 @@ import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.LogUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.bean.IPCPowerInfo
import com.zhidao.support.adas.high.common.CupidLogUtils
import java.util.concurrent.TimeUnit
@@ -104,10 +103,14 @@ class MoGoAutopilotProvider :
}
override fun setIPCShutDown() {
AdasManager.getInstance().sendBaseInfo(IPCPowerInfo.shutdown())
AdasManager.getInstance().shutdownIPC()
}
override fun setIPCReboot() {
AdasManager.getInstance().sendBaseInfo(IPCPowerInfo.reboot())
AdasManager.getInstance().rebootIPC()
}
override fun recordCause(key: String?, name: String?, id: String?, reason: String?) {
AdasManager.getInstance().recordCause(key, name, id, reason)
}
}

View File

@@ -147,6 +147,14 @@ class WarningFloat {
}
}
fun setWindowWidth(width: Int) = apply {
this.config.width = width
}
fun setWindowHeight(height: Int) = apply {
this.config.height = height
}
/**
* 创建浮窗包括Activity浮窗和系统浮窗如若系统浮窗无权限先进行权限申请
*/

View File

@@ -65,8 +65,8 @@ internal class WarningFloatWindowHelper(
// 没有边界限制,允许窗口扩展到屏幕外
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
else WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
width = WindowManager.LayoutParams.WRAP_CONTENT
height = WindowManager.LayoutParams.WRAP_CONTENT
width = config.width
height = config.height
// 如若设置了固定坐标,直接定位
if (config.locationPair != Pair(0, 0)) {

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.hmi.notification
import android.view.View
import android.view.WindowManager
import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator
import com.mogo.eagle.core.function.hmi.notification.enums.ShowPattern
import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern
@@ -59,4 +60,9 @@ data class WarningNotificationConfig(
// Callbacks
var callbacks: OnFloatCallbacks? = null,
// 窗口宽度
var width: Int = WindowManager.LayoutParams.WRAP_CONTENT,
// 窗口高度
var height: Int = WindowManager.LayoutParams.WRAP_CONTENT
)

View File

@@ -30,7 +30,6 @@ class TurnLightBroadcastReceiver : BroadcastReceiver() {
try {
val type = intent.getIntExtra("type", 0)
val lightInt = intent.getIntExtra("light", 0)
Logger.d("liyz", "TurnLightBroadcastReceiver type = $type ---- lightInt = $lightInt")
showTurnLight(type, lightInt)
} catch (e: Exception) {
e.printStackTrace()

View File

@@ -1,23 +1,30 @@
package com.mogo.eagle.core.function.hmi.ui
import android.animation.Animator
import android.os.Bundle
import android.os.Handler
import android.text.TextUtils
import android.util.Log
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import android.view.*
import android.view.animation.OvershootInterpolator
import androidx.annotation.VisibleForTesting
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult
import com.mogo.eagle.core.data.camera.CameraEntity
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.check.CallerCheckManager
import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager
import com.mogo.eagle.core.function.hmi.R
@@ -30,12 +37,21 @@ 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
import com.mogo.eagle.core.function.hmi.ui.tools.AutoPilotAndCheckView
import com.mogo.eagle.core.function.hmi.ui.tools.AutoPilotBadCaseView
import com.mogo.eagle.core.function.hmi.ui.tools.post
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.module.common.enums.EventTypeEnum
import kotlinx.android.synthetic.main.fragment_hmi.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED
import java.text.SimpleDateFormat
import java.util.*
import java.util.concurrent.TimeUnit
/**
* @author xiaoyuzhou
@@ -45,7 +61,7 @@ import kotlinx.android.synthetic.main.fragment_hmi.*
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_HMI)
class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>(),
IMoGoWaringProvider,
MoGoWarningContract.View {
MoGoWarningContract.View, IMoGoAutopilotIdentifyListener {
private val TAG = "MoGoHmiFragment"
// DebugSettingView
@@ -64,9 +80,106 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
private var toolsView: AutoPilotAndCheckView? = null
private var autoPilotToolsFloat: WarningFloat.Builder? = null
// 检测、自动驾驶速度设置
private var toolsViewFloat: WarningFloat.Builder? = null
@Volatile
private var autoPilotBadCaseEntrance: View? = null
private var autoPilotBadCaseView: AutoPilotBadCaseView? = null
companion object {
private const val MSG_WHAT_DISMISS_BAD_CASE_ENTRY = 0x1010
private val DURATION_FOR_DISMISS = TimeUnit.HOURS.toMillis(4)
}
@ExperimentalCoroutinesApi
private val channel by lazy {
Channel<AutoPilotRecordResult?>(UNLIMITED).also {
lifecycleScope.launchWhenResumed {
withContext(Dispatchers.Default) {
while (!it.isClosedForReceive) {
try {
val entrance = autoPilotBadCaseEntrance
val old = entrance?.getTag(R.id.autopilot_badcase_record) as? AutoPilotRecordResult
if (entrance == null || old == null || old.consumed) {
Logger.d(TAG, "-- step -- 1 --")
var oldT = try {
old?.timestamp?.takeIf { it.isNotBlank() }?.let {
SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.getDefault()).parse(it)?.time ?: 0L
} ?: 0L
} catch (t: Throwable) {
t.printStackTrace()
0L
}
var record: AutoPilotRecordResult? = null
var newT = try {
it.receive()?.also { record = it }?.timestamp?.takeIf { it.isNotBlank() }?.let {
SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.getDefault()).parse(it)?.time
?: 0L
} ?: 0L
} catch (t: Throwable) {
t.printStackTrace()
0L
}
if (oldT == 0L || (newT > 0L && (newT - oldT > 0L) && (newT - oldT) < DURATION_FOR_DISMISS)) {
Logger.d(TAG, "-- step -- 2 --")
record?.takeIf { it.key != old?.key && it.timestamp != old?.timestamp }?.also {
Logger.d(TAG, "record: [$record] is displaying and consuming ~~~" )
showBadCaseEntrance(it)
}
continue
}
while (oldT != 0L && newT != 0L && (newT - oldT) >= DURATION_FOR_DISMISS) {
Logger.d(TAG, "record: [$record] has been discarded, because it has been timeout." )
oldT = newT
newT = try {
it.receive()?.also {
record = it
}?.timestamp?.takeIf { it.isNotBlank() }?.let {
SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.getDefault()).parse(it)?.time ?: 0L
} ?: 0L
} catch (t: Throwable) {
t.printStackTrace()
0L
}
}
record?.takeIf { it.key != old?.key && it.timestamp != old?.timestamp }?.also {
Logger.d(TAG, "record: [$record] is displaying for rest ..." )
showBadCaseEntrance(it)
}
} else {
Logger.d(TAG, "record: [$old] hasn't been consumed~~~~" )
}
} finally {
delay(1000)
}
}
}
}
}
}
private val handler by lazy {
Handler(Handler.Callback {
if (it.what == MSG_WHAT_DISMISS_BAD_CASE_ENTRY) {
val entrance = autoPilotBadCaseEntrance
if (entrance != null && entrance.visibility == View.VISIBLE) {
Logger.d(TAG, "${DURATION_FOR_DISMISS}毫秒后BadCase入口消失")
(entrance.getTag(R.id.autopilot_badcase_record) as? AutoPilotRecordResult)?.let { itx ->
itx.consumed = true
}
entrance.visibility = View.GONE
}
return@Callback true
}
return@Callback false
})
}
override fun vipIdentification(visible: Boolean) {
ThreadUtils.runOnUiThread {
@@ -94,50 +207,157 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
}
viewShowDebugView.setOnLongClickListener {
Log.d(TAG, "长按显示状态工具栏")
context?.let {
if (mDebugSettingViewFloat != null) {
WarningFloat.dismiss(mDebugSettingViewFloat!!.config.floatTag, false)
mDebugSettingViewFloat = null
mDebugSettingView = null
} else {
if (mDebugSettingView == null) {
mDebugSettingView = DebugSettingView(it)
}
mDebugSettingViewFloat = WarningFloat.with(it)
.setTag("DebugSettingView")
.setLayout(mDebugSettingView!!)
.setSidePattern(SidePattern.RIGHT)
.setGravity(Gravity.RIGHT, offsetY = 70)
.setImmersionStatusBar(true)
.setAnimator(object : DefaultAnimator() {
override fun enterAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.enterAnim(view, params, windowManager, sidePattern)
?.apply {
interpolator = OvershootInterpolator()
}
override fun exitAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.exitAnim(view, params, windowManager, sidePattern)
?.setDuration(200)
})
.show()
}
}
toggleDebugView()
true
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
}
@ExperimentalCoroutinesApi
override fun onAutopilotRecordResult(record: AutoPilotRecordResult?) {
record ?: return
Logger.d(TAG, "onAutopilotRecordResult:$record")
if (record.type == 1 && record.stat == 100) {
lifecycleScope.launchWhenResumed {
channel.send(record)
}
}
}
override fun onDestroyView() {
super.onDestroyView()
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
}
@VisibleForTesting
fun showBadCaseEntrance(record: AutoPilotRecordResult) {
Logger.d(TAG, "showBadCaseEntrance:$record")
lifecycleScope.launch {
if (vs_bad_case_entrance?.parent != null) {
val inflateView = vs_bad_case_entrance.inflate()
autoPilotBadCaseEntrance = inflateView
}
val entrance = autoPilotBadCaseEntrance
if (entrance != null) {
if (entrance.visibility != View.VISIBLE) {
entrance.visibility = View.VISIBLE
}
entrance.setTag(R.id.autopilot_badcase_record, record)
entrance.onClick {
showBadCasesFloat {
it.visibility = View.GONE
}
}
dismissBadCaseEntryAfterSomeTime()
}
}
}
private fun showBadCasesFloat(dismiss: (() -> Unit)?) {
Logger.d(TAG, "showBadCaseToolsFloat")
context?.let { it ->
if (autoPilotToolsFloat == null) {
if (autoPilotBadCaseView == null) {
autoPilotBadCaseView = AutoPilotBadCaseView(it).also { itx ->
itx.onDismiss {
val record =
autoPilotBadCaseEntrance?.getTag(R.id.autopilot_badcase_record) as? AutoPilotRecordResult
dismissBadCaseFloatView()
}
itx.onSelect {
lifecycleScope.launch {
val record =
autoPilotBadCaseEntrance?.getTag(R.id.autopilot_badcase_record) as? AutoPilotRecordResult
try {
val params = mutableMapOf<String, String>()
autoPilotBadCaseEntrance?.apply {
params["carLicense"] =
MoGoAiCloudClientConfig.getInstance().sn
params["filename"] = record?.fileName ?: ""
params["filesize"] = record?.total.toString()
params["key"] = record?.key ?: ""
params["reason"] = it.reason ?: ""
params["timestamp"] = System.currentTimeMillis().toString()
}
val response = post(params)
if (response.isSuccessful) {
val body = response.body()
if (body == null) {
Logger.e(TAG, "返回的body是空的~~~")
return@launch
}
if (body.code == 200) {
Logger.i(TAG, "ok:${body}")
dismissBadCaseFloatView()
dismiss?.invoke()
CallerAutoPilotManager.recordCause(
record?.key,
record?.fileName,
it.id, it.reason)
ToastUtils.showShort("接管反馈成功~")
record?.consumed = true
return@launch
}
Logger.e(TAG, "fail:${body}")
}
} catch (t: Throwable) {
t.printStackTrace()
ToastUtils.showShort("网络请求失败,请尝试联网~")
Logger.e(TAG, "exception:${t.message}")
}
}
}
}
}
autoPilotToolsFloat = WarningFloat.with(it)
.setTag("BadCaseCollectFloat")
.setLayout(autoPilotBadCaseView!!)
.setSidePattern(SidePattern.LEFT)
.setGravity(Gravity.LEFT, offsetY = 72)
.setImmersionStatusBar(true)
.setAnimator(object : DefaultAnimator() {
override fun enterAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.enterAnim(view, params, windowManager, sidePattern)
?.apply {
interpolator = OvershootInterpolator()
}
override fun exitAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.exitAnim(view, params, windowManager, sidePattern)
?.setDuration(200)
})
.addWarningStatusListener(object : IMoGoWarningStatusListener {
override fun onDismiss() {
autoPilotToolsFloat = null
autoPilotBadCaseView = null
}
})
.show()
} else {
autoPilotToolsFloat?.show()
}
}
}
private fun dismissBadCaseEntryAfterSomeTime() {
handler.removeMessages(MSG_WHAT_DISMISS_BAD_CASE_ENTRY)
handler.sendEmptyMessageDelayed(MSG_WHAT_DISMISS_BAD_CASE_ENTRY, DURATION_FOR_DISMISS)
}
private fun showToolsFloat() {
Logger.d(TAG, "showToolsFloat")
context?.let {
@@ -154,6 +374,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
override fun onClose(v: View) {
dismissToolsFloatView()
}
override fun showDebugPanelView() {
toggleDebugView()
}
})
}
toolsViewFloat = WarningFloat.with(it)
@@ -259,6 +483,52 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
ivToolsIcon?.visibility = visibility
}
/**
* 开关DebugView
*/
override fun toggleDebugView() {
Log.d(TAG, "长按显示状态工具栏")
context?.let {
if (mDebugSettingViewFloat != null) {
WarningFloat.dismiss(mDebugSettingViewFloat!!.config.floatTag, false)
mDebugSettingViewFloat = null
mDebugSettingView = null
} else {
if (mDebugSettingView == null) {
mDebugSettingView = DebugSettingView(it)
}
mDebugSettingViewFloat = WarningFloat.with(it)
.setTag("DebugSettingView")
.setLayout(mDebugSettingView!!)
.setSidePattern(SidePattern.RIGHT)
.setGravity(Gravity.RIGHT, offsetY = 70)
.setImmersionStatusBar(true)
.setAnimator(object : DefaultAnimator() {
override fun enterAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.enterAnim(view, params, windowManager, sidePattern)
?.apply {
interpolator = OvershootInterpolator()
}
override fun exitAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.exitAnim(view, params, windowManager, sidePattern)
?.setDuration(200)
})
.show()
}
}
}
/**
* 展示VR下V2X预警
*
@@ -637,12 +907,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
}
/**
* 显示转向灯效果 TODO
* 显示转向灯效果
*/
override fun showTurnLight(light: Int) {
//Logger.d("liyz", "hmiFragment showTurnLight --- light = $light")
// turnLightView?.visibility = View.VISIBLE
turnLightView.setTurnLight(light)
// turnLightView.setTurnLight(light)
}
@@ -650,15 +918,66 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
* 显示刹车效果
*/
override fun showBrakeLight(light: Int) {
//Logger.d("liyz", "hmiFragment showBrakeLight --- light = $light")
// brakeView?.visibility = View.VISIBLE
brakeView.setBrakeLight(light)
// brakeView.setBrakeLight(light)
}
/**
* 展示工控机下载状态信息
* @param downloadVersion 下载版本
* @param downloadStatus 下载状态(0:下载完成1:正在下载2:下载失败)
* @param downloadProgress 下载进度
*/
override fun showAdDownloadStatus(
downloadVersion: String,
downloadStatus: Int,
downloadProgress: Int
) {
// if (downloadProgress>0){
// //新版工控机包处于下载中或已下载完成状态,展示工具箱提示角标
// viewUpgradeTips.visibility = View.VISIBLE
// }
if(downloadStatus==0){
//新版本工控机包下载完成,处于可升级状态,展示工具箱提示角标
viewUpgradeTips.visibility = View.VISIBLE
}else if(downloadStatus==1){
//新版本工控机包正在下载中,展示工具箱提示角标
viewUpgradeTips.visibility = View.VISIBLE
}else if(downloadStatus==2){
//新版本工控机包下载失败,隐藏工具箱提交角标
viewUpgradeTips.visibility = View.GONE
}
}
/**
* 展示工控机升级状态信息
* @param upgradeStatus 升级状态true代表升级成功、false代表升级不成功
*/
override fun showAdUpgradeStatus(upgradeStatus: Boolean) {
if(upgradeStatus){
//工控机升级成功,隐藏工具箱提示角标
viewUpgradeTips.visibility = View.GONE
}else{
//工控机升级失败,展示工具箱提示角标
viewUpgradeTips.visibility = View.VISIBLE
}
//TODO 给工具箱空间传递状态
// toolsView?.setStatus(true)
}
private fun dismissBadCaseFloatView() {
autoPilotToolsFloat?.let {
WarningFloat.dismiss(it.config.floatTag, false)
autoPilotToolsFloat = null
autoPilotBadCaseView = null
}
}
override fun onDestroy() {
super.onDestroy()
Log.d(TAG, "onDestroy")
handler.removeCallbacksAndMessages(null)
}

View File

@@ -81,17 +81,26 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
viewCheckStatus.setOnClickListener {
clickListener?.go2CheckPage()
}
ivDebugPanel.setOnClickListener {
clickListener?.showDebugPanelView()
}
etInputSpeed.setOnTouchListener { v, _ ->
if (etInputSpeed.hasFocusable()) {
if (keyBoardUtil == null) {
keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed)
if (!connectStatus) {
ToastUtils.showShort("设置车速失败,请启动域控制器")
keyBoardUtil?.hideKeyboard()
return@setOnTouchListener true
} else {
if (etInputSpeed.hasFocusable()) {
if (keyBoardUtil == null) {
keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed)
}
keyBoardUtil?.showKeyboard()
}
keyBoardUtil?.showKeyboard()
if (!etInputSpeed.hasFocus()) {
etInputSpeed.requestFocus()
}
return@setOnTouchListener false
}
if (!etInputSpeed.hasFocus()) {
etInputSpeed.requestFocus()
}
return@setOnTouchListener false
}
// // 比如需要设置默认速度
// val speed = "30"
@@ -124,5 +133,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
interface ClickListener {
fun go2CheckPage()
fun onClose(v: View)
fun showDebugPanelView()
}
}

View File

@@ -0,0 +1,338 @@
package com.mogo.eagle.core.function.hmi.ui.tools
import android.annotation.SuppressLint
import android.content.Context
import android.content.Context.MODE_PRIVATE
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.StateListDrawable
import android.os.Handler
import android.util.AttributeSet
import android.util.StateSet
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.Keep
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.gson.annotations.Expose
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.debug.DebugConfig.getNetMode
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.tools.BadCaseEntity.Reason
import com.mogo.eagle.core.network.RetrofitFactory
import com.mogo.eagle.core.network.utils.GsonUtil
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.Utils
import kotlinx.android.synthetic.main.layout_badcase_collect.view.*
import kotlinx.coroutines.*
import kotlinx.coroutines.android.asCoroutineDispatcher
import retrofit2.Response
import retrofit2.http.FieldMap
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.POST
import kotlin.Result.Companion.failure
import kotlin.Result.Companion.success
private typealias OnDismissCallback = () -> Unit
private typealias OnSelectCallback = (Reason) -> Unit
interface BadCaseApi {
@FormUrlEncoded
@POST("/yycp-vehicle-management-service/tool/badcase/add")
suspend fun post(@FieldMap map: Map<String, String>): Response<PostResult>
@GET("/yycp-vehicle-management-service/tool/badcase/reasons")
suspend fun get(): Response<BadCaseEntity>
}
@Keep
class BadCaseEntity {
var code: Int = -1
var data: List<Reason>? = null
var msg: String? = null
var success: Boolean = false
var total: Int = -1
@Expose(serialize = false, deserialize = false)
var isBuildIn: Boolean = false
@Keep
class Reason {
var id: String? = null
var reason: String? = null
/**
* 业务字段,不参与序列化和反序列化
*/
@Expose(deserialize = false, serialize = false)
var isChecked: Boolean = false
}
}
@Keep
class PostResult {
var code: Int = -1
var msg: String? = null
var data: Array<String>? = null
var success: Boolean = false
override fun toString(): String {
return "Result(code=$code, msg=$msg, data=${data?.contentToString()}, success=$success)"
}
}
private fun getHost(): String = if (getNetMode() == DebugConfig.NET_MODE_RELEASE) "http://dzt.zhidaozhixing.com" else "http://front.zdjs-private-test.myghost.zhidaoauto.com"
internal suspend fun post(map: Map<String, String>): Response<PostResult> {
return RetrofitFactory.getInstance(getHost()).create(BadCaseApi::class.java).post(map)
}
private suspend fun get(): Response<BadCaseEntity>? {
return try { RetrofitFactory.getInstance(getHost()).create(BadCaseApi::class.java).get() } catch (t: Throwable) { t.printStackTrace(); null}
}
private suspend fun updateCache(entity: BadCaseEntity) = suspendCancellableCoroutine<Unit> {
try {
val future = ThreadUtils.getIoPool().submit {
try {
val gson = GsonUtil.jsonFromObject(entity)
Sp.saveBody(gson)
it.resumeWith(success(Unit))
} catch (t: Throwable) {
it.resumeWith(failure(t))
}
}
it.invokeOnCancellation {
future.cancel(true)
}
} catch (e: Throwable) {
it.resumeWith(failure(e))
}
}
private suspend fun getCache(): BadCaseEntity? = suspendCancellableCoroutine {
try {
val body = Sp.getBody()
if (body != null && body.isNotEmpty()) {
val future = ThreadUtils.getIoPool().submit {
try {
val result = GsonUtil.objectFromJson(body, BadCaseEntity::class.java)
it.resumeWith(success(result))
} catch (t: Throwable) {
it.resumeWith(success(null))
}
}
it.invokeOnCancellation {
future.cancel(true)
}
}
} catch (t: Throwable) {
it.resumeWith(success(null))
}
}
private fun getBuildIn(): BadCaseEntity = BadCaseEntity().also { itx ->
val data = mutableListOf<Reason>()
data += Reason().also {
it.reason = "变道有干扰"
}
data += Reason().also {
it.reason = "遇红绿灯未停车"
}
data += Reason().also {
it.reason = "遇障碍物未停车"
}
itx.data = data
itx.isBuildIn = true
}
internal object Sp {
private val sp by lazy {
Utils.getApp().getSharedPreferences("bad_case_prefs", MODE_PRIVATE)
}
@SuppressLint("ApplySharedPref")
fun saveBody(body: String) {
sp.edit().putString("prefs", body).commit()
}
fun getBody(): String? {
return sp.getString("prefs", null)
}
}
class AutoPilotBadCaseView: ConstraintLayout {
private var dismiss: OnDismissCallback? = null
private var select: OnSelectCallback? = null
private var cases: List<Reason>? = null
private var selectCase: Reason? = null
private val scope = CoroutineScope(Handler().asCoroutineDispatcher() + SupervisorJob())
constructor(context: Context) : this(context, null)
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
LayoutInflater.from(context).inflate(R.layout.layout_badcase_collect, this, true)
background = ColorDrawable(Color.parseColor("#F0151D41"))
isClickable = true
layoutParams = ViewGroup.LayoutParams(960.toPixels().toInt(), 1528.toPixels().toInt())
close?.onClick {
dismiss?.invoke()
}
cancel?.also {
it.background = shape(solid = Color.parseColor("#3B4577"), radius = 16)
it.onClick {
dismiss?.invoke()
}
}
ok?.also {
val enabled = gradient(radius = 16.toPixels().toInt(), orientation = GradientDrawable.Orientation.LEFT_RIGHT, centerX = 0.06f, startColor = Color.rgb(35, 146, 252), endColor = Color.rgb(28, 75, 252))
val disabled = gradient(radius = 16.toPixels().toInt(), orientation = GradientDrawable.Orientation.LEFT_RIGHT, centerX = 0.06f, startColor = Color.rgb(24, 71, 129), endColor = Color.rgb(21, 46, 129))
it.background = object : StateListDrawable() {}.also { itx ->
itx.addState(intArrayOf(android.R.attr.state_enabled), enabled)
itx.addState(StateSet.WILD_CARD, disabled)
}
it.onClick {
val case = selectCase
if (case != null) {
select?.invoke(case)
}
}
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
val adapter = rv_take_over?.adapter
if (adapter != null && adapter.itemCount > 0) {
return
}
scope.launch {
showLoading()
try {
get()?.takeIf { it.isSuccessful && it.body() != null && it.body()?.code == 200 }?.let {
val entity = it.body()!!
try {
updateCache(entity)
} catch (t: Throwable) {
t.printStackTrace()
} finally {
updateBadCaseList(entity)
}
}
?:
getCache()?.also {
updateBadCaseList(it)
}
?:
updateBadCaseList(getBuildIn())
} finally {
hideLoading()
}
}
}
private fun updateBadCaseList(body: BadCaseEntity) {
cases = body.data
rv_take_over?.let {
it.layoutManager = LinearLayoutManager(it.context, LinearLayoutManager.VERTICAL, false)
it.adapter = object : RecyclerView.Adapter<BadCaseViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BadCaseViewHolder = BadCaseViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.layout_badcase_item, parent, false))
override fun onBindViewHolder(holder: BadCaseViewHolder, position: Int) {
val cases = cases
if (cases == null || cases.isEmpty()) {
return
}
if (position >= cases.size) {
return
}
val case = cases[position]
holder.bindData(case)
}
override fun getItemCount(): Int = cases?.size ?: 0
}
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
scope.cancel("Cancel all for AutoPilotBadCaseView#onDetachedFromWindow")
}
private fun showLoading() {
pb?.let {
it.visibility = View.VISIBLE
}
}
private fun hideLoading() {
pb?.let {
it.visibility = View.INVISIBLE
}
}
private inner class BadCaseViewHolder(item: View) : RecyclerView.ViewHolder(item) {
private val check: ImageView = item.findViewById(R.id.check)
private val reason: TextView = item.findViewById(R.id.reason)
init {
check.background = StateListDrawable().also {
it.addState(intArrayOf(android.R.attr.state_selected), ContextCompat.getDrawable(itemView.context, R.drawable.icon_ap_badcase_check))
it.addState(StateSet.WILD_CARD, ContextCompat.getDrawable(itemView.context, R.drawable.icon_ap_badcase_default))
}
}
@SuppressLint("NotifyDataSetChanged")
fun bindData(case: Reason) {
check.isSelected = case.isChecked
reason.text = case.reason ?: ""
if (case.isChecked) {
ok?.isSelected = true
}
itemView.onClick {
case.isChecked = !case.isChecked
selectCase = case
cancelOtherChecked(case)
ok?.isEnabled = hasCheckedItem()
rv_take_over?.adapter?.notifyDataSetChanged()
}
}
private fun hasCheckedItem(): Boolean = cases?.find { it.isChecked } != null
private fun cancelOtherChecked(case: Reason) {
val cases = cases
if (cases == null || cases.isEmpty()) {
return
}
cases.filterNot { it == case }.forEach {
it.isChecked = false
}
}
}
fun onDismiss(dismiss:() -> Unit) {
this.dismiss = dismiss
}
fun onSelect(cb:(Reason) -> Unit) {
this.select = cb
}
}

View File

@@ -33,46 +33,53 @@ class BrakeViewStatus @JvmOverloads constructor(
LayoutInflater.from(context).inflate(R.layout.view_brake_light_status, this, true)
}
private var isBrake :Boolean = false
/**
* 刹车动画
*/
fun setBrakeLight(brakeLight: Int) {
if (brakeLight == 1) { //TODO 暂时还不知道数据,如果一直猜会怎样?
var appearAnimation = AlphaAnimation(0f, 1f)
appearAnimation.duration = 300
layout_brake.startAnimation(appearAnimation)
image_brake.startAnimation(appearAnimation)
tv_brake.startAnimation(appearAnimation)
layout_brake.visibility = View.VISIBLE
image_brake.visibility = View.VISIBLE
tv_brake.visibility = View.VISIBLE
} else { //不踩刹车,就消失
GlobalScope.launch(Dispatchers.Main) {
scaleImageAndTv()
if (!isBrake) {
var appearAnimation = AlphaAnimation(0f, 1f)
appearAnimation.duration = 300
layout_brake.startAnimation(appearAnimation)
image_brake.startAnimation(appearAnimation)
tv_brake.startAnimation(appearAnimation)
layout_brake.visibility = View.VISIBLE
image_brake.visibility = View.VISIBLE
tv_brake.visibility = View.VISIBLE
isBrake = true
}
var disappearAnimation = AlphaAnimation(1f, 0f)
disappearAnimation.duration = 1200
layout_brake.startAnimation(disappearAnimation)
image_brake.startAnimation(disappearAnimation)
tv_brake.startAnimation(disappearAnimation)
disappearAnimation.setAnimationListener(object: Animation.AnimationListener{
override fun onAnimationRepeat(p0: Animation?) {
} else { //不踩刹车,就消失
if (isBrake) {
isBrake = false
GlobalScope.launch(Dispatchers.Main) {
scaleImageAndTv()
}
override fun onAnimationStart(p0: Animation?) {
}
var disappearAnimation = AlphaAnimation(1f, 0f)
disappearAnimation.duration = 1200
layout_brake.startAnimation(disappearAnimation)
image_brake.startAnimation(disappearAnimation)
tv_brake.startAnimation(disappearAnimation)
override fun onAnimationEnd(p0: Animation?) {
layout_brake.visibility = View.GONE
image_brake.visibility = View.GONE
tv_brake.visibility = View.GONE
disappearAnimation.setAnimationListener(object: Animation.AnimationListener{
override fun onAnimationRepeat(p0: Animation?) {
}
stopAnimate()
}
})
override fun onAnimationStart(p0: Animation?) {
}
override fun onAnimationEnd(p0: Animation?) {
layout_brake.visibility = View.GONE
image_brake.visibility = View.GONE
tv_brake.visibility = View.GONE
stopAnimate()
}
})
}
}
}

View File

@@ -30,11 +30,55 @@ class TurnLightViewStatus @JvmOverloads constructor(
LayoutInflater.from(context).inflate(R.layout.view_turn_light_status, this, true)
}
private var isShowNormalBg :Boolean = false
private var isLeftLight :Boolean = false
private var isRightLight :Boolean = false
private var isDisappare :Boolean = false
/**
* 转向灯动画
*/
fun setTurnLight(directionLight: Int) {
//显示背景
if (!isShowNormalBg && (directionLight == 1 || directionLight == 2)) {
showNormalAnimation()
isShowNormalBg = true
}
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
if (directionLight == 1) { //左转向
if (!isLeftLight) {
left_select_image.visibility = View.VISIBLE
right_select_image.visibility = View.GONE
right_select_image.clearAnimation()
setAnimation(left_select_image)
isLeftLight = true
isRightLight = false
isDisappare = false
}
} else if (directionLight == 2) { //右转向
if (!isRightLight) {
left_select_image.visibility = View.GONE
right_select_image.visibility = View.VISIBLE
left_select_image.clearAnimation()
setAnimation(right_select_image)
isRightLight = true
isLeftLight = false
isDisappare = false
}
} else { //消失
if (!isDisappare) {
animationDisappear()
isDisappare = true
isShowNormalBg = false
isLeftLight = false
isDisappare = false
}
}
}
//显示背景
private fun showNormalAnimation() {
val appearAnimation = AlphaAnimation(0f, 1.0f)
appearAnimation.duration = 600
val appearAnimationImage = AlphaAnimation(0f, 1.0f)
@@ -46,36 +90,24 @@ class TurnLightViewStatus @JvmOverloads constructor(
turn_light_layout.visibility = View.VISIBLE
left_nor_image.visibility = View.VISIBLE
right_nor_image.visibility = View.VISIBLE
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
if (directionLight == 1) { //左转向
left_select_image.visibility = View.VISIBLE
right_select_image.visibility = View.GONE
right_select_image.clearAnimation()
setAnimation(left_select_image)
} else if (directionLight == 2) { //右转向
left_select_image.visibility = View.GONE
right_select_image.visibility = View.VISIBLE
left_select_image.clearAnimation()
setAnimation(right_select_image)
} else { //消失
animationDisappear()
stopAnimate()
}
}
//消失动画,当转向等数据为空时候
private fun animationDisappear() {
left_select_image.visibility = View.GONE
right_select_image.visibility = View.GONE
left_select_image.clearAnimation()
right_select_image.clearAnimation()
val disappearAnimationLeft = AlphaAnimation(1.0f, 0f)
disappearAnimationLeft.duration = 200
disappearAnimationLeft.duration = 300
val disappearAnimationBg = AlphaAnimation(1.0f, 0f)
disappearAnimationBg.duration = 1000
turn_light_layout.startAnimation(disappearAnimationBg)
disappearAnimationBg.duration = 1200
left_nor_image.startAnimation(disappearAnimationLeft)
right_nor_image.startAnimation(disappearAnimationLeft)
turn_light_layout.startAnimation(disappearAnimationBg)
disappearAnimationLeft.setAnimationListener(object : Animation.AnimationListener {
override fun onAnimationRepeat(p0: Animation?) {
@@ -99,6 +131,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
override fun onAnimationEnd(p0: Animation?) {
turn_light_layout.visibility = View.GONE
stopAnimate()
}
})
}
@@ -114,8 +147,9 @@ class TurnLightViewStatus @JvmOverloads constructor(
}
private fun stopAnimate() {
left_select_image.clearAnimation()
right_select_image.clearAnimation()
turn_light_layout.clearAnimation()
left_nor_image.clearAnimation()
right_nor_image.clearAnimation()
}
}

View File

@@ -0,0 +1,191 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.animation.ValueAnimator
import android.content.Context
import android.content.res.TypedArray
import android.graphics.*
import android.util.AttributeSet
import android.view.View
import android.view.animation.OvershootInterpolator
import androidx.core.content.ContextCompat
import com.mogo.eagle.core.function.hmi.R
/**
* @author XuXinChao
* @description 自定义圆形进度条
* @since: 2022/1/14
*/
class CircularProgressView @JvmOverloads constructor(
context: Context, attrs: AttributeSet?, defStyleAttr : Int)
: View(context, attrs, defStyleAttr){
val typedArray : TypedArray = context.obtainStyledAttributes(attrs, R.styleable.CircularProgressView)
// 绘制画笔
private val mBackPaint : Paint = Paint()
private val mProgPaint : Paint = Paint()
// 绘制区域
private var mRectF : RectF? = null
// 圆环渐变色
private var mColorArray : IntArray?=null
// 圆环进度(0-100) 初始化进度
private var mProgress : Int = typedArray.getInteger(R.styleable.CircularProgressView_progress, 0)
constructor(context : Context) : this(context,null)
constructor(context : Context,attrs : AttributeSet?) :this(context, attrs, 0)
init {
// 初始化背景圆环画笔
mBackPaint.style = Paint.Style.STROKE // 只描边,不填充
mBackPaint.strokeCap = Paint.Cap.ROUND // 设置圆角
mBackPaint.isAntiAlias = true // 设置抗锯齿
mBackPaint.isDither = true // 设置抖动
mBackPaint.strokeWidth = typedArray.getDimension(R.styleable.CircularProgressView_backWidth, 5.0f)
mBackPaint.color = typedArray.getColor(R.styleable.CircularProgressView_backColor, Color.LTGRAY)
// 初始化进度圆环画笔
mProgPaint.style = Paint.Style.STROKE // 只描边,不填充
mProgPaint.strokeCap = Paint.Cap.ROUND // 设置圆角
mProgPaint.isAntiAlias = true // 设置抗锯齿
mProgPaint.isDither = true // 设置抖动
mProgPaint.strokeWidth = typedArray.getDimension(R.styleable.CircularProgressView_progWidth, 10.0f)
mProgPaint.color = typedArray.getColor(R.styleable.CircularProgressView_progColor, Color.BLUE)
// 初始化进度圆环渐变色
val startColor = typedArray.getColor(R.styleable.CircularProgressView_progStartColor, -1)
val firstColor = typedArray.getColor(R.styleable.CircularProgressView_progFirstColor, -1)
if(startColor != -1 && firstColor != -1){
mColorArray = intArrayOf(startColor,firstColor)
}else{
mColorArray = null
}
typedArray.recycle();
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
val viewWide = getMeasuredWidth() - getPaddingLeft() - getPaddingRight();
val viewHigh = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
val mRectLength =
((if (viewWide > viewHigh) viewHigh else viewWide) - if (mBackPaint.strokeWidth > mProgPaint.strokeWidth) mBackPaint.strokeWidth else mProgPaint.strokeWidth).toInt()
val mRectL = getPaddingLeft() + (viewWide - mRectLength) / 2
val mRectT = getPaddingTop() + (viewHigh - mRectLength) / 2
mRectF = RectF(mRectL.toFloat(), mRectT.toFloat(), (mRectL + mRectLength).toFloat(),
(mRectT + mRectLength).toFloat())
// 设置进度圆环渐变色
mColorArray?.let {
mProgPaint.shader = LinearGradient(
0.0f, 0.0f, 0.0f,
measuredWidth.toFloat(), it, null, Shader.TileMode.MIRROR)
}
}
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
canvas?.let {
mRectF?.let { it1 -> it.drawArc(it1, 0.0f, 360.0f, false, mBackPaint) }
mRectF?.let { it1 -> it.drawArc(it1, 275.0f,
(360 * mProgress / 100).toFloat(), false, mProgPaint) }
}
}
/**
* 获取当前进度
* @return 当前进度0-100
*/
fun getProgress() : Int{
return mProgress
}
/**
* 设置当前进度
* @param progress 当前进度0-100
*/
fun setProgress(progress : Int){
mProgress = progress
invalidate()
}
/**
* 设置当前进度并展示进度动画。如果动画时间小于等于0则不展示动画
* @param progress 当前进度0-100
* @param animTime 动画时间(毫秒)
*/
fun setProgress(progress : Int, animTime : Long){
if (animTime<=0){
setProgress(progress)
} else{
val animator = ValueAnimator.ofInt(mProgress, progress)
animator.addUpdateListener{
mProgress = it.animatedValue as Int
invalidate()
}
animator.interpolator = OvershootInterpolator()
animator.duration = animTime
animator.start()
}
}
/**
* 设置背景圆环宽度
* @param width 背景圆环宽度
*/
fun setBackWidth(width : Int){
mBackPaint.strokeWidth = width.toFloat()
invalidate()
}
/**
* 设置背景圆环颜色
* @param color 背景圆环颜色
*/
fun setBackColor(color : Int){
mBackPaint.color = ContextCompat.getColor(context,color)
invalidate()
}
/**
* 设置进度圆环宽度
* @param width 进度圆环宽度
*/
fun setProgWidth(width : Int){
mProgPaint.strokeWidth = width.toFloat()
invalidate()
}
/**
* 设置进度圆环颜色
* @param color 景圆环颜色
*/
fun setProgColor(color : Int){
mProgPaint.color = ContextCompat.getColor(context,color)
mProgPaint.shader = null
invalidate()
}
fun setProgColor(startColor : Int,endColor: Int){
mColorArray = intArrayOf(ContextCompat.getColor(context,startColor),ContextCompat.getColor(context,endColor))
mColorArray?.let {
mProgPaint.shader = LinearGradient(0f, 0f, 0f,
getMeasuredWidth().toFloat(), it, null, Shader.TileMode.MIRROR)
}
}
fun setProgColor(colorArray : IntArray){
colorArray.let {
if(it.size<2){
return
}
mColorArray = it.copyOf()
mColorArray?.let{
mProgPaint.shader = LinearGradient(0f, 0f, 0f,
getMeasuredWidth().toFloat(), it, null, Shader.TileMode.MIRROR)
}
}
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
@@ -10,6 +11,8 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import kotlinx.android.synthetic.main.view_system_version.view.*
/**
@@ -25,10 +28,18 @@ class SystemVersionView @JvmOverloads constructor(
companion object {
const val TAG = "SystemVersionView"
const val AD_LATEST_VERSION = 1 //AD最新版
const val AD_DOWNING = 2 //AD下载中
const val AD_DOWNLOAD_FAIL = 3 //AD下载失败
const val AD_UPGRADEABLE = 4 //AD下载成功可升级状态
const val AD_UPGRADING = 5 //AD升级中
const val AD_UPGRADE_FAIL = 6 //AD升级失败
}
private var connectStatus = false
private var adUpgradeDialog : AdUpgradeDialog? = null
private var adStatus = AD_LATEST_VERSION //工控机默认为最新版
init {
LayoutInflater.from(context).inflate(R.layout.view_system_version, this, true)
@@ -36,6 +47,9 @@ class SystemVersionView @JvmOverloads constructor(
}
private fun initView(){
showCurrentPadVersion()
showCurrentAdVersion()
//鹰眼版本视图点击事件
ivPadVersion.setOnClickListener {
Logger.i(TAG,"pad version view clicked")
@@ -43,10 +57,104 @@ class SystemVersionView @JvmOverloads constructor(
//工控机版本视图点击事件
ivAdVersion.setOnClickListener {
Logger.i(TAG,"ad version view clicked")
if(adUpgradeDialog == null){
adUpgradeDialog = AdUpgradeDialog(context)
when(adStatus){
AD_LATEST_VERSION -> {
//最新版
}
AD_DOWNING -> {
//下载中
//TODO 需要向工控机要下载时间
ToastUtils.showShort("新版本下载中预计XX分钟下载完成")
}
AD_DOWNLOAD_FAIL -> {
//下载失败
}
AD_UPGRADEABLE -> {
//下载成功,可升级,点击弹起升级确认弹窗
if(adUpgradeDialog == null){
adUpgradeDialog = AdUpgradeDialog(context)
}
adUpgradeDialog?.showUpgradeDialog()
}
AD_UPGRADING -> {
//升级中
ToastUtils.showShort("新版本升级中预计5分钟升级完成")
}
AD_UPGRADE_FAIL -> {
//升级失败
ToastUtils.showShort("升级失败,请联系运维人员")
}
}
adUpgradeDialog?.showUpgradeDialog()
}
}
/**
* 展示当前鹰眼版本
*/
private fun showCurrentPadVersion(){
tvPadVersionContent?.let {
it.text = AppUtils.getAppVersionName()
}
}
/**
* 展示当前工控机版本
*/
private fun showCurrentAdVersion(){
tvAdVersionContent?.let {
// it.text = AdasManager.getInstance().getAdasConfig().getDockVersion())
}
}
/**
* 展示工控机下载状态信息
* @param downloadVersion 下载版本
* @param downloadStatus 下载状态(0:下载完成1:正在下载2:下载失败)
* @param downloadProgress 下载进度
*/
fun showAdDownloadStatus(downloadVersion : String,downloadStatus : Int,downloadProgress : Int){
if(downloadStatus==0){
//下载完成处于可升级状态展示“可升级”角标将AD背景变为蓝色并隐藏下载进度条
adStatus = AD_UPGRADEABLE
ivAdStatus?.setImageResource(R.drawable.icon_upgradeable)
ivAdVersion?.setBackgroundResource(R.drawable.version_upgradeable_background)
adCircularProgressView?.visibility = View.GONE
}else if(downloadStatus==1){
//正在下载,展示“下载中”角标,展示进度条,并设置当前下载进度
adStatus = AD_DOWNING
ivAdStatus?.setImageResource(R.drawable.icon_downloading)
adCircularProgressView?.let {
it.visibility = View.VISIBLE
it.setProgress(downloadProgress)
}
}else if(downloadStatus==2){
//下载失败,目前暂时将状态设为“最新版”角标,并隐藏进度条
adStatus = AD_DOWNLOAD_FAIL
ivAdStatus?.setImageResource(R.drawable.icon_latest_version)
adCircularProgressView?.visibility = View.GONE
}
}
/**
* 展示工控机升级状态信息
* @param upgradeStatus 升级状态true代表升级成功、false代表升级不成功
*/
fun showAdUpgradeStatus(upgradeStatus : Boolean){
if(upgradeStatus){
//AD升级成功工控机图标展示最新版样式
adStatus = AD_LATEST_VERSION
ivAdStatus?.setImageResource(R.drawable.icon_latest_version)
}else{
//AD升级失败工控机图标展示升级失败样式
adStatus = AD_UPGRADE_FAIL
ivAdStatus?.setImageResource(R.drawable.icon_upgrade_failed)
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -97,6 +97,18 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/viewPerspectiveSwitch"
app:layout_goneMarginStart="50px" />
<ViewStub
android:id="@+id/vs_bad_case_entrance"
android:inflatedId="@+id/bad_case_entrance"
android:layout_width="@dimen/module_hmi_check_size"
android:layout_height="@dimen/module_hmi_check_size"
android:layout_marginStart="25px"
android:layout_marginBottom="40px"
android:layout="@layout/view_ap_badcase_entrance"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/ivToolsIcon"
app:layout_goneMarginStart="50px"/>
<View
android:id="@+id/viewUpgradeTips"

View File

@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:background="#151D41F0"
tools:layout_height="match_parent"
tools:layout_width="match_parent"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<ImageView
android:id="@+id/close"
android:layout_width="107px"
android:layout_height="107px"
android:layout_marginTop="66px"
android:layout_marginEnd="40px"
android:src="@drawable/icon_close_nor"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/blue_block"
android:layout_width="14px"
android:layout_height="50px"
android:layout_marginStart="80px"
android:layout_marginTop="92px"
android:background="#2966EC"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="19px"
android:text="请选择本次接管原因"
android:textColor="#ffffff"
android:textSize="42px"
app:layout_constraintBottom_toBottomOf="@+id/blue_block"
app:layout_constraintStart_toEndOf="@+id/blue_block"
app:layout_constraintTop_toTopOf="@+id/blue_block" />
<TextView
android:id="@+id/time_of_take_over"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="113px"
android:layout_marginTop="10px"
android:textColor="#A7B6F0"
android:textSize="32px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/blue_block"
tools:text="接管时间2021.12.21 14:32" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_take_over"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="72px"
android:overScrollMode="never"
app:layout_constraintBottom_toTopOf="@+id/ok"
android:layout_marginBottom="20px"
app:layout_constraintTop_toBottomOf="@+id/time_of_take_over" />
<TextView
android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="123px"
android:paddingTop="31px"
android:paddingEnd="123px"
android:paddingBottom="31px"
android:text="确认"
android:textColor="#ffffff"
android:textSize="42px"
android:layout_marginStart="100px"
android:layout_marginEnd="100px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/cancel"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
android:enabled="false"
android:layout_marginBottom="100px"/>
<TextView
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="123px"
android:paddingTop="31px"
android:paddingEnd="123px"
android:paddingBottom="31px"
android:text="取消"
android:textColor="#ffffff"
android:textSize="42px"
android:layout_marginEnd="100px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/ok"
android:layout_marginBottom="100px"/>
<ProgressBar
android:id="@+id/pb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@android:style/Widget.Holo.ProgressBar.Large"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</merge>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/dp_10"
android:paddingTop="@dimen/dp_10"
android:gravity="center_vertical">
<ImageView
android:id="@+id/check"
android:layout_width="70px"
android:layout_height="70px"
android:layout_marginStart="113px"/>
<TextView
android:id="@+id/reason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:layout_marginStart="30px"
android:layout_marginEnd="20px"
android:textSize="42px"
android:lines="1"
android:ellipsize="end"
tools:text="转弯过于靠近路侧转弯过于靠近路侧转弯过于靠近路侧转弯过于靠近路侧转弯过于靠近路侧转弯过于靠近路侧转弯过于靠近路侧转弯过于靠近路侧"/>
</LinearLayout>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="@dimen/dp_10"
android:scaleType="center"
tools:layout_width="@dimen/module_hmi_check_size"
tools:layout_height="@dimen/module_hmi_check_size"
android:background="@drawable/icon_car_ap_badcase_entrance" />

View File

@@ -58,6 +58,28 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewCheckStatus" />
<ImageView
android:id="@+id/ivDebugPanel"
android:layout_width="150px"
android:layout_height="150px"
android:background="@drawable/debug_icon_nor"
app:layout_constraintStart_toEndOf="@id/viewCheckStatus"
app:layout_constraintTop_toTopOf="@id/viewCheckStatus"
android:layout_marginStart="142px"
/>
<TextView
android:id="@+id/tvDebug"
android:layout_width="128px"
android:layout_height="42px"
android:layout_marginStart="416px"
android:layout_marginTop="23px"
android:text="@string/debug_panel"
android:textColor="@color/color_FFA7B6F0"
android:textSize="32px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivDebugPanel" />
<View
android:layout_width="14px"
android:layout_height="50px"
@@ -171,6 +193,7 @@
/>
<com.mogo.eagle.core.function.hmi.ui.widget.SystemVersionView
android:id="@+id/systemVersionView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40px"

View File

@@ -68,6 +68,21 @@
android:background="@drawable/version_latest_background"
/>
<com.mogo.eagle.core.function.hmi.ui.widget.CircularProgressView
android:id="@+id/adCircularProgressView"
android:layout_width="150px"
android:layout_height="150px"
app:layout_constraintCircle="@id/ivAdVersion"
tools:ignore="MissingConstraints"
app:backColor="#E63B4577"
app:backWidth="2dp"
app:progColor="#029DFF"
app:progWidth="2dp"
app:progress="0"
android:visibility="gone"
/>
<ImageView
android:id="@+id/ivAdStatus"
android:layout_width="120px"

View File

@@ -38,4 +38,15 @@
<attr name="Title" format="string" />
<attr name="Icon" format="string" />
</declare-styleable>
<declare-styleable name="CircularProgressView">
<attr name="backWidth" format="dimension" /> <!--背景圆环宽度-->
<attr name="progWidth" format="dimension" /> <!--进度圆环宽度-->
<attr name="backColor" format="color" /> <!--背景圆环颜色-->
<attr name="progColor" format="color" /> <!--进度圆环颜色-->
<attr name="progStartColor" format="color" /> <!--进度圆环开始颜色-->
<attr name="progFirstColor" format="color" /> <!--进度圆环结束颜色-->
<attr name="progress" format="integer" /> <!--圆环进度-->
</declare-styleable>
</resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="autopilot_badcase_record" type="id" />
</resources>

View File

@@ -1,5 +1,5 @@
<resources>
<string name="app_name">mogo-module-push</string>
<string name="app_name">mogo-core-function-hmi</string>
<string name="motice_push_check">查看</string>
<string name="log_min">最小化</string>
@@ -20,6 +20,7 @@
<string name="log_text_loading">日志加载中...</string>
<string name="check_vehicle_detection">车辆检测</string>
<string name="debug_panel">调试面板</string>
<string name="check_vehicle_speed_setting">车速设置</string>
<string name="check_system_operation">系统运行</string>
<string name="check_system_shut_down">关机</string>

View File

@@ -70,10 +70,7 @@ dependencies {
api rootProject.ext.dependencies.mogoservice
api rootProject.ext.dependencies.moduleshare
api rootProject.ext.dependencies.moduleextensions
api rootProject.ext.dependencies.modulemap
api rootProject.ext.dependencies.moduleADAS
api rootProject.ext.dependencies.modulepushbase
api rootProject.ext.dependencies.modulepush
api rootProject.ext.dependencies.callchat
api rootProject.ext.dependencies.callchatprovider
api rootProject.ext.dependencies.mapcustom
@@ -100,12 +97,8 @@ dependencies {
api project(':foudations:mogo-commons')
api project(':modules:mogo-module-common')
api project(':modules:mogo-module-service')
api project(':modules:mogo-module-share')
api project(':modules:mogo-module-extensions')
api project(':modules:mogo-module-map')
api project(':modules:mogo-module-adas')
api project(":modules:mogo-module-push-base")
api project(":modules:mogo-module-push")
api project(':modules:mogo-module-carchatting')
api project(':modules:mogo-module-carchattingprovider')
api project(':libraries:map-custom')

View File

@@ -31,7 +31,6 @@ import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.module.common.constants.HostConst;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.share.constant.ShareConstants;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
import com.mogo.test.crashreport.CrashReportConstants;
@@ -306,19 +305,10 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
}
MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder"));
MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_TTS_CONFIG, ServiceConst.PATH_TTS_CONFIG));
MogoModulePaths.addBaseModule(new MogoModule(ShareConstants.TAG, ShareConstants.MODEL_NAME));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_TANLU_API, "TanluApi"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_TRAFFIC_UPLOAD, "TrafficUpload"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_SHARE, "ShareControl"));
MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY));
// MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_STRATEGY_SHARE, "StrategyShare"));
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GAODE_AIMLESS_SHARE, "GaoDeAimlessShare"));
//mogo deva tools
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_DEVA_TOOLS, "IMoGoDevaToolsProvider"));
// 域控制器模块(新)
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AUTO_PILOT, "IMoGoAutoPilotProvider"));
// OBU 模块
@@ -327,7 +317,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AI_MONITORING, "IMoGoMonitoringProvider"));
// 云公告发布
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AI_NOTICE, "IMoGoNoticeProvider"));
// V2X 模块
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_V2X_MODULE, "V2XProvider"));
// 自动驾驶系统检测模块

View File

@@ -60,6 +60,9 @@ dependencies {
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_api
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogomap
implementation rootProject.ext.dependencies.mogomapapi
} else {
implementation project(':modules:mogo-module-common')
implementation project(':services:mogo-service-api')
@@ -68,6 +71,9 @@ dependencies {
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-function-api')
implementation project(':core:mogo-core-function-call')
implementation project(":libraries:mogo-map")
implementation project(":libraries:mogo-map-api")
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.module.map;
package com.mogo.eagle.core.function.map;
import android.content.Context;
import android.os.Bundle;
@@ -94,7 +94,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
mMogoMap = mMogoMapView.getMap();
if ( mMogoMap != null ) {
mMogoMap.getUIController().showMyLocation( true );
mMogoMap.getUIController().recoverLockMode();// 启动锁车
}
}
@@ -128,7 +127,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
if ( mMogoMapView != null ) {
mMogoMapView.onPause();
}
MapBroadCastHelper.getInstance( getContext() ).mapBackground();
}
@Override
@@ -140,7 +138,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
if ( mMogoMapView != null ) {
mMogoMapView.onResume();
}
MapBroadCastHelper.getInstance( getContext() ).mapFrount();
}
@Override
@@ -178,9 +175,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
uiSettings.setZoomControlsEnabled( false );
//设置双指缩放手势是否可用
uiSettings.setZoomGesturesEnabled( true );
if ( mMogoMap.getUIController() != null ) {
mMogoMap.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
}
}
}
@@ -196,7 +190,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
@Override
public void onDestroyView() {
MapBroadCastHelper.getInstance( getContext() ).release();
if ( mMogoMapView != null ) {
mMogoMapView.onDestroy();
mMogoMapView = null;
@@ -222,17 +215,16 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
mMogoMapView.getMap().getUIController().changeCurrentIcon(iconId);
}
/**
* sight mode
* @param mode
*/
public static final int SIGHT_MODE_NORMAL = 0;
public static final int SIGHT_MODE_TOP = 1;
public static final int SIGHT_MODE_BACK = 2;
public static final int SIGHT_MODE_CROSS = 3;
public static final int SIGHT_MODE_FAR = 4;
@Override
public void setMapDAngle(int mode) {
float angle = getSightModeAngle(mode);

View File

@@ -1,4 +1,4 @@
package com.mogo.module.map;
package com.mogo.eagle.core.function.map;
import android.content.Context;

View File

@@ -0,0 +1,19 @@
package com.mogo.eagle.core.function.map;
import com.mogo.commons.mvp.Presenter;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 描述
*/
public class MapPresenter extends Presenter<MapView> {
private static final String TAG = "MapPresenter";
public MapPresenter(MapView view) {
super(view);
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.module.map;
package com.mogo.eagle.core.function.map;
import com.mogo.commons.mvp.IView;
import com.mogo.map.uicontroller.IMogoMapUIController;

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">mogo-core-function-map</string>
</resources>

View File

@@ -10,34 +10,31 @@ import androidx.recyclerview.widget.RecyclerView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.eagle.core.function.notice.R;
import com.mogo.eagle.core.function.notice.utils.AnimatorUtilsKt;
import com.mogo.eagle.core.function.notice.view.GlobalToolsKt;
import com.mogo.eagle.core.function.notice.view.PushItemAnimator;
import com.mogo.eagle.core.function.notice.view.SwipeItemLayout;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.eagle.core.function.notice.Config;
import com.mogo.eagle.core.function.notice.R;
import com.mogo.eagle.core.function.notice.adapter.PushMessageAdapter;
import com.mogo.eagle.core.function.notice.model.PushBean;
import com.mogo.eagle.core.function.notice.repository.PushRepository;
import com.mogo.eagle.core.function.notice.utils.AnimatorUtilsKt;
import com.mogo.eagle.core.function.notice.utils.HandlerUtils;
import com.mogo.eagle.core.function.notice.view.PushItemAnimator;
import com.mogo.eagle.core.function.notice.view.SwipeItemLayout;
import com.mogo.eagle.core.function.notice.viewmodel.MessageViewModel;
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.module.common.view.OnPreventFastClickListener;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
public
/**
* @author congtaowang
* @since 2020/9/1
*
* 描述
*/
class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHistoryPresenter > implements MessageHistoryView, IMogoMsgCenterListener {
public class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHistoryPresenter > implements MessageHistoryView {
private static final String TAG = "MessageHistoryFragment";
@@ -143,7 +140,6 @@ class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHis
mRootView.setOnClickListener( view -> {
} );
GlobalToolsKt.getApis( getContext() ).getMsgCenterApi().registerMsgCenterListener( this );
}
private void exitSelf() {
@@ -178,13 +174,6 @@ class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHis
} );
}
@Override
public void onMsgChanged( boolean hasMsg, int amount ) {
HandlerUtils.INSTANCE.getMBgHandler().post( () -> {
mViewModel.setList( PushRepository.Companion.getPushRepository().getAll() );
} );
}
@Override
public void onResume() {
super.onResume();
@@ -199,6 +188,5 @@ class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHis
@Override
public void onDestroyView() {
super.onDestroyView();
GlobalToolsKt.getApis( getContext() ).getMsgCenterApi().unregisterMsgCenterListener( this );
}
}

View File

@@ -43,7 +43,6 @@ class PushRepository(mContext: Context) {
private val pushViewModel: PushViewModel = PushViewModel(mContext, this)
private val pushBeanQueue: Queue<PushBean> = LinkedList()
private val statusManager = getApis(mContext).statusManagerApi
private val msgCenter = getApis(mContext).msgCenterApi
val pushBeanDao by lazy {
Room.databaseBuilder(appContext, PushBeanDatabase::class.java, "database_push").build()
.pushBeanDao()
@@ -59,37 +58,6 @@ class PushRepository(mContext: Context) {
}
init {
// 注册push通道监听 type 100时为push消息 lixp TODO
// getApis(mContext).getSocketManagerApi(mContext)
// .registerOnMessageListener(Config.PUSH_TYPE, object : IMogoOnMessageListener<PushBean> {
// override fun target(): Class<PushBean> {
// return PushBean::class.java
// }
//
// override fun onMsgReceived(bean: PushBean?) {
// Log.d("PushRepository", "pushBean = $bean")
// if (bean != null) {
// AnalyticsUtils.track(Config.NEWS_ARRIVE, "title", bean.title)
// if (bean.mainSchema.isBlank()) {
// bean.mainSchema = ""
// }
// if (bean.imageUrl.isBlank()) {
// bean.imageUrl = ""
// }
// if (bean.appIcon.isBlank()) {
// bean.appIcon = ""
// }
// pushBeanQueue.offer(bean)
// }
// if ( bean != null) {
// HandlerUtils.mBgHandler.post {
// pushBeanDao.insertAll(bean)
// updateMsgNum()
// }
// }
// startIterate()
// }
// })
HandlerUtils.mBgHandler.postDelayed({
updateMsgNum()
}, 5000)
@@ -102,9 +70,7 @@ class PushRepository(mContext: Context) {
updateMsgNum()
return
}
mHandler.post {
msgCenter.setMsgStatus(num > 0, num)
}
}
private fun startIterate() {
@@ -215,9 +181,6 @@ class PushRepository(mContext: Context) {
fun deleteAll() {
HandlerUtils.mBgHandler.post {
pushBeanDao.deleteAll()
mHandler.post {
msgCenter.setMsgStatus(false, 0)
}
}
}

View File

@@ -1,5 +1,5 @@
<resources>
<string name="app_name">mogo-module-push</string>
<string name="app_name">mogo-core-function-notice</string>
<string name="module_push_str_delete">清除</string>
<string name="module_push_str_clear">清空历史消息</string>
<string name="module_push_str_not_data">暂无消息</string>

View File

@@ -166,6 +166,9 @@ public class SmallMapDirectionView
@Override
public void onLocationChanged(@Nullable MogoLocation location) {
//Logger.d(TAG, "onCarLocationChanged2 :" + location.getLatitude()+":"+location.getLongitude());
if (location == null){
return;
}
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
//更新车辆位置
if (mCarMarker != null) {

View File

@@ -1,4 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.eagle.core.function.v2x">
<application>
<receiver android:name=".events.receiver.TestPanelBroadcastReceiver">
<intent-filter>
<action android:name="com.v2x.test_panel_control" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -410,11 +410,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
// 存储本地,出行动态作展示
saveLocalStory(V2XTypeEnum.ALERT_ROAD_WARNING, v2XRoadEventEntity.noveltyInfo)
//如果poiType是道路拥堵则调用接口查询拥堵状态
val poiType = v2XRoadEventEntity.poiType
if (poiType != null && poiType == FOURS_BLOCK_UP.poiType) {
BridgeApi.trafficUpload()?.verifyCurrentTrafficStatus()
}
}
}

View File

@@ -193,8 +193,9 @@ public class V2XShareEventAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView share = itemView.findViewById(R.id.share_event_button);
share.setOnClickListener(view -> {
V2XEventPanelFragment.Companion.getInstance().hidePanel();
mApis.getShareManager().showShareDialog();
// TODO
// V2XEventPanelFragment.Companion.getInstance().hidePanel();
// mApis.getShareManager().showShareDialog();
});
TextView refresh = itemView.findViewById(R.id.refresh_button);

View File

@@ -10,7 +10,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel;
@@ -19,10 +18,10 @@ import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil;
import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils;
import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils;
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.TimeUtils;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
@@ -30,7 +29,6 @@ import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XEventZanData;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
import com.zhidao.carchattingprovider.ICarsChattingProvider;
import com.zhidao.carchattingprovider.MogoDriverInfo;
@@ -193,34 +191,6 @@ public abstract class V2XBaseViewHolder<T>
delayedCloseWindow();
}
/**
* 导航规划路线
*/
public void triggerStartNavi(MarkerExploreWay noveltyInfo) {
try {
IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter();
if (registerCenter != null) {
registerCenter.registerMogoNaviListener(MODULE_NAME, this);
}
MogoLatLng endPoint = new MogoLatLng(
noveltyInfo.getLocation().getLat(),
noveltyInfo.getLocation().getLon());
IMogoNavi navi = BridgeApi.INSTANCE.navi();
if (navi != null) {
navi.naviTo(endPoint);
}
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_NAVI);
} catch (Exception e) {
e.printStackTrace();
TipToast.tip("路况信息异常");
}
delayedCloseWindow();
}
public void triggerCancel(){
delayedCloseWindow();
}
@@ -263,11 +233,6 @@ public abstract class V2XBaseViewHolder<T>
@Override
public void onCalculateSuccess() {
Logger.w(TAG, "onCalculateSuccess");
IMogoNavi navi = BridgeApi.INSTANCE.navi();
if (navi != null) {
navi.startNavi(true);
}
IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter();
if (registerCenter != null) {

View File

@@ -11,7 +11,6 @@ import android.widget.TextView;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
@@ -27,8 +26,6 @@ import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.share.IMogoTanluProvider;
import com.mogo.service.share.TanluUploadParams;
import java.util.HashMap;
import java.util.Map;
@@ -181,19 +178,19 @@ public class V2XEventUgcVH extends V2XBaseViewHolder<V2XEventShowEntity> {
unRegisterVoice();
if (status == 1) {
// 上报事故
TanluUploadParams params =
new TanluUploadParams(
mNoveltyInfo.getPoiType(),
IMogoTanluProvider.UPLOAD_FROM_STRATEGY_UGC,
mNoveltyInfo.getInfoIdInt(),
new MogoLatLng(mNoveltyInfo.getLocation().getLat(),
mNoveltyInfo.getLocation().getLon())
);
IMogoTanluProvider tanlu = BridgeApi.INSTANCE.tanlu();
if (tanlu != null) {
tanlu.uploadRoadCondition(params);
}
// // 上报事故
// TanluUploadParams params =
// new TanluUploadParams(
// mNoveltyInfo.getPoiType(),
// IMogoTanluProvider.UPLOAD_FROM_STRATEGY_UGC,
// mNoveltyInfo.getInfoIdInt(),
// new MogoLatLng(mNoveltyInfo.getLocation().getLat(),
// mNoveltyInfo.getLocation().getLon())
// );
// IMogoTanluProvider tanlu = BridgeApi.INSTANCE.tanlu();
// if (tanlu != null) {
// tanlu.uploadRoadCondition(params);
// }
dataStatistics(1);
} else if (status == 0) {
dataStatistics(2);

View File

@@ -32,12 +32,11 @@ import com.mogo.module.v2x.voice.V2XVoiceManager;
public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private TextView mTvAddress, mTvAddressDistance;
private ImageView mIvToNav, mIvClose;
private ImageView mIvClose;
private MarkerExploreWay mNoveltyInfo;
private V2XPushMessageEntity mV2XPushMessageEntity;
// 语音控制导航
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo);
private V2XVoiceCallbackListener mNaviCancel = (command, intent) -> triggerCancel();
public V2XFatigueDrivingVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
@@ -46,9 +45,7 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
, v2XWindow);
mTvAddress = itemView.findViewById(R.id.tvAddress);
mTvAddressDistance = itemView.findViewById(R.id.tvAddressDistance);
mIvToNav = itemView.findViewById(R.id.ivToNav);
mIvClose = itemView.findViewById(R.id.ivClose);
mIvToNav.setOnClickListener(v -> triggerStartNavi(mNoveltyInfo));
mIvClose.setOnClickListener(v -> delayedCloseWindow());
// 设置视图状态监听
@@ -56,13 +53,6 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
@Override
public void onViewAttachedToWindow(View v) {
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
// 注册语音交互
V2XVoiceManager.INSTANCE
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI,
mNaviCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP,
mNaviCb);
V2XVoiceManager.INSTANCE
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_CANCEL_NAVI_UN_WAKEUP,mNaviCancel);

View File

@@ -10,25 +10,23 @@ import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil;
import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils;
import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils;
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.TimeUtils;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XEventZanData;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
import com.zhidao.carchattingprovider.ICarsChattingProvider;
import com.zhidao.carchattingprovider.MogoDriverInfo;
@@ -180,36 +178,6 @@ public abstract class V2XHistoryBaseViewHolder<T>
delayedCloseWindow();
}
/**
* 导航规划路线
*/
public void triggerStartNavi(MarkerExploreWay noveltyInfo) {
try {
IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter();
if (registerCenter != null) {
registerCenter.registerMogoNaviListener(MODULE_NAME, this);
}
MogoLatLng endPoint = new MogoLatLng(
noveltyInfo.getLocation().getLat(),
noveltyInfo.getLocation().getLon());
IMogoNavi navi = BridgeApi.INSTANCE.navi();
if (navi != null) {
navi.naviTo(endPoint);
}
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
noveltyInfo.getSn(),
V2XConst.V2X_ROAD_NAVI);
} catch (Exception e) {
e.printStackTrace();
TipToast.tip("路况信息异常");
}
delayedCloseWindow();
}
/**
* 显示自定义 Toast
*
@@ -247,10 +215,6 @@ public abstract class V2XHistoryBaseViewHolder<T>
@Override
public void onCalculateSuccess() {
Logger.w(TAG, "onCalculateSuccess");
IMogoNavi navi = BridgeApi.INSTANCE.navi();
if (navi != null) {
navi.startNavi(true);
}
IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter();
if (registerCenter != null) {
registerCenter.unregisterMogoNaviListener(MODULE_NAME);

View File

@@ -55,15 +55,12 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private TextView tvDistance;
private TextView tvEventTime;
private ImageView ivCall;
private ImageView ivNavi;
private V2XPushMessageEntity mV2XPushMessageEntity;
private MarkerExploreWay mNoveltyInfo;
// 上传事件的用户信息
private MarkerUserInfo mUserInfo = new MarkerUserInfo();
// 语音控制导航
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo);
// 语音控制拨打电话
private V2XVoiceCallbackListener mCallChartingCb = (command, intent) -> {
try {
@@ -88,14 +85,6 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
tvDistance = itemView.findViewById(R.id.tvFaultHelpDistance);
tvEventTime = itemView.findViewById(R.id.tvFaultHelpEventTime);
ivCall = itemView.findViewById(R.id.ivFaultHelpEventCall);
ivNavi = itemView.findViewById(R.id.ivFaultHelpEventNavi);
ivNavi.setOnClickListener(v -> {
triggerStartNavi(mNoveltyInfo);
V2XRefreshModel v2XRefreshModel = BridgeApi.INSTANCE.refreshModel();
if (v2XRefreshModel != null) {
v2XRefreshModel.respondingToHelp(mUserInfo.getSn());
}
});
// 设置视图状态监听
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@@ -104,10 +93,6 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
// 注册语音交互
V2XVoiceManager.INSTANCE
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI,
mNaviCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP,
mNaviCb)
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING,
mCallChartingCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP,
@@ -121,8 +106,6 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow");
// 反注册语音交互
V2XVoiceManager.INSTANCE
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP)
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP);

View File

@@ -40,7 +40,6 @@ public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private ImageView ivRoadReportTrue;
private ImageView ivRoadReportErr;
private ImageView ivRoadCallChart;
private ImageView ivRoadEventNav;
private ImageView ivRoadEventLike;
// 上传事件的用户信息
@@ -49,8 +48,6 @@ public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private V2XPushMessageEntity mV2XRoadEventEntity;
private MarkerExploreWay mNoveltyInfo;
// 语音控制导航
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo);
// 语音控制拨打电话
private V2XVoiceCallbackListener mCallChartingCb = (command, intent) -> {
try {
@@ -78,11 +75,8 @@ public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
ivRoadReportTrue = itemView.findViewById(R.id.ivRoadReportTrue);
ivRoadReportErr = itemView.findViewById(R.id.ivRoadReportErr);
ivRoadCallChart = itemView.findViewById(R.id.ivRoadCallChart);
ivRoadEventNav = itemView.findViewById(R.id.ivRoadEventNav);
ivRoadEventLike = itemView.findViewById(R.id.ivRoadEventLike);
ivRoadEventNav.getParent().getParent().requestDisallowInterceptTouchEvent(true);
ivRoadEventNav.setOnClickListener(v -> triggerStartNavi(mNoveltyInfo));
ivRoadCallChart.setOnClickListener(v -> {
try {
mUserInfo.setSn(mV2XRoadEventEntity.getSn());
@@ -105,10 +99,6 @@ public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
// 注册语音交互
V2XVoiceManager.INSTANCE
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI,
mNaviCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP,
mNaviCb)
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING,
mCallChartingCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP,
@@ -128,8 +118,6 @@ public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
// 反注册语音交互
V2XVoiceManager.INSTANCE
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP)
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP)
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING)
@@ -171,7 +159,6 @@ public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
switch (mV2XRoadEventEntity.getSceneId()) {
case "100015"://取快递
case "100016"://顺风车
ivRoadEventNav.setVisibility(View.VISIBLE);
ivRoadCallChart.setVisibility(View.VISIBLE);
ivRoadReportTrue.setVisibility(View.GONE);
ivRoadReportErr.setVisibility(View.GONE);
@@ -182,7 +169,6 @@ public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
case "100018"://故障车辆推送
ivRoadEventLike.setVisibility(View.VISIBLE);
ivRoadCallChart.setVisibility(View.GONE);
ivRoadEventNav.setVisibility(View.GONE);
ivRoadReportTrue.setVisibility(View.GONE);
ivRoadReportErr.setVisibility(View.GONE);
break;

View File

@@ -31,16 +31,13 @@ import kotlinx.coroutines.launch
class V2XRecommendRouteVH(viewGroup: ViewGroup, v2XWindow: IV2XWindow<*>) : V2XBaseViewHolder<V2XEventShowEntity>(
LayoutInflater.from(viewGroup.context).inflate(R.layout.item_v2x_recommend_route, viewGroup, false), v2XWindow), V2XVoiceCallbackListener {
private var mTvAddress: TextView? = null
private var mIvToNav: ImageView? = null
private var mIvClose: ImageView? = null
private var mNoveltyInfo: MarkerExploreWay? = null
private val mainScope = MainScope()
init {
mTvAddress = itemView.findViewById<TextView>(R.id.tvAddress)
mIvToNav = itemView.findViewById<ImageView>(R.id.ivToNav)
mIvClose = itemView.findViewById<ImageView>(R.id.ivClose)
mIvToNav?.setOnClickListener { triggerStartNavi(mNoveltyInfo) }
mTvAddress = itemView.findViewById(R.id.tvAddress)
mIvClose = itemView.findViewById(R.id.ivClose)
mIvClose?.setOnClickListener { delayedCloseWindow() }
itemView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
override fun onViewAttachedToWindow(view: View) {
@@ -75,7 +72,6 @@ class V2XRecommendRouteVH(viewGroup: ViewGroup, v2XWindow: IV2XWindow<*>) : V2XB
override fun onCallback(command: String?, intent: Intent?) {
when (command) {
V2XVoiceConstants.V2X_CONFIRM_ACTION -> triggerStartNavi(mNoveltyInfo)
V2XVoiceConstants.V2X_CANCLE_ACTION -> delayedCloseWindow()
}
}

View File

@@ -1,5 +1,8 @@
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
@@ -28,9 +31,6 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
/**
* 出行动态中的他人故障求助
*
@@ -45,7 +45,6 @@ public class V2XScenarioHistoryOtherSeekHelpVH extends V2XHistoryBaseViewHolder<
private TextView mTvFaultHelpEventTime;
private TextView mTvFaultHelpDistance;
private ImageView mIvFaultHelpEventCall;
private ImageView mIvFaultHelpEventNavi;
private MarkerExploreWay mNoveltyInfo;
// 上传事件的用户信息
@@ -63,7 +62,6 @@ public class V2XScenarioHistoryOtherSeekHelpVH extends V2XHistoryBaseViewHolder<
mTvFaultHelpEventTime = itemView.findViewById(R.id.tvFaultHelpEventTime);
mTvFaultHelpDistance = itemView.findViewById(R.id.tvFaultHelpDistance);
mIvFaultHelpEventCall = itemView.findViewById(R.id.ivFaultHelpEventCall);
mIvFaultHelpEventNavi = itemView.findViewById(R.id.ivFaultHelpEventNavi);
}
@Override
@@ -118,11 +116,6 @@ public class V2XScenarioHistoryOtherSeekHelpVH extends V2XHistoryBaseViewHolder<
e.printStackTrace();
}
mIvFaultHelpEventNavi.setOnClickListener(v -> {
BridgeApi.INSTANCE.refreshModel().respondingToHelp(mUserInfo.getSn());
triggerStartNavi(mNoveltyInfo);
});
// M1低配车机限制
// 不展示打电话按钮
// 不能查看用户详情

View File

@@ -80,8 +80,6 @@ internal object BridgeApi {
fun analytics() = apis?.analyticsApi
fun navi() = apis?.mapServiceApi?.getNavi(context())
fun overlay() = apis?.mapServiceApi?.getOverlayManager(context())
fun carChatProvider() = carChatProvider
@@ -104,14 +102,10 @@ internal object BridgeApi {
fun registerCenter() = apis?.registerCenterApi
fun entranceButton() = apis?.entranceButtonController
fun imageLoader() = apis?.imageLoaderApi
fun windowManager() = apis?.windowManagerApi
fun tanlu() = apis?.tanluApi
fun displayEffects() = apis?.displayEffectsManager
fun intentManager() = apis?.intentManagerApi
@@ -120,9 +114,5 @@ internal object BridgeApi {
fun locationClient() = apis?.mapServiceApi?.getSingletonLocationClient(context())
fun share() = apis?.shareManager
fun markerService() = apis?.markerService
fun trafficUpload() = apis?.trafficUploadApi
}

View File

@@ -241,30 +241,9 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
}
}
// M1 不基于地图的版本直接展示事件面板,且不可关闭
if (DebugConfig.isMapBased()) {
val x = resources.getDimensionPixelSize(if (DebugConfig.isLauncher()) {
R.dimen.module_v2x_event_panel_in_launcher_btn_x
} else {
R.dimen.module_v2x_event_panel_btn_x
})
val y = resources.getDimensionPixelSize(R.dimen.module_v2x_event_panel_btn_y)
BridgeApi.entranceButton()?.let {
it.addBottomLayerView(mV2XEventPanelHistoryCountView, x, y)
}
mV2XEventPanelHistoryCountView?.visibility = if (MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
View.GONE
}else{
View.VISIBLE
}
changeEventCount()
MogoApisHandler.getInstance().apis.statusManagerApi.registerStatusChangedListener(MODULE_NAME, StatusDescriptor.VR_MODE, this)
} else {
// 模拟手动点击,默认选择第二个,周边事件
// http://jira.zhidaohulian.com/browse/E84XAD-250
mRgTabSelect?.check(R.id.rbSurroundingEvent)
}
// 模拟手动点击,默认选择第二个,周边事件
// http://jira.zhidaohulian.com/browse/E84XAD-250
mRgTabSelect?.check(R.id.rbSurroundingEvent)
} catch (e: Exception) {
e.printStackTrace()

View File

@@ -4,33 +4,31 @@ import android.annotation.SuppressLint
import android.content.Context
import android.util.Log
import android.view.View
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.share
import com.mogo.eagle.core.function.v2x.events.fragment.V2XEventPanelFragment.Companion.getInstance
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.v2xStatus
import com.mogo.commons.mvp.MvpFragment
import com.mogo.eagle.core.function.v2x.events.fragment.presenter.ScenarioHistoryPresenter
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.function.v2x.events.adapter.V2XScenarioHistoryAdapter
import com.mogo.module.common.entity.V2XHistoryScenarioData
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusChangedListener
import com.mogo.module.common.view.SpacesItemDecoration
import com.mogo.eagle.core.function.v2x.events.view.V2XListEmptyView.OnControlListener
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusDescriptor
import com.mogo.eagle.core.function.v2x.events.utils.V2XUtils
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.function.v2x.R.dimen
import com.mogo.eagle.core.function.v2x.R.layout
import com.mogo.eagle.core.function.v2x.events.adapter.V2XScenarioHistoryAdapter
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.v2xStatus
import com.mogo.eagle.core.function.v2x.events.fragment.presenter.ScenarioHistoryPresenter
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusChangedListener
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusDescriptor
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusDescriptor.EventPanelWindow_UI
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils
import com.mogo.eagle.core.function.v2x.events.utils.V2XUtils
import com.mogo.eagle.core.function.v2x.events.view.V2XListEmptyView.OnControlListener
import com.mogo.eagle.core.network.utils.GsonUtil
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.module.common.entity.V2XHistoryScenarioData
import com.mogo.module.common.view.SpacesItemDecoration
import kotlinx.android.synthetic.main.module_v2x_event_panel_fragment_scenario_history.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.util.ArrayList
import java.util.*
/**
* 出行动态V2X 提示过的场景历史
@@ -71,11 +69,12 @@ class V2XScenarioHistoryFragment : MvpFragment<V2XScenarioHistoryFragment?, Scen
private fun initListener() {
viewEmpty.setOnControlListener(object : OnControlListener {
override fun onShearClick() {
val share = share()
if (share != null) {
share.showShareDialog()
getInstance().hidePanel()
}
// TODO
// val share = share()
// if (share != null) {
// share.showShareDialog()
// getInstance().hidePanel()
// }
}
override fun onRefreshClick() {}

View File

@@ -156,9 +156,10 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
if (id == R.id.tv_main_share) {
//弹出框面板消失,出现分享弹框
V2XEventPanelFragment.Companion.getInstance().hidePanel();
if (mApis != null && mApis.getShareManager() != null) {
mApis.getShareManager().showShareDialog();
}
// TODO
// if (mApis != null && mApis.getShareManager() != null) {
// mApis.getShareManager().showShareDialog();
// }
} else if (id == R.id.tv_main_refresh || id == R.id.tv_top_refresh) { //刷新
initData();
}

View File

@@ -63,19 +63,6 @@ public interface IMoGoV2XMarkerManager extends IProvider {
*/
void clearOnlineCarPOI();
/**
* 绘制 特殊车辆
*
* @param context
* @param v2XMarkerEntity
* @param clickListener
*/
void drawableSpecialCarPOI(Context context, V2XSpecialCarRes.V2XMarkerEntity v2XMarkerEntity, IMogoMarkerClickListener clickListener);
/**
* 清除 特殊车辆 POI
*/
void clearSpecialCarPOI();
/**
* 绘制可以直播的在线车辆

View File

@@ -2,20 +2,16 @@ package com.mogo.eagle.core.function.v2x.events.manager.impl;
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_EVENT_ALARM_POI;
import static com.mogo.module.service.strategy.CarIconDisplayStrategy.sFrameVr;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes;
import com.mogo.eagle.core.function.v2x.events.listener.V2XMarkerClickListener;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
@@ -24,6 +20,7 @@ import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.marker.V2XMarkerAdapter;
import com.mogo.eagle.core.function.v2x.events.utils.EntityUtilsKt;
import com.mogo.eagle.core.function.v2x.events.utils.MapUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.ViewUtils;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
@@ -34,7 +31,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.drawer.MarkerDrawer;
import com.mogo.module.common.drawer.marker.IMarkerView;
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
import com.mogo.module.common.drawer.marker.RoadConditionInfoWindow3DAdapter;
import com.mogo.module.common.entity.MarkerCardResult;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
@@ -47,13 +43,11 @@ import com.mogo.module.common.utils.CarSeries;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.Utils;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.v2x.V2XManager;
import com.mogo.v2x.data.V2XMarkerCardResult;
import com.mogo.v2x.data.V2XMarkerExploreWay;
import com.mogo.v2x.data.V2XMarkerLocation;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -84,7 +78,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
polylineManager.clearLine();
}
clearAlarmPOI();
clearSpecialCarPOI();
// 锁车
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
if (mapUiController != null) {
@@ -257,152 +250,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
}
}
@Override
public void drawableSpecialCarPOI(Context context, V2XSpecialCarRes.V2XMarkerEntity v2XMarkerEntity, IMogoMarkerClickListener clickListener) {
try {
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
if (mapUiController != null) {
mapUiController.changeMapMode(EnumMapUI.NorthUP_2D);
}
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
if (v2xStatus != null) {
v2xStatus.setOtherSeekHelpPOIShow(TAG, true);
}
// 绘制特殊车辆
if (v2XMarkerEntity == null) {
return;
}
MarkerLocation markerLocation = new MarkerLocation();
markerLocation.setLon(v2XMarkerEntity.getLon());
markerLocation.setLat(v2XMarkerEntity.getLat());
// 进行数据转换用于Marker展示
V2XRoadEventEntity roadEventEntity = new V2XRoadEventEntity();
roadEventEntity.setPoiType(v2XMarkerEntity.getTargetId() + "");
roadEventEntity.setLocation(markerLocation);
roadEventEntity.setBindObj(v2XMarkerEntity);
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setBindObj(v2XMarkerEntity);
markerShowEntity.setChecked(false);
markerShowEntity.setMarkerLocation(markerLocation);
// 重置告警信息
V2XStatusManager.getInstance().setAlarmInfo(roadEventEntity);
// 清除原来的大而全的新鲜事儿
clearALLPOI();
if (roadEventEntity.getLocation() != null) {
// 道路事件,或者水波纹扩散效果
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
.data(roadEventEntity)
.latitude(roadEventEntity.getLocation().getLat())
.longitude(roadEventEntity.getLocation().getLon());
optionsRipple.anchor(0.5f, 0.5f);
//由于性能问题D车机不使用事件扩散动画
//showInfoWindow只支持添加单个marker,不支持帧动画
if (!CarSeries.isF8xxSeries()) {
optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity));
boolean isVrMode = false;
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
isVrMode = statusManager.isVrMode();
}
if (isVrMode) {
mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, null);
mAlarmInfoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mAlarmInfoMarker.getMogoMarkerOptions()));
mAlarmInfoMarker.showInfoWindow();
} else {
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
if (marker != null) {
mAlarmInfoMarker = marker.addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
}
}
// 当前Marker设置为最上面
mAlarmInfoMarker.setToTop();
} else {
boolean isVrMode = false;
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
isVrMode = statusManager.isVrMode();
}
if (isVrMode) {
ArrayList<Bitmap> mBitmapFrames = new ArrayList<>();
for (int i : sFrameVr) {
mBitmapFrames.add(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), i));
}
optionsRipple.icons(mBitmapFrames);
optionsRipple.period(20);
optionsRipple.scale(0.4f);
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
if (marker != null) {
mAlarmInfoMarker = marker.addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
}
MogoMarkerOptions options = new MogoMarkerOptions().data(roadEventEntity)
.latitude(roadEventEntity.getLocation().getLat()).longitude(roadEventEntity.getLocation().getLon());
options.anchor(0.5f, 0.5f);
options.icon3DRes(R.raw.special_vehicle);
options.anchorColor("#FFBF29FF");
if (marker != null) {
m3DMarker = marker.addMarker(V2X_EVENT_ALARM_POI, options);
}
if (m3DMarker != null) {
m3DMarker.setToTop();
}
} else {
optionsRipple.icons(V2XMarkerAdapter.getV2XRoadEventViewGif(context, roadEventEntity));
optionsRipple.period(100);
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
if (marker != null) {
mAlarmInfoMarker = marker.addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
}
// 当前Marker设置为最上面
if (mAlarmInfoMarker != null) {
mAlarmInfoMarker.setToTop();
}
}
}
// 绘制连接线
IMoGoV2XPolylineManager iMoGoV2XPolylineManager = BridgeApi.INSTANCE.v2xPolyline();
if (iMoGoV2XPolylineManager != null) {
iMoGoV2XPolylineManager.drawablePolyline(context, roadEventEntity);
}
// 缩放地图
MapUtils.zoomMap(
new MogoLatLng(roadEventEntity.getLocation().getLat(),
roadEventEntity.getLocation().getLon()
), context);
} else {
Logger.e(MODULE_NAME, "Location 必须进行初始化!!!!!");
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void clearSpecialCarPOI() {
boolean isOtherSeekHelpPOIShow = false;
IMoGoV2XStatusManager iMoGoV2XStatusManager = BridgeApi.INSTANCE.v2xStatus();
if (iMoGoV2XStatusManager != null) {
isOtherSeekHelpPOIShow = iMoGoV2XStatusManager.isOtherSeekHelpPOIShow();
}
if (isOtherSeekHelpPOIShow) {
iMoGoV2XStatusManager.setOtherSeekHelpPOIShow(TAG, false);
// 重置告警信息
V2XStatusManager.getInstance().setAlarmInfo(null);
if (mAlarmInfoMarker != null) {
mAlarmInfoMarker.remove();
}
if (m3DMarker != null) {
m3DMarker.remove();
}
}
}
@Override
public void drawableLiveCarPOI(List<MarkerOnlineCar> markerOnlineCars, IMogoMarkerClickListener clickListener) {
@@ -691,8 +538,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
}
if (isVrMode) {
mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, clickListener);
// mAlarmInfoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mAlarmInfoMarker.getMogoMarkerOptions()));
// mAlarmInfoMarker.showInfoWindow();
} else {
optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity));
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();

View File

@@ -9,10 +9,10 @@ import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.overlay.IMogoOverlayManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import com.mogo.service.statusmanager.IMogoStatusManager;
@@ -76,11 +76,11 @@ public class MoGoV2XPolylineManager implements IMoGoV2XPolylineManager {
options.width(10).useGradient(true).colorValues(colors);
// 当前车辆位置
IMogoNavi navi = BridgeApi.INSTANCE.navi();
MogoLatLng carLocation = null;
if (navi != null) {
carLocation = navi.getCarLocation();
}
MogoLatLng carLocation = new MogoLatLng(
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
);
if (carLocation != null) {
options.add(carLocation);
} else {

View File

@@ -0,0 +1,195 @@
package com.mogo.eagle.core.function.v2x.events.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes;
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XVoiceCallLiveBiz;
import com.mogo.eagle.core.function.v2x.events.utils.TestOnLineCarUtils;
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.zhidao.carchattingprovider.ICarsChattingProvider;
import com.zhidao.carchattingprovider.MogoDriverInfo;
import java.util.List;
import static android.text.style.TtsSpan.GENDER_MALE;
/**
* V2X 测试面板广播接收,目的是可以通过广播调用起来面板
*
* @author donghongyu
*/
public class TestPanelBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = V2XConst.MODULE_NAME + "_TestPanelBroadcastReceiver";
private Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
try {
this.mContext = context;
int sceneType = intent.getIntExtra(V2XConst.BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY, 0);
Logger.d(TAG, "textPanelOpenType:" + sceneType);
// 分发场景
dispatchSceneTest(sceneType);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 分发处理场景
*
* @param sceneType 场景类型
*/
private void dispatchSceneTest(int sceneType) {
Logger.d(TAG, "sceneType=" + sceneType);
if (sceneType == 0) {//打开用户信息
MogoDriverInfo mogoDriverInfo = new MogoDriverInfo();
mogoDriverInfo.setAge(24);
mogoDriverInfo.setGender(GENDER_MALE);
mogoDriverInfo.setSn("12345678");
mogoDriverInfo.setUserName("测试");
mogoDriverInfo.setUserHead("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600872867592&di=994e371880ca6ae2814f553e0d0e4139&imgtype=0&src=http%3A%2F%2Fp3.ssl.cdn.btime.com%2Ft014c5d8a1e5cef12ba.jpg%3Fsize%3D506x543");
ICarsChattingProvider provider = BridgeApi.INSTANCE.carChatProvider();
if (provider != null) {
provider.showUserWindow("CAR_CALL_USER_TO_" + V2XConst.MODULE_NAME, mogoDriverInfo, mContext);
}
} else if (sceneType == 1) {// 触发道路事件
V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioRoadEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
// 存储本地,出行动态作展示
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING,
v2XMessageEntity.getContent().getNoveltyInfo());
} else if (sceneType == 3) {//触发H5推送事件
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioPushEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} else if (sceneType == 4) {//触发H5推送直播事件
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioPushLiveEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} else if (sceneType == 5) {//H5推送触发V2X动画
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioAnimationEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} else if (sceneType == 6) {//查看前车直播
V2XVoiceCallLiveBiz.getInstance().getFrontCarLive();
} else if (sceneType == 7) {//查看前方路口直播
V2XVoiceCallLiveBiz.getInstance().getOpenRoadCameraLive();
} else if (sceneType == 8) {//触发疲劳驾驶
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioFatigueDrivingData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} else if (sceneType == 9) {//触发他人发起道路求助事件
V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioSeekHelpData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} else if (sceneType == 10) {//触发事件UGC
V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioRoadEventUGCData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} else if (sceneType == 11) {//触发违章停车事件
V2XMessageEntity<List<MarkerExploreWay>> v2XMessageEntity =
TestOnLineCarUtils.getV2XIllegalParkData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} else if (sceneType == 12) {//车路云场景预警-右侧
V2XMessageEntity messageEntity = TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData("right");
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, messageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} else if (sceneType == 13) {//车路云场景预警-左侧
V2XMessageEntity messageEntity = TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData("left");
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, messageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} else if (sceneType == 14) {//行人预警,行人路线预测 车路云预警-前方行人
V2XMessageEntity messageEntity = TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData("pedestrians");
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, messageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} /*else if (sceneType == 16) {//触发基于目的地预测的线路推荐
V2XRefreshModel model = BridgeApi.INSTANCE.refreshModel();
model.
V2XServiceManager.getV2XRefreshModel().queryRoadData("F803EB2046PZD00149");
} */else if (sceneType == 17) {//最优路线推荐
V2XMessageEntity<V2XOptimalRouteDataRes> v2XMessageEntity =
TestOnLineCarUtils.getV2XOptimalRoute();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} else if (sceneType == 18) {// 自车求助
V2XMessageEntity<Boolean> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioCarForHelpEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
statusManager.setSeekHelping(V2XConst.MODULE_NAME, true);
}
} else if (sceneType == 20) {// 小地图绘制线
List<MogoLatLng> coordinates = TestOnLineCarUtils.getTestCoordinates();
CallerSmpManager.drawablePolyline(coordinates);
} else if (sceneType == 21) {// 小地图清除绘制线
CallerSmpManager.clearPolyline();
}
}
/**
* 存储本地数据
*
* @param v2XRoadEventEntity 要存储的场景
*/
public void saveLocalStory(int scenarioType, MarkerExploreWay v2XRoadEventEntity) {
try {
V2XSQLiteUtils.saveLocalStory(scenarioType, v2XRoadEventEntity, v2XRoadEventEntity.hashCode());
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -1,11 +1,15 @@
package com.mogo.eagle.core.function.v2x.events.scenario.impl;
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING;
import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.scenario.IV2XScenarioManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.animation.V2XAnimationScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.fatigue.V2XFatigueDrivingScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.help.V2XCarForHelpScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XPushLiveCarScenario;
@@ -17,19 +21,16 @@ import com.mogo.eagle.core.function.v2x.events.scenario.scene.route.V2XOptimalRo
import com.mogo.eagle.core.function.v2x.events.scenario.scene.seek.V2XSeekHelpScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.ugc.V2XEventUgcScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.warning.V2XFrontWarningScenario;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.scenario.scene.destination.V2XRecommendRouteScenario;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING;
/**
* author : donghongyu
@@ -89,9 +90,6 @@ public class V2XScenarioManager implements IV2XScenarioManager {
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING:
mV2XScenario = new V2XPushLiveCarScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING:
mV2XScenario = new V2XAnimationScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP:
mV2XScenario = new V2XCarForHelpScenario();
break;

View File

@@ -1,127 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.animation;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
import com.mogo.eagle.core.function.v2x.events.utils.ADASUtils;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.windowview.IMogoWindowManager;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/5/15 5:37 PM
* desc : 场景动画的场景展示目前这里仅在演示DEMO中使用
* version: 1.0
*/
public class V2XAnimationScenario extends AbsV2XScenario<V2XPushMessageEntity> {
public V2XAnimationScenario() {
setV2XWindow(new V2XAnimationWindow());
}
@Override
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
boolean isMainPageOnResume = false;
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
isMainPageOnResume = statusManager.isMainPageOnResume();
}
if (!isSameScenario(v2XMessageEntity)
&& isMainPageOnResume) {
boolean isV2XAnimationShow = false;
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
if (v2xStatus != null) {
isV2XAnimationShow = v2xStatus.isV2XAnimationShow();
}
if (isV2XAnimationShow) {
close();
}
setV2XMessageEntity(v2XMessageEntity);
show();
} else {
setV2XMessageEntity(v2XMessageEntity);
Logger.w(V2XConst.MODULE_NAME, "要处理的场景已经存在,丢弃这次初始化");
}
}
@Override
public void show() {
showWindow();
}
@Override
public void showWindow() {
if (getV2XWindow() != null) {
getV2XWindow().setWindowStatusListener(new V2XWindowStatusListener() {
@Override
public void onViewShow() {
ADASUtils.broadcastToADAS(BridgeApi.INSTANCE.context(), getV2XMessageEntity().getContent());
}
@Override
public void onViewClose() {
closeWindow();
clearPOI();
}
});
getV2XWindow().show(getV2XMessageEntity().getContent());
IMogoWindowManager windowManager = BridgeApi.INSTANCE.windowManager();
if (windowManager != null) {
windowManager.addView(getV2XWindow().getView(), 0, 0, false);
}
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
if (v2xStatus != null) {
v2xStatus.setV2XAnimationWindowShow(TAG, true);
}
}
}
@Override
public void closeWindow() {
if (getV2XWindow() != null) {
getV2XWindow().close();
}
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
if (v2xStatus != null) {
v2xStatus.setV2XAnimationWindowShow(TAG, false);
}
}
@Override
public void showButton() {
if (getV2XButton() != null) {
getV2XButton().show();
}
}
@Override
public void closeButton() {
if (getV2XButton() != null) {
getV2XButton().close();
}
}
@Override
public void drawPOI() {
if (getV2XMarker() != null) {
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
}
}
@Override
public void clearPOI() {
setV2XMessageEntity(null);
if (getV2XMarker() != null) {
getV2XMarker().clearPOI();
}
}
}

View File

@@ -1,145 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.animation;
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
import android.content.Context;
import android.net.Uri;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.eagle.core.widget.TextureVideoView;
import com.mogo.service.windowview.IMogoTopViewManager;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/24 11:34 AM
* desc : TODO 前瞻演示功能场景动画
* version: 1.0
*/
public class V2XAnimationWindow extends ConstraintLayout implements IV2XWindow<V2XPushMessageEntity> {
// 弹窗状态监听
private V2XWindowStatusListener mV2XWindowStatusListener;
private TextureVideoView vvCarAnimation;
public V2XAnimationWindow() {
this(BridgeApi.INSTANCE.context(), null);
}
public V2XAnimationWindow(Context context) {
this(context, null);
}
public V2XAnimationWindow(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public V2XAnimationWindow(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
}
public void initView(Context context) {
Logger.w(MODULE_NAME, "初始化场景动画View。。。。。");
LayoutInflater.from(context).inflate(R.layout.window_animation, this);
vvCarAnimation = findViewById(R.id.vvCarAnimation);
}
/**
* 展示道路事件详情Windows
*/
@Override
public void show(V2XPushMessageEntity entity) {
Uri videoUri = null;
String tts = null;
switch (entity.getSceneId()) {
// 前车紧急制动告警
case "100005":
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_emergency_braking);
break;
// 十字路口碰撞预警
case "100006":
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_left_right_car);
tts = "注意路口车辆";
break;
// 岔路口碰撞预警
case "100007":
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_cut_in_line);
break;
// 禁行车道预警
case "100008":
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_current_row_closed);
break;
// 应急车辆优先通行
case "100012":
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_emergency_lane);
break;
// 闯红灯预警
case "100013":
videoUri = Uri.parse("android.resource://" + getContext().getPackageName() + "/raw/" + R.raw.video_traffic_light_speed_cut);
break;
default:
Logger.e(MODULE_NAME, "未定义的类型:" + entity.getSceneId());
}
String path = "https://v.youku.com/v_show/id_XNjAzNzI3MDA0.html";
if (videoUri != null) {
// vvCarAnimation.setVideoPath(path);
vvCarAnimation.setVideoURI(videoUri);
vvCarAnimation.setOnPreparedListener(mediaPlayer -> {
Logger.w(MODULE_NAME, "场景动画准备。。。。。");
});
vvCarAnimation.setOnCompletionListener(mediaPlayer -> {
Logger.w(MODULE_NAME, "动画播放结束...");
if (mV2XWindowStatusListener != null) {
mV2XWindowStatusListener.onViewClose();
}
});
vvCarAnimation.start();
Logger.w(MODULE_NAME, "开始播放动画。。。。。");
if (mV2XWindowStatusListener != null) {
mV2XWindowStatusListener.onViewShow();
}
}
if (tts != null) {
AIAssist.getInstance(BridgeApi.INSTANCE.context()).speakTTSVoice(tts);
}
}
@Override
public void close() {
//移除窗体
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
if (topViewManager != null) {
topViewManager.removeView(this);
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (vvCarAnimation != null) {
vvCarAnimation.stopPlayback();
}
}
@Override
public View getView() {
return this;
}
@Override
public void setWindowStatusListener(V2XWindowStatusListener listener) {
this.mV2XWindowStatusListener = listener;
}
}

View File

@@ -6,22 +6,18 @@ import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.windowview.IMogoTopViewManager;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
/**
@@ -34,9 +30,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
*/
public class V2XFatigueDrivingScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {
// 语音控制导航
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> startNavi();
public V2XFatigueDrivingScenario() {
setV2XWindow(new V2XFatigueDrivingWindow());
}
@@ -56,10 +49,6 @@ public class V2XFatigueDrivingScenario extends AbsV2XScenario<V2XPushMessageEnti
if (!isSameScenario(v2XMessageEntity)) {
setV2XMessageEntity(v2XMessageEntity);
if (v2XMessageEntity != null) {
// 注册语音交互
V2XVoiceManager.INSTANCE
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI, mNaviCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP, mNaviCb);
if (v2XMessageEntity.isShowState()
&& isMainPageOnResume) {
show();
@@ -146,27 +135,4 @@ public class V2XFatigueDrivingScenario extends AbsV2XScenario<V2XPushMessageEnti
v2xStatus.setFatigueDrivingWindowShow(TAG, false);
}
}
/**
* 导航规划路线
*/
private void startNavi() {
if (getV2XMessageEntity().getContent() != null) {
// 反注册语音交互
V2XVoiceManager.INSTANCE
.unRegisterWakeCmd(
V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI)
.unRegisterUnWakeVoice(
V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP);
MogoLatLng endPoint = new MogoLatLng(getV2XMessageEntity().getContent().getLat(),
getV2XMessageEntity().getContent().getLon());
IMogoNavi navi = BridgeApi.INSTANCE.navi();
if (navi != null) {
navi.naviTo(endPoint);
}
close();
}
}
}

View File

@@ -3,8 +3,6 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.help;
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.Nullable;
@@ -16,17 +14,15 @@ import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.service.entrance.IMogoEntranceButtonController;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
/**
* @ProjectName: MoGoModulSafeDriving
@@ -69,15 +65,6 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
showButton();
mySeekHelpCountDownTimerCancel();
mySeekHelpCountDownTimerStart();
if (cancelCb == null) {
cancelCb = (command, intent) -> {
IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton();
TextView tv = entranceButton != null ? entranceButton.getButton(ButtonIndex.BUTTON2) : null;
if (tv != null) {
showDialog();
}
};
}
unregisterSeekHelpButtonCmd();
V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP, cancelCb);
V2XVoiceManager.INSTANCE.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CANCEL_FOR_HELP_UN_WAKEUP, cancelCb);
@@ -109,7 +96,7 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
if (getV2XButton() != null) {
getV2XButton().setOnActionListener(this::showDialog);
getV2XButton().show();
// V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP, R.drawable.module_v2x_left_notice_seek_help, "正在发起求助...");
// V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP, R.drawable.module_v2x_left_notice_seek_help, "正在发起求助...");
}
});
}
@@ -123,10 +110,6 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
}
if (isSeekHelping) {
Logger.d(TAG, "关闭自车求助按钮!");
IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton();
if (entranceButton != null) {
entranceButton.hideLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP);
}
statusManager.setSeekHelping(TAG, false);
if (getV2XButton() != null) {
getV2XButton().close();
@@ -149,8 +132,6 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
if (v2xMarker != null) {
// 移除事件POI
v2xMarker.clearSpecialCarPOI();
// 绘制上次的数据
v2xMarker.drawableLastAllPOI();
}
@@ -246,33 +227,6 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
entity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP);
entity.setContent(isTrue);
init(entity);
} else if (descriptor == StatusDescriptor.VR_MODE) {
boolean isSeekHelping = false;
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
isSeekHelping = statusManager.isSeekHelping();
}
if (isSeekHelping) {
if (isTrue) {
((V2XSeekHelpButton) getV2XButton()).showTopView();
IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton();
if (entranceButton != null) {
TextView button = entranceButton.getButton(ButtonIndex.BUTTON2);
if (button != null) {
button.setVisibility(View.GONE);
}
}
} else {
((V2XSeekHelpButton) getV2XButton()).closeTopView();
IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton();
if (entranceButton != null) {
TextView button = entranceButton.getButton(ButtonIndex.BUTTON2);
if (button != null) {
button.setVisibility(View.VISIBLE);
}
}
}
}
}
}
}

View File

@@ -5,8 +5,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback;
@@ -17,9 +17,6 @@ import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.service.entrance.IMogoEntranceButtonController;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.windowview.IMogoTopViewManager;
/**
@@ -57,34 +54,6 @@ public class V2XSeekHelpButton implements IV2XButton {
@Override
public void show() {
registerVoice();
try {
IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton();
tv = entranceButton != null ? entranceButton.getButton(ButtonIndex.BUTTON2) : null;
if (tv != null) {
tv.setText("取消\n求助");
tv.setOnClickListener(v -> {
//调用取消求助接口
// TODO: 2020/5/18 回调,显示对话框
doAction();
});
}
boolean isVrMode = false;
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
isVrMode = statusManager.isVrMode();
}
if (isVrMode) {
showTopView();
tv.setVisibility(View.GONE);
} else {
closeTopView();
tv.setVisibility(View.VISIBLE);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void showTopView() {

View File

@@ -4,15 +4,11 @@ import android.content.Intent;
import android.view.View;
import android.widget.TextView;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XButton;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XButtonListener;
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.service.entrance.IMogoEntranceButtonController;
/**
* 道路实况按钮
@@ -36,19 +32,6 @@ public class V2XRoadEventButton implements IV2XButton {
public void show() {
// 注册语音交互
registerVoice();
IMogoEntranceButtonController entranceButton = BridgeApi.INSTANCE.entranceButton();
tv = entranceButton != null ? entranceButton.getButton(ButtonIndex.BUTTON1) : null;
if (tv != null){
tv.setText("查看\n详情");
tv.setBackgroundResource(R.drawable.bg_v2x_event_live_show);
tv.setVisibility(View.VISIBLE);
tv.setOnClickListener(v -> {
if (mListener != null) {
mListener.onAction();
}
close();
});
}
}
@Override

View File

@@ -1,14 +1,13 @@
package com.mogo.eagle.core.function.v2x.events.utils;
import android.location.Location;
import android.util.Log;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
/**
* author : donghongyu
@@ -26,31 +25,21 @@ public class LocationUtils {
* @return 当前位置
*/
public static MogoLatLng getCurrentLatLon() {
IMogoNavi navi = BridgeApi.INSTANCE.navi();
MogoLatLng latLon = null;
if (navi != null) {
latLon = navi.getCarLocation();
if (latLon == null) {
Location location = navi.getCarLocation2();
if (location != null) {
latLon = new MogoLatLng(location.getLatitude(), location.getLongitude());
}
// 当前车辆位置
MogoLatLng latLon = new MogoLatLng(
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
);
IMogoLocationClient locationClient = BridgeApi.INSTANCE.locationClient();
if (locationClient != null) {
MogoLocation location = locationClient.getLastKnowLocation();
if (location != null) {
latLon = new MogoLatLng(location.getLatitude(), location.getLongitude());
}
}
if (latLon == null) {
IMogoLocationClient locationClient = BridgeApi.INSTANCE.locationClient();
if (locationClient != null) {
MogoLocation location = locationClient.getLastKnowLocation();
if (location != null) {
latLon = new MogoLatLng(location.getLatitude(), location.getLongitude());
}
}
}
if (latLon == null) {
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
if (mapUiController != null) {
latLon = mapUiController.getWindowCenterLocation();
}
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
if (mapUiController != null) {
latLon = mapUiController.getWindowCenterLocation();
}
return latLon;
}

View File

@@ -5,6 +5,7 @@ import android.graphics.Rect
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
import com.mogo.eagle.core.utilcode.util.WindowUtils
import com.mogo.module.common.MogoApisHandler
import com.mogo.module.common.utils.CarSeries
import java.lang.Exception
@@ -18,8 +19,6 @@ class MapUtils {
if (latLng == null) {
return
}
// 当前车辆位置
val navi = BridgeApi.navi() ?: return
//Logger.d(V2XConst.MODULE_NAME, "重新调整地图缩放比:" + latLng);
val mBoundRect = Rect()
val paddingTop: Int
@@ -41,7 +40,11 @@ class MapUtils {
mBoundRect.top = paddingTop
mBoundRect.left = paddingLeft
mBoundRect.right = paddingRight
val carLocation = navi.carLocation
// 当前车辆位置
val carLocation = MogoLatLng(
MogoApisHandler.getInstance().apis.adasControllerApi.lastLat,
MogoApisHandler.getInstance().apis.adasControllerApi.lastLon
)
// 调整自适应的地图镜头
carLocation?.let {
BridgeApi.mapUiController()?.showBounds("MapUtils", it, listOf(latLng), mBoundRect, true)

View File

@@ -0,0 +1,516 @@
package com.mogo.eagle.core.function.v2x.events.utils;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes;
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.List;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-01-0918:20
* desc : 生成测试数据
* version: 1.0
*/
public class TestOnLineCarUtils {
/**
* 获取测试的违章停车数据
*/
public static V2XMessageEntity<List<MarkerExploreWay>> getV2XIllegalParkData() {
try {
InputStream inputStream = Utils.getApp().getResources().openRawResource(R.raw.illegal_park_data);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
MarkerResponse markerResponse = GsonUtil.objectFromJson(baos.toString(), MarkerResponse.class);
V2XMessageEntity<List<MarkerExploreWay>> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING);
// 设置数据
v2xMessageEntity.setContent(markerResponse.getResult().getExploreWay());
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟道路事件测试数据
*/
public static V2XMessageEntity<V2XRoadEventEntity> getV2XScenarioRoadEventData() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.scenario_road_event_data);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XRoadEventEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XRoadEventEntity.class);
V2XMessageEntity<V2XRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟道路事件UGC测试数据
*/
public static V2XMessageEntity<V2XRoadEventEntity> getV2XScenarioRoadEventUGCData() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.scenario_road_event_data);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XRoadEventEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XRoadEventEntity.class);
V2XMessageEntity<V2XRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟H5推送数据
*/
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarioPushEventData() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.scenario_push_event_data);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 测试数据
*/
public static V2XMessageEntity getV2XScenarioPushFrontWarningEventData(String adasResult) {
try {
int id = R.raw.scenario_warning_event_data_right;
switch (adasResult) {
case "left":
id = R.raw.scenario_warning_event_data_left;
break;
case "pedestrians":
id = R.raw.scenario_warning_event_data_pedestrians;
break;
default:
}
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(id);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class);
V2XMessageEntity messageEntity = new V2XMessageEntity();
messageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS);
messageEntity.setContent(warningEntity);
return messageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟H5推送直播数据
*/
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarioPushLiveEventData() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.scenario_push_live_event_data);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟H5推送场景动画数据
*/
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarioAnimationEventData() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.scenario_push_animation_event_data);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟H5推送场景--十字路口碰撞
*/
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarioCrossCrash() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.scenario_push_cross_crash);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟 疲劳驾驶
*/
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarioFatigueDrivingData() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.scenario_fatigue_driving_data);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XPushMessageEntity v2xRoadEventEntity =
GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟 道路求助
*/
public static V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> getV2XScenarioSeekHelpData() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.scenario_seek_help);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XSpecialCarRes v2xRoadEventEntity =
GsonUtil.objectFromJson(baos.toString(), V2XSpecialCarRes.class);
V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity.getCoordinates());
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟 后方VIP
*/
public static V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> getV2XScenarionVRBehindVIPData() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.scenario_push_vr_hehind_vip_data);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XSpecialCarRes v2xRoadEventEntity =
GsonUtil.objectFromJson(baos.toString(), V2XSpecialCarRes.class);
V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity.getCoordinates());
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 逆向车辆路线预判
*/
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarionVRReverseCarData() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.scenario_push_vr_reverse_car_data);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟最优路线推送
*/
public static V2XMessageEntity<V2XOptimalRouteDataRes> getV2XOptimalRoute() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.test_data_v2x_zuiyouluxian);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XOptimalRouteDataRes v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XOptimalRouteDataRes.class);
V2XMessageEntity<V2XOptimalRouteDataRes> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 自车求助测试数据
*/
public static V2XMessageEntity<Boolean> getV2XScenarioCarForHelpEventData() {
try {
V2XMessageEntity<Boolean> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP);
// 设置数据
v2xMessageEntity.setContent(true);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 返回绘制线路测试数据
*
* @return
*/
public static List<MogoLatLng> getTestCoordinates() {
try {
InputStream inputStream = Utils.getApp()
.getResources()
.openRawResource(R.raw.test_coordinates);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
return GsonUtil.arrayFromJson(baos.toString(), MogoLatLng.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@@ -71,6 +71,7 @@
<ImageView
android:id="@+id/ivToNav"
android:layout_width="@dimen/module_v2x_event_button_size"
android:visibility="invisible"
android:layout_height="@dimen/module_v2x_event_button_size"
android:layout_marginEnd="@dimen/dp_40"
android:src="@drawable/selector_nav_btn"

View File

@@ -112,6 +112,7 @@
android:id="@+id/ivFaultHelpEventNavi"
android:layout_width="@dimen/module_v2x_event_button_size"
android:layout_height="@dimen/module_v2x_event_button_size"
android:visibility="gone"
android:src="@drawable/selector_nav_btn"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@@ -107,9 +107,9 @@
android:layout_height="@dimen/module_v2x_fault_help_event_call_width"
android:layout_marginRight="@dimen/module_v2x_fault_help_event_navi_margin_right"
android:src="@drawable/v2x_event_icon_daohang_vr"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -110,7 +110,7 @@
android:visibility="gone"
app:layout_constraintStart_toEndOf="@+id/ivRoadCallChart"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
/>
<ImageView
android:id="@+id/ivRoadEventLike"

View File

@@ -57,6 +57,7 @@
android:layout_height="@dimen/module_v2x_event_button_size"
android:layout_marginEnd="@dimen/dp_40"
android:src="@drawable/v2x_to_nav"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/ivClose"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -123,6 +123,7 @@
android:layout_height="@dimen/module_v2x_event_button_size"
android:layout_marginRight="@dimen/dp_40"
android:src="@drawable/selector_nav_history"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -0,0 +1,80 @@
package com.mogo.eagle.core.data.autopilot
class AutoPilotRecordResult {
/**
* 磁盘可用空间(M)
*/
var diskFree: Int = 0
/**
* 采集时长
*/
var duration: Double = 0.0
/**
* 保存的文件名
*/
var fileName: String? = ""
/**
* 其他信息,包含错误信息等
*/
var note: String? = ""
/**
* 域控制器定义的bag key
*/
var key: String? = ""
/**
* 采集状态:
* 100 - 采集成功,自动结束
* 101 - 采集成功,收到结束指令
* 200 - 采集失败
* 201 - 采集中
* 300 - 开始采集
*/
var stat: Int = 0
/**
* 任务类型1-badcase采集任务,2-地图数据采集任务
*/
var type: Int = 0
/**
* 任务ID
*/
var id: Int = 0
/**
* 时间戳格式YYYY-MM-DD-hh-mm-ss
*/
var timestamp: String? = ""
/**
* 此次采集数据总大小M
*/
var total: Int? = 0
/**
* 记录此条数据是否已消费
*/
@Volatile
var consumed: Boolean = false
override fun toString(): String {
return "AutoPilotRecordResult(diskFree=$diskFree, duration=$duration, fileName=$fileName, note=$note, key=$key, stat=$stat, type=$type, id=$id, timestamp=$timestamp, total=$total)"
}
}

View File

@@ -66,13 +66,6 @@ public class MogoServicePaths {
@Deprecated
public static final String PATH_STATUS_MANAGER = "/statusmanager/api";
/**
* 消息中心
*/
@Keep
@Deprecated
public static final String PATH_MSG_CENTER = "/msgcenter/api";
/**
* 消息中心
*/
@@ -80,13 +73,6 @@ public class MogoServicePaths {
@Deprecated
public static final String PATH_WINDOW_MANAGER = "/windowmanger/api";
/**
* 卡片控制
*/
@Keep
@Deprecated
public static final String PATH_CARD_MANAGER = "/cardmanager/api";
/**
* 管理 fragment
*/
@@ -159,13 +145,6 @@ public class MogoServicePaths {
@Deprecated
public static final String PATH_REFRESH_STRATEGY_API = "/refreshstrategy/api";
/**
* 入口按钮
*/
@Keep
@Deprecated
public static final String PATH_ENTRANCE_BUTTON_API = "/entrancebutton/api";
/**
* 顶部1/2屏管理
*/
@@ -187,13 +166,6 @@ public class MogoServicePaths {
@Deprecated
public static final String PATH_MARKER_SERVICE = "/mogomarker/api";
/**
* 其他模块调用分享框
*/
@Keep
@Deprecated
public static final String PATH_SHARE = "/extensions/share";
/**
* 事件面板
*/
@@ -222,41 +194,6 @@ public class MogoServicePaths {
@Deprecated
public static final String PATH_AGREEMENT = "/agreement/showFragment";
/**
* 探路api
*/
@Keep
@Deprecated
public static final String PATH_TANLU_API = "/tanlulib/api";
/**
* 策略上报
*/
@Keep
@Deprecated
public static final String PATH_STRATEGY_SHARE = "/share/strategy";
/**
* 分享模块中,交通状况服务上报
*/
@Keep
@Deprecated
public static final String PATH_TRAFFIC_UPLOAD = "/share/traffic";
/**
* 高德地图巡航上报
*/
@Keep
@Deprecated
public static final String PATH_GAODE_AIMLESS_SHARE = "/share/gaodeAimless";
/**
* 探路ui
*/
@Keep
@Deprecated
public static final String PATH_TANLU_UI_API = "/tanlu/ui";
/**
* 在线好友面板
*/

View File

@@ -16,46 +16,46 @@ enum class TrafficTypeEnum(
) {
TYPE_TRAFFIC_ID_WEI_ZHI(
0,
100,
"未知数据",
R.raw.special_vehicle,
R.raw.special_vehicle
R.raw.v2x_shigong_warning,
R.raw.v2x_shigong_warning
),
TYPE_TRAFFIC_ID_PEOPLE(
1,
"",
R.raw.people,
R.raw.people
R.raw.traffic_people,
R.raw.traffic_people
),
TYPE_TRAFFIC_ID_BICYCLE(
2,
"自行车",
R.raw.zixingche,
R.raw.zixingche
R.raw.traffic_zixingche,
R.raw.traffic_zixingche
),
TYPE_TRAFFIC_ID_TA_CHE(
3,
"他车",
R.raw.othercar,
R.raw.othercar
R.raw.traffic_tachexiaoche,
R.raw.traffic_tachexiaoche
),
TYPE_TRAFFIC_ID_MOTO(
4,
"摩托",
R.raw.motuoche,
R.raw.motuoche
R.raw.traffic_motuoche,
R.raw.traffic_motuoche
),
TYPE_TRAFFIC_ID_BUS(
6,
"大巴",
R.raw.daba,
R.raw.daba
R.raw.traffic_daba,
R.raw.traffic_daba
),
TYPE_TRAFFIC_ID_TRUCK(
8,
"卡车",
R.raw.daba,
R.raw.daba
R.raw.traffic_daba,
R.raw.traffic_daba
),
TYPE_TRAFFIC_ID_CAMERA(
9,

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.function.api.autopilot
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage
import com.mogo.eagle.core.data.traffic.TrafficData
import java.util.*
@@ -16,13 +17,19 @@ interface IMoGoAutopilotIdentifyListener {
*
* @param trafficData 交通元素信息列表
*/
fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList<TrafficData>?)
fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList<TrafficData>?) {}
/**
* 报警信息
*
* @param autopilotWarnMessage 预警信息
*/
fun onAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?)
fun onAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) {}
/**
* 采集结果回调
*/
fun onAutopilotRecordResult(record: AutoPilotRecordResult?) {}
}

View File

@@ -60,6 +60,14 @@ public interface IMoGoAutopilotProvider extends IMoGoFunctionServerProvider {
Boolean setAutoPilotSpeed(int speed);
/**
* 记录各种失败
* @param key 采集任务的标识
* @param name 文件名字
* @param reason 原因
*/
void recordCause(String key, String name, String id, String reason);
/**
* 关机
*/

View File

@@ -34,6 +34,11 @@ interface IMoGoWaringProvider {
*/
fun setToolsViewVisibility(visibility: Int)
/**
* 开关DebugView
*/
fun toggleDebugView()
/**
* 展示VR下V2X预警
*
@@ -159,4 +164,18 @@ interface IMoGoWaringProvider {
*/
fun showBrakeLight(brakeLight: Int)
/**
* 展示工控机下载状态信息
* @param downloadVersion 下载版本
* @param downloadStatus 下载状态(0:下载完成1:正在下载2:下载失败)
* @param downloadProgress 下载进度
*/
fun showAdDownloadStatus(downloadVersion : String,downloadStatus : Int,downloadProgress : Int)
/**
* 展示工控机升级状态信息
* @param upgradeStatus 升级状态true代表升级成功、false代表升级不成功
*/
fun showAdUpgradeStatus(upgradeStatus : Boolean)
}

View File

@@ -13,7 +13,7 @@ import com.mogo.eagle.core.function.call.base.CallerBase
object CallerAutoPilotManager {
private val TAG = "CallerAutoPilotManager"
private val providerApi: IMoGoAutopilotProvider
private val providerApi: IMoGoAutopilotProvider?
get() = CallerBase.getApiInstance(
IMoGoAutopilotProvider::class.java,
MogoServicePaths.PATH_AUTO_PILOT
@@ -25,7 +25,7 @@ object CallerAutoPilotManager {
* @param autoPilotIp 指定与控制器IP
*/
fun resetIpAddress(autoPilotIp: String) {
providerApi.resetIpAddress(autoPilotIp)
providerApi?.resetIpAddress(autoPilotIp)
}
/**
@@ -38,7 +38,7 @@ object CallerAutoPilotManager {
//LogUtils.eTag(TAG, "自动驾驶控制参数异常,请检查参数信息")
return
}
providerApi.startAutoPilot(controlParameters)
providerApi?.startAutoPilot(controlParameters)
}
/**
@@ -46,40 +46,44 @@ object CallerAutoPilotManager {
* 具体的json格式需要与@宋克难 进行沟通
*/
fun sendDataToAutopilot(jsonString: String) {
providerApi.sendMessageToAutopilot(jsonString)
providerApi?.sendMessageToAutopilot(jsonString)
}
/**
* 结束自动驾驶
*/
fun cancelAutoPilot() {
providerApi.cancelAutoPilot()
providerApi?.cancelAutoPilot()
}
/**
* 开启域控制器录制bag包
*/
fun recordPackage() {
providerApi.recordPackage()
providerApi?.recordPackage()
}
fun setEnableLog(isEnableLog: Boolean) {
providerApi.setEnableLog(isEnableLog)
providerApi?.setEnableLog(isEnableLog)
}
fun setIsWriteLog(isWriteLog: Boolean) {
providerApi.setIsWriteLog(isWriteLog)
providerApi?.setIsWriteLog(isWriteLog)
}
fun setAutoPilotSpeed(speed: Int): Boolean {
return providerApi.setAutoPilotSpeed(speed)
return providerApi?.setAutoPilotSpeed(speed) ?: false
}
fun recordCause(key: String?, name: String?, id: String?, reason: String?) {
providerApi?.recordCause(key, name, id, reason)
}
fun setIPCShutDown() {
providerApi.setIPCShutDown()
providerApi?.setIPCShutDown()
}
fun setIPCReboot() {
providerApi.setIPCReboot()
providerApi?.setIPCReboot()
}
}

View File

@@ -149,4 +149,5 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
}
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.call.autopilot
import androidx.annotation.Nullable
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
@@ -89,4 +90,17 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() {
}
}
/**
* 采集任务记录回调
*/
fun invokeAutopilotRecordResult(result: AutoPilotRecordResult) {
M_AUTOPILOT_IDENTIFY_LISTENERS.forEach {
val tag = it.key
val listener = it.value
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
listener.onAutopilotRecordResult(result)
}
}
}

Some files were not shown because too many files have changed in this diff Show More