Merge branch 'dev_robotaxi-d-app-module_251_220125_2.5.1' into dev_MogoAP_eagle-220_211207_8.0.17_merge
# Conflicts: # app/build.gradle
This commit is contained in:
@@ -6,13 +6,16 @@ import androidx.annotation.RequiresPermission
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
|
||||
import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
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.IPCUpgradeInfo
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@@ -23,13 +26,15 @@ import java.util.concurrent.TimeUnit
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
|
||||
class MoGoAutopilotProvider :
|
||||
IMoGoAutopilotProvider {
|
||||
IMoGoAutopilotProvider {
|
||||
private val TAG = "MoGoAutoPilotProvider"
|
||||
private var mContext: Context? = null
|
||||
|
||||
override val functionName: String
|
||||
get() = TAG
|
||||
|
||||
override fun init(context: Context) {
|
||||
mContext = context
|
||||
// 初始化ADAS 域控制器
|
||||
//AdasManager.getInstance().create(context)
|
||||
AsyncDataToAutopilotServer.INSTANCE.initServer()
|
||||
@@ -47,6 +52,8 @@ class MoGoAutopilotProvider :
|
||||
ThreadUtils.executeBySingleWithDelay(object : ThreadUtils.SimpleTask<String>() {
|
||||
@RequiresPermission(permission.INTERNET)
|
||||
override fun doInBackground(): String {
|
||||
// 保存本地 AutoPilot IP地址
|
||||
mContext?.let { SharedPrefsMgr.getInstance(it).putString(MoGoConfig.AUTOPILOT_IP, autoPilotIp) }
|
||||
// 设置IP地址
|
||||
AdasManager.getInstance().setIPCIp(autoPilotIp)
|
||||
// 打开通讯连接
|
||||
@@ -83,7 +90,7 @@ class MoGoAutopilotProvider :
|
||||
|
||||
override fun recordPackage(): Boolean {
|
||||
return AdasManager.getInstance()
|
||||
.recordPackage(1, (System.currentTimeMillis() / 1000).toInt())
|
||||
.recordPackage(1, (System.currentTimeMillis() / 1000).toInt())
|
||||
}
|
||||
|
||||
override fun setEnableLog(isEnableLog: Boolean) {
|
||||
@@ -113,4 +120,18 @@ class MoGoAutopilotProvider :
|
||||
override fun recordCause(key: String?, name: String?, id: String?, reason: String?) {
|
||||
AdasManager.getInstance().recordCause(key, name, id, reason)
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级确认
|
||||
*/
|
||||
override fun setIPCUpgradeAffirm() {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.affirm());
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级取消
|
||||
*/
|
||||
override fun setIPCUpgradeCancel() {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.cancel());
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.check
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.check.ICheckProvider
|
||||
@@ -12,10 +11,7 @@ import com.mogo.eagle.core.function.check.net.CheckNetWork.checkNetWork
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData
|
||||
import com.mogo.eagle.core.function.check.view.CheckActivity
|
||||
import com.mogo.eagle.core.function.check.view.CheckDialog
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityLifecycleManager
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.service.receiver.MogoReceiver
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
||||
@@ -89,7 +85,7 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
|
||||
*/
|
||||
private fun showDialog(context: Context) {
|
||||
try {
|
||||
if (ActivityLifecycleManager.getInstance().isAppActive && AppUtils.isAppRunning(
|
||||
if (AppStateManager.isActive() && AppUtils.isAppRunning(
|
||||
AppUtils.getAppPackageName()
|
||||
) && ActivityUtils.getTopActivity() !is CheckActivity
|
||||
) {
|
||||
|
||||
@@ -54,6 +54,11 @@ dependencies {
|
||||
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
kapt rootProject.ext.dependencies.androidxroomcompiler
|
||||
implementation rootProject.ext.dependencies.androidxroomruntime
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package com.mogo.eagle.core.function.hmi.notification
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.appcompat.view.ContextThemeWrapper
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import com.mogo.eagle.core.function.hmi.notification.enums.SidePattern
|
||||
import com.mogo.eagle.core.function.hmi.notification.interfaces.OnFloatAnimator
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.reminder.Reminder
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.impl.ViewReminder
|
||||
import com.mogo.eagle.core.utilcode.util.WindowUtils
|
||||
|
||||
/**
|
||||
@@ -33,7 +39,6 @@ class WarningFloat {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 浮窗的属性构建类,支持链式调用
|
||||
*/
|
||||
@@ -155,6 +160,14 @@ class WarningFloat {
|
||||
this.config.height = height
|
||||
}
|
||||
|
||||
fun isOverride(isOverride: Boolean) = apply {
|
||||
this.config.isOverride = isOverride
|
||||
}
|
||||
|
||||
fun isEnqueue(enqueue: Boolean) = apply {
|
||||
this.config.isEnqueue = enqueue
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建浮窗,包括Activity浮窗和系统浮窗,如若系统浮窗无权限,先进行权限申请
|
||||
*/
|
||||
@@ -164,9 +177,66 @@ class WarningFloat {
|
||||
config.layoutId == null && config.layoutView == null ->
|
||||
Logger.e(TAG, "需要传入 layoutId 或 layoutView ")
|
||||
// 申请浮窗权限
|
||||
else -> WarningFloatWindowManager.create(activity, config)
|
||||
else -> {
|
||||
var content: View? = null
|
||||
if (config.layoutView != null) {
|
||||
content = config.layoutView
|
||||
} else if (config.layoutId != null) {
|
||||
content = LayoutInflater.from(activity).inflate(config.layoutId!!, null)
|
||||
}
|
||||
if (config.isEnqueue) {
|
||||
content?.let {
|
||||
config.layoutId = null
|
||||
config.layoutView = it
|
||||
Reminder.enqueue(getLifecycleOwner(activity), WarningFloatReminder(activity, config, it))
|
||||
}
|
||||
} else {
|
||||
WarningFloatWindowManager.create(activity, config)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLifecycleOwner(context: Context): LifecycleOwner {
|
||||
if (context is LifecycleOwner) {
|
||||
return context
|
||||
}
|
||||
if (context is ContextThemeWrapper) {
|
||||
return getLifecycleOwner(context.baseContext)
|
||||
}
|
||||
return ProcessLifecycleOwner.get()
|
||||
}
|
||||
|
||||
|
||||
internal class WarningFloatReminder(private val activity: Context, private val config: WarningNotificationConfig, content: View): ViewReminder(content) {
|
||||
|
||||
private var hasShow = false
|
||||
|
||||
override fun show() {
|
||||
hasShow = !WarningFloatWindowManager.create(activity, config)
|
||||
}
|
||||
|
||||
override fun hide() {
|
||||
dismiss(config.floatTag, false)
|
||||
}
|
||||
|
||||
override fun isOverride(): Boolean {
|
||||
return config.isOverride
|
||||
}
|
||||
|
||||
override fun maxProtectDuration(): Long {
|
||||
return if (hasShow) 0L else super.maxProtectDuration()
|
||||
}
|
||||
}
|
||||
|
||||
fun isShow(): Boolean = WarningFloatWindowManager.getHelper(config.floatTag)?.isShow() ?: false
|
||||
|
||||
fun resetExpireTime(expireTime: Long) {
|
||||
if (!isShow()) {
|
||||
return
|
||||
}
|
||||
WarningFloatWindowManager.getHelper(config.floatTag)?.resetDownTime(expireTime)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -131,6 +131,11 @@ internal class WarningFloatWindowHelper(
|
||||
}
|
||||
}
|
||||
|
||||
fun resetDownTime(expireTime: Long) {
|
||||
config.countDownTime = expireTime
|
||||
resetDownTime()
|
||||
}
|
||||
|
||||
/**
|
||||
* 入场动画
|
||||
*/
|
||||
@@ -292,5 +297,5 @@ internal class WarningFloatWindowHelper(
|
||||
windowManager.updateViewLayout(view, params)
|
||||
}
|
||||
|
||||
|
||||
fun isShow(): Boolean = config.isShow
|
||||
}
|
||||
@@ -18,15 +18,17 @@ internal object WarningFloatWindowManager {
|
||||
* 创建浮窗,tag不存在创建,tag存在创建失败
|
||||
* 创建结果通过tag添加到相应的map进行管理
|
||||
*/
|
||||
fun create(context: Context, config: WarningNotificationConfig) {
|
||||
fun create(context: Context, config: WarningNotificationConfig): Boolean {
|
||||
if (!checkTag(config)) {
|
||||
val helper = WarningFloatWindowHelper(context, config)
|
||||
if (helper.createWindow()) windowMap[config.floatTag!!] = helper
|
||||
return true
|
||||
} else {
|
||||
Log.w(TAG, "存在相同的tag,延长弹窗时间")
|
||||
// 存在相同的tag,直接创建失败
|
||||
config.callbacks?.createdResult(false, "存在相同的tag,延长弹窗时间", null)
|
||||
windowMap[config.floatTag!!]?.resetDownTime()
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,4 +65,7 @@ data class WarningNotificationConfig(
|
||||
|
||||
// 窗口高度
|
||||
var height: Int = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
) {
|
||||
var isEnqueue: Boolean = false
|
||||
var isOverride: Boolean = true
|
||||
}
|
||||
|
||||
@@ -78,12 +78,6 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
|
||||
if (EventTypeEnum.TYPE_USECASE_ID_IVP.poiType == v2xType.toString()) {
|
||||
CallerHmiManager.showLimitingVelocity(1)
|
||||
}
|
||||
CallerHmiManager.showWarningV2X(
|
||||
v2xType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
tag,
|
||||
null
|
||||
)
|
||||
CallerHmiManager.showWarningV2X(v2xType, alertContent, ttsContent, tag, null, true, 5000L)
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@ import android.text.TextUtils
|
||||
import android.util.Log
|
||||
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.AdUpgradeStateHelper
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
@@ -38,6 +38,7 @@ 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.Repository
|
||||
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
|
||||
@@ -71,7 +72,6 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
// V2X、OBU、云端推送,预警弹窗
|
||||
private var mWarningFloat: WarningFloat.Builder? = null
|
||||
|
||||
// 通知、云公告弹窗
|
||||
private var mNoticeFloat: WarningFloat.Builder? = null
|
||||
|
||||
// 超视距、路侧、前车直播
|
||||
@@ -92,7 +92,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
|
||||
companion object {
|
||||
private const val MSG_WHAT_DISMISS_BAD_CASE_ENTRY = 0x1010
|
||||
private val DURATION_FOR_DISMISS = TimeUnit.HOURS.toMillis(4)
|
||||
private val CASE_EXPIRE_DURATION = TimeUnit.HOURS.toMillis(4)
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@@ -105,10 +105,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
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 --")
|
||||
Log.d("QQQ", "-- step -- 1 --")
|
||||
var oldT = try {
|
||||
old?.timestamp?.takeIf { it.isNotBlank() }?.let {
|
||||
SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.getDefault()).parse(it)?.time ?: 0L
|
||||
SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()).parse(it)?.time ?: 0L
|
||||
} ?: 0L
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
@@ -117,7 +117,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
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
|
||||
SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()).parse(it)?.time
|
||||
?: 0L
|
||||
} ?: 0L
|
||||
} catch (t: Throwable) {
|
||||
@@ -125,23 +125,23 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
0L
|
||||
}
|
||||
|
||||
if (oldT == 0L || (newT > 0L && (newT - oldT > 0L) && (newT - oldT) < DURATION_FOR_DISMISS)) {
|
||||
Logger.d(TAG, "-- step -- 2 --")
|
||||
if (oldT == 0L || (newT > 0L && (newT - oldT > 0L) && (newT - oldT) < CASE_EXPIRE_DURATION)) {
|
||||
Log.d("QQQ", "-- step -- 2 --")
|
||||
record?.takeIf { it.key != old?.key && it.timestamp != old?.timestamp }?.also {
|
||||
Logger.d(TAG, "record: [$record] is displaying and consuming ~~~" )
|
||||
Log.d("QQQ", "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." )
|
||||
while (oldT != 0L && newT != 0L && (newT - oldT) >= CASE_EXPIRE_DURATION) {
|
||||
Log.d("QQQ", "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
|
||||
SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()).parse(it)?.time ?: 0L
|
||||
} ?: 0L
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
@@ -149,11 +149,14 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
record?.takeIf { it.key != old?.key && it.timestamp != old?.timestamp }?.also {
|
||||
Logger.d(TAG, "record: [$record] is displaying for rest ..." )
|
||||
Log.d("QQQ", "record: [$record] is displaying for rest ..." )
|
||||
showBadCaseEntrance(it)
|
||||
}
|
||||
} else {
|
||||
Logger.d(TAG, "record: [$old] hasn't been consumed~~~~" )
|
||||
entrance.takeIf { it.visibility != View.VISIBLE }?.also {
|
||||
it.visibility = View.VISIBLE
|
||||
}
|
||||
Log.d("QQQ", "record: [$old] hasn't been consumed~~~~" )
|
||||
}
|
||||
} finally {
|
||||
delay(1000)
|
||||
@@ -169,10 +172,19 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
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
|
||||
val record = entrance.getTag(R.id.autopilot_badcase_record) as? AutoPilotRecordResult
|
||||
record?.consumed = true
|
||||
record?.let { itx ->
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
val i = Repository.dao().deleteRecord(itx)
|
||||
Log.d("QQQ", "delete result: $i")
|
||||
} catch (t: Throwable) {
|
||||
Log.d("QQQ", "---- delete error: ${t.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
dismissBadCaseFloatView()
|
||||
entrance.visibility = View.GONE
|
||||
}
|
||||
return@Callback true
|
||||
@@ -212,18 +224,41 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
|
||||
lifecycleScope.launchWhenResumed {
|
||||
withContext(Dispatchers.IO) {
|
||||
val dao = Repository.dao()
|
||||
try {
|
||||
dao.getAllUnConsumedRecords()?.forEach {
|
||||
channel.send(it)
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
override fun onAutopilotRecordResult(record: AutoPilotRecordResult?) {
|
||||
record ?: return
|
||||
Logger.d(TAG, "onAutopilotRecordResult:$record")
|
||||
Log.d("QQQ", "onAutopilotRecordResult:$record")
|
||||
if (record.type == 1 && record.stat == 100) {
|
||||
lifecycleScope.launchWhenResumed {
|
||||
channel.send(record)
|
||||
withContext(Dispatchers.IO) {
|
||||
val dao = Repository.dao()
|
||||
try {
|
||||
dao.insertRecord(record)
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
record.also {
|
||||
channel.send(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -233,15 +268,15 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
fun showBadCaseEntrance(record: AutoPilotRecordResult) {
|
||||
Logger.d(TAG, "showBadCaseEntrance:$record")
|
||||
private fun showBadCaseEntrance(record: AutoPilotRecordResult) {
|
||||
Log.d("QQQ", "showBadCaseEntrance:$record")
|
||||
lifecycleScope.launch {
|
||||
if (vs_bad_case_entrance?.parent != null) {
|
||||
val inflateView = vs_bad_case_entrance.inflate()
|
||||
autoPilotBadCaseEntrance = inflateView
|
||||
}
|
||||
val entrance = autoPilotBadCaseEntrance
|
||||
Log.d("QQQ", "show --- 1 ----")
|
||||
if (entrance != null) {
|
||||
if (entrance.visibility != View.VISIBLE) {
|
||||
entrance.visibility = View.VISIBLE
|
||||
@@ -258,20 +293,19 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
|
||||
private fun showBadCasesFloat(dismiss: (() -> Unit)?) {
|
||||
Logger.d(TAG, "showBadCaseToolsFloat")
|
||||
Log.d("QQQ", "showBadCaseToolsFloat")
|
||||
context?.let { it ->
|
||||
if (autoPilotToolsFloat == null) {
|
||||
if (autoPilotBadCaseView == null) {
|
||||
autoPilotBadCaseView = AutoPilotBadCaseView(it).also { itx ->
|
||||
val record =
|
||||
autoPilotBadCaseEntrance?.getTag(R.id.autopilot_badcase_record) as? AutoPilotRecordResult
|
||||
itx.tag = record
|
||||
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 {
|
||||
@@ -281,13 +315,14 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
params["filesize"] = record?.total.toString()
|
||||
params["key"] = record?.key ?: ""
|
||||
params["reason"] = it.reason ?: ""
|
||||
params["timestamp"] = System.currentTimeMillis().toString()
|
||||
params["duration"] = record?.duration?.toInt()?.toString() ?: ""
|
||||
params["timestamp"] = record?.timestamp ?: ""
|
||||
}
|
||||
val response = post(params)
|
||||
if (response.isSuccessful) {
|
||||
val body = response.body()
|
||||
if (body == null) {
|
||||
Logger.e(TAG, "返回的body是空的~~~")
|
||||
Log.e("QQQ", "返回的body是空的~~~")
|
||||
return@launch
|
||||
}
|
||||
if (body.code == 200) {
|
||||
@@ -299,15 +334,24 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
record?.fileName,
|
||||
it.id, it.reason)
|
||||
ToastUtils.showShort("接管反馈成功~")
|
||||
record?.consumed = true
|
||||
record?.also {
|
||||
it.consumed = true
|
||||
withContext(Dispatchers.IO) {
|
||||
try {
|
||||
Repository.dao().deleteRecord(record)
|
||||
} catch (t: Throwable) {
|
||||
Log.d("QQQ", "---- delete error 2: ${t.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
return@launch
|
||||
}
|
||||
Logger.e(TAG, "fail:${body}")
|
||||
Log.e("QQQ", "fail:${body}")
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
ToastUtils.showShort("网络请求失败,请尝试联网~")
|
||||
Logger.e(TAG, "exception:${t.message}")
|
||||
Log.e("QQQ", "exception:${t.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,7 +399,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
|
||||
private fun dismissBadCaseEntryAfterSomeTime() {
|
||||
handler.removeMessages(MSG_WHAT_DISMISS_BAD_CASE_ENTRY)
|
||||
handler.sendEmptyMessageDelayed(MSG_WHAT_DISMISS_BAD_CASE_ENTRY, DURATION_FOR_DISMISS)
|
||||
handler.sendEmptyMessageDelayed(MSG_WHAT_DISMISS_BAD_CASE_ENTRY, CASE_EXPIRE_DURATION)
|
||||
}
|
||||
|
||||
private fun showToolsFloat() {
|
||||
@@ -538,73 +582,77 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
@Synchronized
|
||||
override fun showWarningV2X(
|
||||
v2xType: Int,
|
||||
alertContent: String?,
|
||||
ttsContent: String?,
|
||||
tag: String?,
|
||||
listenerIMoGo: IMoGoWarningStatusListener?
|
||||
) {
|
||||
|
||||
override fun showWarningV2X(v2xType: Int, alertContent: String?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long) {
|
||||
activity?.let {
|
||||
val floatWindow = mWarningFloat
|
||||
val showTag = floatWindow?.config?.floatTag
|
||||
if (floatWindow == null || TextUtils.isEmpty(showTag)) {
|
||||
val notificationView = V2XNotificationView(it)
|
||||
notificationView.setWarningIcon(EventTypeEnum.getWarningIcon(v2xType.toString()))
|
||||
val warningContent = alertContent ?: EventTypeEnum.getWarningContent(v2xType.toString())
|
||||
if (warningContent.isEmpty()) {
|
||||
Logger.e(TAG, "Show warningContent is null or empty!")
|
||||
return
|
||||
} else {
|
||||
notificationView.setWarningContent(warningContent)
|
||||
}
|
||||
|
||||
val notificationView = V2XNotificationView(it)
|
||||
notificationView.setWarningIcon(EventTypeEnum.getWarningIcon(v2xType.toString()))
|
||||
val warningContent = alertContent ?: EventTypeEnum.getWarningContent(v2xType.toString())
|
||||
if (warningContent.isNullOrEmpty()) {
|
||||
Logger.e(TAG, "Show warningContent is null or empty!")
|
||||
return
|
||||
} else {
|
||||
notificationView.setWarningContent(warningContent)
|
||||
}
|
||||
if (mWarningFloat != null && mWarningFloat!!.config.floatTag != tag) {
|
||||
WarningFloat.dismiss(mWarningFloat!!.config.floatTag, true)
|
||||
}
|
||||
|
||||
if (mWarningFloat != null && mWarningFloat!!.config.floatTag != tag) {
|
||||
WarningFloat.dismiss(mWarningFloat!!.config.floatTag, true)
|
||||
}
|
||||
|
||||
mWarningFloat = WarningFloat.with(it)
|
||||
mWarningFloat = WarningFloat.with(it)
|
||||
.setTag(tag)
|
||||
.setLayout(notificationView)
|
||||
.setSidePattern(SidePattern.RESULT_TOP)
|
||||
.setCountDownTime(5000)
|
||||
.setCountDownTime(expireTime)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setImmersionStatusBar(true)
|
||||
.isEnqueue(true)
|
||||
.addWarningStatusListener(listenerIMoGo)
|
||||
.addWarningStatusListener(object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
// 创建弹窗成功才进行TTS播报
|
||||
Logger.d(
|
||||
"MoGoWarningFragment",
|
||||
"mWarningFloat = $mWarningFloat---ttsContent = $ttsContent"
|
||||
"MoGoWarningFragment",
|
||||
"mWarningFloat = $mWarningFloat---ttsContent = $ttsContent"
|
||||
)
|
||||
if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent)) {
|
||||
if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent) && playTts) {
|
||||
Logger.d("MoGoWarningFragment", "---> ttsContent = $ttsContent")
|
||||
AIAssist.getInstance(activity)
|
||||
.speakTTSVoice(ttsContent)
|
||||
.speakTTSVoice(ttsContent)
|
||||
}
|
||||
}
|
||||
})
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.enterAnim(view, params, windowManager, sidePattern)?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
super.enterAnim(view, params, windowManager, sidePattern)?.apply {
|
||||
interpolator = OvershootInterpolator()
|
||||
}
|
||||
|
||||
override fun exitAnim(
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
view: View,
|
||||
params: WindowManager.LayoutParams,
|
||||
windowManager: WindowManager,
|
||||
sidePattern: SidePattern
|
||||
): Animator? =
|
||||
super.exitAnim(view, params, windowManager, sidePattern)?.setDuration(200)
|
||||
super.exitAnim(view, params, windowManager, sidePattern)?.setDuration(200)
|
||||
})
|
||||
.show()
|
||||
|
||||
} else {
|
||||
if (floatWindow.isShow()) {
|
||||
val notification = floatWindow.config.layoutView as? V2XNotificationView
|
||||
if (alertContent?.isNotEmpty() == true) {
|
||||
notification?.setWarningContent(alertContent)
|
||||
floatWindow.resetExpireTime(expireTime)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -906,64 +954,58 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
}
|
||||
}
|
||||
|
||||
private var isOpenTurnlight :Boolean = true
|
||||
|
||||
/**
|
||||
* 显示转向灯效果
|
||||
*/
|
||||
override fun showTurnLight(light: Int) {
|
||||
// turnLightView.setTurnLight(light)
|
||||
|
||||
if (isOpenTurnlight) {
|
||||
//Log.d("liyz", "showTurnLight light = $light")
|
||||
turnLightView.setTurnLight(light)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示刹车效果
|
||||
*/
|
||||
override fun showBrakeLight(light: Int) {
|
||||
// brakeView.setBrakeLight(light)
|
||||
if (isOpenTurnlight) {
|
||||
// Log.d("liyz", "showBrakeLight light = $light")
|
||||
brakeView.setBrakeLight(light)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun setTurnLightFunction(isOpen: Boolean) {
|
||||
isOpenTurnlight = isOpen
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示工控机下载状态信息
|
||||
* 展示工控机下载、升级状态信息
|
||||
* @param upgradeMode 升级模式(提示升级、静默升级)
|
||||
* @param downloadStatus 下载状态
|
||||
* @param currentProgress 当前已经下载包体大小
|
||||
* @param totalProgress 下载包体总大小
|
||||
* @param downloadVersion 下载版本
|
||||
* @param downloadStatus 下载状态(0:下载完成;1:正在下载;2:下载失败)
|
||||
* @param downloadProgress 下载进度
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
override fun showAdDownloadStatus(
|
||||
downloadVersion: String,
|
||||
override fun showAdUpgradeStatus(
|
||||
upgradeMode: Int,
|
||||
downloadStatus: Int,
|
||||
downloadProgress: Int
|
||||
currentProgress: Int,
|
||||
totalProgress: Int,
|
||||
downloadVersion: String,
|
||||
upgradeStatus: Int
|
||||
) {
|
||||
// if (downloadProgress>0){
|
||||
// //新版工控机包处于下载中或已下载完成状态,展示工具箱提示角标
|
||||
// viewUpgradeTips.visibility = View.VISIBLE
|
||||
// }
|
||||
if(downloadStatus==0){
|
||||
//新版本工控机包下载完成,处于可升级状态,展示工具箱提示角标
|
||||
//如果工控机处于“下载中”、“可升级(下载完成)”、“升级中”、“升级失败”状态时,工具箱入口显示红色角标
|
||||
if(AdUpgradeStateHelper.showUpgradeTips(downloadStatus, upgradeStatus)){
|
||||
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
|
||||
viewUpgradeTips.visibility = View.GONE
|
||||
}
|
||||
//TODO 给工具箱空间传递状态
|
||||
// toolsView?.setStatus(true)
|
||||
//将状态同步到工具箱
|
||||
toolsView?.showAdUpgradeStatus(upgradeMode,downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
}
|
||||
|
||||
private fun dismissBadCaseFloatView() {
|
||||
|
||||
@@ -9,15 +9,14 @@ import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.*
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.data.obu.ObuStatusInfo
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
|
||||
@@ -25,6 +24,7 @@ import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
@@ -50,11 +50,12 @@ import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
||||
* 展示 本机、网络、工控机、OBU等状态信息,支持设置IP,等参数进行调试
|
||||
*/
|
||||
class DebugSettingView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener,
|
||||
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, IMoGoMapLocationListener {
|
||||
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener,
|
||||
IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener {
|
||||
|
||||
private val TAG = "DebugSettingView"
|
||||
|
||||
@@ -68,10 +69,16 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
// 添加 OBU状态 监听
|
||||
CallerObuListenerManager.addListener(TAG, this)
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
|
||||
// 添加 地图样式改变 监听
|
||||
CallerMapLocationListenerManager.addListener(TAG, this)
|
||||
// 添加 域控制器感知数据 监听
|
||||
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
|
||||
if (logInfoView != null) {
|
||||
logInfoView!!.onEnterForeground()
|
||||
}
|
||||
@@ -79,10 +86,16 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// 移除 OBU状态 监听
|
||||
CallerObuListenerManager.removeListener(TAG)
|
||||
// 移除 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
// 移除 ADAS车辆状态&定位 监听
|
||||
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
|
||||
// 移除 地图样式改变 监听
|
||||
CallerMapLocationListenerManager.removeListener(TAG)
|
||||
// 移除 域控制器感知数据 监听
|
||||
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
|
||||
if (logInfoView != null) {
|
||||
logInfoView!!.onEnterBackground()
|
||||
}
|
||||
@@ -139,6 +152,14 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
tbOpenLight.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if (!isChecked) {
|
||||
CallerHmiManager.setTurnLightFunction(true)
|
||||
} else {
|
||||
CallerHmiManager.setTurnLightFunction(false)
|
||||
}
|
||||
}
|
||||
|
||||
changesight_top_btn.setOnClickListener {
|
||||
CallerHDMapManager.setMapDAngle(0);
|
||||
}
|
||||
@@ -146,14 +167,14 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
tvObuInfo.text = CallerObuListenerManager.getObuStatusInfoJsonString()
|
||||
tvAutopilotInfo.text =
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString()
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString()
|
||||
|
||||
// 绘制应用基本信息
|
||||
drawAppInfo()
|
||||
|
||||
// 初始化OBU IP信息
|
||||
val ipAddress =
|
||||
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, "192.168.1.199")
|
||||
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, "192.168.1.199")
|
||||
|
||||
etObuIP.setText(ipAddress)
|
||||
etObuIP.text?.let { etObuIP.setSelection(it.length) }
|
||||
@@ -169,7 +190,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
// 初始化工控机 IP信息
|
||||
val autoPilotIpAddress =
|
||||
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.AUTOPILOT_IP, "192.168.1.102")
|
||||
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.AUTOPILOT_IP, "192.168.1.102")
|
||||
|
||||
etAutopilotIP.setText(autoPilotIpAddress)
|
||||
etAutopilotIP.text?.let { etAutopilotIP.setSelection(it.length) }
|
||||
@@ -178,8 +199,6 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
val autoPilotIp = etAutopilotIP.text.toString()
|
||||
if (autoPilotIp.isNotEmpty()) {
|
||||
CallerAutoPilotManager.resetIpAddress(autoPilotIp)
|
||||
// 保存本地 AutoPilot IP地址
|
||||
SharedPrefsMgr.getInstance(context).putString(MoGoConfig.AUTOPILOT_IP, autoPilotIp)
|
||||
} else {
|
||||
ToastUtils.showShort("请输入正确的IP地址")
|
||||
}
|
||||
@@ -190,21 +209,20 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
CallerAutoPilotManager.recordPackage()
|
||||
}
|
||||
|
||||
|
||||
// 初始化 GSP数据源 数据
|
||||
rgGpsProvider.check(
|
||||
when (FunctionBuildConfig.gpsProvider) {
|
||||
0 -> {
|
||||
R.id.rbGpsProviderAndroid
|
||||
when (FunctionBuildConfig.gpsProvider) {
|
||||
0 -> {
|
||||
R.id.rbGpsProviderAndroid
|
||||
}
|
||||
1 -> {
|
||||
R.id.rbGpsProviderRTK
|
||||
}
|
||||
2 -> {
|
||||
R.id.rbGpsProviderOBU
|
||||
}
|
||||
else -> R.id.rbGpsProviderAndroid
|
||||
}
|
||||
1 -> {
|
||||
R.id.rbGpsProviderRTK
|
||||
}
|
||||
2 -> {
|
||||
R.id.rbGpsProviderOBU
|
||||
}
|
||||
else -> R.id.rbGpsProviderAndroid
|
||||
}
|
||||
)
|
||||
rgGpsProvider.setOnCheckedChangeListener { group, checkedId ->
|
||||
when (checkedId) {
|
||||
@@ -222,14 +240,14 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
// 初始化 感知数据是否绘制 选择情况
|
||||
rgIsDrawIdentifyData.check(
|
||||
when (FunctionBuildConfig.isDrawIdentifyData) {
|
||||
true -> {
|
||||
R.id.rbDraw
|
||||
when (FunctionBuildConfig.isDrawIdentifyData) {
|
||||
true -> {
|
||||
R.id.rbDraw
|
||||
}
|
||||
false -> {
|
||||
R.id.rbDoNotDraw
|
||||
}
|
||||
}
|
||||
false -> {
|
||||
R.id.rbDoNotDraw
|
||||
}
|
||||
}
|
||||
)
|
||||
rgIsDrawIdentifyData.setOnCheckedChangeListener { group, checkedId ->
|
||||
when (checkedId) {
|
||||
@@ -242,37 +260,20 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
/*// 切换地图中心点视角
|
||||
tbChangeCarCenter100.setOnClickListener {
|
||||
CallerHDMapManager.changeMaoViewAngle(1)
|
||||
// 演示模式,上一次勾选的数据
|
||||
cbIsDrawAutopilotTrajectoryData.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = isChecked
|
||||
}
|
||||
tbChangeCarQuarter100.setOnClickListener {
|
||||
CallerHDMapManager.changeMaoViewAngle(2)
|
||||
|
||||
// 演示模式,上一次勾选的数据
|
||||
val isDemoMode =
|
||||
SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.IS_DEMO_MODE, false)
|
||||
rbIsDemoMode.isChecked = isDemoMode
|
||||
// 演示模式
|
||||
rbIsDemoMode.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
FunctionBuildConfig.isDemoMode = isChecked
|
||||
SharedPrefsMgr.getInstance(context).putBoolean(MoGoConfig.IS_DEMO_MODE, isChecked)
|
||||
}
|
||||
tbChangeCarTwoFifths100.setOnClickListener {
|
||||
CallerHDMapManager.changeMaoViewAngle(3)
|
||||
}
|
||||
tbChangeCarTwoFifths80.setOnClickListener {
|
||||
CallerHDMapManager.changeMaoViewAngle(4)
|
||||
}
|
||||
tbChangeCAR_AFTER_30_FRONT_80.setOnClickListener {
|
||||
CallerHDMapManager.changeMaoViewAngle(5)
|
||||
}
|
||||
tbChangeCAR_AFTER_30_FRONT_100.setOnClickListener {
|
||||
CallerHDMapManager.changeMaoViewAngle(6)
|
||||
}
|
||||
tbChangeCAR_AFTER_30_FRONT_120.setOnClickListener {
|
||||
CallerHDMapManager.changeMaoViewAngle(7)
|
||||
}
|
||||
tbChangeCAR_AFTER_40_FRONT_80.setOnClickListener {
|
||||
CallerHDMapManager.changeMaoViewAngle(8)
|
||||
}
|
||||
tbChangeCAR_AFTER_40_FRONT_100.setOnClickListener {
|
||||
CallerHDMapManager.changeMaoViewAngle(9)
|
||||
}
|
||||
tbChangeCAR_AFTER_40_FRONT_120.setOnClickListener {
|
||||
CallerHDMapManager.changeMaoViewAngle(10)
|
||||
}*/
|
||||
|
||||
tbSelfLog.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if (isChecked) {
|
||||
@@ -305,7 +306,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
tbLogCatch.isChecked =
|
||||
SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.CATCH_LOG, false)
|
||||
SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.CATCH_LOG, false)
|
||||
tbLogCatch.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
CallerDevaToolsManager.startCatchLog()
|
||||
@@ -316,20 +317,20 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
CallerDevaToolsListenerManager.registerDevaToolsLogCatchListener(TAG,
|
||||
object : IMoGoDevaToolsListener {
|
||||
override fun onLogCatchClose() {
|
||||
super.onLogCatchClose()
|
||||
tbLogCatch.isChecked = false
|
||||
}
|
||||
object : IMoGoDevaToolsListener {
|
||||
override fun onLogCatchClose() {
|
||||
super.onLogCatchClose()
|
||||
tbLogCatch.isChecked = false
|
||||
}
|
||||
|
||||
override fun onLogCatch(lineLog: String) {
|
||||
logInfoView?.let {
|
||||
if (logViewAttach) {
|
||||
it.onLogCatch(lineLog)
|
||||
override fun onLogCatch(lineLog: String) {
|
||||
logInfoView?.let {
|
||||
if (logViewAttach) {
|
||||
it.onLogCatch(lineLog)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
tbLogDebugView.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
logInfoView = LogInfoView()
|
||||
@@ -414,7 +415,14 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) {
|
||||
|
||||
//Logger.d(TAG, "autoPilotCarStateInfo:$autoPilotCarStateInfo")
|
||||
UiThreadHandler.post {
|
||||
tvAutopilotInfo.post {
|
||||
tvCarInfo.text =
|
||||
"GPS时间:${autoPilotCarStateInfo?.values?.satelliteTime}\n" +
|
||||
"自车经纬度:\n${autoPilotCarStateInfo?.values?.lon}\n${autoPilotCarStateInfo?.values?.lat}\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotSNRequest() {
|
||||
@@ -426,7 +434,23 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?) {
|
||||
Logger.d(TAG, "location:$location")
|
||||
//Logger.d(TAG, "location:$location")
|
||||
}
|
||||
|
||||
override fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList<TrafficData>?) {
|
||||
UiThreadHandler.post {
|
||||
tvAutopilotInfo.post {
|
||||
tvIdentifyInfo.text =
|
||||
"感知数据个数:${trafficData?.size}\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onAutopilotRecordResult(record: AutoPilotRecordResult?) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ class AdUpgradeDialog(context: Context) : BaseFloatDialog(context), LifecycleObs
|
||||
private var upgradeConfirm : TextView? = null
|
||||
private var upgradeCancel : TextView? = null
|
||||
|
||||
private var clickListener: ClickListener? = null
|
||||
|
||||
init {
|
||||
setContentView(R.layout.dialog_ad_upgrade)
|
||||
setCanceledOnTouchOutside(true)
|
||||
@@ -29,18 +31,28 @@ class AdUpgradeDialog(context: Context) : BaseFloatDialog(context), LifecycleObs
|
||||
|
||||
upgradeConfirm?.setOnClickListener{
|
||||
Logger.i(TAG,"upgradeConfirm click")
|
||||
clickListener?.confirm()
|
||||
}
|
||||
upgradeCancel?.setOnClickListener {
|
||||
Logger.i(TAG,"upgradeCancel click")
|
||||
clickListener?.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
fun setClickListener(clickListener: ClickListener) {
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
|
||||
fun showUpgradeDialog(){
|
||||
if(isShowing){
|
||||
return
|
||||
}
|
||||
|
||||
show()
|
||||
}
|
||||
|
||||
interface ClickListener{
|
||||
fun confirm()
|
||||
fun cancel()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -112,6 +112,20 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示工控机下载、升级状态信息
|
||||
* @param upgradeMode 升级模式(提示升级、静默升级)
|
||||
* @param downloadStatus 下载状态
|
||||
* @param currentProgress 当前已经下载包体大小
|
||||
* @param totalProgress 下载包体总大小
|
||||
* @param downloadVersion 下载版本
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun showAdUpgradeStatus(upgradeMode: Int,downloadStatus : Int,currentProgress : Int,totalProgress : Int
|
||||
,downloadVersion : String,upgradeStatus : Int){
|
||||
systemVersionView?.showAdUpgradeStatus(upgradeMode,downloadStatus,currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
|
||||
@@ -20,12 +20,14 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.room.*
|
||||
import com.google.gson.annotations.Expose
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.debug.DebugConfig.getNetMode
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult
|
||||
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.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.kotlin.*
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
@@ -38,13 +40,46 @@ import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import kotlin.Result.Companion.failure
|
||||
import kotlin.Result.Companion.success
|
||||
|
||||
|
||||
private typealias OnDismissCallback = () -> Unit
|
||||
private typealias OnSelectCallback = (Reason) -> Unit
|
||||
|
||||
|
||||
object Repository {
|
||||
|
||||
fun dao(): Dao {
|
||||
return Room.databaseBuilder(Utils.getApp(), RecordDb::class.java, "bad-cases").build().dao()
|
||||
}
|
||||
|
||||
@Database(entities = [
|
||||
AutoPilotRecordResult::class
|
||||
],
|
||||
version = 1,
|
||||
exportSchema = false)
|
||||
abstract class RecordDb : RoomDatabase() {
|
||||
abstract fun dao(): Dao
|
||||
}
|
||||
|
||||
@androidx.room.Dao
|
||||
interface Dao {
|
||||
|
||||
@Transaction
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertRecord(record: AutoPilotRecordResult): Long
|
||||
|
||||
@Transaction
|
||||
@Delete
|
||||
suspend fun deleteRecord(record: AutoPilotRecordResult): Int
|
||||
|
||||
@Query("SELECT * FROM record ORDER BY timestamp ASC")
|
||||
suspend fun getAllUnConsumedRecords(): List<AutoPilotRecordResult>?
|
||||
}
|
||||
}
|
||||
|
||||
interface BadCaseApi {
|
||||
|
||||
@FormUrlEncoded
|
||||
@@ -94,11 +129,11 @@ class PostResult {
|
||||
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)
|
||||
return MoGoRetrofitFactory.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}
|
||||
return try { MoGoRetrofitFactory.getInstance(getHost()).create(BadCaseApi::class.java).get() } catch (t: Throwable) { t.printStackTrace(); null}
|
||||
}
|
||||
|
||||
private suspend fun updateCache(entity: BadCaseEntity) = suspendCancellableCoroutine<Unit> {
|
||||
@@ -144,14 +179,37 @@ private suspend fun getCache(): BadCaseEntity? = suspendCancellableCoroutine {
|
||||
private fun getBuildIn(): BadCaseEntity = BadCaseEntity().also { itx ->
|
||||
val data = mutableListOf<Reason>()
|
||||
data += Reason().also {
|
||||
it.id = "1"
|
||||
it.reason = "变道有干扰"
|
||||
}
|
||||
data += Reason().also {
|
||||
it.id = "2"
|
||||
it.reason = "遇红绿灯未停车"
|
||||
}
|
||||
data += Reason().also {
|
||||
it.id = "3"
|
||||
it.reason = "遇障碍物未停车"
|
||||
}
|
||||
data += Reason().also {
|
||||
it.id = "4"
|
||||
it.reason = "无法绕行"
|
||||
}
|
||||
data += Reason().also {
|
||||
it.id = "5"
|
||||
it.reason = "画龙"
|
||||
}
|
||||
data += Reason().also {
|
||||
it.id = "6"
|
||||
it.reason = "转弯过于靠近路侧"
|
||||
}
|
||||
data += Reason().also {
|
||||
it.id = "7"
|
||||
it.reason = "无故退出自动驾驶"
|
||||
}
|
||||
data += Reason().also {
|
||||
it.id = "8"
|
||||
it.reason = "其它"
|
||||
}
|
||||
itx.data = data
|
||||
itx.isBuildIn = true
|
||||
}
|
||||
@@ -191,7 +249,6 @@ class AutoPilotBadCaseView: ConstraintLayout {
|
||||
background = ColorDrawable(Color.parseColor("#F0151D41"))
|
||||
isClickable = true
|
||||
layoutParams = ViewGroup.LayoutParams(960.toPixels().toInt(), 1528.toPixels().toInt())
|
||||
|
||||
close?.onClick {
|
||||
dismiss?.invoke()
|
||||
}
|
||||
@@ -223,6 +280,15 @@ class AutoPilotBadCaseView: ConstraintLayout {
|
||||
if (adapter != null && adapter.itemCount > 0) {
|
||||
return
|
||||
}
|
||||
time_of_take_over?.text = "接管时间: ${(tag as? AutoPilotRecordResult)?.timestamp?.let {
|
||||
try {
|
||||
SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()).parse(it)?.let { itx ->
|
||||
SimpleDateFormat("yyyy.MM.dd HH:mm", Locale.getDefault()).format(itx)
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
null
|
||||
} ?: SimpleDateFormat("yyyy.MM.dd HH:mm", Locale.getDefault()).format(Date())}}"
|
||||
|
||||
scope.launch {
|
||||
showLoading()
|
||||
try {
|
||||
|
||||
@@ -33,52 +33,54 @@ class BrakeViewStatus @JvmOverloads constructor(
|
||||
LayoutInflater.from(context).inflate(R.layout.view_brake_light_status, this, true)
|
||||
}
|
||||
|
||||
private var isBrake :Boolean = false
|
||||
private var isBrake: Boolean = false
|
||||
|
||||
/**
|
||||
* 刹车动画
|
||||
*/
|
||||
fun setBrakeLight(brakeLight: Int) {
|
||||
if (brakeLight == 1) { //TODO 暂时还不知道数据,如果一直猜会怎样?
|
||||
if (brakeLight == 1) { //刹车灯亮
|
||||
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
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
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
|
||||
}
|
||||
}
|
||||
} else { //不踩刹车,就消失
|
||||
if (isBrake) {
|
||||
isBrake = false
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
scaleImageAndTv()
|
||||
|
||||
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?) {
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
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?) {
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import kotlinx.android.synthetic.main.view_brake_light_status.view.*
|
||||
import kotlinx.android.synthetic.main.view_turn_light_status.view.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/**
|
||||
* @description
|
||||
@@ -40,27 +43,33 @@ class TurnLightViewStatus @JvmOverloads constructor(
|
||||
*/
|
||||
fun setTurnLight(directionLight: Int) {
|
||||
if (!isShowNormalBg && (directionLight == 1 || directionLight == 2)) {
|
||||
showNormalAnimation()
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
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)
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
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)
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
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
|
||||
@@ -68,10 +77,13 @@ class TurnLightViewStatus @JvmOverloads constructor(
|
||||
|
||||
} else { //消失
|
||||
if (!isDisappare) {
|
||||
animationDisappear()
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
animationDisappear()
|
||||
}
|
||||
isDisappare = true
|
||||
isShowNormalBg = false
|
||||
isLeftLight = false
|
||||
isRightLight = false
|
||||
isDisappare = false
|
||||
}
|
||||
}
|
||||
@@ -99,6 +111,10 @@ class TurnLightViewStatus @JvmOverloads constructor(
|
||||
left_select_image.clearAnimation()
|
||||
right_select_image.clearAnimation()
|
||||
|
||||
left_nor_image.clearAnimation()
|
||||
right_nor_image.clearAnimation()
|
||||
turn_light_layout.clearAnimation()
|
||||
|
||||
val disappearAnimationLeft = AlphaAnimation(1.0f, 0f)
|
||||
disappearAnimationLeft.duration = 300
|
||||
|
||||
@@ -131,7 +147,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
|
||||
|
||||
override fun onAnimationEnd(p0: Animation?) {
|
||||
turn_light_layout.visibility = View.GONE
|
||||
stopAnimate()
|
||||
// stopAnimate()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ import android.widget.FrameLayout
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
@@ -53,7 +55,11 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun initEvent(context: Context) {
|
||||
|
||||
setOnLongClickListener {
|
||||
Logger.d(TAG, "长按显示状态工具栏")
|
||||
CallerHmiManager.toggleDebugView()
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private val timerTask = object : TimerTask() {
|
||||
@@ -99,12 +105,6 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
|
||||
override fun onCarLocationChanged2(latLng: Location) {
|
||||
mLatLng = latLng
|
||||
// UiThreadHandler.post {
|
||||
// val speed = (latLng.speed * 3.6f).toInt()
|
||||
// mSpeedChartView.setArcColor(Color.parseColor(if (speed > 60) "#DB3137" else "#3E77F6"))
|
||||
// mSpeedChartView.setValues(speed)
|
||||
// setBackgroundResource(if (speed > 60) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,8 +5,10 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.autopilot.AdUpgradeStateHelper
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
|
||||
@@ -28,18 +30,21 @@ 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 dockerVersion :String ?=null //工控机版本
|
||||
private var autopilotStatus:Int ?=null //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中
|
||||
private var adUpgradeDialog : AdUpgradeDialog? = null
|
||||
private var adStatus = AD_LATEST_VERSION //工控机默认为最新版
|
||||
|
||||
private var upgradeMode: Int=-1 //升级模式
|
||||
private var downloadStatus: Int=-1 //下载状态
|
||||
private var currentProgress: Int=0 //当前已下载包体大小
|
||||
private var previousProgress: Int=0 //前一秒的下载进度,用于计算下载剩余时间
|
||||
private var totalProgress: Int=0 //包体总大小
|
||||
private var downloadVersion: String?=null //工控机docker版本
|
||||
private var upgradeStatus: Int=-1 //升级状态
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_system_version, this, true)
|
||||
@@ -57,42 +62,122 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
//工控机版本视图点击事件
|
||||
ivAdVersion.setOnClickListener {
|
||||
Logger.i(TAG,"ad version view clicked")
|
||||
when(adStatus){
|
||||
AD_LATEST_VERSION -> {
|
||||
//最新版
|
||||
Logger.i(TAG,"upgradeMode="+upgradeMode+" downloadStatus="+downloadStatus+" upgradeStatus="+upgradeStatus)
|
||||
if(AdUpgradeStateHelper.isDownloading(downloadStatus)){
|
||||
//点击Toast提示:下载剩余时间
|
||||
ToastUtils.showShort("预计"+AdUpgradeStateHelper.getRemainingTime(totalProgress,previousProgress,currentProgress)+"下载完成")
|
||||
}else if(AdUpgradeStateHelper.isHintUpgradeMode(upgradeMode) && AdUpgradeStateHelper.isDownloadFinish(downloadStatus)){
|
||||
//如果升级模式为“提示升级”,并且下载状态为已经下载完成,点击弹出升级确认弹窗
|
||||
if(adUpgradeDialog == null){
|
||||
adUpgradeDialog = AdUpgradeDialog(context)
|
||||
adUpgradeDialog?.setClickListener(object : AdUpgradeDialog.ClickListener{
|
||||
override fun confirm() {
|
||||
if(autopilotStatus==2){
|
||||
//当前处于自动驾驶状态,不可进行升级,Toast提示
|
||||
ToastUtils.showShort("升级前请先退出自动驾驶模式")
|
||||
}else{
|
||||
//确认升级
|
||||
Logger.i(TAG,"upgrade confirm")
|
||||
//设置当前状态为“升级中”
|
||||
AdUpgradeStateHelper.setUpgradeStatus(true)
|
||||
CallerAutoPilotManager.setIPCUpgradeAffirm()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
AD_DOWNING -> {
|
||||
//下载中
|
||||
//TODO 需要向工控机要下载时间
|
||||
ToastUtils.showShort("新版本下载中,预计XX分钟下载完成")
|
||||
}
|
||||
AD_DOWNLOAD_FAIL -> {
|
||||
//下载失败
|
||||
override fun cancel() {
|
||||
//取消升级
|
||||
Logger.i(TAG,"upgrade cancel")
|
||||
CallerAutoPilotManager.setIPCUpgradeCancel()
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
AD_UPGRADEABLE -> {
|
||||
//下载成功,可升级,点击弹起升级确认弹窗
|
||||
if(adUpgradeDialog == null){
|
||||
adUpgradeDialog = AdUpgradeDialog(context)
|
||||
}
|
||||
adUpgradeDialog?.showUpgradeDialog()
|
||||
}
|
||||
AD_UPGRADING -> {
|
||||
//升级中
|
||||
ToastUtils.showShort("新版本升级中,预计5分钟升级完成")
|
||||
}
|
||||
AD_UPGRADE_FAIL -> {
|
||||
//升级失败
|
||||
ToastUtils.showShort("升级失败,请联系运维人员")
|
||||
}
|
||||
|
||||
adUpgradeDialog?.showUpgradeDialog()
|
||||
}else if(AdUpgradeStateHelper.getUpgradeStatus()){
|
||||
//工控机状态为“升级中”
|
||||
ToastUtils.showShort("新版本升级中,预计5分钟升级完成")
|
||||
}else if(AdUpgradeStateHelper.isUpgradeFailed(upgradeStatus)){
|
||||
//如果升级失败,则Toast提示:升级失败,请联系运维人员
|
||||
ToastUtils.showShort("升级失败,请联系运维人员")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置工控机下载、升级状态信息
|
||||
* @param upgradeMode 升级模式(提示升级、静默升级)
|
||||
* @param downloadStatus 下载状态
|
||||
* @param currentProgress 当前已经下载包体大小
|
||||
* @param totalProgress 下载包体总大小
|
||||
* @param downloadVersion 下载版本
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun setAdUpgradeInfo(upgradeMode: Int,downloadStatus: Int,currentProgress: Int,totalProgress: Int,
|
||||
downloadVersion: String,upgradeStatus: Int){
|
||||
this.upgradeMode=upgradeMode
|
||||
this.downloadStatus=downloadStatus
|
||||
this.previousProgress=this.currentProgress
|
||||
this.currentProgress=currentProgress
|
||||
this.totalProgress=totalProgress
|
||||
this.downloadVersion=downloadVersion
|
||||
this.upgradeStatus=upgradeStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示工控机下载、升级状态信息
|
||||
* @param upgradeMode 升级模式(提示升级、静默升级)
|
||||
* @param downloadStatus 下载状态
|
||||
* @param currentProgress 当前已经下载包体大小
|
||||
* @param totalProgress 下载包体总大小
|
||||
* @param downloadVersion 下载版本
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun showAdUpgradeStatus(upgradeMode: Int,downloadStatus: Int,currentProgress: Int,totalProgress: Int
|
||||
,downloadVersion: String,upgradeStatus: Int){
|
||||
//设置工控机下载、升级状态信息
|
||||
setAdUpgradeInfo(upgradeMode, downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
|
||||
if(AdUpgradeStateHelper.isDownloading(downloadStatus)){
|
||||
//正在下载,展示“下载中”角标,展示进度条,并设置当前下载进度
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_downloading)
|
||||
adCircularProgressView?.let {
|
||||
it.visibility = View.VISIBLE
|
||||
it.setProgress(AdUpgradeStateHelper.downloadProgress(currentProgress,totalProgress))
|
||||
}
|
||||
}else if(AdUpgradeStateHelper.isDownloadFinish(downloadStatus)){
|
||||
//下载完成,处于可升级状态,展示“可升级”角标,将AD背景变为蓝色,并隐藏下载进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_upgradeable)
|
||||
ivAdVersion?.setBackgroundResource(R.drawable.version_upgradeable_background)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
if(AdUpgradeStateHelper.isQuietUpgradeMode(upgradeMode)){
|
||||
//如果升级模式为“静默升级”,则下载完成后,调用升级命令进行升级
|
||||
CallerAutoPilotManager.setIPCUpgradeAffirm()
|
||||
AdUpgradeStateHelper.setUpgradeStatus(true)
|
||||
}
|
||||
}else if(AdUpgradeStateHelper.isDownloadFailed(downloadStatus)){
|
||||
//下载失败,将状态设为“最新版”角标,并隐藏进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_latest_version)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
} else if(AdUpgradeStateHelper.isUpgradeSuccess(upgradeStatus)){
|
||||
//升级成功,将状态设为“最新版”角标,并隐藏进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_latest_version)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
AdUpgradeStateHelper.setUpgradeStatus(false)
|
||||
}else if(AdUpgradeStateHelper.isUpgradeFailed(upgradeStatus)){
|
||||
//升级失败,将状态设为“升级失败”角标,并隐藏进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_upgrade_failed)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
AdUpgradeStateHelper.setUpgradeStatus(false)
|
||||
}else{
|
||||
//其他状态,均显示“最新版”,并隐藏进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_latest_version)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 展示当前鹰眼版本
|
||||
*/
|
||||
@@ -108,57 +193,12 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
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)
|
||||
if(!dockerVersion.isNullOrEmpty()){
|
||||
it.text = dockerVersion
|
||||
}
|
||||
}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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
@@ -171,6 +211,8 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
connectStatus = autoPilotStatusInfo.connectStatus
|
||||
dockerVersion = autoPilotStatusInfo.dockVersion
|
||||
autopilotStatus = autoPilotStatusInfo.state
|
||||
setViewStatus()
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:enabled="false"
|
||||
android:layout_marginBottom="100px"/>
|
||||
android:layout_marginBottom="150px"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cancel"
|
||||
@@ -97,7 +97,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/ok"
|
||||
android:layout_marginBottom="100px"/>
|
||||
android:layout_marginBottom="150px"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_900"
|
||||
android:layout_height="@dimen/dp_900"
|
||||
android:layout_height="@dimen/dp_1000"
|
||||
android:background="#FFFFFF">
|
||||
|
||||
<ScrollView
|
||||
@@ -31,35 +31,51 @@
|
||||
android:textSize="@dimen/dp_34"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<!-- <LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<!-- <LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="PAD系统时间:"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="PAD系统时间:"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
|
||||
<TextClock
|
||||
android:id="@+id/tvNowTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:format12Hour="yyyy年MM月dd日 EEEE aa HH:mm:ss"
|
||||
android:format24Hour="yyyy年MM月dd日 EEEE aa HH:mm:ss"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
</LinearLayout>-->
|
||||
<TextClock
|
||||
android:id="@+id/tvNowTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:format12Hour="yyyy年MM月dd日 EEEE aa HH:mm:ss"
|
||||
android:format24Hour="yyyy年MM月dd日 EEEE aa HH:mm:ss"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
</LinearLayout>-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAppInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_34"
|
||||
android:textSize="@dimen/dp_30"
|
||||
tools:text="应用基础信息" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCarInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_30"
|
||||
tools:text="车辆基础信息" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvIdentifyInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_30"
|
||||
tools:text="感知信息" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!--鹰眼UI控制-->
|
||||
@@ -166,7 +182,8 @@
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 顶视角"
|
||||
android:textSize="@dimen/dp_34"/>
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/changesight_back_btn"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -174,7 +191,8 @@
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 后方来车视角"
|
||||
android:textSize="@dimen/dp_34"/>
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/changesight_cross_btn"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -182,7 +200,7 @@
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 十字路口视角"
|
||||
android:textSize="@dimen/dp_34"/>
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/changesight_far_btn"
|
||||
@@ -191,7 +209,8 @@
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 远视角"
|
||||
android:textSize="@dimen/dp_34"/>
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/reset_changesight"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -200,99 +219,18 @@
|
||||
android:gravity="center"
|
||||
android:text="恢复视角"
|
||||
android:textSize="@dimen/dp_34"/>
|
||||
<!-- <Button
|
||||
android:id="@+id/tbChangeCarCenter100"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 CAR_CENTER_100"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tbChangeCarQuarter100"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 CAR_QUARTER_100"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tbChangeCarTwoFifths100"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 CAR_TWO_FIFTHS_100"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tbChangeCarTwoFifths80"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 CAR_TWO_FIFTHS_80"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tbChangeCAR_AFTER_30_FRONT_80"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 CAR_AFTER_30_FRONT_80"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tbChangeCAR_AFTER_30_FRONT_100"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 CAR_AFTER_30_FRONT_100"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tbChangeCAR_AFTER_30_FRONT_120"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 CAR_AFTER_30_FRONT_120"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tbChangeCAR_AFTER_40_FRONT_80"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 CAR_AFTER_40_FRONT_80"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tbChangeCAR_AFTER_40_FRONT_100"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 CAR_AFTER_40_FRONT_100"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tbChangeCAR_AFTER_40_FRONT_120"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:text="切换 CAR_AFTER_40_FRONT_120"
|
||||
android:textSize="@dimen/dp_34" />-->
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbOpenLight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:textOff="关闭「转向灯控制」"
|
||||
android:textOn="打开「转向灯控制」"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
|
||||
|
||||
<!--日志输出控制-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -440,6 +378,23 @@
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbIsDrawAutopilotTrajectoryData"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="选中绘制车前引导线"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/rbIsDemoMode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="选中开启美化模式"
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_34" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -504,6 +459,7 @@
|
||||
android:textColor="#000"
|
||||
android:textSize="@dimen/dp_34"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/etAutopilotIP"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityLifecycleManager;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
@@ -47,7 +46,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
getApis().getIntentManagerApi().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
|
||||
ActivityLifecycleManager.getInstance().setAppActive(true);
|
||||
//ActivityLifecycleManager.getInstance().setAppActive(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,7 +59,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getApis().getIntentManagerApi().unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
|
||||
ActivityLifecycleManager.getInstance().setAppActive(false);
|
||||
//ActivityLifecycleManager.getInstance().setAppActive(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,16 +69,11 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldCloseADASPanelWhenPause() {
|
||||
return !mIsHomeKeyDown;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadOthersModules() {
|
||||
super.loadOthersModules();
|
||||
Logger.d(TAG, "loadOthersModules");
|
||||
// loadOCHModule();
|
||||
loadOCHModule();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,6 +54,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
initBuildConfig();
|
||||
initConfigWithSP();
|
||||
super.onCreate();
|
||||
if (!shouldInit()) {
|
||||
return;
|
||||
@@ -79,6 +80,11 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
*/
|
||||
protected abstract void initBuildConfig();
|
||||
|
||||
/**
|
||||
* 从SP本地设置中恢复数据
|
||||
*/
|
||||
protected abstract void initConfigWithSP();
|
||||
|
||||
/**
|
||||
* 初始化异常采集配置
|
||||
*/
|
||||
@@ -300,9 +306,8 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
MogoModulePaths.addBaseModule(new MogoModule(UpgradeReportConstants.PATH, UpgradeReportConstants.NAME));
|
||||
// 初始化 apm 日志采集
|
||||
MogoModulePaths.addBaseModule(new MogoModule(CrashReportConstants.PATH, CrashReportConstants.NAME));
|
||||
if (DebugConfig.isMapBased()) {
|
||||
MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
||||
}
|
||||
// 车聊聊,IM
|
||||
MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
||||
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder"));
|
||||
MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY));
|
||||
@@ -325,10 +330,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, "PUSH_UI"));
|
||||
// ADAS模块(旧,慢慢被 域控制器模块 替换掉)
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_ADAS, "AdasProvider"));
|
||||
// 全局语音唤醒
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake"));
|
||||
// ADAS模块(旧,慢慢被 域控制器模块 替换掉)
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_ADAS, "AdasProvider"));
|
||||
|
||||
if (!DebugConfig.isLauncher()) {
|
||||
PersistentManager
|
||||
|
||||
@@ -59,17 +59,7 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
|
||||
@Override
|
||||
public void changeTo2dMode() {
|
||||
try {
|
||||
mMogoMapView.getMap().getUIController()
|
||||
.changeMapMode(
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
.getCurrentSkinMode()
|
||||
);
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// do not implement
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -340,18 +340,14 @@ class MogoPrivateObuManager private constructor() {
|
||||
// CallerHmiManager.showWarning(direction)
|
||||
|
||||
//显示弹框,语音提示
|
||||
CallerHmiManager.showWarningV2X(
|
||||
appId.toInt(),
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
CallerHmiManager.showWarningV2X(appId.toInt(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
)
|
||||
}, true, 5000L)
|
||||
// 更新数据
|
||||
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
|
||||
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
|
||||
@@ -421,18 +417,14 @@ class MogoPrivateObuManager private constructor() {
|
||||
// if (level == 2 || level == 3) { //不考虑level
|
||||
//显示警告红边
|
||||
CallerHmiManager.showWarning(direction)
|
||||
CallerHmiManager.showWarningV2X(
|
||||
v2xType.toInt(),
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(v2xType + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
CallerHmiManager.showWarningV2X(v2xType.toInt(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(v2xType + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
)
|
||||
}, true, 5000L)
|
||||
// }
|
||||
// 更新数据
|
||||
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
|
||||
@@ -615,13 +607,8 @@ class MogoPrivateObuManager private constructor() {
|
||||
0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT
|
||||
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
|
||||
alertContent = EventTypeEnum.getWarningContent(appId.toString())
|
||||
CallerHmiManager.showWarningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(),
|
||||
null
|
||||
)
|
||||
CallerHmiManager.showWarningV2X(appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(), null, true, 5000L)
|
||||
}
|
||||
0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT
|
||||
}
|
||||
@@ -685,13 +672,8 @@ class MogoPrivateObuManager private constructor() {
|
||||
|
||||
val maxSpeed = currentLight.glosa_suggested_speed_max.toInt()
|
||||
if (maxSpeed > 0) {
|
||||
CallerHmiManager.showWarningV2X(
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType.toInt(),
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(),
|
||||
null
|
||||
)
|
||||
CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType.toInt(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(), null, true, 5000L)
|
||||
}
|
||||
}
|
||||
// 黄灯
|
||||
@@ -813,18 +795,14 @@ class MogoPrivateObuManager private constructor() {
|
||||
)
|
||||
if (level == 2 || level == 3) {
|
||||
//显示弹框,语音提示
|
||||
CallerHmiManager.showWarningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
CallerHmiManager.showWarningV2X(appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
)
|
||||
}, true, 5000L)
|
||||
//显示警告红边
|
||||
CallerHmiManager.showWarning(direction)
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -33,7 +31,9 @@ import java.util.List;
|
||||
* @date 2021/5/19 10:50 上午
|
||||
*/
|
||||
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_SMP)
|
||||
public class SmallMapFragment extends BaseFragment implements IMogoSmallMapProvider, IMoGoAutopilotPlanningListener, IMogoAdasOCHCallback , IMoGoAutopilotStatusListener {
|
||||
public class SmallMapFragment extends BaseFragment
|
||||
implements IMogoSmallMapProvider, IMoGoAutopilotPlanningListener,
|
||||
IMoGoAutopilotStatusListener {
|
||||
private final String TAG = "SmallMapFragment";
|
||||
protected SmallMapDirectionView mSmallMapDirectionView;
|
||||
|
||||
@@ -63,7 +63,6 @@ public class SmallMapFragment extends BaseFragment implements IMogoSmallMapProvi
|
||||
mSmallMapDirectionView = mRootView.findViewById(R.id.smallMapDirectionView);
|
||||
mSmallMapDirectionView.onCreateView(savedInstanceState);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasOCHCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -143,15 +142,6 @@ public class SmallMapFragment extends BaseFragment implements IMogoSmallMapProvi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAt(AutopilotStationInfo data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChanged(int state, String reason) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package com.mogo.eagle.core.function.smp.view;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/6/24 11:33 上午
|
||||
|
||||
@@ -570,7 +570,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
override fun onShow() {}
|
||||
override fun onDismiss() {
|
||||
}
|
||||
})
|
||||
}, true, 5000L)
|
||||
TrafficMarkerDrawer.updateITrafficInfo(trafficData)
|
||||
}
|
||||
2 -> {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
|
||||
/**
|
||||
* 事件面板viewpager2的adapter
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class V2XEventPagerAdapter(fragment: Fragment,
|
||||
private val fragments: Array<Fragment>) :
|
||||
FragmentStateAdapter(fragment) {
|
||||
|
||||
/**
|
||||
* 目前一共就三个fragment
|
||||
*/
|
||||
override fun getItemCount(): Int = fragments.size
|
||||
|
||||
override fun createFragment(position: Int): Fragment = fragments[position]
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XIllegalParkVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XLiveVideoVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XOtherSeekHelpVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XPushEventVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XRoadEventVH;
|
||||
//import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XRoadEventVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
@@ -46,10 +46,10 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING:
|
||||
holder = new V2XLiveVideoVH(parent, mV2XWindow);
|
||||
break;
|
||||
//道路事件详情
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
|
||||
holder = new V2XRoadEventVH(parent, mV2XWindow);
|
||||
break;
|
||||
// //道路事件详情
|
||||
// case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
|
||||
// holder = new V2XRoadEventVH(parent, mV2XWindow);
|
||||
// break;
|
||||
//违章停车
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
|
||||
holder = new V2XIllegalParkVH(parent, mV2XWindow);
|
||||
@@ -83,9 +83,9 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
if (holder instanceof V2XLiveVideoVH) {
|
||||
((V2XLiveVideoVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
if (holder instanceof V2XRoadEventVH) {
|
||||
((V2XRoadEventVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
// if (holder instanceof V2XRoadEventVH) {
|
||||
// ((V2XRoadEventVH) holder).initView(itemList.get(position));
|
||||
// }
|
||||
if (holder instanceof V2XIllegalParkVH) {
|
||||
((V2XIllegalParkVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XScenarioHistoryIllegalParkVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XScenarioHistoryOtherSeekHelpVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XScenarioHistoryRoadEventVH;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XScenarioHistoryAdapter extends RecyclerView.Adapter<ViewHolder> {
|
||||
|
||||
private ArrayList<V2XHistoryScenarioData> mV2XHistoryScenarioData;
|
||||
|
||||
public V2XScenarioHistoryAdapter(ArrayList<V2XHistoryScenarioData> v2XHistoryScenarioData) {
|
||||
if (v2XHistoryScenarioData != null) {
|
||||
this.mV2XHistoryScenarioData = v2XHistoryScenarioData;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ViewHolder holder;
|
||||
switch (viewType) {
|
||||
//道路事件详情
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
|
||||
holder = new V2XScenarioHistoryRoadEventVH(parent);
|
||||
break;
|
||||
//违章停车
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
|
||||
holder = new V2XScenarioHistoryIllegalParkVH(parent);
|
||||
break;
|
||||
//他人故障求助
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
|
||||
holder = new V2XScenarioHistoryOtherSeekHelpVH(parent);
|
||||
break;
|
||||
//没有更多的数据的Footer
|
||||
default:
|
||||
View footerView = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.footer_nomore_view, parent, false);
|
||||
holder = new FooterViewHolder(footerView);
|
||||
break;
|
||||
}
|
||||
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
if (position < mV2XHistoryScenarioData.size()) {
|
||||
if (holder instanceof V2XScenarioHistoryRoadEventVH) {
|
||||
((V2XScenarioHistoryRoadEventVH) holder).initView(mV2XHistoryScenarioData.get(position));
|
||||
}
|
||||
if (holder instanceof V2XScenarioHistoryIllegalParkVH) {
|
||||
((V2XScenarioHistoryIllegalParkVH) holder).initView(mV2XHistoryScenarioData.get(position));
|
||||
}
|
||||
if (holder instanceof V2XScenarioHistoryOtherSeekHelpVH) {
|
||||
((V2XScenarioHistoryOtherSeekHelpVH) holder).initView(mV2XHistoryScenarioData.get(position));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position < mV2XHistoryScenarioData.size()) {
|
||||
return mV2XHistoryScenarioData.get(position).getScenarioType();
|
||||
} else {
|
||||
// 没有更多的Footer
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
// 多添加一个Footer
|
||||
return mV2XHistoryScenarioData == null ? 0 : mV2XHistoryScenarioData.size() + 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Footer 视图
|
||||
*/
|
||||
static class FooterViewHolder extends RecyclerView.ViewHolder {
|
||||
public FooterViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventDescription;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventItem;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventItemEnum;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventLoadMoreItem;
|
||||
import com.mogo.eagle.core.function.v2x.events.fragment.V2XEventPanelFragment;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.AdapterCallback;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import com.mogo.module.common.view.CustomRatingBar;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class V2XShareEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private Context context;
|
||||
private ArrayList dataArrayList;
|
||||
private final LayoutInflater shareLayoutInflater;
|
||||
private IMogoServiceApis mApis;
|
||||
private AdapterCallback callback;
|
||||
|
||||
public V2XShareEventAdapter(Context context, ArrayList dataArrayList, AdapterCallback callback) {
|
||||
this.context = context;
|
||||
this.dataArrayList = dataArrayList;
|
||||
this.callback = callback;
|
||||
shareLayoutInflater = LayoutInflater.from(context);
|
||||
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
//根据viewType创建自定义布局
|
||||
if (viewType == V2XShareEventItemEnum.ITEM_TYPE_NUM_DES) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_description, parent,
|
||||
false);
|
||||
shareDescriptionViewHolder holder = new shareDescriptionViewHolder(v);
|
||||
return holder;
|
||||
} else if (viewType == V2XShareEventItemEnum.ITEM_TYPE_SHARE_LIST) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_item, parent,
|
||||
false);
|
||||
shareItemViewHolder holder = new shareItemViewHolder(v);
|
||||
return holder;
|
||||
} else if (viewType == V2XShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_empty, parent,
|
||||
false);
|
||||
shareEmptyViewHolder holder = new shareEmptyViewHolder(v);
|
||||
return holder;
|
||||
} else if (viewType == V2XShareEventItemEnum.ITEM_TYPE_LOAD_MORE_STATUS) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.item_v2x_event_share_load_more, parent,
|
||||
false);
|
||||
shareLoadStatusViewHolder holder = new shareLoadStatusViewHolder(v);
|
||||
return holder;
|
||||
} else {
|
||||
View v = shareLayoutInflater.inflate(R.layout.footer_nomore_view, parent,
|
||||
false);
|
||||
shareLoadNoMoreViewHolder holder = new shareLoadNoMoreViewHolder(v);
|
||||
return holder;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
try {
|
||||
|
||||
|
||||
if (holder instanceof shareDescriptionViewHolder) {
|
||||
//分享次数,车友认同次数,热心指数
|
||||
if (dataArrayList.size() > position) {
|
||||
V2XShareEventDescription.ResultBean.EnthusiasmIndexBean data = (V2XShareEventDescription.ResultBean.EnthusiasmIndexBean) dataArrayList.get(position);
|
||||
if (data != null) {
|
||||
String shareNum = String.valueOf(data.getShareNum());
|
||||
String likeNum = String.valueOf(data.getLikeNum());
|
||||
double enthusiasmIndex = data.getEnthusiasmIndex() <= 5 ? data.getEnthusiasmIndex() : 5;
|
||||
if (shareNum != null) {
|
||||
((shareDescriptionViewHolder) holder).shareNumTextView.setText(shareNum);
|
||||
}
|
||||
if (likeNum != null) {
|
||||
((shareDescriptionViewHolder) holder).approveNumTextView.setText(likeNum);
|
||||
}
|
||||
((shareDescriptionViewHolder) holder).ratingBar.setRating((float) enthusiasmIndex);
|
||||
}
|
||||
}
|
||||
} else if (holder instanceof shareItemViewHolder) {
|
||||
//分享列表
|
||||
if (dataArrayList.size() > position) {
|
||||
V2XShareEventItem.ResultBean.PageBean.ContentBean data = (V2XShareEventItem.ResultBean.PageBean.ContentBean) dataArrayList.get(position);
|
||||
if (data != null) {
|
||||
String poitype = data.getPoiType();
|
||||
String address = data.getUploadAddress();
|
||||
String time = DateTimeUtils.getTimeText(data.getUploadTimestamp(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm);
|
||||
String likeNum = String.valueOf(data.getLikeNum());
|
||||
String notLikeNum = String.valueOf(data.getNotlikeNum());
|
||||
|
||||
if (poitype != null) {
|
||||
((shareItemViewHolder) holder).caseStyleTextView.setText(EventTypeEnum.getPoiTypeStr(poitype));
|
||||
((shareItemViewHolder) holder).caseStyleTextView.setBackgroundResource(EventTypeEnum.getPoiTypeBgForShareItem(poitype));
|
||||
|
||||
}
|
||||
if (address != null) {
|
||||
((shareItemViewHolder) holder).caseAddressTextView.setText(address);
|
||||
}
|
||||
if (time != null) {
|
||||
((shareItemViewHolder) holder).caseTimeTextView.setText(time);
|
||||
}
|
||||
if (likeNum != null) {
|
||||
((shareItemViewHolder) holder).caseUsefulTextView.setText(likeNum);
|
||||
}
|
||||
if (notLikeNum != null) {
|
||||
((shareItemViewHolder) holder).caseUselessTextView.setText(notLikeNum);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataArrayList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
Object item = dataArrayList.get(position);
|
||||
if (item instanceof V2XShareEventDescription.ResultBean.EnthusiasmIndexBean) {
|
||||
return V2XShareEventItemEnum.ITEM_TYPE_NUM_DES;
|
||||
} else if (item instanceof V2XShareEventItem.ResultBean.PageBean.ContentBean) {
|
||||
return V2XShareEventItemEnum.ITEM_TYPE_SHARE_LIST;
|
||||
} else if (item instanceof V2XShareEventLoadMoreItem) {
|
||||
return ((V2XShareEventLoadMoreItem) dataArrayList.get(position)).getViewType();
|
||||
}
|
||||
return V2XShareEventItemEnum.ITEM_TYPE_OTHER;
|
||||
}
|
||||
|
||||
/*
|
||||
* 分享列表
|
||||
* */
|
||||
class shareItemViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView caseStyleTextView;
|
||||
private TextView caseAddressTextView;
|
||||
private TextView caseTimeTextView;
|
||||
private TextView caseUsefulTextView;
|
||||
private TextView caseUselessTextView;
|
||||
|
||||
public shareItemViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
caseStyleTextView = itemView.findViewById(R.id.road_case_style);
|
||||
caseAddressTextView = itemView.findViewById(R.id.road_case_address);
|
||||
caseTimeTextView = itemView.findViewById(R.id.road_case_share_time);
|
||||
caseUsefulTextView = itemView.findViewById(R.id.road_case_useful_num);
|
||||
caseUselessTextView = itemView.findViewById(R.id.road_case_useless_num);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 分享次数,热心指数...
|
||||
* */
|
||||
class shareDescriptionViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView shareNumTextView;
|
||||
private TextView approveNumTextView;
|
||||
private CustomRatingBar ratingBar;
|
||||
|
||||
public shareDescriptionViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
shareNumTextView = itemView.findViewById(R.id.share_num);
|
||||
approveNumTextView = itemView.findViewById(R.id.share_approve);
|
||||
ratingBar = itemView.findViewById(R.id.rating_bar);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 去分享 刷新
|
||||
* */
|
||||
class shareEmptyViewHolder extends RecyclerView.ViewHolder {
|
||||
public shareEmptyViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
TextView share = itemView.findViewById(R.id.share_event_button);
|
||||
share.setOnClickListener(view -> {
|
||||
// TODO
|
||||
// V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
// mApis.getShareManager().showShareDialog();
|
||||
});
|
||||
|
||||
TextView refresh = itemView.findViewById(R.id.refresh_button);
|
||||
refresh.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
callback.getShareEventResponse();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 加载更多/没有更多
|
||||
* */
|
||||
class shareLoadStatusViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView statusButton;
|
||||
|
||||
public shareLoadStatusViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
statusButton = itemView.findViewById(R.id.event_share_load_status);
|
||||
;
|
||||
statusButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
callback.loadMoreShareEventList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 没有更多记录了
|
||||
* */
|
||||
class shareLoadNoMoreViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public shareLoadNoMoreViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XSurroundingViewHolder;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingConstruction;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.SurroundingItemClickListener;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 周边
|
||||
* @since 2020/7/29
|
||||
*/
|
||||
public class V2XSurroundingAdapter extends RecyclerView.Adapter<V2XSurroundingViewHolder> {
|
||||
private List<SurroundingConstruction> mPoiInfosList;
|
||||
private Context mContext;
|
||||
private ImageView mBgImageView;
|
||||
private ImageView mTypeImageView;
|
||||
private TextView mTypeTv;
|
||||
private TextView mTotalTv;
|
||||
|
||||
private SurroundingItemClickListener mClickListener;
|
||||
|
||||
|
||||
public V2XSurroundingAdapter(Context context, List<SurroundingConstruction> poiInfosList, SurroundingItemClickListener clickListener) {
|
||||
mContext = context;
|
||||
mPoiInfosList = poiInfosList;
|
||||
mClickListener = clickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return super.getItemViewType(position);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public V2XSurroundingViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.module_fragment_surrounding_event_item, parent, false);
|
||||
return new V2XSurroundingViewHolder(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull V2XSurroundingViewHolder holder, final int position) {
|
||||
final SurroundingConstruction surroundingConstruction = mPoiInfosList.get(position);
|
||||
if (surroundingConstruction == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mBgImageView = holder.itemView.findViewById(R.id.iv_event_bg);
|
||||
mTypeImageView = holder.itemView.findViewById(R.id.iv_event_type);
|
||||
mTypeTv = holder.itemView.findViewById(R.id.tv_poitype);
|
||||
mTotalTv = holder.itemView.findViewById(R.id.tv_info_total);
|
||||
|
||||
mTypeTv.setText(EventTypeEnum.getTypeName(surroundingConstruction.getPoiType()));
|
||||
if (surroundingConstruction.getConstrutList() != null) {
|
||||
mTotalTv.setText(surroundingConstruction.getConstrutList().size() + "条");
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mClickListener != null) {
|
||||
mClickListener.onItemClickListener(v, holder.getAdapterPosition(), surroundingConstruction);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mBgImageView.setBackgroundResource(EventTypeEnum.getTypeRes(surroundingConstruction.getPoiType()));
|
||||
mTypeImageView.setBackgroundResource(EventTypeEnum.getTypeSmallRes(surroundingConstruction.getPoiType()));
|
||||
// RequestOptions requestOptions = new RequestOptions()
|
||||
// .placeholder(R.drawable.v2x_icon_live_logo)
|
||||
// .error(R.drawable.v2x_icon_live_logo)
|
||||
// .fallback(R.drawable.v2x_icon_live_logo);
|
||||
// Glide.with(mContext)
|
||||
// .asBitmap()
|
||||
// .load(getTypeSmallRes(surroundingConstruction.getPoiType()))
|
||||
// .apply(requestOptions)
|
||||
// .into(new SkinAbleBitmapTarget(mTypeImageView, requestOptions));
|
||||
|
||||
}
|
||||
|
||||
public static int dip2px(Context context, float dpValue) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (dpValue * scale + 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mPoiInfosList == null ? 0 : mPoiInfosList.size();
|
||||
}
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.holder.V2XSurroundingDetailVH;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.SurroundingDetailItemListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.HeartLikeView;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.HeartUnLikeView;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 周边详情
|
||||
* @since 2020/11/18
|
||||
*/
|
||||
public class V2XSurroundingDetailAdapter extends RecyclerView.Adapter<V2XSurroundingDetailVH> {
|
||||
private List<MarkerExploreWay> markerExploreWays;
|
||||
private Context mContext;
|
||||
private TextView mTypeTv;
|
||||
private TextView mAddressTv;
|
||||
private TextView mUserNameTv;
|
||||
private TextView mTimeTv;
|
||||
private HeartLikeView mHeartLikeView;
|
||||
private HeartUnLikeView mUnHeartLikeView;
|
||||
|
||||
private SurroundingDetailItemListener mListener;
|
||||
|
||||
public V2XSurroundingDetailAdapter(Context context, List<MarkerExploreWay> list, SurroundingDetailItemListener listener) {
|
||||
mContext = context;
|
||||
markerExploreWays = list;
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return super.getItemViewType(position);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public V2XSurroundingDetailVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.module_v2x_event_surrounding_detail_item, parent, false);
|
||||
return new V2XSurroundingDetailVH(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull V2XSurroundingDetailVH holder, final int position) {
|
||||
final MarkerExploreWay exploreWay = markerExploreWays.get(position);
|
||||
if (exploreWay == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mAddressTv = holder.itemView.findViewById(R.id.surrounding_road_type_address);
|
||||
mUserNameTv = holder.itemView.findViewById(R.id.surrounding_username);
|
||||
mTimeTv = holder.itemView.findViewById(R.id.surrounding_time);
|
||||
mTypeTv = holder.itemView.findViewById(R.id.surrounding_road_type);
|
||||
mHeartLikeView = holder.itemView.findViewById(R.id.surrounding_road_like);
|
||||
mUnHeartLikeView = holder.itemView.findViewById(R.id.surrounding_road_unlike);
|
||||
|
||||
mUserNameTv.setText( exploreWay.getUserInfo() != null ? ("用户" + exploreWay.getUserInfo().getUserName() + "分享") : "蘑菇用户分享");
|
||||
mTypeTv.setText(EventTypeEnum.getTypeName(exploreWay.getPoiType()));
|
||||
mAddressTv.setText(exploreWay.getAddr());
|
||||
mTimeTv.setText(DateTimeUtils.getTimeText(exploreWay.getGenerateTime(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm));
|
||||
|
||||
Logger.d(V2XConst.MODULE_NAME, "exploreWay.isFabulous() = " + exploreWay.isFabulous());
|
||||
showView(exploreWay.isFabulous());
|
||||
|
||||
mHeartLikeView.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈有用 position = " + position);
|
||||
roadReportTrue(exploreWay);
|
||||
mListener.onItemClickListener(v, position, exploreWay);
|
||||
});
|
||||
|
||||
mUnHeartLikeView.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈无用 position = " + position);
|
||||
roadReportErr(exploreWay);
|
||||
mListener.onItemClickListener(v, position, exploreWay);
|
||||
});
|
||||
}
|
||||
|
||||
private void showView(boolean isAlreadyShow) {
|
||||
if (isAlreadyShow) {
|
||||
mHeartLikeView.setVisibility(View.GONE);
|
||||
mUnHeartLikeView.setVisibility(View.GONE);
|
||||
} else {
|
||||
mHeartLikeView.setVisibility(View.VISIBLE);
|
||||
mUnHeartLikeView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况正确
|
||||
*/
|
||||
private void roadReportTrue(MarkerExploreWay exploreWay) {
|
||||
if (exploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
exploreWay.getInfoId(),
|
||||
exploreWay.getPoiType(),
|
||||
2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况错误
|
||||
*/
|
||||
private void roadReportErr(MarkerExploreWay exploreWay) {
|
||||
if (exploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
exploreWay.getInfoId(),
|
||||
exploreWay.getPoiType(),
|
||||
3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return markerExploreWays == null ? 0 : markerExploreWays.size();
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,6 @@ import com.mogo.eagle.core.utilcode.util.TimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
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;
|
||||
@@ -245,8 +244,4 @@ public abstract class V2XBaseViewHolder<T>
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic(MogoTraffic traffic) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,233 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
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.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.service.module.IMogoRegisterCenter;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
import com.zhidao.carchattingprovider.ICarsChattingProvider;
|
||||
import com.zhidao.carchattingprovider.MogoDriverInfo;
|
||||
|
||||
/**
|
||||
* 出行动态
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public abstract class V2XHistoryBaseViewHolder<T>
|
||||
extends RecyclerView.ViewHolder
|
||||
implements IMogoNaviListener {
|
||||
|
||||
private static final String TAG = "V2XBaseViewHolder";
|
||||
private ICarsChattingProvider mCarsChattingProvider;
|
||||
|
||||
|
||||
public V2XHistoryBaseViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充View视图
|
||||
*
|
||||
* @param viewData 与视图绑定的数据
|
||||
*/
|
||||
public abstract void initView(T viewData);
|
||||
|
||||
/**
|
||||
* 延迟关闭窗体视图
|
||||
*/
|
||||
public void delayedCloseWindow() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 点赞
|
||||
*/
|
||||
public void triggerZan(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice("已点赞", null);
|
||||
showTip("已点赞");
|
||||
if (noveltyInfo != null) {
|
||||
// 调用网络API接口
|
||||
BridgeApi.INSTANCE.refreshModel().giveLikeLiveVideo(null, noveltyInfo.getSn());
|
||||
V2XEventZanData v2XEventZanData = new V2XEventZanData();
|
||||
v2XEventZanData.setEventId(noveltyInfo.getInfoId());
|
||||
v2XEventZanData.setTriggerTime(TimeUtils.getNowMills());
|
||||
V2XSQLiteUtils.saveEventZanLocalStory(v2XEventZanData);
|
||||
|
||||
|
||||
// 上报数据统计
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_ZAN);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
public void triggerIVReportHead(MarkerExploreWay noveltyInfo) {
|
||||
Log.d(TAG, "点击头像" + mCarsChattingProvider);
|
||||
try {
|
||||
mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation();
|
||||
MogoDriverInfo mogoDriverInfo = new MogoDriverInfo();
|
||||
int ageNumber = noveltyInfo.getUserInfo().getAgeNumber();
|
||||
mogoDriverInfo.setAge(ageNumber);
|
||||
String gender = noveltyInfo.getUserInfo().getGender();
|
||||
mogoDriverInfo.setGender(gender);
|
||||
String sn = noveltyInfo.getUserInfo().getSn();
|
||||
mogoDriverInfo.setSn(sn != null ? sn : "");
|
||||
String name = noveltyInfo.getUserInfo().getUserName();
|
||||
mogoDriverInfo.setUserName(name != null ? name : "");
|
||||
mogoDriverInfo.setUserHead(noveltyInfo.getUserInfo().getUserHead());
|
||||
if (mCarsChattingProvider != null) {
|
||||
mCarsChattingProvider.showUserWindow(MODULE_NAME, mogoDriverInfo, this.itemView.getContext());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "点击头像发生错误--triggerIVReportHead" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打电话
|
||||
*/
|
||||
public void triggerCallChart(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(noveltyInfo.getLocation().getLat());
|
||||
location.setLon(noveltyInfo.getLocation().getLon());
|
||||
|
||||
ChartingUtil.callChatting(noveltyInfo.getUserInfo(), location);
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_CHAT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
TipToast.tip("用户信息异常");
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况错误
|
||||
*/
|
||||
public void triggerReportErr(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getPoiType(),
|
||||
3);
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_REPORT_ERROR);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
TipToast.tip("路况信息异常");
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况正确
|
||||
*/
|
||||
public void triggerReportTrue(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getPoiType(),
|
||||
2);
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
noveltyInfo.getSn(),
|
||||
V2XConst.V2X_ROAD_REPORT_RIGHT);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
TipToast.tip("路况信息异常");
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示自定义 Toast
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public void showTip(String msg) {
|
||||
TipToast.tip(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
Logger.w(TAG, "onCalculateSuccess");
|
||||
IMogoRegisterCenter registerCenter = BridgeApi.INSTANCE.registerCenter();
|
||||
if (registerCenter != null) {
|
||||
registerCenter.unregisterMogoNaviListener(MODULE_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic(MogoTraffic traffic) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,544 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
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.entity.net.V2XUserInfoRes;
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XRoadLiveCarScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.V2XRoadEventWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.V2XRoadVideoCarScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.HeartLikeView;
|
||||
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.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform;
|
||||
import com.mogo.eagle.core.utilcode.util.CollectionUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.module.common.animation.BezierAnimationView;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.v2x.DisplayEffectsInterface;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/11 4:35 PM
|
||||
* desc : 道路事件详情
|
||||
* version: 1.0
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
private static final String TAG = "V2XRoadEventVH";
|
||||
private Context mContext;
|
||||
private MogoImageView ivEventImg;
|
||||
private MogoImageView ivReportHead;
|
||||
private ImageView ivEventPlay;
|
||||
|
||||
// 控制按钮
|
||||
private TextView tvEventTypeTitle;
|
||||
private TextView tvEventAddress;
|
||||
private TextView tvEventDistance;
|
||||
private TextView tvEventTime;
|
||||
private ImageView ivEventLive;
|
||||
private ImageView ivEventCallChart;
|
||||
private ImageView ivEventReportTrue;
|
||||
private ImageView ivEventReportErr;
|
||||
private HeartLikeView ivEventZan;
|
||||
|
||||
private WindowManagerView mWindowManagerView;
|
||||
|
||||
// 上传事件的用户信息
|
||||
private MarkerUserInfo mUserInfo;
|
||||
// 当前的新鲜事儿信息
|
||||
private MarkerExploreWay mNoveltyInfo;
|
||||
private V2XRoadEventEntity mV2XRoadEventEntity;
|
||||
private V2XEventShowEntity mV2XEventShowEntity;
|
||||
|
||||
// 拨打车聊聊语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackCallListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
}
|
||||
};
|
||||
// 点赞语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackLickListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
triggerZan(mNoveltyInfo);
|
||||
}
|
||||
};
|
||||
// 反馈"正确"语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackReportTrueListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
triggerReportTrue(mNoveltyInfo);
|
||||
}
|
||||
};
|
||||
// 反馈"错误"语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackReportErrorListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
triggerReportErr(mNoveltyInfo);
|
||||
}
|
||||
};
|
||||
// 反馈"错误"语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceOpenLiveListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
showLiveCar(mV2XEventShowEntity);
|
||||
}
|
||||
};
|
||||
// 查看车辆信息
|
||||
private V2XVoiceCallbackListener v2xVoiceOpenCarInfoListener = new V2XVoiceCallbackListener() {
|
||||
@Override
|
||||
public void onCallback(String command, Intent intent) {
|
||||
triggerIVReportHead(mNoveltyInfo);
|
||||
}
|
||||
};
|
||||
|
||||
private MogoImageView ivEvent;
|
||||
private TextView tvEvent;
|
||||
private ImageView ivPlay;
|
||||
private TextView tvLine;
|
||||
private TextView tvPlay;
|
||||
|
||||
|
||||
private void init(View itemView) {
|
||||
ivEventImg = itemView.findViewById(R.id.ivEventImg);
|
||||
ivReportHead = itemView.findViewById(R.id.ivEventHead);
|
||||
ivEventPlay = itemView.findViewById(R.id.ivEventPlay);
|
||||
tvEventTypeTitle = itemView.findViewById(R.id.tvEventTypeTitle);
|
||||
tvEventAddress = itemView.findViewById(R.id.tvEventAddress);
|
||||
tvEventDistance = itemView.findViewById(R.id.tvEventDistance);
|
||||
tvEventTime = itemView.findViewById(R.id.tvEventTime);
|
||||
ivEventLive = itemView.findViewById(R.id.ivEventLive);
|
||||
ivEventCallChart = itemView.findViewById(R.id.ivEventCallChart);
|
||||
ivEventZan = itemView.findViewById(R.id.ivEventZan);
|
||||
ivEventReportTrue = itemView.findViewById(R.id.ivEventReportTrue);
|
||||
ivEventReportErr = itemView.findViewById(R.id.ivEventReportErr);
|
||||
|
||||
ivEvent = itemView.findViewById(R.id.iv_event);
|
||||
tvEvent = itemView.findViewById(R.id.tv_event);
|
||||
ivPlay = itemView.findViewById(R.id.iv_play);
|
||||
tvLine = itemView.findViewById(R.id.tv_line);
|
||||
tvPlay = itemView.findViewById(R.id.tv_play);
|
||||
}
|
||||
|
||||
public V2XRoadEventVH(ViewGroup viewGroup, IV2XWindow v2XWindow) {
|
||||
super(BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().isVrMode() ?
|
||||
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail_vr, viewGroup, false) :
|
||||
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail, viewGroup, false)
|
||||
, v2XWindow);
|
||||
mContext = viewGroup.getContext();
|
||||
init(itemView);
|
||||
// 设置视图状态监听
|
||||
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
// Logger.w(MODULE_NAME, "列表View V2XRoadEventDetailVH 触发 onViewAttachedToWindow");
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING,
|
||||
v2XVoiceCallbackCallListener)
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN,
|
||||
v2XVoiceCallbackLickListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP,
|
||||
v2XVoiceCallbackCallListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP,
|
||||
v2XVoiceCallbackLickListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE,
|
||||
v2XVoiceCallbackReportTrueListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR,
|
||||
v2XVoiceCallbackReportErrorListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP,
|
||||
v2xVoiceOpenCarInfoListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) {
|
||||
Log.d(TAG, "onViewDetachedFromWindow unRegister");
|
||||
// 反注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING)
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_CAR_INFO_UN_WAKEUP);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
try {
|
||||
if (v2XEventShowEntity == null) {
|
||||
return;
|
||||
}
|
||||
mV2XEventShowEntity = v2XEventShowEntity;
|
||||
mV2XRoadEventEntity = v2XEventShowEntity.getV2XRoadEventEntity();
|
||||
|
||||
if (mV2XRoadEventEntity == null) {
|
||||
return;
|
||||
}
|
||||
mNoveltyInfo = mV2XRoadEventEntity.getNoveltyInfo();
|
||||
if (mNoveltyInfo != null) {
|
||||
mUserInfo = mNoveltyInfo.getUserInfo();
|
||||
if (!CollectionUtils.isEmpty(mNoveltyInfo.getItems())) {
|
||||
String imgUrl = mNoveltyInfo.getItems().get(0).getThumbnail();
|
||||
String url = mNoveltyInfo.getItems().get(0).getUrl();
|
||||
if (TextUtils.isEmpty(imgUrl)) {
|
||||
imgUrl = mNoveltyInfo.getItems().get(0).getUrl();
|
||||
}
|
||||
if (!TextUtils.isEmpty(imgUrl)) {
|
||||
boolean isVrMode = false;
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
isVrMode = statusManager.isVrMode();
|
||||
}
|
||||
if (isVrMode) {
|
||||
Glide.with(mContext).load(imgUrl).apply(RequestOptions.bitmapTransform(
|
||||
new GlideRoundedCornersTransform(20, GlideRoundedCornersTransform.CornerType.LEFT))).into(ivEventImg);
|
||||
} else {
|
||||
IMogoImageloader imageloader = BridgeApi.INSTANCE.imageLoader();
|
||||
if (imageloader != null) {
|
||||
imageloader.displayImage(imgUrl, ivEventImg);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (url.contains(".mp4")) {
|
||||
ivEventImg.setOnClickListener(v -> {
|
||||
showRoadVideoInfo(v2XEventShowEntity);
|
||||
});
|
||||
ivPlay.setVisibility(VISIBLE);
|
||||
tvLine.setVisibility(VISIBLE);
|
||||
tvPlay.setVisibility(VISIBLE);
|
||||
tvPlay.setOnClickListener(v -> {
|
||||
showRoadVideoInfo(v2XEventShowEntity);
|
||||
});
|
||||
ivEventPlay.setOnClickListener(v -> {
|
||||
showRoadVideoInfo(v2XEventShowEntity);
|
||||
});
|
||||
ivEventPlay.setVisibility(VISIBLE);
|
||||
} else {
|
||||
ivEventImg.setOnClickListener(null);
|
||||
ivEventPlay.setOnClickListener(null);
|
||||
ivEventPlay.setVisibility(GONE);
|
||||
ivPlay.setVisibility(GONE);
|
||||
tvLine.setVisibility(GONE);
|
||||
tvPlay.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
if (mNoveltyInfo.getUserInfo() != null &&
|
||||
!TextUtils.isEmpty(mNoveltyInfo.getUserInfo().getUserHead())) {
|
||||
|
||||
IMogoImageloader imageloader = BridgeApi.INSTANCE.imageLoader();
|
||||
if (imageloader != null) {
|
||||
imageloader.displayImage(mNoveltyInfo.getUserInfo().getUserHead(), ivReportHead);
|
||||
}
|
||||
}
|
||||
|
||||
String poiType = EventTypeEnum.getPoiTypeStr(mNoveltyInfo.getPoiType());
|
||||
if (!TextUtils.isEmpty(poiType)) {
|
||||
tvEventTypeTitle.setText(poiType);
|
||||
tvEventTypeTitle.setBackgroundResource(EventTypeEnum.getPoiTypeBg(mNoveltyInfo.getPoiType(),
|
||||
BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().isVrMode()));
|
||||
|
||||
}
|
||||
ivEvent.setImageResource(EventTypeEnum.getPoiTypeSrcVr(mNoveltyInfo.getPoiType()));
|
||||
tvEvent.setText(EventTypeEnum.getPoiTypeStrVr(mNoveltyInfo.getPoiType()));
|
||||
if (EventTypeEnum.FOURS_FOG.getPoiType().equals(mNoveltyInfo.getPoiType())) {
|
||||
DisplayEffectsInterface displayEffects = BridgeApi.INSTANCE.displayEffects();
|
||||
if (displayEffects != null) {
|
||||
displayEffects.displayEffects(EventTypeEnum.FOURS_FOG.getPoiType());
|
||||
}
|
||||
CallerHmiManager.INSTANCE.showWarning(WarningDirectionEnum.ALERT_WARNING_TOP);
|
||||
}
|
||||
tvEventAddress.setText(mNoveltyInfo.getAddr());
|
||||
tvEventDistance.setText("距离 " + (int) mNoveltyInfo.getDistance() + "米");
|
||||
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTimeInMillis(mNoveltyInfo.getGenerateTime());
|
||||
String eventTime = DateTimeUtils.printCalendarByPattern(c, "yyyy/MM/dd HH:mm");
|
||||
if (!TextUtils.isEmpty(eventTime)) {
|
||||
tvEventTime.setText(eventTime);
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(mV2XEventShowEntity.getV2XLiveCarList())) {
|
||||
ivEventLive.setVisibility(VISIBLE);
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_LIVE_ROAD,
|
||||
v2XVoiceOpenLiveListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP,
|
||||
v2XVoiceOpenLiveListener);
|
||||
ivEventLive.setOnClickListener(v -> {
|
||||
showLiveCar(v2XEventShowEntity);
|
||||
});
|
||||
} else {
|
||||
ivEventLive.setVisibility(GONE);
|
||||
}
|
||||
|
||||
ivEventReportTrue.setVisibility(GONE);
|
||||
ivEventReportErr.setVisibility(GONE);
|
||||
|
||||
if (V2XSQLiteUtils.isZanEvent(mNoveltyInfo.getInfoId())) {
|
||||
ivEventZan.setVisibility(GONE);
|
||||
} else {
|
||||
ivEventZan.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
// 用户上报的才会展示拨打电话
|
||||
if (!TextUtils.isEmpty(mNoveltyInfo.getUploadType())
|
||||
&& mNoveltyInfo.getUploadType().equals("1")) {
|
||||
requestUserInfo(mNoveltyInfo);
|
||||
}
|
||||
|
||||
ivEventReportTrue.setOnClickListener(v -> {
|
||||
triggerReportTrue(mNoveltyInfo);
|
||||
});
|
||||
ivEventReportErr.setOnClickListener(v -> {
|
||||
triggerReportErr(mNoveltyInfo);
|
||||
});
|
||||
ivEventCallChart.setOnClickListener(v -> {
|
||||
ivEventCallChart.setVisibility(GONE);
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
});
|
||||
|
||||
ivEventZan.setOnClickCallListener(v -> {
|
||||
triggerZan(mNoveltyInfo);
|
||||
});
|
||||
|
||||
ivReportHead.setOnClickListener(v -> {
|
||||
triggerIVReportHead(mNoveltyInfo);
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 展示事件的图片/视频资源
|
||||
* */
|
||||
private void showRoadVideoInfo(V2XEventShowEntity v2XEventShowEntity) {
|
||||
if (v2XEventShowEntity != null) {
|
||||
/*
|
||||
* MarkerExploreWay 具体事件
|
||||
* V2XRoadEventEntity 包含MarkerExploreWay 事件的二次封装(tts播报内容 事件类型等)
|
||||
* V2XMessageEntity 三次封装(是否进行事件与本机连线 是否显示通话功能等)
|
||||
* V2XEventShowEntity 包含V2XRoadEventEntity
|
||||
* */
|
||||
Log.d(TAG, "马上展示图片/视频资源全屏");
|
||||
V2XMessageEntity v2XMessageEntity = new V2XMessageEntity<>();
|
||||
v2XMessageEntity.setContent(v2XEventShowEntity);
|
||||
V2XRoadVideoCarScenario.getInstance().init(v2XMessageEntity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示直播信息
|
||||
*
|
||||
* @param v2XEventShowEntity
|
||||
*/
|
||||
private void showLiveCar(V2XEventShowEntity v2XEventShowEntity) {
|
||||
if (v2XEventShowEntity != null) {
|
||||
// 展示周边的直播车辆
|
||||
List<V2XEventShowEntity> eventShowEntityArrayList = new ArrayList<>();
|
||||
for (V2XLiveCarInfoEntity v2XLiveCarInfoRes : v2XEventShowEntity.getV2XLiveCarList()) {
|
||||
V2XEventShowEntity showEntity = new V2XEventShowEntity();
|
||||
showEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING);
|
||||
showEntity.setV2XLiveCarInfoRes(v2XLiveCarInfoRes);
|
||||
showEntity.setV2XRoadEventEntity(mV2XRoadEventEntity);
|
||||
eventShowEntityArrayList.add(showEntity);
|
||||
}
|
||||
|
||||
Logger.d(MODULE_NAME, "要展示的直播:" + GsonUtil.jsonFromObject(eventShowEntityArrayList));
|
||||
V2XMessageEntity<List<V2XEventShowEntity>> v2XMessageEntity = new V2XMessageEntity<>();
|
||||
v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING);
|
||||
v2XMessageEntity.setContent(eventShowEntityArrayList);
|
||||
v2XMessageEntity.setShowState(true);
|
||||
V2XRoadLiveCarScenario.getInstance().init(v2XMessageEntity);
|
||||
|
||||
// 打开直播后,窗口倒计时暂停关闭,直播被关闭后继续倒计时
|
||||
if (mV2XWindow != null) {
|
||||
if (mV2XWindow instanceof V2XRoadEventWindow) {
|
||||
((V2XRoadEventWindow) mV2XWindow).stopCountDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void bezierAnimation(int[] loc) {
|
||||
if (mWindowManagerView == null) {
|
||||
Log.d(TAG, "bezierAnimation:null");
|
||||
mWindowManagerView = new WindowManagerView.Builder(mContext.getApplicationContext())
|
||||
.contentView(R.layout.module_common_bezier_layout)
|
||||
.size(WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.WRAP_CONTENT)
|
||||
.position(loc[0], loc[1])
|
||||
.gravity(Gravity.TOP | Gravity.LEFT)
|
||||
.showInWindowManager();
|
||||
}
|
||||
try {
|
||||
if (mWindowManagerView.isShowing()) {
|
||||
return;
|
||||
}
|
||||
mWindowManagerView.show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
BezierAnimationView bezierAnimationView = mWindowManagerView.findViewById(R.id.bezier_view);
|
||||
bezierAnimationView.bezierAnimationStart();
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// mWindowManagerView.dismiss();
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
|
||||
public int[] getLocation(View v) {
|
||||
int[] loc = new int[4];
|
||||
int[] location = new int[2];
|
||||
v.getLocationOnScreen(location);
|
||||
loc[0] = location[0];
|
||||
loc[1] = location[1];
|
||||
int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
v.measure(w, h);
|
||||
|
||||
loc[2] = v.getMeasuredWidth();
|
||||
loc[3] = v.getMeasuredHeight();
|
||||
|
||||
//base = computeWH();
|
||||
return loc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为了给车聊聊更多的信息需要重新查询一次
|
||||
*
|
||||
* @param noveltyInfo
|
||||
*/
|
||||
private void requestUserInfo(MarkerExploreWay noveltyInfo) {
|
||||
Logger.d(MODULE_NAME, "上报事件的用户SN:" + noveltyInfo.getSn());
|
||||
// 获取道路事件周边的直播车机
|
||||
if (!TextUtils.isEmpty(noveltyInfo.getSn())) {
|
||||
BridgeApi.INSTANCE.refreshModel()
|
||||
.queryUserInfoBySn(
|
||||
noveltyInfo.getSn(),
|
||||
new V2XRefreshCallback<V2XUserInfoRes>() {
|
||||
@Override
|
||||
public void onSuccess(V2XUserInfoRes result) {
|
||||
if (result != null && result.getResult() != null && result.getResult().getInfo() != null) {
|
||||
V2XUserInfoRes.Result.Info infoBean = result.getResult().getInfo();
|
||||
if (mUserInfo == null) {
|
||||
mUserInfo = new MarkerUserInfo();
|
||||
}
|
||||
mUserInfo.setSn(infoBean.getSn());
|
||||
try {
|
||||
if (!TextUtils.isEmpty(infoBean.getCardIdAge())) {
|
||||
mUserInfo.setAge(Integer.parseInt(infoBean.getCardIdAge()));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mUserInfo.setUserName(infoBean.getUserNickName());
|
||||
mUserInfo.setUserHead(infoBean.getHeadImgUrl());
|
||||
mUserInfo.setGender(infoBean.getCardIdSex());
|
||||
|
||||
// 重新设置用户信息
|
||||
mNoveltyInfo.setUserInfo(mUserInfo);
|
||||
|
||||
// M1低配车机限制
|
||||
// 不展示打电话按钮
|
||||
// 不能查看用户详情
|
||||
if (DebugConfig.isMapBased()) {
|
||||
// 只有自研车机才会 有车聊聊通话
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isCanCall(b -> {
|
||||
if (b) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isOnLine(mUserInfo.getSn(), b1 -> {
|
||||
if (b1) {
|
||||
ivEventCallChart.setVisibility(VISIBLE);
|
||||
} else {
|
||||
ivEventCallChart.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ivEventCallChart.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String msg) {
|
||||
ivEventCallChart.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 延迟关闭窗体
|
||||
// */
|
||||
// @Override
|
||||
// public void delayedCloseWindow() {
|
||||
//// itemView.postDelayed(() -> {
|
||||
//// // 移除窗体
|
||||
//// V2XServiceManager
|
||||
//// .getIMogoWindowManager()
|
||||
//// .removeView(V2XRoadEventScenario.getInstance().getV2XWindow().getView());
|
||||
//// V2XRoadEventScenario.getInstance().close();
|
||||
//// }, 1000);
|
||||
// }
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.HeartLikeView;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.HeartUnLikeView;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* 出行面板违章停车
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XScenarioHistoryIllegalParkVH extends V2XHistoryBaseViewHolder<V2XHistoryScenarioData> {
|
||||
private TextView mTvAddress;
|
||||
private TextView mTvIllegalNum;
|
||||
|
||||
private TextView mTagEventType;
|
||||
private TextView mTagEventEvaluate;
|
||||
|
||||
private HeartLikeView mLlIllegalParkingLike;
|
||||
private HeartUnLikeView mLlIllegalParkingUnLike;
|
||||
|
||||
private MarkerExploreWay mExploreWay;
|
||||
|
||||
private V2XHistoryScenarioData mOldScenarioData;
|
||||
|
||||
public V2XScenarioHistoryIllegalParkVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_v2x_scennario_history, viewGroup, false));
|
||||
mTvAddress = itemView.findViewById(R.id.tvAddress);
|
||||
mTvIllegalNum = itemView.findViewById(R.id.tvIllegalNum);
|
||||
|
||||
mTagEventType = itemView.findViewById(R.id.tagEventType);
|
||||
mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate);
|
||||
|
||||
mLlIllegalParkingLike = itemView.findViewById(R.id.llIllegalParkingLike);
|
||||
mLlIllegalParkingUnLike = itemView.findViewById(R.id.llIllegalParkingUnLike);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XHistoryScenarioData viewData) {
|
||||
try {
|
||||
mOldScenarioData = viewData;
|
||||
mExploreWay = GsonUtil.objectFromJson(viewData.getEventJsonData(), MarkerExploreWay.class);
|
||||
mTvAddress.setText(mExploreWay.getAddr());
|
||||
|
||||
try {
|
||||
mTvIllegalNum.setText("违章人数:" + (int) mExploreWay.getItems().get(0).getIllegalCount());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (!viewData.isDispose()) {
|
||||
hideControlButton(View.VISIBLE);
|
||||
} else {
|
||||
hideControlButton(View.GONE);
|
||||
}
|
||||
|
||||
mLlIllegalParkingLike.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
|
||||
roadReportTrue();
|
||||
});
|
||||
|
||||
mLlIllegalParkingUnLike.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
|
||||
roadReportErr();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void hideControlButton(int gone) {
|
||||
mTagEventEvaluate.setVisibility(gone);
|
||||
mLlIllegalParkingLike.setVisibility(gone);
|
||||
mLlIllegalParkingUnLike.setVisibility(gone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
try {
|
||||
hideControlButton(View.GONE);
|
||||
// 进行数据库存储
|
||||
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
|
||||
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
|
||||
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
|
||||
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
|
||||
v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode());
|
||||
v2XHistoryScenarioData.setDispose(true);
|
||||
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
|
||||
mOldScenarioData.setDispose(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况正确
|
||||
*/
|
||||
private void roadReportTrue() {
|
||||
delayedCloseWindow();
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getInfoId(),
|
||||
mExploreWay.getPoiType(),
|
||||
2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况错误
|
||||
*/
|
||||
private void roadReportErr() {
|
||||
delayedCloseWindow();
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getInfoId(),
|
||||
mExploreWay.getPoiType(),
|
||||
3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
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;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
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.fragment.V2XEventPanelFragment;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.ChartingUtil;
|
||||
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.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.util.SpanUtils;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 出行动态中的他人故障求助
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XScenarioHistoryOtherSeekHelpVH extends V2XHistoryBaseViewHolder<V2XHistoryScenarioData> {
|
||||
|
||||
private TextView mTagEventType;
|
||||
private TextView mTagEventEvaluate;
|
||||
private MogoImageView mIvFaultHelpHead;
|
||||
private TextView mTvFaultHelpName;
|
||||
private TextView mTvFaultHelpEventTime;
|
||||
private TextView mTvFaultHelpDistance;
|
||||
private ImageView mIvFaultHelpEventCall;
|
||||
|
||||
private MarkerExploreWay mNoveltyInfo;
|
||||
// 上传事件的用户信息
|
||||
private MarkerUserInfo mUserInfo = new MarkerUserInfo();
|
||||
|
||||
private V2XHistoryScenarioData mOldScenarioData;
|
||||
|
||||
public V2XScenarioHistoryOtherSeekHelpVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_v2x_scennario_history_other_help, viewGroup, false));
|
||||
mTagEventType = itemView.findViewById(R.id.tagEventType);
|
||||
mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate);
|
||||
mIvFaultHelpHead = itemView.findViewById(R.id.ivFaultHelpHead);
|
||||
mTvFaultHelpName = itemView.findViewById(R.id.tvFaultHelpName);
|
||||
mTvFaultHelpEventTime = itemView.findViewById(R.id.tvFaultHelpEventTime);
|
||||
mTvFaultHelpDistance = itemView.findViewById(R.id.tvFaultHelpDistance);
|
||||
mIvFaultHelpEventCall = itemView.findViewById(R.id.ivFaultHelpEventCall);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XHistoryScenarioData viewData) {
|
||||
try {
|
||||
mOldScenarioData = viewData;
|
||||
V2XPushMessageEntity xPushMessageEntity = GsonUtil.objectFromJson(viewData.getEventJsonData(), V2XPushMessageEntity.class);
|
||||
|
||||
mUserInfo.setSn(xPushMessageEntity.getSn());
|
||||
mUserInfo.setUserHead(xPushMessageEntity.getHeadImgUrl());
|
||||
mUserInfo.setUserName(xPushMessageEntity.getDisplayName());
|
||||
mUserInfo.setGender(xPushMessageEntity.getSex());
|
||||
mUserInfo.setAge(xPushMessageEntity.getAge());
|
||||
|
||||
mTvFaultHelpName.setText(xPushMessageEntity.getDisplayName());
|
||||
|
||||
if (!TextUtils.isEmpty(xPushMessageEntity.getHeadImgUrl())) {
|
||||
IMogoImageloader imageLoader = BridgeApi.INSTANCE.imageLoader();
|
||||
if (imageLoader != null) {
|
||||
imageLoader.displayImage(xPushMessageEntity.getHeadImgUrl(), mIvFaultHelpHead);
|
||||
}
|
||||
}
|
||||
|
||||
if (xPushMessageEntity.getDistance() > 1000) {
|
||||
SpanUtils.with(mTvFaultHelpDistance)
|
||||
.append("" + (int) xPushMessageEntity.getDistance() / 1000)
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
|
||||
.append("公里")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.dp_32))
|
||||
.create();
|
||||
} else {
|
||||
SpanUtils.with(mTvFaultHelpDistance)
|
||||
.append("" + (int) xPushMessageEntity.getDistance())
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
|
||||
.append("米")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.dp_32))
|
||||
.create();
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
|
||||
String eventTime = String.format("%s发布求助信息",
|
||||
sdf.format(new Date(xPushMessageEntity.getCreateTime())));
|
||||
mTvFaultHelpEventTime.setText(eventTime);
|
||||
|
||||
try {
|
||||
MarkerLocation markerLocation = new MarkerLocation();
|
||||
markerLocation.setLon(xPushMessageEntity.getLon());
|
||||
markerLocation.setLat(xPushMessageEntity.getLat());
|
||||
mNoveltyInfo = new MarkerExploreWay();
|
||||
mNoveltyInfo.setLocation(markerLocation);
|
||||
mNoveltyInfo.setUserInfo(mUserInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// M1低配车机限制
|
||||
// 不展示打电话按钮
|
||||
// 不能查看用户详情
|
||||
if (DebugConfig.isMapBased()) {
|
||||
// 只有自研车机才会 有车聊聊通话
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isCanCall(b -> {
|
||||
if (b) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isOnLine(xPushMessageEntity.getSn(), b1 -> {
|
||||
if (b1) {
|
||||
mIvFaultHelpEventCall.setVisibility(VISIBLE);
|
||||
} else {
|
||||
mIvFaultHelpEventCall.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mIvFaultHelpEventCall.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
|
||||
mIvFaultHelpEventCall.setOnClickListener(v -> {
|
||||
if (!V2XUtils.isFastClick()) {
|
||||
BridgeApi.INSTANCE.refreshModel().respondingToHelp(mUserInfo.getSn());
|
||||
try {
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
try {
|
||||
hideControlButton(View.GONE);
|
||||
// 进行数据库存储
|
||||
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
|
||||
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
|
||||
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
|
||||
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
|
||||
v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode());
|
||||
v2XHistoryScenarioData.setDispose(true);
|
||||
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
|
||||
mOldScenarioData.setDispose(true);
|
||||
|
||||
V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void hideControlButton(int gone) {
|
||||
mTagEventEvaluate.setVisibility(gone);
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.RoadConditionUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.HeartLikeView;
|
||||
import com.mogo.eagle.core.function.v2x.events.view.HeartUnLikeView;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
/**
|
||||
* 出行面板道路事件面板
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XScenarioHistoryRoadEventVH extends V2XHistoryBaseViewHolder<V2XHistoryScenarioData> {
|
||||
private TextView mTvAddress;
|
||||
private TextView mTvIllegalNum;
|
||||
private ImageView mIvIconP;
|
||||
private TextView mTagEventType;
|
||||
private TextView mTagEventEvaluate;
|
||||
|
||||
private HeartLikeView mLlIllegalParkingLike;
|
||||
private HeartUnLikeView mLlIllegalParkingUnLike;
|
||||
|
||||
private MarkerExploreWay mExploreWay;
|
||||
private V2XHistoryScenarioData mOldScenarioData;
|
||||
|
||||
public V2XScenarioHistoryRoadEventVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_v2x_scennario_history, viewGroup, false));
|
||||
mTvAddress = itemView.findViewById(R.id.tvAddress);
|
||||
mTvIllegalNum = itemView.findViewById(R.id.tvIllegalNum);
|
||||
mIvIconP = itemView.findViewById(R.id.ivIconP);
|
||||
mTagEventType = itemView.findViewById(R.id.tagEventType);
|
||||
mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate);
|
||||
|
||||
mLlIllegalParkingLike = itemView.findViewById(R.id.llIllegalParkingLike);
|
||||
mLlIllegalParkingUnLike = itemView.findViewById(R.id.llIllegalParkingUnLike);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XHistoryScenarioData viewData) {
|
||||
try {
|
||||
mOldScenarioData = viewData;
|
||||
mExploreWay = GsonUtil.objectFromJson(viewData.getEventJsonData(), MarkerExploreWay.class);
|
||||
|
||||
mIvIconP.setVisibility(View.GONE);
|
||||
mTvAddress.setText(mExploreWay.getAddr());
|
||||
mTagEventType.setText(EventTypeEnum.getPoiTypeStr(mExploreWay.getPoiType()));
|
||||
|
||||
try {
|
||||
mTvIllegalNum.setText(mExploreWay.getUserInfo().getUserName() + "的分享 " +
|
||||
TimeUtils.millis2String(mOldScenarioData.getTriggerTime(), "MM月dd日 HH:mm"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (!viewData.isDispose()) {
|
||||
hideControlButton(View.VISIBLE);
|
||||
} else {
|
||||
hideControlButton(View.GONE);
|
||||
}
|
||||
|
||||
mLlIllegalParkingLike.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
|
||||
roadReportTrue();
|
||||
});
|
||||
|
||||
mLlIllegalParkingUnLike.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
|
||||
roadReportErr();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void hideControlButton(int gone) {
|
||||
mTagEventEvaluate.setVisibility(gone);
|
||||
mLlIllegalParkingLike.setVisibility(gone);
|
||||
mLlIllegalParkingUnLike.setVisibility(gone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
try {
|
||||
hideControlButton(View.GONE);
|
||||
// 进行数据库存储
|
||||
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
|
||||
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
|
||||
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
|
||||
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
|
||||
v2XHistoryScenarioData.setEventJsonDataHashCode(mOldScenarioData.getEventJsonDataHashCode());
|
||||
v2XHistoryScenarioData.setDispose(true);
|
||||
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
|
||||
mOldScenarioData.setDispose(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况正确
|
||||
*/
|
||||
private void roadReportTrue() {
|
||||
delayedCloseWindow();
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getInfoId(),
|
||||
mExploreWay.getPoiType(),
|
||||
2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况错误
|
||||
*/
|
||||
private void roadReportErr() {
|
||||
delayedCloseWindow();
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getInfoId(),
|
||||
mExploreWay.getPoiType(),
|
||||
3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/11/16
|
||||
*/
|
||||
public class V2XSurroundingDetailVH extends RecyclerView.ViewHolder{
|
||||
|
||||
public V2XSurroundingDetailVH(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.adapter.holder;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/7/29
|
||||
*/
|
||||
public class V2XSurroundingViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
public V2XSurroundingViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager
|
||||
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant
|
||||
import com.zhidao.carchattingprovider.ICarsChattingProvider
|
||||
import java.lang.ref.WeakReference
|
||||
@@ -72,8 +71,6 @@ internal object BridgeApi {
|
||||
|
||||
fun map() = apis?.mapServiceApi
|
||||
|
||||
fun onlineCarPanelApi(): IMogoOnlineCarListPanelProvider? = apis?.onlineCarPanelApi
|
||||
|
||||
fun statusManager(): IMogoStatusManager? = apis?.statusManagerApi
|
||||
|
||||
fun topViewManager() = apis?.topViewManager
|
||||
|
||||
@@ -23,10 +23,7 @@ public class V2XConst {
|
||||
* 事件面板名称
|
||||
*/
|
||||
public static final String MODULE_NAME_EVENT_PANEL = "MODULE_EVENT_PANEL";
|
||||
/**
|
||||
* 事件面板路径
|
||||
*/
|
||||
public static final String PATH_EVENT_PANEL = "/event/panel";
|
||||
|
||||
|
||||
/**
|
||||
* V2X 场景广播 Action
|
||||
|
||||
@@ -1,438 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.fragment
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.graphics.Typeface
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.style.AbsoluteSizeSpan
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.text.style.StyleSpan
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.RadioButton
|
||||
import android.widget.RadioGroup
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.function.v2x.R
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XEventPagerAdapter
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XSurroundingDetailAdapter
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.BackRefreshInfo
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingConstruction
|
||||
import com.mogo.eagle.core.function.v2x.events.fragment.presenter.EventPanelPresenter
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.SurroundingDetailItemListener
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.TrackUtils
|
||||
import com.mogo.eagle.core.function.v2x.events.view.V2XEventPanelHistoryCountView
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceConstants
|
||||
import com.mogo.module.common.entity.MarkerExploreWay
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.enums.EventTypeEnum
|
||||
import com.mogo.module.common.view.SpacesItemDecoration
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
||||
import com.mogo.service.statusmanager.StatusDescriptor
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
|
||||
/**
|
||||
* 事件面板主fragment
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPresenter>(), SurroundingDetailItemListener,IMogoStatusChangedListener{
|
||||
|
||||
private val TAG = "V2XEventPanelFragment"
|
||||
|
||||
private var isFirstLoad = false
|
||||
|
||||
private var fragments: Array<Fragment>? = null
|
||||
|
||||
private var mediator: TabLayoutMediator? = null
|
||||
|
||||
private var mV2XEventPanelHistoryCountView: V2XEventPanelHistoryCountView? = null
|
||||
|
||||
private var mClPanelContainer: ConstraintLayout? = null
|
||||
private var mVpEventPanel: ViewPager2? = null
|
||||
private var mRgTabSelect: RadioGroup? = null
|
||||
private var mBtnHidePanels: ImageView? = null
|
||||
private var mRbScenarioHistory: RadioButton? = null
|
||||
private var mRbSurroundingEvent: RadioButton? = null
|
||||
private var mRbShareEvents: RadioButton? = null
|
||||
|
||||
private var mBackImage: ImageView? = null
|
||||
private var mTopBriefTv: TextView? = null
|
||||
private var mDetailRecyclerView: RecyclerView? = null
|
||||
private lateinit var mSurroundingDetailAdapter: V2XSurroundingDetailAdapter
|
||||
var markerExploreWays = mutableListOf<MarkerExploreWay>()
|
||||
|
||||
private var mV2XScenarioHistoryFragment: V2XScenarioHistoryFragment? = null
|
||||
private var mV2XShareEventsFragment: V2XShareEventsFragment? = null
|
||||
private var mV2XSurroundingFragment: V2XSurroundingFragment? = null
|
||||
|
||||
companion object {
|
||||
private var fragment: V2XEventPanelFragment? = null
|
||||
fun getInstance(): V2XEventPanelFragment {
|
||||
if (fragment == null) {
|
||||
synchronized(this) {
|
||||
if (fragment == null) {
|
||||
fragment = V2XEventPanelFragment()
|
||||
}
|
||||
}
|
||||
}
|
||||
return fragment as V2XEventPanelFragment
|
||||
}
|
||||
}
|
||||
|
||||
// 打开出行动态TAB
|
||||
private val mCheckHistoryEventCb = V2XVoiceCallbackListener { _: String?, _: Intent? ->
|
||||
try {
|
||||
mRbScenarioHistory?.isChecked = true
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
EventBus.getDefault().register(this)
|
||||
}
|
||||
|
||||
// 打开周边事件TAB
|
||||
private val mCheckSurroundingCb = V2XVoiceCallbackListener { _: String?, _: Intent? ->
|
||||
try {
|
||||
mRbSurroundingEvent?.isChecked = true
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
// 打开我的分享TAB
|
||||
private val mCheckShearEventCb = V2XVoiceCallbackListener { _: String?, _: Intent? ->
|
||||
try {
|
||||
mRbShareEvents?.isChecked = true
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
// 打关闭事件面板
|
||||
private val mCloeEventCb = V2XVoiceCallbackListener { _: String?, _: Intent? ->
|
||||
try {
|
||||
TrackUtils.trackV2xHistoryEvent(5)
|
||||
hidePanel()
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_v2x_event_panel_fragment_event_panel
|
||||
}
|
||||
|
||||
override fun getTagName(): String {
|
||||
return TAG
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
Logger.d(MODULE_NAME, "事件面板初始化……")
|
||||
try {
|
||||
mV2XScenarioHistoryFragment = V2XScenarioHistoryFragment()
|
||||
mV2XShareEventsFragment = V2XShareEventsFragment()
|
||||
mV2XSurroundingFragment = V2XSurroundingFragment()
|
||||
|
||||
fragments = arrayOf(
|
||||
mV2XScenarioHistoryFragment!!,
|
||||
mV2XSurroundingFragment!!,
|
||||
mV2XShareEventsFragment!!
|
||||
)
|
||||
|
||||
|
||||
mClPanelContainer = mRootView.findViewById(R.id.clPanelContainer)
|
||||
mVpEventPanel = mRootView.findViewById(R.id.vpEventPanel)
|
||||
mRgTabSelect = mRootView.findViewById(R.id.rgTabSelect)
|
||||
mBtnHidePanels = mRootView.findViewById(R.id.btnHidePanels)
|
||||
mRbScenarioHistory = mRootView.findViewById(R.id.rbScenarioHistory)
|
||||
mRbSurroundingEvent = mRootView.findViewById(R.id.rbSurroundingEvent)
|
||||
mRbShareEvents = mRootView.findViewById(R.id.rbShareEvents)
|
||||
|
||||
mBackImage = mRootView.findViewById(R.id.back_image)
|
||||
mTopBriefTv = mRootView.findViewById(R.id.tv_brief_detail)
|
||||
mDetailRecyclerView = mRootView.findViewById(R.id.surrounding_detail_recycleview)
|
||||
|
||||
initDetail()
|
||||
|
||||
// M1 不基于地图的版本直接展示事件面板,且不可关闭
|
||||
if (!DebugConfig.isMapBased()) {
|
||||
mClPanelContainer?.visibility = View.VISIBLE
|
||||
mBtnHidePanels?.visibility = View.GONE
|
||||
}
|
||||
|
||||
//禁用预加载
|
||||
mVpEventPanel?.offscreenPageLimit = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT
|
||||
mVpEventPanel?.adapter = V2XEventPagerAdapter(this, fragments!!)
|
||||
mVpEventPanel?.isUserInputEnabled = false; //true:滑动,false:禁止滑动
|
||||
|
||||
mRgTabSelect?.setOnCheckedChangeListener { _, checkedId ->
|
||||
when (checkedId) {
|
||||
R.id.rbScenarioHistory -> {
|
||||
// 更改选中是否加粗
|
||||
mRbScenarioHistory?.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
|
||||
mRbSurroundingEvent?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
mRbShareEvents?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
|
||||
TrackUtils.trackV2xHistoryEvent(2)
|
||||
mVpEventPanel?.setCurrentItem(0, false)
|
||||
}
|
||||
R.id.rbSurroundingEvent -> {
|
||||
// 更改选中是否加粗
|
||||
mRbScenarioHistory?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
mRbSurroundingEvent?.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
|
||||
mRbShareEvents?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
|
||||
TrackUtils.trackV2xHistoryEvent(3)
|
||||
mVpEventPanel?.setCurrentItem(1, false)
|
||||
}
|
||||
R.id.rbShareEvents -> {
|
||||
// 更改选中是否加粗
|
||||
mRbScenarioHistory?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
mRbSurroundingEvent?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
mRbShareEvents?.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
|
||||
|
||||
TrackUtils.trackV2xHistoryEvent(4)
|
||||
mVpEventPanel?.setCurrentItem(2, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mBtnHidePanels?.setOnClickListener {
|
||||
TrackUtils.trackV2xHistoryEvent(5)
|
||||
hidePanel()
|
||||
}
|
||||
|
||||
mBackImage?.setOnClickListener {
|
||||
EventBus.getDefault().post(BackRefreshInfo())
|
||||
showBaseUi(true)
|
||||
}
|
||||
|
||||
mV2XEventPanelHistoryCountView = V2XEventPanelHistoryCountView(context)
|
||||
mV2XEventPanelHistoryCountView!!.setOnClickListener {
|
||||
if (mClPanelContainer == null) {
|
||||
mClPanelContainer = mRootView.findViewById(R.id.clPanelContainer);
|
||||
}
|
||||
if (mClPanelContainer != null) {
|
||||
if (!isPanelShow()) {
|
||||
TrackUtils.trackV2xHistoryEvent(1)
|
||||
showPanel()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 模拟手动点击,默认选择第二个,周边事件
|
||||
// http://jira.zhidaohulian.com/browse/E84XAD-250
|
||||
mRgTabSelect?.check(R.id.rbSurroundingEvent)
|
||||
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
EventBus.getDefault().unregister(this)
|
||||
MogoApisHandler.getInstance().apis.statusManagerApi.unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.VR_MODE, this)
|
||||
mediator?.detach()
|
||||
// 避免内存泄漏
|
||||
fragment = null
|
||||
mClPanelContainer = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun createPresenter(): EventPanelPresenter {
|
||||
|
||||
return EventPanelPresenter(this)
|
||||
}
|
||||
|
||||
/*
|
||||
* 语音查询热心指数需求
|
||||
* */
|
||||
fun showPanelWithSelectedItem(item: Int) {
|
||||
showPanel()
|
||||
selectWithItem(item)
|
||||
}
|
||||
|
||||
override fun onItemClickListener(v: View?, position: Int, exploreWay: MarkerExploreWay?) {
|
||||
markerExploreWays[position].isFabulous = true
|
||||
mSurroundingDetailAdapter.notifyItemChanged(position)
|
||||
}
|
||||
|
||||
private fun initDetail() {
|
||||
mDetailRecyclerView!!.addItemDecoration(SpacesItemDecoration(resources.getDimension(R.dimen.share_item_padding).toInt()))
|
||||
mSurroundingDetailAdapter = V2XSurroundingDetailAdapter(activity, markerExploreWays, this)
|
||||
mDetailRecyclerView!!.adapter = mSurroundingDetailAdapter
|
||||
val linearLayoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
|
||||
mDetailRecyclerView!!.layoutManager = linearLayoutManager
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun updateSurroundingDetail(data: SurroundingConstruction) {
|
||||
loadSurroundingDetail(data)
|
||||
}
|
||||
|
||||
private fun loadSurroundingDetail(detailData: SurroundingConstruction?) {
|
||||
showBaseUi(false)
|
||||
if (detailData != null) {
|
||||
markerExploreWays.clear()
|
||||
markerExploreWays.addAll(detailData.construtList.toMutableList())
|
||||
mSurroundingDetailAdapter.notifyDataSetChanged()
|
||||
|
||||
val originStr = String.format(BridgeApi.context().resources.getString(R.string.v2x_surrounding_detail_top_brief), markerExploreWays.size)
|
||||
val spannableString = SpannableString(originStr + EventTypeEnum.getTypeName(detailData.poiType))
|
||||
spannableString.setSpan(ForegroundColorSpan(Color.parseColor("#459DFF")),
|
||||
7, originStr.length - EventTypeEnum.getTypeName(detailData.poiType)?.length!!, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
//设置字体大小,true表示前面的字体大小 dip
|
||||
spannableString.setSpan(AbsoluteSizeSpan(BridgeApi.context().resources.getDimension(R.dimen.module_v2x_surrounding_top_textsize).toInt(), true),
|
||||
7, originStr.length - EventTypeEnum.getTypeName(detailData.poiType)?.length!!, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
spannableString.setSpan(StyleSpan(Typeface.BOLD), 7,
|
||||
originStr.length - EventTypeEnum.getTypeName(detailData.poiType)?.length!!, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
mTopBriefTv?.text = (spannableString)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否显示基础页面
|
||||
*/
|
||||
private fun showBaseUi(isShow: Boolean) {
|
||||
if (isShow) {
|
||||
mBackImage?.visibility = View.GONE
|
||||
mTopBriefTv?.visibility = View.GONE
|
||||
mDetailRecyclerView?.visibility = View.GONE
|
||||
|
||||
mRgTabSelect?.visibility = View.VISIBLE
|
||||
mVpEventPanel?.visibility = View.VISIBLE
|
||||
if (DebugConfig.isMapBased()) {
|
||||
mBtnHidePanels?.visibility = View.VISIBLE
|
||||
}
|
||||
} else {
|
||||
mBackImage?.visibility = View.VISIBLE
|
||||
mTopBriefTv?.visibility = View.VISIBLE
|
||||
mDetailRecyclerView?.visibility = View.VISIBLE
|
||||
|
||||
mRgTabSelect?.visibility = View.GONE
|
||||
mVpEventPanel?.visibility = View.GONE
|
||||
if (DebugConfig.isMapBased()) {
|
||||
mBtnHidePanels?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 语音查询事件面板内容
|
||||
* */
|
||||
private fun selectWithItem(item: Int) {
|
||||
when (item) {
|
||||
0 -> {
|
||||
try {
|
||||
mRbScenarioHistory?.isChecked = true
|
||||
mV2XScenarioHistoryFragment?.fromVoice = true
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
1 -> {
|
||||
try {
|
||||
if (mRbSurroundingEvent?.isChecked == true) {
|
||||
mV2XSurroundingFragment?.ttsForVoiceCheckout()
|
||||
} else {
|
||||
mRbSurroundingEvent?.isChecked = true
|
||||
mV2XSurroundingFragment?.fromVoice = true
|
||||
}
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
2 -> {
|
||||
try {
|
||||
if (mRbShareEvents?.isChecked == true) {
|
||||
mV2XShareEventsFragment?.ttsForVoiceCheckout()
|
||||
} else {
|
||||
mRbShareEvents?.isChecked = true
|
||||
mV2XShareEventsFragment?.fromVoice = true
|
||||
}
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun showPanel() {
|
||||
Logger.d(MODULE_NAME, "in fragment show panel")
|
||||
mClPanelContainer?.visibility = View.VISIBLE
|
||||
|
||||
if (DebugConfig.isMapBased()) {
|
||||
V2XVoiceManager.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP, mCloeEventCb)
|
||||
}
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP, mCheckHistoryEventCb)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP, mCheckSurroundingCb)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP, mCheckShearEventCb)
|
||||
try {
|
||||
if (isFirstLoad) {
|
||||
mV2XScenarioHistoryFragment?.presenter?.loadHistory()
|
||||
mV2XShareEventsFragment?.presenter?.loadShareEventList()
|
||||
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
isFirstLoad = true
|
||||
}
|
||||
|
||||
fun hidePanel() {
|
||||
if (DebugConfig.isMapBased()) {
|
||||
Logger.d(MODULE_NAME, "in fragment hide panel")
|
||||
mClPanelContainer?.visibility = View.GONE
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP)
|
||||
}
|
||||
}
|
||||
|
||||
fun isPanelShow(): Boolean {
|
||||
return mClPanelContainer?.visibility == View.VISIBLE
|
||||
}
|
||||
|
||||
// 修改未处理消息
|
||||
fun changeEventCount() {
|
||||
// val historyMessage = V2XSQLiteUtils.getScenarioHistoryUnDisposeData()
|
||||
// if (historyMessage != null) {
|
||||
// mV2XEventPanelHistoryCountView?.changeMsgCount(historyMessage.size)
|
||||
// } else {
|
||||
// mV2XEventPanelHistoryCountView?.changeMsgCount(0)
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {
|
||||
if (isTrue) {
|
||||
// 在vr模式
|
||||
mV2XEventPanelHistoryCountView?.visibility = View.GONE
|
||||
}else{
|
||||
mV2XEventPanelHistoryCountView?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.fragment
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
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.*
|
||||
|
||||
/**
|
||||
* 出行动态,V2X 提示过的场景历史
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
class V2XScenarioHistoryFragment : MvpFragment<V2XScenarioHistoryFragment?, ScenarioHistoryPresenter?>() {
|
||||
private val TAG = "V2XScenarioHistoryFragment"
|
||||
var fromVoice = false
|
||||
private var mV2XScenarioHistoryAdapter: V2XScenarioHistoryAdapter? = null
|
||||
private val mV2XHistoryScenarioData = ArrayList<V2XHistoryScenarioData>()
|
||||
private var mListener: IMoGoV2XStatusChangedListener? = null
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return layout.module_v2x_event_panel_fragment_scenario_history
|
||||
}
|
||||
|
||||
override fun getTagName(): String {
|
||||
return TAG
|
||||
}
|
||||
|
||||
@SuppressLint("LongLogTag") override fun initViews() {
|
||||
Log.d(TAG, "initViews --------> ")
|
||||
recyclerView.addItemDecoration(SpacesItemDecoration(resources.getDimension(dimen.share_item_padding).toInt()))
|
||||
mV2XScenarioHistoryAdapter = V2XScenarioHistoryAdapter(mV2XHistoryScenarioData)
|
||||
recyclerView.adapter = mV2XScenarioHistoryAdapter
|
||||
recyclerView.addItemDecoration(SpacesItemDecoration(14)) // 配置列表朝向
|
||||
val layoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
|
||||
recyclerView.layoutManager = layoutManager
|
||||
initListener()
|
||||
viewEmpty.setTripMessage("暂无交通事件")
|
||||
viewEmpty.setRefreshVisibility(false)
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化页面用到得监听
|
||||
*/
|
||||
private fun initListener() {
|
||||
viewEmpty.setOnControlListener(object : OnControlListener {
|
||||
override fun onShearClick() {
|
||||
// TODO
|
||||
// val share = share()
|
||||
// if (share != null) {
|
||||
// share.showShareDialog()
|
||||
// getInstance().hidePanel()
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onRefreshClick() {}
|
||||
})
|
||||
mListener = object : IMoGoV2XStatusChangedListener {
|
||||
override fun onStatusChanged(descriptor: V2XStatusDescriptor, isTrue: Boolean) {
|
||||
Logger.d(TAG, "$descriptor initViews --------> $isTrue")
|
||||
if (descriptor == EventPanelWindow_UI) {
|
||||
mPresenter!!.loadHistory()
|
||||
}
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
Logger.d(TAG, "init --------> ")
|
||||
}
|
||||
}
|
||||
val v2xStatus = v2xStatus()
|
||||
v2xStatus?.registerStatusChangedListener(TAG, EventPanelWindow_UI, mListener)
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表加载数据
|
||||
*
|
||||
* @param v2XHistoryScenarioData 最新数据
|
||||
*/
|
||||
fun loadHistory(v2XHistoryScenarioData: List<V2XHistoryScenarioData>) {
|
||||
Logger.d(TAG, "查询到历史消息:" + GsonUtil.jsonFromObject(v2XHistoryScenarioData))
|
||||
ThreadUtils.runOnUiThread {
|
||||
mV2XHistoryScenarioData.clear()
|
||||
if (v2XHistoryScenarioData.size > 0) {
|
||||
viewEmpty.visibility = View.GONE
|
||||
clHistoryList.visibility = View.VISIBLE
|
||||
mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData)
|
||||
} else {
|
||||
viewEmpty.visibility = View.VISIBLE
|
||||
clHistoryList.visibility = View.GONE
|
||||
}
|
||||
mV2XScenarioHistoryAdapter?.notifyDataSetChanged()
|
||||
ttsForHistoryFirstToday()
|
||||
if (fromVoice) {
|
||||
ttsForVoiceCheckout()
|
||||
fromVoice = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 手动点击出行动态 TTS播报
|
||||
* */
|
||||
private fun ttsForHistoryFirstToday() {
|
||||
val hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_HISTORY_SELECTED")
|
||||
if (!hasBroadTts) {
|
||||
if (mV2XHistoryScenarioData.size > 0) {
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice("小智为您记录了今天的出行事件", null)
|
||||
} else {
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice("小智在这里为您记录今天的出行事件", null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 语音查询出行动态 TTS播报
|
||||
* */
|
||||
fun ttsForVoiceCheckout() {
|
||||
if (mV2XHistoryScenarioData.size > 0) {
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice("为您找到以下动态请查看", null)
|
||||
} else {
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice("今天暂无出行动态,试试对我说分享拥堵给其他车友吧", null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
// 清除V2X事件数据库中过期的数据,数据有效期为24小时
|
||||
viewLifecycleOwner.lifecycleScope.launch(Dispatchers.IO) {
|
||||
V2XSQLiteUtils.clearYesterdayScenarioHistoryData()
|
||||
mPresenter!!.loadHistory()
|
||||
}
|
||||
}
|
||||
|
||||
override fun createPresenter(): ScenarioHistoryPresenter {
|
||||
return ScenarioHistoryPresenter(this)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
val v2xStatus = v2xStatus()
|
||||
v2xStatus?.unregisterStatusChangedListener(TAG, EventPanelWindow_UI, mListener)
|
||||
}
|
||||
}
|
||||
@@ -1,267 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XShareEventAdapter;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventDescription;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventItem;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventItemEnum;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.V2XShareEventLoadMoreItem;
|
||||
import com.mogo.eagle.core.function.v2x.events.fragment.presenter.ShareEventsPresenter;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.AdapterCallback;
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback;
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XShareNetworkModel;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.view.LinearLayoutCommonManager;
|
||||
import com.mogo.module.common.view.SpacesItemDecoration;
|
||||
import com.mogo.module.common.view.NetworkLoadingView;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment, ShareEventsPresenter> implements AdapterCallback {
|
||||
|
||||
private static final String TAG = "V2XShareEventsFragment";
|
||||
private RecyclerView recyclerView;
|
||||
private V2XShareEventAdapter adapter;
|
||||
private ArrayList dataArrayList = new ArrayList();
|
||||
public Boolean fromVoice = false;
|
||||
private int pageNum = 1;
|
||||
private V2XShareNetworkModel v2XShareNetworkModel;
|
||||
private V2XShareEventDescription resultData;
|
||||
|
||||
//动画
|
||||
private NetworkLoadingView loadingView;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_v2x_event_share_recylerview;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
v2XShareNetworkModel = new V2XShareNetworkModel(getContext());
|
||||
initRecyclerView();
|
||||
initData();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
return mRootView;
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
recyclerView = mRootView.findViewById(R.id.road_case_share_list);
|
||||
recyclerView.addItemDecoration(new SpacesItemDecoration((int) getResources().getDimension(R.dimen.share_item_padding)));
|
||||
adapter = new V2XShareEventAdapter(getActivity(), dataArrayList, this);
|
||||
recyclerView.setAdapter(adapter);
|
||||
LinearLayoutCommonManager linearLayoutManager =
|
||||
new LinearLayoutCommonManager(getActivity(), LinearLayoutCommonManager.VERTICAL, false);
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
loadingView = mRootView.findViewById(R.id.network_loading_imageview);
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
getShareEventResponse();
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取热心指数,分享列表等分享内容
|
||||
* */
|
||||
@Override
|
||||
public void getShareEventResponse() {
|
||||
pageNum = 1;
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
animationAction(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
v2XShareNetworkModel.getShareEventResponse(pageNum, 10, new V2XRefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object result) {
|
||||
if (result instanceof V2XShareEventDescription) {
|
||||
resultData = (V2XShareEventDescription) result;
|
||||
|
||||
if (resultData != null && resultData.getResult() != null
|
||||
&& resultData.getResult().getEnthusiasmIndex() != null) {
|
||||
if (dataArrayList.size() > 0) {
|
||||
dataArrayList.clear();
|
||||
}
|
||||
dataArrayList.add(resultData.getResult().getEnthusiasmIndex());
|
||||
if (fromVoice == true) {
|
||||
try {
|
||||
ttsForVoiceCheckout();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (result instanceof V2XShareEventItem) {
|
||||
Log.d("V2XShareEventsFragment","onSuccess--loadSuccessWithShareEventList");
|
||||
loadSuccessWithShareEventList(result);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String msg) {
|
||||
if (dataArrayList.size() > 0) {
|
||||
dataArrayList.clear();
|
||||
Log.d("V2XShareEventsFragment","onFail--clear");
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
loadingView.stopWithError(msg, View.VISIBLE);
|
||||
|
||||
loadingView.refresButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getShareEventResponse();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 语音打开我的分享,TTS播报
|
||||
* */
|
||||
public void ttsForVoiceCheckout() {
|
||||
int shareNum = resultData.getResult().getEnthusiasmIndex().getShareNum();
|
||||
int approveNum = resultData.getResult().getEnthusiasmIndex().getLikeNum();
|
||||
double enthusiasm = resultData.getResult().getEnthusiasmIndex().getEnthusiasmIndex();
|
||||
Log.d(TAG, String.valueOf(enthusiasm) + "TTS播报热心指数个数");
|
||||
String ttsString = "";
|
||||
if (enthusiasm <= 2) {
|
||||
ttsString = "您目前已完成" + shareNum + "次分享,获得" + approveNum + "次车友认同,热心指数" + enthusiasm
|
||||
+ "颗星,老铁请再接再厉,对我说,上报路况。分享更多路况帮助其他车友。";
|
||||
} else if (2 < enthusiasm && enthusiasm < 5) {
|
||||
ttsString = "您目前已完成" + shareNum + "次分享,获得" + approveNum + "次车友认同,热心指数" + enthusiasm
|
||||
+ "颗星,老铁您的热心温暖了无数车友,加油距离五颗星不远了。";
|
||||
} else {
|
||||
ttsString = "您目前已完成" + shareNum + "次分享,获得" + approveNum + "次车友认同,热心指数" + enthusiasm
|
||||
+ "颗星,实至名归,老铁你就是大家一直赞扬的热心车友,请继续保持。";
|
||||
}
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice(ttsString, null);
|
||||
fromVoice = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* 我的分享列表数据处理
|
||||
* */
|
||||
private void loadSuccessWithShareEventList(Object result) {
|
||||
|
||||
animationAction(View.GONE);
|
||||
V2XShareEventItem resultData = (V2XShareEventItem) result;
|
||||
V2XShareEventLoadMoreItem item = new V2XShareEventLoadMoreItem();
|
||||
if (resultData != null && resultData.getResult() != null) {
|
||||
if (resultData.getResult().getPage() != null) {
|
||||
int total = resultData.getResult().getPage().getTotal();
|
||||
if (total == 0) {
|
||||
//空白
|
||||
item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY);
|
||||
dataArrayList.add(item);
|
||||
int len = dataArrayList.size();
|
||||
} else {
|
||||
if (dataArrayList.size() > 0) {
|
||||
Object data = dataArrayList.get(dataArrayList.size() - 1);
|
||||
if (data instanceof V2XShareEventLoadMoreItem) {
|
||||
dataArrayList.remove(dataArrayList.size() - 1);
|
||||
}
|
||||
}
|
||||
if (resultData.getResult().getPage().getContent().size() > 0) {
|
||||
//当前页有数据
|
||||
dataArrayList.addAll(resultData.getResult().getPage().getContent());
|
||||
item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_LOAD_MORE_STATUS);
|
||||
} else {
|
||||
//当前页没有数据
|
||||
item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_NO_MORE);
|
||||
}
|
||||
if (total > 10) {
|
||||
dataArrayList.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "分享列表:" + dataArrayList.get(0));
|
||||
} else {
|
||||
//空白
|
||||
item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY);
|
||||
dataArrayList.add(item);
|
||||
}
|
||||
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void animationAction(int visible) {
|
||||
if (visible == View.VISIBLE) {
|
||||
if (loadingView != null) {
|
||||
loadingView.start();
|
||||
}
|
||||
} else {
|
||||
if (loadingView != null) {
|
||||
loadingView.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected ShareEventsPresenter createPresenter() {
|
||||
Log.d(TAG, "createPresenter");
|
||||
ttsForSharedFirstToday();
|
||||
return new ShareEventsPresenter(this);
|
||||
}
|
||||
|
||||
private void ttsForSharedFirstToday() {
|
||||
boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_SHARED_SELECTED");
|
||||
Log.d(TAG,"shouldBroadTts"+hasBroadTts);
|
||||
if (!hasBroadTts) {
|
||||
AIAssist.getInstance(Utils.getApp()).speakTTSVoice("您可以在这里查看历史的分享记录", null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadMoreShareEventList() {
|
||||
Log.d(TAG, "page--" + pageNum);
|
||||
animationAction(View.VISIBLE);
|
||||
pageNum += 1;
|
||||
v2XShareNetworkModel.getShareEventList(pageNum, 10, new V2XRefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object result) {
|
||||
loadSuccessWithShareEventList(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String msg) {
|
||||
loadingView.stopWithError("网络异常,点击刷新重试", View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,491 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.fragment;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.AbsoluteSizeSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XSurroundingAdapter;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.BackRefreshInfo;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingConstruction;
|
||||
import com.mogo.eagle.core.function.v2x.events.fragment.presenter.SurroundingEventPresenter;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.SurroundingItemClickListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.widgets.SurroundingEventView;
|
||||
import com.mogo.eagle.core.function.v2x.events.widgets.SurroundingMarginDecoration;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.common.view.NetworkLoadingView;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
import com.mogo.service.module.IMogoMarkerService;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static android.view.View.OVER_SCROLL_NEVER;
|
||||
|
||||
/**
|
||||
* 周边事件
|
||||
*/
|
||||
public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, SurroundingEventPresenter> implements SurroundingEventView,
|
||||
View.OnClickListener, SurroundingItemClickListener {
|
||||
private static final String TAG = "V2XSurroundingFragment";
|
||||
private RelativeLayout mSurroundingLayout;
|
||||
private RecyclerView mRecyclerView;
|
||||
private TextView mTotalTv;
|
||||
private RelativeLayout mTopLayout;
|
||||
private RelativeLayout mEmptyLayout;
|
||||
private TextView mTopFreshTv;
|
||||
private TextView mShareTv;
|
||||
private TextView mFreshTv;
|
||||
private V2XSurroundingAdapter mAdapter;
|
||||
private SurroundingEventPresenter surroundingEventPresenter;
|
||||
private List<SurroundingConstruction> poiInfosList = new ArrayList<>();
|
||||
private IMogoServiceApis mApis;
|
||||
private NetworkLoadingView mloadingImage;
|
||||
public Boolean fromVoice = false;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_event_panel_fragment_surrounding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
return mRootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mSurroundingLayout = findViewById(R.id.layout_surrounding_event);
|
||||
mRecyclerView = findViewById(R.id.surrounding_recycleview);
|
||||
mTotalTv = findViewById(R.id.tv_brief);
|
||||
mTopLayout = findViewById(R.id.layout_top);
|
||||
mEmptyLayout = findViewById(R.id.layout_empty_data_show);
|
||||
mTopFreshTv = findViewById(R.id.tv_top_refresh);
|
||||
mShareTv = findViewById(R.id.tv_main_share);
|
||||
mFreshTv = findViewById(R.id.tv_main_refresh);
|
||||
mloadingImage = mRootView.findViewById(R.id.loading_iv);
|
||||
mTopFreshTv.setOnClickListener(this);
|
||||
mShareTv.setOnClickListener(this);
|
||||
mFreshTv.setOnClickListener(this);
|
||||
|
||||
// mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
|
||||
GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 2);
|
||||
int spacingInPixels = getContext().getResources().getDimensionPixelSize(R.dimen.module_v2x_surrounding_item_bottom_right_textsize);
|
||||
int spacingInPixelsLeft = getContext().getResources().getDimensionPixelSize(R.dimen.module_v2x_surrounding_item_maigin_left);
|
||||
mRecyclerView.addItemDecoration(new SurroundingMarginDecoration(spacingInPixels, spacingInPixelsLeft));
|
||||
mRecyclerView.setLayoutManager(layoutManage);
|
||||
|
||||
mAdapter = new V2XSurroundingAdapter(getActivity(), poiInfosList, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
initData();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected SurroundingEventPresenter createPresenter() {
|
||||
surroundingEventPresenter = new SurroundingEventPresenter(getContext(), this);
|
||||
return surroundingEventPresenter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == R.id.tv_main_share) {
|
||||
//弹出框面板消失,出现分享弹框
|
||||
V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取和刷新数据
|
||||
*/
|
||||
private void initData() {
|
||||
mTopLayout.setVisibility(View.GONE);
|
||||
mRecyclerView.setVisibility(View.GONE);
|
||||
mEmptyLayout.setVisibility(View.GONE);
|
||||
mloadingImage.start();
|
||||
surroundingEventPresenter.getSurroundingEventData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示列表数据
|
||||
*/
|
||||
@Override
|
||||
public void showSurroudingData(List<MarkerExploreWay> exploreWayList) {
|
||||
mloadingImage.stop();
|
||||
if (exploreWayList != null && exploreWayList.size() > 0) {
|
||||
//展示数据
|
||||
mTopLayout.setVisibility(View.VISIBLE);
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
mEmptyLayout.setVisibility(View.GONE);
|
||||
|
||||
poiInfosList.clear();
|
||||
//对数据进行分类
|
||||
poiInfosList.addAll(handleMapToList(getPoiTypeMap(exploreWayList)));
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
//总条数
|
||||
String originStr = String.format(getContext().getResources().getString(R.string.v2x_surrounding_top_brief), exploreWayList.size());
|
||||
SpannableString spannableString = new SpannableString(originStr);
|
||||
spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#459DFF")),
|
||||
7, originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
//设置字体大小,true表示前面的字体大小 dip
|
||||
spannableString.setSpan(new AbsoluteSizeSpan((int) getContext().getResources().getDimension(R.dimen.module_v2x_surrounding_top), true),
|
||||
7, originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
spannableString.setSpan(new StyleSpan(Typeface.BOLD), 7,
|
||||
originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
mTotalTv.setText(spannableString);
|
||||
|
||||
ttsForSurroundingFirstToday(exploreWayList.size());
|
||||
} else {
|
||||
mTopLayout.setVisibility(View.GONE);
|
||||
mRecyclerView.setVisibility(View.GONE);
|
||||
mEmptyLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (fromVoice == true) {
|
||||
ttsForVoiceCheckout();
|
||||
fromVoice = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动点击周边事件 TTS播报
|
||||
*/
|
||||
private void ttsForSurroundingFirstToday(int eventCount) {
|
||||
boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_SURROUNDING_SELECTED");
|
||||
if (!hasBroadTts) {
|
||||
if (eventCount > 0) {
|
||||
AIAssist.getInstance(Utils.getApp()).
|
||||
speakTTSVoice("发现周边" + eventCount + "条交通信息", null);
|
||||
} else {
|
||||
Logger.e(TAG,"周边没有发现交通信息");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 语音查询周边事件 TTS播报
|
||||
* */
|
||||
public void ttsForVoiceCheckout() {
|
||||
if (poiInfosList.size() > 0) {
|
||||
AIAssist.getInstance(Utils.getApp()).
|
||||
speakTTSVoice("为您找到周边以下事件请查看", null);
|
||||
} else {
|
||||
AIAssist.getInstance(Utils.getApp()).
|
||||
speakTTSVoice("周边5公里内无事件,试试对我说分享路况给其他车友吧", null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Map<String, SurroundingConstruction> getPoiTypeMap(List<MarkerExploreWay> list) {
|
||||
Map<String, SurroundingConstruction> mPoiTypeMarkers = new HashMap<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MarkerExploreWay exploreWay = list.get(i);
|
||||
if (!mPoiTypeMarkers.containsKey(exploreWay.getPoiType())) {
|
||||
mPoiTypeMarkers.put(exploreWay.getPoiType(), new SurroundingConstruction(exploreWay.getPoiType()));
|
||||
}
|
||||
SurroundingConstruction construction = mPoiTypeMarkers.get(exploreWay.getPoiType());
|
||||
construction.addMarkerExploreWay(exploreWay);
|
||||
}
|
||||
|
||||
Log.d(TAG, "getPoiTypeMap mPoiTypeMarkers.size() = " + mPoiTypeMarkers.size());
|
||||
|
||||
return mPoiTypeMarkers;
|
||||
}
|
||||
|
||||
|
||||
private List<SurroundingConstruction> handleMapToList(Map<String, SurroundingConstruction> map) {
|
||||
Collection<? extends SurroundingConstruction> valueCollection = map.values();
|
||||
List<SurroundingConstruction> list = new ArrayList<>(valueCollection);
|
||||
List<SurroundingConstruction> resultSurroundingList = new ArrayList<>();
|
||||
List<SurroundingConstruction> outSurroundingList = new ArrayList<>();
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
List<String> prioritySorts = prioritySort();
|
||||
for (String poiType : prioritySorts) {
|
||||
for (SurroundingConstruction construction : list) {
|
||||
if (!prioritySorts.contains(construction.getPoiType())) {
|
||||
outSurroundingList.add(construction);
|
||||
continue;
|
||||
} else if (poiType.equals(construction.getPoiType())) {
|
||||
resultSurroundingList.add(construction);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (outSurroundingList != null && outSurroundingList.size() > 0) {
|
||||
resultSurroundingList.addAll(outSurroundingList);
|
||||
}
|
||||
|
||||
Log.d(TAG, "handleMapToList resultSurroundingList.size() = " + resultSurroundingList.size());
|
||||
return resultSurroundingList;
|
||||
}
|
||||
|
||||
public static List<String> prioritySort() {
|
||||
List<String> poiTypes = new LinkedList<>();
|
||||
|
||||
// 封路
|
||||
poiTypes.add("10003");
|
||||
// 结冰
|
||||
poiTypes.add("10011");
|
||||
// 浓雾
|
||||
poiTypes.add("10010");
|
||||
// 交通检查
|
||||
poiTypes.add("10002");
|
||||
// 交通事故
|
||||
poiTypes.add("10013");
|
||||
// 拥堵
|
||||
poiTypes.add("10007");
|
||||
// 道路施工
|
||||
poiTypes.add("10006");
|
||||
// 积水
|
||||
poiTypes.add("10008");
|
||||
//实时路况
|
||||
poiTypes.add("10015");
|
||||
|
||||
return poiTypes;
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onBackRefresh(final BackRefreshInfo event) {
|
||||
if (event == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
initData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理marker的显示
|
||||
*
|
||||
* @param v
|
||||
* @param position
|
||||
* @param construction
|
||||
*/
|
||||
@Override
|
||||
public void onItemClickListener(View v, int position, SurroundingConstruction construction) {
|
||||
if (construction != null) {
|
||||
if (!DebugConfig.isMapBased()) {
|
||||
EventBus.getDefault().post(construction);
|
||||
} else {
|
||||
//卡片消失
|
||||
V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
//清除道路事件
|
||||
|
||||
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
|
||||
if (marker != null) {
|
||||
marker.removeMarkers(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
}
|
||||
try {
|
||||
//处理 marker的显示
|
||||
List<MarkerExploreWay> exploreWayList = construction.getConstrutList();
|
||||
Logger.d(TAG, "onItemClickListener exploreWayList.size() = " + exploreWayList.size());
|
||||
if (exploreWayList != null && exploreWayList.size() > 0) {
|
||||
for (int i = 0; i < exploreWayList.size(); i++) {
|
||||
MarkerExploreWay exploreWay = exploreWayList.get(i);
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setBindObj(exploreWay);
|
||||
markerShowEntity.setChecked(false);
|
||||
markerShowEntity.setTextContent(exploreWay.getAddr());
|
||||
markerShowEntity.setMarkerLocation(exploreWay.getLocation());
|
||||
markerShowEntity.setMarkerType(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
IMogoMarkerService markerService = BridgeApi.INSTANCE.markerService();
|
||||
if (markerService == null) {
|
||||
return;
|
||||
}
|
||||
IMogoMarker mogoMarker = markerService.drawMarker(markerShowEntity);
|
||||
// 点击监听,天际弹窗展示详情
|
||||
if (mogoMarker != null) {
|
||||
mogoMarker.startScaleAnimation(0, 1.2f, 0, 1.2f, 300, new AccelerateInterpolator(), new OnMarkerAnimationListener() {
|
||||
@Override
|
||||
public void onAnimStart() {
|
||||
Logger.d(TAG, " onItemClickListener onAnimStart -----> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimEnd() {
|
||||
if (mogoMarker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, " onItemClickListener onAnimEnd ------> ");
|
||||
mogoMarker.startScaleAnimation(1.2f, 1, 1.2f, 1, 100, new LinearInterpolator(), null);
|
||||
}
|
||||
});
|
||||
mogoMarker.setOwner(markerShowEntity.getMarkerType());
|
||||
mogoMarker.setObject(markerShowEntity);
|
||||
}
|
||||
}, i * 100L);
|
||||
}
|
||||
|
||||
//自适应显示
|
||||
showBonndsRoadtion(exploreWayList);
|
||||
} else {
|
||||
Logger.e(TAG, "onItemClickListener exploreWayList == null");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 子类信息tts播报
|
||||
*/
|
||||
AIAssist.getInstance(Utils.getApp()).
|
||||
speakTTSVoice(construction.getTypeNameTTS(construction.getPoiType()), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自适应显示
|
||||
*
|
||||
* @param exploreWayList
|
||||
*/
|
||||
private void showBonndsRoadtion(List<MarkerExploreWay> exploreWayList) {
|
||||
Logger.d(TAG, "showBonndsRoadtion exploreWayList.size() = " + exploreWayList.size());
|
||||
Rect rect = new Rect(
|
||||
(int) getContext().getResources().getDimension(R.dimen.module_v2x_map_left),
|
||||
(int) getContext().getResources().getDimension(R.dimen.module_v2x_map_top),
|
||||
(int) getContext().getResources().getDimension(R.dimen.module_v2x_map_right),
|
||||
(int) getContext().getResources().getDimension(R.dimen.module_v2x_map_bottom));
|
||||
|
||||
moveNotFresh();
|
||||
//第一个参数:调用者,第二个参数:当前自车的位置,第三个参数:需要显示在范围内的点(不包含自车的位置)
|
||||
//第四个参数:显示范围的UI边界,第五个参数:是否锁定自车位置(看业务需要)
|
||||
|
||||
IMogoMapUIController mapUiController = BridgeApi.INSTANCE.mapUiController();
|
||||
if (mapUiController != null) {
|
||||
mapUiController.showBounds(ServiceConst.CARD_TYPE_ROAD_CONDITION, null, getMogoList(exploreWayList), rect, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void moveNotFresh() {
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
if (statusManager != null) {
|
||||
statusManager.setUserInteractionStatus(TAG, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造经纬度列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<MogoLatLng> getMogoList(List<MarkerExploreWay> markerExploreWayList) {
|
||||
List<MogoLatLng> list = new ArrayList<>();
|
||||
if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
|
||||
if (markerExploreWayList.size() < 6) {
|
||||
for (int i = 0; i < markerExploreWayList.size(); i++) {
|
||||
MarkerLocation location = markerExploreWayList.get(i).getLocation();
|
||||
if (location != null) {
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
|
||||
list.add(mogoLatLng);
|
||||
} else {
|
||||
Logger.e(TAG, "getMogoList() < 6 location == null");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
MarkerLocation location = markerExploreWayList.get(i).getLocation();
|
||||
if (location != null) {
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
|
||||
list.add(mogoLatLng);
|
||||
} else {
|
||||
Logger.e(TAG, "getMogoList() location == null");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "getMogoList() markerExploreWay == null");
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (poiInfosList != null) {
|
||||
poiInfosList.clear();
|
||||
poiInfosList = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.fragment.presenter
|
||||
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.function.v2x.events.fragment.V2XEventPanelFragment
|
||||
|
||||
/**
|
||||
* 事件面板presenter
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class EventPanelPresenter(view: V2XEventPanelFragment) : Presenter<V2XEventPanelFragment>(view)
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.fragment.presenter;
|
||||
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.function.v2x.events.fragment.V2XScenarioHistoryFragment;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class ScenarioHistoryPresenter extends Presenter<V2XScenarioHistoryFragment> {
|
||||
|
||||
public ScenarioHistoryPresenter(V2XScenarioHistoryFragment view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
public void loadHistory() {
|
||||
WorkThreadHandler.getInstance().post(() -> {
|
||||
List<V2XHistoryScenarioData> v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData();
|
||||
mView.loadHistory(v2XHistoryScenarioData);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.fragment.presenter;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.function.v2x.events.fragment.V2XShareEventsFragment;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
|
||||
public class ShareEventsPresenter extends Presenter<V2XShareEventsFragment> {
|
||||
|
||||
public ShareEventsPresenter(IView view) { super((V2XShareEventsFragment) view); }
|
||||
|
||||
public void loadShareEventList() {
|
||||
WorkThreadHandler.getInstance().post(() -> {
|
||||
mView.getShareEventResponse();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.fragment.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.Center;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingRequest;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.panel.SurroundingResponse;
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XApiServiceFactory;
|
||||
import com.mogo.eagle.core.function.v2x.events.widgets.SurroundingEventView;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/7/29
|
||||
*/
|
||||
public class SurroundingEventPresenter extends Presenter<SurroundingEventView> {
|
||||
private Context mContext;
|
||||
private IMogoNetwork mNetWork;
|
||||
private IMogoServiceApis mApis;
|
||||
private static final String TAG = "V2XSurroundingFragment";
|
||||
|
||||
|
||||
public SurroundingEventPresenter(Context context, SurroundingEventView view) {
|
||||
super(view);
|
||||
mContext = context;
|
||||
mNetWork =
|
||||
((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi();
|
||||
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@NonNull LifecycleOwner owner) {
|
||||
super.onCreate(owner);
|
||||
}
|
||||
|
||||
public void getSurroundingEventData() {
|
||||
MogoLocation location = mApis.getMapServiceApi().getSingletonLocationClient(mContext).getLastKnowLocation();
|
||||
if (location == null) {
|
||||
return;
|
||||
}
|
||||
Center center = new Center(location.getLatitude(), location.getLongitude());
|
||||
String[] poiTypes = {"10002", "10003", "10006", "10007", "10008", "10010", "10011", "10013", "10015"};
|
||||
SurroundingRequest request = new SurroundingRequest(center, poiTypes, 5, 300);
|
||||
|
||||
V2XApiServiceFactory.getDevaApiService(mContext).getSurroundingEventList(MoGoAiCloudClientConfig.getInstance().getSn(), convert(GsonUtil.jsonFromObject(request)))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<SurroundingResponse>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
mView.showSurroudingData(null);
|
||||
Logger.e(TAG, "onError e = " + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(SurroundingResponse data) {
|
||||
super.onSuccess(data);
|
||||
Logger.d(TAG, "onSuccess ------> ");
|
||||
if (data != null && data.getResult() != null) {
|
||||
mView.showSurroudingData(data.getResult().getExploreWay());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
mView.showSurroudingData(null);
|
||||
Logger.e(TAG, "onError message = " + message + " >>> code = " + code);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static RequestBody convert(String json) {
|
||||
// String json = GsonUtil.getGson().toJson( map );
|
||||
Logger.d(TAG, "request params: %s", json);
|
||||
RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json);
|
||||
return requestBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
super.onDestroy(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLifecycleChanged(@NonNull LifecycleOwner owner, @NonNull Lifecycle.Event event) {
|
||||
super.onLifecycleChanged(owner, event);
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.provider;
|
||||
|
||||
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.function.v2x.events.V2XEventManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.fragment.V2XEventPanelFragment;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.eventpanel.IEventPanelProvider;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-2114:03
|
||||
* desc : V2X的管理
|
||||
* version: 2.0
|
||||
*/
|
||||
@Route(path = V2XConst.PATH_EVENT_PANEL)
|
||||
public class V2XEventPanelModuleProvider implements
|
||||
IEventPanelProvider {
|
||||
private final String TAG = "EventPanelModuleProvider";
|
||||
|
||||
@Override
|
||||
public Fragment createFragment(Context context, Bundle data) {
|
||||
Logger.d(MODULE_NAME, "事件模版 createFragment。。。。");
|
||||
return V2XEventPanelFragment.Companion.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
return V2XConst.MODULE_NAME_EVENT_PANEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoModuleLifecycle getCardLifecycle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapListener getMapListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return ModuleType.TYPE_CARD_FRAGMENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNaviListener getNaviListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationListener getLocationListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
V2XEventManager.INSTANCE.init(context);
|
||||
Logger.d(MODULE_NAME, "事件模版 模块初始化。。。。");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPanelWithSelectedItem(int item) {
|
||||
V2XEventPanelFragment.Companion.getInstance().showPanelWithSelectedItem(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPanel() {
|
||||
V2XEventPanelFragment.Companion.getInstance().showPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hidePanel() {
|
||||
V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
}
|
||||
}
|
||||
@@ -35,12 +35,12 @@ public interface IV2XScenario {
|
||||
/**
|
||||
* 展示按钮
|
||||
*/
|
||||
void showButton();
|
||||
default void showButton() {}
|
||||
|
||||
/**
|
||||
* 关闭按钮
|
||||
*/
|
||||
void closeButton();
|
||||
default void closeButton() {}
|
||||
|
||||
/**
|
||||
* 绘制POI
|
||||
|
||||
@@ -30,7 +30,6 @@ 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.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -159,14 +158,6 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
}
|
||||
|
||||
private void hidOtherPanel() {
|
||||
try {
|
||||
// 与其它面板互斥
|
||||
IMogoOnlineCarListPanelProvider onlineCarListPanelProvider = BridgeApi.INSTANCE.onlineCarPanelApi();
|
||||
if (onlineCarListPanelProvider != null) {
|
||||
onlineCarListPanelProvider.hidePanel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 道路实况按钮
|
||||
*/
|
||||
public class V2XRoadEventButton implements IV2XButton {
|
||||
private TextView tv;
|
||||
private IV2XButtonListener mListener;
|
||||
private V2XVoiceCallbackListener mVoiceListener = (String command, Intent intent) -> {
|
||||
if (mListener != null) {
|
||||
mListener.onAction();
|
||||
}
|
||||
close();
|
||||
};
|
||||
|
||||
@Override
|
||||
public void setOnActionListener(IV2XButtonListener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
// 注册语音交互
|
||||
registerVoice();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (tv != null) {
|
||||
tv.setVisibility(View.GONE);
|
||||
// 反注册语音交互
|
||||
mListener = null;
|
||||
}
|
||||
unRegisterVoice();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerVoice() {
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CONFIRM, mVoiceListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CONFIRM_UN_WAKEUP, mVoiceListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegisterVoice() {
|
||||
V2XVoiceManager.INSTANCE
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_COMMON_CONFIRM)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CONFIRM_UN_WAKEUP);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,19 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
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.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.livecar.V2XRoadLiveCarScenario;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.ADASUtils;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -32,13 +24,11 @@ import java.util.Map;
|
||||
* desc : 道路预警场景
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> implements IMogoTopViewStatusListener {
|
||||
public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> implements IMoGoWarningStatusListener {
|
||||
private static final String TAG = "V2XRoadEventScenario";
|
||||
|
||||
public V2XRoadEventScenario() {
|
||||
setV2XButton(new V2XRoadEventButton());
|
||||
setV2XMarker(new V2XRoadEventMarker());
|
||||
setV2XWindow(new V2XRoadEventWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,29 +62,17 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
try {
|
||||
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
|
||||
//只展示不播报 不广播
|
||||
|
||||
boolean onlyShow = getV2XMessageEntity().isOnlyShow();
|
||||
|
||||
if (onlyShow == false) {
|
||||
if (!onlyShow) {
|
||||
// 设置TTS
|
||||
getV2XMessageEntity().getContent().getTts(false);
|
||||
// 广播给ADASzzz
|
||||
ADASUtils.broadcastToADAS(
|
||||
BridgeApi.INSTANCE.context(),
|
||||
getV2XMessageEntity().getContent());
|
||||
}
|
||||
|
||||
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
|
||||
boolean isMainPageOnResume = false;
|
||||
|
||||
if (statusManager != null && statusManager.isMainPageOnResume()) {
|
||||
isMainPageOnResume = true;
|
||||
showWindow();
|
||||
}
|
||||
|
||||
|
||||
IMogoAnalytics analytics = BridgeApi.INSTANCE.analytics();
|
||||
if (analytics != null) {
|
||||
// 地图主动推送/触发消息 埋点
|
||||
@@ -119,46 +97,11 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
// 关闭直播弹窗
|
||||
try {
|
||||
IV2XWindow v2XWindow = V2XRoadLiveCarScenario.getInstance().getV2XWindow();
|
||||
if (v2XWindow != null) {
|
||||
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeSubView(v2XWindow.getView());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 关闭之前的事件弹窗
|
||||
boolean isShowEventWindow = false;
|
||||
IMoGoV2XStatusManager statusManager = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (statusManager != null) {
|
||||
isShowEventWindow = statusManager.isRoadEventWindowShow();
|
||||
}
|
||||
if (isShowEventWindow) {
|
||||
((V2XRoadEventWindow) getV2XWindow()).updateTopWindowInfo(getV2XMessageEntity().getContent());
|
||||
} else {
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) Utils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height));
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
|
||||
if (topViewManager != null) {
|
||||
topViewManager.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
}
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
}
|
||||
if (statusManager != null) {
|
||||
statusManager.setRoadEventWindowShow(TAG, true);
|
||||
}
|
||||
V2XMessageEntity<V2XRoadEventEntity> entity = getV2XMessageEntity();
|
||||
V2XRoadEventEntity content = entity != null ? entity.getContent() : null;
|
||||
if (content != null) {
|
||||
CallerHmiManager.INSTANCE.showWarningV2X(entity.getType(), content.getAlarmContent(), content.getTts(), TAG, null, !entity.isOnlyShow(), 5000L);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -184,70 +127,45 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().close();
|
||||
}
|
||||
IMoGoV2XStatusManager statusManager = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (statusManager != null) {
|
||||
statusManager.setRoadEventButtonShow(TAG, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
IV2XMarker marker = getV2XMarker();
|
||||
if (marker != null) {
|
||||
// 重置告警信息
|
||||
V2XStatusManager.getInstance().setAlarmInfo(getV2XMessageEntity().getContent());
|
||||
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
|
||||
marker.drawPOI(getV2XMessageEntity().getContent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().clearPOI();
|
||||
IV2XMarker marker = getV2XMarker();
|
||||
if (marker != null) {
|
||||
marker.clearPOI();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
//Logger.d(MODULE_NAME, "展示 Window 动画结束");
|
||||
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
boolean isMainPageOnResume = false;
|
||||
if (statusManager != null) {
|
||||
isMainPageOnResume = statusManager.isMainPageOnResume();
|
||||
public void onShow() {
|
||||
Logger.d(V2XConst.MODULE_NAME, "弹窗展示");
|
||||
IMoGoV2XStatusManager status = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (status != null) {
|
||||
status.setRoadEventWindowShow(TAG, true);
|
||||
}
|
||||
if (isMainPageOnResume) {
|
||||
if (getV2XMessageEntity() != null && getV2XMessageEntity().isNeedAddLine() == true) {
|
||||
drawPOI();
|
||||
}
|
||||
V2XMessageEntity<V2XRoadEventEntity> entity = getV2XMessageEntity();
|
||||
if (entity != null && entity.isNeedAddLine()) {
|
||||
drawPOI();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
Logger.d(V2XConst.MODULE_NAME, "关闭 Window 动画结束");
|
||||
release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
//Logger.d(MODULE_NAME, "展示 Window 开始");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
//Logger.d(MODULE_NAME, "关闭 Window 开始");
|
||||
public void onDismiss() {
|
||||
Logger.d(V2XConst.MODULE_NAME, "弹窗消失");
|
||||
IMoGoV2XStatusManager status = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (status != null) {
|
||||
status.setRoadEventWindowShow(TAG, false);
|
||||
}
|
||||
// 重置场景提示的消息
|
||||
setV2XMessageEntity(null);
|
||||
clearPOI();
|
||||
closeButton();
|
||||
release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,312 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.adapter.V2XRoadEventAdapter;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XLiveCarRes;
|
||||
import com.mogo.eagle.core.function.v2x.events.listener.V2XWindowStatusListener;
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback;
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XWindow;
|
||||
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.function.v2x.events.voice.V2XVoicePagingListener;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
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.windowview.IMogoTopViewManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/14 2:37 PM
|
||||
* desc : 显示事件的列表
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XRoadEventWindow extends V2XBasWindow
|
||||
implements V2XRefreshCallback<V2XLiveCarRes>, IV2XWindow<V2XRoadEventEntity> {
|
||||
private String TAG = "V2XRoadEventDetailWindow";
|
||||
// 关闭按钮
|
||||
private ImageView mBtnCloseWindow;
|
||||
// 展示列表
|
||||
private RecyclerView mRecyclerView;
|
||||
// 列表数据适配器
|
||||
private V2XRoadEventAdapter mV2XRoadEventAdapter;
|
||||
// 列表展示
|
||||
private final List<V2XEventShowEntity> mItemList = new ArrayList<>();
|
||||
// 当前展示的位置
|
||||
private int mCurPosition;
|
||||
// 处理道路事件,30秒倒计时
|
||||
private final Handler handlerV2XEvent = new Handler();
|
||||
private Runnable runnableV2XEvent;
|
||||
private int mExpireTime = 20000;
|
||||
// 关闭弹窗回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackCloseWindowListener = (command, intent) -> close();
|
||||
// 翻页回调监听
|
||||
private V2XVoicePagingListener v2XVoicePagingCallbackListener = new V2XVoicePagingListener() {
|
||||
|
||||
@Override
|
||||
public void onNextCallback() {
|
||||
if (mRecyclerView != null && mCurPosition >= 0 && mCurPosition < mV2XRoadEventAdapter.getItemCount() - 1) {
|
||||
mRecyclerView.scrollToPosition(mCurPosition + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrevCallback() {
|
||||
if (mRecyclerView != null && mCurPosition > 0 && mCurPosition <= mV2XRoadEventAdapter.getItemCount() - 1) {
|
||||
mRecyclerView.scrollToPosition(mCurPosition - 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public V2XRoadEventWindow() {
|
||||
this(BridgeApi.INSTANCE.context(), null);
|
||||
}
|
||||
|
||||
public V2XRoadEventWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XRoadEventWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XRoadEventWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化视图
|
||||
*/
|
||||
private void initView(Context context) {
|
||||
//Logger.d(MODULE_NAME, "V2X===初始化道路事件小窗口View。。。。。");
|
||||
// 填充布局
|
||||
LayoutInflater.from(context).inflate(BridgeApi.INSTANCE.statusManager() != null && BridgeApi.INSTANCE.statusManager().isVrMode() ?
|
||||
R.layout.window_road_event_detail_vr : R.layout.window_road_event_detail, this);
|
||||
// 详情列表
|
||||
mBtnCloseWindow = findViewById(R.id.btnCloseWindow);
|
||||
// 详情列表
|
||||
mRecyclerView = findViewById(R.id.rvRoadEventList);
|
||||
|
||||
mBtnCloseWindow.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList, this);
|
||||
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
|
||||
// 设置切换样式
|
||||
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
|
||||
// 配置列表朝向
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (recyclerView.getChildCount() > 0) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
//获得当前显示在第一个item的位置
|
||||
mCurPosition = layoutManager.findFirstCompletelyVisibleItemPosition();
|
||||
// 用户处于交互的时候延后隐藏时间
|
||||
startCountDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(V2XRoadEventEntity entity) {
|
||||
//Logger.d(MODULE_NAME, "V2X===道路事件详情:展示 Window:" + entity);
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE
|
||||
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW, v2XVoiceCallbackCloseWindowListener)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP, v2XVoiceCallbackCloseWindowListener)
|
||||
.registerPagingCallback(v2XVoicePagingCallbackListener);
|
||||
// 更新头部的窗体视图
|
||||
updateTopWindowInfo(entity);
|
||||
|
||||
// 倒计时
|
||||
mExpireTime = entity.getExpireTime();
|
||||
startCountDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新头部的窗体视图
|
||||
*/
|
||||
public void updateTopWindowInfo(V2XRoadEventEntity v2XRoadEventEntity) {
|
||||
//Logger.d(MODULE_NAME, "V2X===道路事件详情:更新 Window:" + v2XRoadEventEntity);
|
||||
|
||||
// 清空数据
|
||||
mItemList.clear();
|
||||
if (v2XRoadEventEntity != null) {
|
||||
// 道路事件行驶到了50米附近,弹出事件纠错框给用户
|
||||
//Logger.d(MODULE_NAME, "V2X===道路事件:" + v2XRoadEventEntity);
|
||||
|
||||
// 进行类型分发
|
||||
if (EventTypeEnum.TRAFFIC_CHECK.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.ROAD_CLOSED.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_ROAD_WORK.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_BLOCK_UP.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_PONDING.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_FOG.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_ICE.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_ACCIDENT.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_ACCIDENT_01.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_ACCIDENT_02.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_ACCIDENT_03.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_ACCIDENT_04.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_ACCIDENT_05.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_LIVING.getPoiType().equals(v2XRoadEventEntity.getPoiType())
|
||||
|| EventTypeEnum.FOURS_NEALY.getPoiType().equals(v2XRoadEventEntity.getPoiType())) {
|
||||
// 展示道路事件本身详情
|
||||
if (mItemList.isEmpty()) {
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING);
|
||||
v2XEventShowEntity.setV2XRoadEventEntity(v2XRoadEventEntity);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
}
|
||||
// 获取道路事件周边的直播车机
|
||||
V2XRefreshModel v2XRefreshModel = BridgeApi.INSTANCE.refreshModel();
|
||||
if (v2XRefreshModel != null) {
|
||||
v2XRefreshModel
|
||||
.queryNearbyVehicleLiveByLocation(
|
||||
this,
|
||||
v2XRoadEventEntity.getLocation().getLon(),
|
||||
v2XRoadEventEntity.getLocation().getLat());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2XLiveCarRes result) {
|
||||
//Logger.d(MODULE_NAME, "V2X===事件周边的直播车机:" + result);
|
||||
try {
|
||||
if (!mItemList.isEmpty() &&
|
||||
result != null &&
|
||||
result.getResult() != null &&
|
||||
result.getResult().getInfo() != null &&
|
||||
result.getResult().getInfo().size() > 0) {
|
||||
mItemList.get(0).setV2XLiveCarList(result.getResult().getInfo());
|
||||
}
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter.notifyDataSetChanged();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String msg) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关闭详情展示框
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
//Logger.d(MODULE_NAME, "V2X===关闭 Window");
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.INSTANCE.unRegisterPagingCallback();
|
||||
V2XVoiceManager.INSTANCE
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP)
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING)
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN)
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REPORT)
|
||||
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_LIVE_ROAD)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR);
|
||||
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
|
||||
IMogoTopViewManager topViewManager = BridgeApi.INSTANCE.topViewManager();
|
||||
if (topViewManager != null) {
|
||||
topViewManager.removeView(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void startCountDown() {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
|
||||
// 移出Window详细信息
|
||||
close();
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
//Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + mExpireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止倒计时
|
||||
*/
|
||||
public void stopCountDown() {
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void release() {
|
||||
super.release();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.utils;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.fragment.V2XEventPanelFragment;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.sqlite.SQLIDao;
|
||||
@@ -95,7 +94,7 @@ public class V2XSQLiteUtils {
|
||||
try {
|
||||
int result = getScenarioHistoryDao().update(oldScenarioData, newScenarioData);
|
||||
Logger.d(V2XConst.MODULE_NAME, "修改数据成功:" + result);
|
||||
V2XEventPanelFragment.Companion.getInstance().changeEventCount();
|
||||
//V2XEventPanelFragment.Companion.getInstance().changeEventCount();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -171,7 +170,7 @@ public class V2XSQLiteUtils {
|
||||
// 存储新数据
|
||||
V2XSQLiteUtils.getScenarioHistoryDao().insert(v2XHistoryScenarioData);
|
||||
}
|
||||
V2XEventPanelFragment.Companion.getInstance().changeEventCount();
|
||||
//V2XEventPanelFragment.Companion.getInstance().changeEventCount();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -168,13 +168,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
||||
private fun redLightWarning() {
|
||||
Logger.d(TAG, "=====闯红灯预警=====")
|
||||
ThreadUtils.runOnUiThread {
|
||||
CallerHmiManager.showWarningV2X(
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP.poiType.toInt(),
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP.content,
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP.tts,
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP.poiType,
|
||||
null
|
||||
)
|
||||
CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_USECASE_ID_IVP.poiType.toInt(), EventTypeEnum.TYPE_USECASE_ID_IVP.content, EventTypeEnum.TYPE_USECASE_ID_IVP.tts, EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, null, true, 5000L)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,11 +186,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
||||
EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType),
|
||||
speed
|
||||
)
|
||||
CallerHmiManager.showWarningV2X(
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType.toInt(),
|
||||
content, tts,
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, null
|
||||
)
|
||||
CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType.toInt(), content, tts, EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, null, true, 5000L)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,20 +129,16 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
//如果上次结果和本次灯态结果变化比较大,则已变灯,控制HMI展示弹窗
|
||||
if (abs(currentResult!!.remain - it.remain) > 5 && currentResult.isGreen()) {
|
||||
Logger.d(TAG, "调用showWarningV2X to show")
|
||||
CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType.toInt(),
|
||||
EventTypeEnum.TYPE_VIP_IDENTIFICATION.content,
|
||||
EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts,
|
||||
EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType,
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {}
|
||||
override fun onDismiss() {
|
||||
Logger.d(
|
||||
TAG,
|
||||
"showWarningV2X vip dismiss , resetConditions"
|
||||
)
|
||||
resetConditions()
|
||||
}
|
||||
})
|
||||
CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType.toInt(), EventTypeEnum.TYPE_VIP_IDENTIFICATION.content, EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts, EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType, object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {}
|
||||
override fun onDismiss() {
|
||||
Logger.d(
|
||||
TAG,
|
||||
"showWarningV2X vip dismiss , resetConditions"
|
||||
)
|
||||
resetConditions()
|
||||
}
|
||||
}, true, 5000L)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvRoadEventList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_v2x_event_window_height"
|
||||
android:minHeight="@dimen/module_v2x_event_window_height"
|
||||
android:orientation="horizontal"
|
||||
android:overScrollMode="never"
|
||||
android:padding="@dimen/module_v2x_widow_top_gaps"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:listitem="@layout/item_v2x_event_detail" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnCloseWindow"
|
||||
android:layout_width="@dimen/dp_88"
|
||||
android:layout_height="@dimen/dp_88"
|
||||
android:layout_marginEnd="@dimen/dp_32"
|
||||
android:layout_marginBottom="@dimen/dp_40"
|
||||
android:background="@drawable/module_common_close_selector"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:layout_width="@dimen/module_v2x_road_event_window_width_vr"
|
||||
android:layout_height="@dimen/module_v2x_road_event_window_height_vr"
|
||||
android:layout_marginTop="@dimen/dp_8">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvRoadEventList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_v2x_road_event_window_height_vr"
|
||||
android:minHeight="@dimen/module_v2x_event_window_height"
|
||||
android:orientation="horizontal"
|
||||
android:overScrollMode="never"
|
||||
android:padding="@dimen/module_v2x_widow_top_gaps"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:listitem="@layout/item_v2x_event_detail_vr" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnCloseWindow"
|
||||
android:layout_width="@dimen/dp_88"
|
||||
android:layout_height="@dimen/dp_88"
|
||||
android:layout_marginEnd="@dimen/dp_32"
|
||||
android:layout_marginBottom="@dimen/dp_40"
|
||||
android:background="@drawable/module_common_close_selector"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -50,7 +50,9 @@ dependencies {
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxroomruntime
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
kapt rootProject.ext.dependencies.androidxroomcompiler
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogo_core_res
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.mogo.eagle.core.data.autopilot
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description 工控机升级状态实体类
|
||||
* @since: 2022/1/21
|
||||
*/
|
||||
class AdUpgradeStateHelper {
|
||||
|
||||
companion object{
|
||||
private const val UPGRADE_QUIET = 0 //静默升级
|
||||
private const val UPGRADE_HINT = 3 //提示升级
|
||||
|
||||
private const val DOWNLOAD_START = 30 //开始下载
|
||||
private const val DOWNLOAD_FINISH = 31 //下载完成
|
||||
private const val DOWNLOAD_FAILED = 32 //下载失败
|
||||
|
||||
private const val UPGRADE_AFFIRM = 60 //是否升级
|
||||
private const val UPGRADE_SUCCEED = 61 //升级成功
|
||||
private const val UPGRADE_FAILED = 62 //升级失败
|
||||
|
||||
private const val USER_AFFIRM = 63 //用户确认
|
||||
private const val USER_CANCEL = 64 //用户取消
|
||||
|
||||
private var UPGRADING = false //工控机是否处于“升级中”状态
|
||||
|
||||
/**
|
||||
* 如果工控机处于“下载中”、“可升级(下载完成)”、“升级中”、“升级失败”状态时,工具箱入口显示红色角标
|
||||
* @param downloadStatus 下载状态
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun showUpgradeTips(downloadStatus: Int,upgradeStatus: Int) : Boolean{
|
||||
return isDownloading(downloadStatus) || isDownloadFinish(downloadStatus) || isUpgradeFailed(upgradeStatus)
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机是否处于“下载中”状态
|
||||
* @param downloadStatus 下载状态
|
||||
*/
|
||||
fun isDownloading(downloadStatus: Int) : Boolean{
|
||||
return downloadStatus == DOWNLOAD_START
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机是否处于“下载完成”(可升级)状态
|
||||
* @param downloadStatus 下载状态
|
||||
*/
|
||||
fun isDownloadFinish(downloadStatus: Int) : Boolean{
|
||||
return downloadStatus == DOWNLOAD_FINISH
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机是否处于“下载失败”状态
|
||||
* @param downloadStatus 下载状态
|
||||
*/
|
||||
fun isDownloadFailed(downloadStatus: Int) : Boolean{
|
||||
return downloadStatus == DOWNLOAD_FAILED
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机是否处于“升级成功”状态
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun isUpgradeSuccess(upgradeStatus: Int) : Boolean{
|
||||
return upgradeStatus == UPGRADE_SUCCEED
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机是否处于“升级失败”状态
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun isUpgradeFailed(upgradeStatus: Int) : Boolean{
|
||||
return upgradeStatus == UPGRADE_FAILED
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据已下载包体大小和包体总大小获取当前下载进度 0-100
|
||||
* @param currentProgress 当前已下载包体大小
|
||||
* @param totalProgress 包体总大小
|
||||
*/
|
||||
fun downloadProgress(currentProgress: Int,totalProgress: Int) : Int{
|
||||
return currentProgress*100/totalProgress
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级模式是否是静默升级
|
||||
* @param upgradeMode 升级模式
|
||||
*/
|
||||
fun isQuietUpgradeMode(upgradeMode: Int) : Boolean{
|
||||
return upgradeMode == UPGRADE_QUIET
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级模式是否是提示升级
|
||||
* @param upgradeMode 升级模式
|
||||
*/
|
||||
fun isHintUpgradeMode(upgradeMode: Int) : Boolean{
|
||||
return upgradeMode == UPGRADE_HINT
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否处于“升级中”状态
|
||||
*/
|
||||
fun getUpgradeStatus() : Boolean{
|
||||
return UPGRADING
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否处于“升级中”状态
|
||||
* @param upgrading 是否是升级中
|
||||
*/
|
||||
fun setUpgradeStatus(upgrading: Boolean){
|
||||
UPGRADING = upgrading
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工控机包体下载剩余时间
|
||||
*/
|
||||
fun getRemainingTime(totalProgress: Int,previousProgress: Int,currentProgress: Int) : String{
|
||||
//剩余包体大小
|
||||
val remainingSize = totalProgress - currentProgress
|
||||
//目前下载进度回调是1秒回调一次,据此计算每秒下载的包大小
|
||||
val speed = currentProgress - previousProgress
|
||||
//剩余包体的大小除以每秒下载的大小,获得剩余下载时间
|
||||
val time = remainingSize/speed
|
||||
//转换为分秒格式返回
|
||||
val minute = time/60
|
||||
val second = time%60
|
||||
if(minute>0 && second>0){
|
||||
return minute.toString()+"分钟"+second+"秒"
|
||||
}else if(minute>0){
|
||||
return minute.toString()+"分钟"
|
||||
}else if(second>0){
|
||||
return second.toString()+"秒"
|
||||
}else{
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,19 @@
|
||||
package com.mogo.eagle.core.data.autopilot
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
|
||||
|
||||
@Entity(tableName = "record")
|
||||
class AutoPilotRecordResult {
|
||||
|
||||
/**
|
||||
* 磁盘可用空间(M)
|
||||
*/
|
||||
var diskFree: Int = 0
|
||||
@ColumnInfo(name = "disk_free")
|
||||
var diskFree: Long = 0
|
||||
|
||||
/**
|
||||
* 采集时长
|
||||
@@ -19,6 +24,7 @@ class AutoPilotRecordResult {
|
||||
/**
|
||||
* 保存的文件名
|
||||
*/
|
||||
@ColumnInfo(name = "file_name")
|
||||
var fileName: String? = ""
|
||||
|
||||
|
||||
@@ -27,7 +33,6 @@ class AutoPilotRecordResult {
|
||||
*/
|
||||
var note: String? = ""
|
||||
|
||||
|
||||
/**
|
||||
* 域控制器定义的bag key
|
||||
*/
|
||||
@@ -54,26 +59,23 @@ class AutoPilotRecordResult {
|
||||
*/
|
||||
var id: Int = 0
|
||||
|
||||
|
||||
/**
|
||||
* 时间戳,格式:YYYY-MM-DD-hh-mm-ss
|
||||
*/
|
||||
var timestamp: String? = ""
|
||||
@PrimaryKey
|
||||
var timestamp: String = SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()).format(Date())
|
||||
|
||||
/**
|
||||
* 此次采集数据总大小(M)
|
||||
*/
|
||||
var total: Int? = 0
|
||||
|
||||
var total: Long? = 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)"
|
||||
}
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
package com.mogo.eagle.core.data.autopilot;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.mogo.eagle.core.data.autopilot.guardian.AutopilotCpuState;
|
||||
import com.mogo.eagle.core.data.autopilot.guardian.AutopilotDiskState;
|
||||
import com.mogo.eagle.core.data.autopilot.guardian.AutopilotHardwareState;
|
||||
import com.mogo.eagle.core.data.autopilot.guardian.AutopilotMemState;
|
||||
import com.mogo.eagle.core.data.autopilot.guardian.AutopilotNetFlowState;
|
||||
import com.mogo.eagle.core.data.autopilot.guardian.AutopilotNodeState;
|
||||
import com.mogo.eagle.core.data.autopilot.guardian.AutopilotProgramState;
|
||||
import com.mogo.eagle.core.data.autopilot.guardian.AutopilotTopicState;
|
||||
import com.mogo.eagle.core.data.autopilot.guardian.AutopilotGuardianModule;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -19,146 +11,103 @@ import java.util.List;
|
||||
* 工控机节点状态信息
|
||||
*/
|
||||
public class AutopilotGuardianStatusInfo implements Serializable {
|
||||
//接口名称
|
||||
@SerializedName("action")
|
||||
private String action;
|
||||
@SerializedName("value")
|
||||
private AutopilotGuardianResult value;
|
||||
|
||||
public static class AutopilotGuardianResult {
|
||||
//车辆类型 WEY-长城 DF-东风 BYD-比亚迪 JINLV-金旅
|
||||
@SerializedName("cartype")
|
||||
private String carType;
|
||||
//车牌号
|
||||
@SerializedName("carnum")
|
||||
private String carNum;
|
||||
//ws连接状态 0-非链接 1-链接
|
||||
@SerializedName("websocket_state")
|
||||
private String wsState;
|
||||
//ai云长链状态 0-非链接 1-链接
|
||||
@SerializedName("aicloud_state")
|
||||
private String aiCloudState;
|
||||
//感知 eagle_hz
|
||||
@SerializedName("eagle_hz")
|
||||
private String eagleHz;
|
||||
//软件节点
|
||||
@SerializedName("nodestate")
|
||||
private List<AutopilotNodeState> nodeState;
|
||||
//topic
|
||||
@SerializedName("topicstate")
|
||||
private List<AutopilotTopicState> topicState;
|
||||
//硬件节点
|
||||
@SerializedName("hardwarestate")
|
||||
private List<AutopilotHardwareState> hardwareState;
|
||||
//CPU
|
||||
@SerializedName("cpustate")
|
||||
private AutopilotCpuState cpuState;
|
||||
//内存
|
||||
@SerializedName("memstate")
|
||||
private AutopilotMemState memState;
|
||||
//硬盘状态
|
||||
@SerializedName("diskstate")
|
||||
private List<AutopilotDiskState> diskState;
|
||||
//占CPU最多的10个程序
|
||||
@SerializedName("programcpustate")
|
||||
private List<AutopilotProgramState> programCpuState;
|
||||
//占内存最多的10个程序
|
||||
@SerializedName("programmemstate")
|
||||
private List<AutopilotProgramState> programMemState;
|
||||
//流量
|
||||
@SerializedName("netflowstate")
|
||||
private List<AutopilotNetFlowState> netFlowState;
|
||||
|
||||
|
||||
public String getCarType() {
|
||||
return carType;
|
||||
}
|
||||
|
||||
public String getCarNum() {
|
||||
return carNum;
|
||||
}
|
||||
|
||||
public String getWsState() {
|
||||
return wsState;
|
||||
}
|
||||
|
||||
public String getAiCloudState() {
|
||||
return aiCloudState;
|
||||
}
|
||||
|
||||
public List<AutopilotNodeState> getNodeState() {
|
||||
return nodeState;
|
||||
}
|
||||
|
||||
public List<AutopilotHardwareState> getHardwareState() {
|
||||
return hardwareState;
|
||||
}
|
||||
|
||||
public AutopilotCpuState getCpuState() {
|
||||
return cpuState;
|
||||
}
|
||||
|
||||
public AutopilotMemState getMemState() {
|
||||
return memState;
|
||||
}
|
||||
|
||||
public List<AutopilotDiskState> getDiskState() {
|
||||
return diskState;
|
||||
}
|
||||
|
||||
public String getEagleHz() {
|
||||
return eagleHz;
|
||||
}
|
||||
|
||||
public List<AutopilotProgramState> getProgramCpuState() {
|
||||
return programCpuState;
|
||||
}
|
||||
|
||||
public List<AutopilotProgramState> getProgramMemState() {
|
||||
return programMemState;
|
||||
}
|
||||
|
||||
public List<AutopilotNetFlowState> getNetFlowState() {
|
||||
return netFlowState;
|
||||
}
|
||||
|
||||
public List<AutopilotTopicState> getTopicState() {
|
||||
return topicState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotGuardianResult{" +
|
||||
"carType='" + carType + '\'' +
|
||||
", carNum='" + carNum + '\'' +
|
||||
", wsState='" + wsState + '\'' +
|
||||
", aiCloudState='" + aiCloudState + '\'' +
|
||||
", eagleHz='" + eagleHz + '\'' +
|
||||
", nodeState=" + nodeState +
|
||||
", topicState=" + topicState +
|
||||
", hardwareState=" + hardwareState +
|
||||
", cpuState=" + cpuState +
|
||||
", memState=" + memState +
|
||||
", diskState=" + diskState +
|
||||
", programCpuState=" + programCpuState +
|
||||
", programMemState=" + programMemState +
|
||||
", netFlowState=" + netFlowState +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
//监控项名称
|
||||
@SerializedName("agentName")
|
||||
private String agentName;
|
||||
//车牌号
|
||||
@SerializedName("carNum")
|
||||
private String carNum;
|
||||
//车型
|
||||
@SerializedName("carType")
|
||||
private String carType;
|
||||
//monitorType
|
||||
@SerializedName("monitorType")
|
||||
private String monitorType;
|
||||
//sn
|
||||
@SerializedName("sn")
|
||||
private String sn;
|
||||
//时间
|
||||
@SerializedName("time")
|
||||
private long time;
|
||||
@SerializedName("modules")
|
||||
private AutopilotGuardianModule modules;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public AutopilotGuardianResult getValue() {
|
||||
return value;
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getAgentName() {
|
||||
return agentName;
|
||||
}
|
||||
|
||||
public void setAgentName(String agentName) {
|
||||
this.agentName = agentName;
|
||||
}
|
||||
|
||||
public String getCarNum() {
|
||||
return carNum;
|
||||
}
|
||||
|
||||
public void setCarNum(String carNum) {
|
||||
this.carNum = carNum;
|
||||
}
|
||||
|
||||
public String getCarType() {
|
||||
return carType;
|
||||
}
|
||||
|
||||
public void setCarType(String carType) {
|
||||
this.carType = carType;
|
||||
}
|
||||
|
||||
public String getMonitorType() {
|
||||
return monitorType;
|
||||
}
|
||||
|
||||
public void setMonitorType(String monitorType) {
|
||||
this.monitorType = monitorType;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(long time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public AutopilotGuardianModule getModules() {
|
||||
return modules;
|
||||
}
|
||||
|
||||
public void setModules(AutopilotGuardianModule modules) {
|
||||
this.modules = modules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotGuardianInfo{" +
|
||||
"action='" + action + '\'' +
|
||||
", value=" + value +
|
||||
", agentName='" + agentName + '\'' +
|
||||
", carNum='" + carNum + '\'' +
|
||||
", carType='" + carType + '\'' +
|
||||
", monitorType='" + monitorType + '\'' +
|
||||
", modules=" + modules +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.mogo.eagle.core.data.autopilot;
|
||||
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -11,11 +13,15 @@ import java.util.List;
|
||||
|
||||
public class AutopilotRouteInfo {
|
||||
|
||||
@SerializedName("action")
|
||||
private String action;
|
||||
@SerializedName("models")
|
||||
private List<RouteModels> models;
|
||||
|
||||
public static class RouteModels {
|
||||
@SerializedName("lat")
|
||||
private Double lat;
|
||||
@SerializedName("lon")
|
||||
private Double lon;
|
||||
|
||||
public Double getLat() {
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des CPU状态
|
||||
* @date 2021/8/11
|
||||
*/
|
||||
public class AutopilotCpuState {
|
||||
//cup总使用率
|
||||
@SerializedName("all")
|
||||
private Double all;
|
||||
@SerializedName("cpu1")
|
||||
private Double cpu1;
|
||||
@SerializedName("cpu2")
|
||||
private Double cpu2;
|
||||
@SerializedName("cpu3")
|
||||
private Double cpu3;
|
||||
@SerializedName("cpu4")
|
||||
private Double cpu4;
|
||||
@SerializedName("cpu5")
|
||||
private Double cpu5;
|
||||
@SerializedName("cpu6")
|
||||
private Double cpu6;
|
||||
@SerializedName("cpu7")
|
||||
private Double cpu7;
|
||||
@SerializedName("cpu8")
|
||||
private Double cpu8;
|
||||
|
||||
public Double getAll() {
|
||||
return all;
|
||||
}
|
||||
|
||||
public Double getCpu1() {
|
||||
return cpu1;
|
||||
}
|
||||
|
||||
public Double getCpu2() {
|
||||
return cpu2;
|
||||
}
|
||||
|
||||
public Double getCpu3() {
|
||||
return cpu3;
|
||||
}
|
||||
|
||||
public Double getCpu4() {
|
||||
return cpu4;
|
||||
}
|
||||
|
||||
public Double getCpu5() {
|
||||
return cpu5;
|
||||
}
|
||||
|
||||
public Double getCpu6() {
|
||||
return cpu6;
|
||||
}
|
||||
|
||||
public Double getCpu7() {
|
||||
return cpu7;
|
||||
}
|
||||
|
||||
public Double getCpu8() {
|
||||
return cpu8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotCpuState{" +
|
||||
"all=" + all +
|
||||
", cpu1=" + cpu1 +
|
||||
", cpu2=" + cpu2 +
|
||||
", cpu3=" + cpu3 +
|
||||
", cpu4=" + cpu4 +
|
||||
", cpu5=" + cpu5 +
|
||||
", cpu6=" + cpu6 +
|
||||
", cpu7=" + cpu7 +
|
||||
", cpu8=" + cpu8 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des 磁盘信息
|
||||
* @date 2021/8/11
|
||||
*/
|
||||
public class AutopilotDiskState {
|
||||
//磁盘总大小
|
||||
@SerializedName("diskall")
|
||||
private String diskall;
|
||||
//磁盘空闲大小
|
||||
@SerializedName("diskfree")
|
||||
private String diskfree;
|
||||
//磁盘挂在目录
|
||||
@SerializedName("diskmount")
|
||||
private String diskmount;
|
||||
//磁盘名称
|
||||
@SerializedName("diskname")
|
||||
private String diskname;
|
||||
//磁盘使用百分比
|
||||
@SerializedName("diskpercent")
|
||||
private String diskpercent;
|
||||
//磁盘已使用大小
|
||||
@SerializedName("diskuse")
|
||||
private String diskuse;
|
||||
|
||||
public String getDiskall() {
|
||||
return diskall;
|
||||
}
|
||||
|
||||
public String getDiskfree() {
|
||||
return diskfree;
|
||||
}
|
||||
|
||||
public String getDiskmount() {
|
||||
return diskmount;
|
||||
}
|
||||
|
||||
public String getDiskname() {
|
||||
return diskname;
|
||||
}
|
||||
|
||||
public String getDiskpercent() {
|
||||
return diskpercent;
|
||||
}
|
||||
|
||||
public String getDiskuse() {
|
||||
return diskuse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotDiskState{" +
|
||||
"diskall='" + diskall + '\'' +
|
||||
", diskfree='" + diskfree + '\'' +
|
||||
", diskmount='" + diskmount + '\'' +
|
||||
", diskname='" + diskname + '\'' +
|
||||
", diskpercent='" + diskpercent + '\'' +
|
||||
", diskuse='" + diskuse + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/12/10
|
||||
*/
|
||||
public class AutopilotGuardianItem {
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("value")
|
||||
private String value;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GuardianItem{" +
|
||||
"name='" + name + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/12/10
|
||||
*/
|
||||
public class AutopilotGuardianItemsName {
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("items")
|
||||
private List<AutopilotGuardianItem> items;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<AutopilotGuardianItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<AutopilotGuardianItem> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GuardianItemsName{" +
|
||||
"name='" + name + '\'' +
|
||||
", items=" + items +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/12/10
|
||||
*/
|
||||
public class AutopilotGuardianModule {
|
||||
@SerializedName("itemsname")
|
||||
private List<AutopilotGuardianItemsName> itemsname;
|
||||
@SerializedName("submodules")
|
||||
private List<AutopilotGuardianSubmodule> submodules;
|
||||
|
||||
public List<AutopilotGuardianItemsName> getItemsname() {
|
||||
return itemsname;
|
||||
}
|
||||
|
||||
public void setItemsname(List<AutopilotGuardianItemsName> itemsname) {
|
||||
this.itemsname = itemsname;
|
||||
}
|
||||
|
||||
public List<AutopilotGuardianSubmodule> getSubmodules() {
|
||||
return submodules;
|
||||
}
|
||||
|
||||
public void setSubmodules(List<AutopilotGuardianSubmodule> submodules) {
|
||||
this.submodules = submodules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GuardianModule{" +
|
||||
"itemsname=" + itemsname +
|
||||
", submodules=" + submodules +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/12/10
|
||||
*/
|
||||
public class AutopilotGuardianSubmodule {
|
||||
@SerializedName("modulename")
|
||||
private String modulename;
|
||||
@SerializedName("subnodes")
|
||||
private List<Subnode> subnodes;
|
||||
|
||||
public String getModulename() {
|
||||
return modulename;
|
||||
}
|
||||
|
||||
public void setModulename(String modulename) {
|
||||
this.modulename = modulename;
|
||||
}
|
||||
|
||||
public List<Subnode> getSubnodes() {
|
||||
return subnodes;
|
||||
}
|
||||
|
||||
public void setSubnodes(List<Subnode> subnodes) {
|
||||
this.subnodes = subnodes;
|
||||
}
|
||||
|
||||
public static class Subnode {
|
||||
@SerializedName("nodename")
|
||||
private String nodename;
|
||||
@SerializedName("nodeitems")
|
||||
private List<AutopilotGuardianItemsName> nodeitems;
|
||||
@SerializedName("topicitems")
|
||||
private List<AutopilotGuardianItemsName> topicitems;
|
||||
|
||||
public String getNodename() {
|
||||
return nodename;
|
||||
}
|
||||
|
||||
public void setNodename(String nodename) {
|
||||
this.nodename = nodename;
|
||||
}
|
||||
|
||||
public List getNodeitems() {
|
||||
return nodeitems;
|
||||
}
|
||||
|
||||
public void setNodeitems(List nodeitems) {
|
||||
this.nodeitems = nodeitems;
|
||||
}
|
||||
|
||||
public List<AutopilotGuardianItemsName> getTopicitems() {
|
||||
return topicitems;
|
||||
}
|
||||
|
||||
public void setTopicitems(List<AutopilotGuardianItemsName> topicitems) {
|
||||
this.topicitems = topicitems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Subnode{" +
|
||||
"nodename='" + nodename + '\'' +
|
||||
", nodeitems=" + nodeitems +
|
||||
", topicitems=" + topicitems +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GuardianSubmodule{" +
|
||||
"modulename='" + modulename + '\'' +
|
||||
", subnodes=" + subnodes +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des 硬件状态
|
||||
* @date 2021/7/26
|
||||
*/
|
||||
public class AutopilotHardwareState {
|
||||
/**
|
||||
* 0不正常
|
||||
*/
|
||||
@SerializedName("run_hz")
|
||||
private String runHz;
|
||||
@SerializedName("set_hz")
|
||||
private String setHz;
|
||||
@SerializedName("topic_name")
|
||||
private String topicName;
|
||||
|
||||
public String getRunHz() {
|
||||
return runHz;
|
||||
}
|
||||
|
||||
public String getSetHz() {
|
||||
return setHz;
|
||||
}
|
||||
|
||||
public String getTopicName() {
|
||||
return topicName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotHardwareState{" +
|
||||
"runHz='" + runHz + '\'' +
|
||||
", setHz='" + setHz + '\'' +
|
||||
", topicName='" + topicName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des 内存状态
|
||||
* @date 2021/8/11
|
||||
*/
|
||||
public class AutopilotMemState {
|
||||
//空闲内存(M)
|
||||
@SerializedName("free")
|
||||
private String free;
|
||||
//内存使用百分比
|
||||
@SerializedName("percent_mem")
|
||||
private String percentMem;
|
||||
//总内存(M)
|
||||
@SerializedName("total_mem")
|
||||
private String totalMem;
|
||||
//使用的内存(M)
|
||||
@SerializedName("used_mem")
|
||||
private String usedMem;
|
||||
|
||||
public String getFree() {
|
||||
return free;
|
||||
}
|
||||
|
||||
public String getPercentMem() {
|
||||
return percentMem;
|
||||
}
|
||||
|
||||
public String getTotalMem() {
|
||||
return totalMem;
|
||||
}
|
||||
|
||||
public String getUsedMem() {
|
||||
return usedMem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotMemState{" +
|
||||
"free='" + free + '\'' +
|
||||
", percentMem='" + percentMem + '\'' +
|
||||
", totalMem='" + totalMem + '\'' +
|
||||
", usedMem='" + usedMem + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des 占用内存的程序
|
||||
* @date 2021/8/16
|
||||
*/
|
||||
public class AutopilotNetFlowState {
|
||||
@SerializedName("netname")
|
||||
private String netName;
|
||||
@SerializedName("recv_flow")
|
||||
private String recvFlow;
|
||||
@SerializedName("send_flow")
|
||||
private String sendFlow;
|
||||
|
||||
public String getNetName() {
|
||||
return netName;
|
||||
}
|
||||
|
||||
public String getRecvFlow() {
|
||||
return recvFlow;
|
||||
}
|
||||
|
||||
public String getSendFlow() {
|
||||
return sendFlow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotNetFlowState{" +
|
||||
"netName='" + netName + '\'' +
|
||||
", recvFlow='" + recvFlow + '\'' +
|
||||
", sendFlow='" + sendFlow + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des 工控机节点状态
|
||||
* @date 2021/7/7
|
||||
*/
|
||||
public class AutopilotNodeState {
|
||||
/**
|
||||
* -on-开启, off-关闭
|
||||
*/
|
||||
@SerializedName("node_name")
|
||||
private String nodeName;
|
||||
@SerializedName("node_state")
|
||||
private String nodeState;
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public String getNodeState() {
|
||||
return nodeState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotNodeState{" +
|
||||
"nodeName='" + nodeName + '\'' +
|
||||
", nodeState='" + nodeState + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des 占用内存的程序
|
||||
* @date 2021/8/16
|
||||
*/
|
||||
public class AutopilotProgramState {
|
||||
//cpu
|
||||
@SerializedName("cpu_percent")
|
||||
private String cpuPercent;
|
||||
//内存
|
||||
@SerializedName("mem_percent")
|
||||
private String memPercent;
|
||||
//name
|
||||
@SerializedName("prog_name")
|
||||
private String progName;
|
||||
|
||||
public String getCpuPercent() {
|
||||
return cpuPercent;
|
||||
}
|
||||
|
||||
public String getMemPercent() {
|
||||
return memPercent;
|
||||
}
|
||||
|
||||
public String getProgName() {
|
||||
return progName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotProgramState{" +
|
||||
"cpuPercent='" + cpuPercent + '\'' +
|
||||
", memPercent='" + memPercent + '\'' +
|
||||
", progName='" + progName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.mogo.eagle.core.data.autopilot.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des topic info
|
||||
* @date 2021/8/16
|
||||
*/
|
||||
public class AutopilotTopicState {
|
||||
|
||||
@SerializedName("run_hz")
|
||||
private String runHz;
|
||||
@SerializedName("set_hz")
|
||||
private String setHz;
|
||||
@SerializedName("topic_name")
|
||||
private String topicName;
|
||||
|
||||
public String getRunHz() {
|
||||
return runHz;
|
||||
}
|
||||
|
||||
public String getSetHz() {
|
||||
return setHz;
|
||||
}
|
||||
|
||||
public String getTopicName() {
|
||||
return topicName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotTopicState{" +
|
||||
"runHz='" + runHz + '\'' +
|
||||
", setHz='" + setHz + '\'' +
|
||||
", topicName='" + topicName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,48 @@ package com.mogo.eagle.core.data.config
|
||||
* 功能构建配置文件,根据 APP 中build.gradle productFlavors 配置的不同将直接影响加载的功能的不同
|
||||
*/
|
||||
object FunctionBuildConfig {
|
||||
|
||||
/**
|
||||
* 自车位置使用哪种外部数据源,0-Android系统,1-工控机,2-OBU
|
||||
* 是否是演示(美化)模式,会存在SP中,方便做现场恢复
|
||||
* 1.当点击【开始服务(taxi)/滑动出发(bus)】btn后,不管实际自动驾驶按钮「state值」如何变更,自动驾驶按钮都呈现2的状态。
|
||||
* 只是自动驾驶按钮的样式为2-被选中的状态
|
||||
* 若点击,则可继续向自动驾驶系统发送启动自动驾驶的命令。
|
||||
* 2.车前引导线一直呈现,含人工接管过程中。
|
||||
*/
|
||||
@JvmField
|
||||
var isDemoMode = false
|
||||
|
||||
/**
|
||||
* 当前APP的身份模式
|
||||
* 0 = 司机模式(默认)
|
||||
* 1 = 乘客模式(部分功能受到影响)
|
||||
*/
|
||||
@JvmField
|
||||
var appIdentityMode = 0
|
||||
|
||||
/**
|
||||
* 自车位置使用哪种外部数据源
|
||||
* 0 = Android系统
|
||||
* 1 = 工控机
|
||||
* 2 = OBU
|
||||
*/
|
||||
@JvmField
|
||||
var gpsProvider = 0
|
||||
|
||||
/**
|
||||
* 地图是否绘制Adas识别回调的Marker
|
||||
* true - 绘制
|
||||
* false - 不绘制
|
||||
*/
|
||||
@JvmField
|
||||
var isDrawIdentifyData = true
|
||||
|
||||
/**
|
||||
* 地图是否忽略判断条件直接绘制工控机引导线数据&全局路径规划
|
||||
* 用于调试
|
||||
* true - 忽略
|
||||
* false - 不忽略
|
||||
*/
|
||||
@JvmField
|
||||
var isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
}
|
||||
@@ -15,4 +15,7 @@ object MoGoConfig {
|
||||
// CMD全量日志抓取
|
||||
const val CATCH_LOG = "CATCH_LOG"
|
||||
|
||||
// 是否是演示(美化)模式,会存在SP中,方便做现场恢复
|
||||
const val IS_DEMO_MODE = "IS_DEMO_MODE"
|
||||
|
||||
}
|
||||
@@ -138,13 +138,6 @@ public class MogoServicePaths {
|
||||
@Deprecated
|
||||
public static final String PATH_ACTION_APIS = "/mogoaction/api";
|
||||
|
||||
/**
|
||||
* 刷新策略控制
|
||||
*/
|
||||
@Keep
|
||||
@Deprecated
|
||||
public static final String PATH_REFRESH_STRATEGY_API = "/refreshstrategy/api";
|
||||
|
||||
/**
|
||||
* 顶部1/2屏管理
|
||||
*/
|
||||
@@ -166,13 +159,6 @@ public class MogoServicePaths {
|
||||
@Deprecated
|
||||
public static final String PATH_MARKER_SERVICE = "/mogomarker/api";
|
||||
|
||||
/**
|
||||
* 事件面板
|
||||
*/
|
||||
@Keep
|
||||
@Deprecated
|
||||
public static final String PATH_EVENT_PANEL = "/event/panel";
|
||||
|
||||
/**
|
||||
* 位置上报
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
* @date 2021/8/17 8:41 下午
|
||||
* 交通元素数据,
|
||||
*/
|
||||
class TrafficData {
|
||||
class /**/TrafficData {
|
||||
/**
|
||||
* 交通元素类型, 车、人、摩托、大巴车、卡车、自行车
|
||||
*/
|
||||
|
||||
@@ -77,4 +77,14 @@ public interface IMoGoAutopilotProvider extends IMoGoFunctionServerProvider {
|
||||
* 重启
|
||||
*/
|
||||
void setIPCReboot();
|
||||
|
||||
/**
|
||||
* 工控机升级确认
|
||||
*/
|
||||
void setIPCUpgradeAffirm();
|
||||
|
||||
/**
|
||||
* 工控机升级取消
|
||||
*/
|
||||
void setIPCUpgradeCancel();
|
||||
}
|
||||
|
||||
@@ -34,6 +34,11 @@ interface IMoGoWaringProvider {
|
||||
*/
|
||||
fun setToolsViewVisibility(visibility: Int)
|
||||
|
||||
/**
|
||||
* 控制转向灯和刹车功能
|
||||
*/
|
||||
fun setTurnLightFunction(isOpen: Boolean)
|
||||
|
||||
/**
|
||||
* 开关DebugView
|
||||
*/
|
||||
@@ -47,13 +52,7 @@ interface IMoGoWaringProvider {
|
||||
* @param ttsContent tts语音播报消息
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
fun showWarningV2X(
|
||||
v2xType: Int,
|
||||
alertContent: String?,
|
||||
ttsContent: String?,
|
||||
tag: String?,
|
||||
listenerIMoGo: IMoGoWarningStatusListener?
|
||||
)
|
||||
fun showWarningV2X(v2xType: Int, alertContent: String?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long)
|
||||
|
||||
/**
|
||||
* 关闭指定floatTag 的 VR下V2X预警弹窗
|
||||
@@ -165,17 +164,15 @@ interface IMoGoWaringProvider {
|
||||
fun showBrakeLight(brakeLight: Int)
|
||||
|
||||
/**
|
||||
* 展示工控机下载状态信息
|
||||
* 展示工控机下载、升级状态信息
|
||||
* @param upgradeMode 升级模式(提示升级、静默升级)
|
||||
* @param downloadStatus 下载状态
|
||||
* @param currentProgress 当前已经下载包体大小
|
||||
* @param totalProgress 下载包体总大小
|
||||
* @param downloadVersion 下载版本
|
||||
* @param downloadStatus 下载状态(0:下载完成;1:正在下载;2:下载失败)
|
||||
* @param downloadProgress 下载进度
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun showAdDownloadStatus(downloadVersion : String,downloadStatus : Int,downloadProgress : Int)
|
||||
|
||||
/**
|
||||
* 展示工控机升级状态信息
|
||||
* @param upgradeStatus 升级状态(true代表升级成功、false代表升级不成功)
|
||||
*/
|
||||
fun showAdUpgradeStatus(upgradeStatus : Boolean)
|
||||
fun showAdUpgradeStatus(upgradeMode : Int,downloadStatus : Int,currentProgress : Int,totalProgress : Int
|
||||
,downloadVersion : String,upgradeStatus : Int)
|
||||
|
||||
}
|
||||
@@ -86,4 +86,19 @@ object CallerAutoPilotManager {
|
||||
fun setIPCReboot() {
|
||||
providerApi?.setIPCReboot()
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置工控机升级确认
|
||||
*/
|
||||
fun setIPCUpgradeAffirm(){
|
||||
providerApi?.setIPCUpgradeAffirm()
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置工控机升级取消
|
||||
*/
|
||||
fun setIPCUpgradeCancel(){
|
||||
providerApi?.setIPCUpgradeCancel()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,7 +41,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加监听
|
||||
* 添加 ADAS状态 监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import android.util.Log
|
||||
import androidx.annotation.Nullable
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
|
||||
@@ -22,7 +21,7 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() {
|
||||
|
||||
|
||||
/**
|
||||
* 添加监听
|
||||
* 添加 ADAS车辆状态&定位 监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ object CallerAutopilotIdentifyListenerManager : CallerBase() {
|
||||
ConcurrentHashMap()
|
||||
|
||||
/**
|
||||
* 添加监听
|
||||
* 添加 域控制器感知数据 监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
|
||||
@@ -52,6 +52,13 @@ object CallerHmiManager : CallerBase() {
|
||||
waringProviderApi.setToolsViewVisibility(visibility)
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制转向灯和刹车功能
|
||||
*/
|
||||
fun setTurnLightFunction(isOpen: Boolean) {
|
||||
waringProviderApi.setTurnLightFunction(isOpen)
|
||||
}
|
||||
|
||||
/**
|
||||
* 开关DebugView
|
||||
*/
|
||||
@@ -67,14 +74,8 @@ object CallerHmiManager : CallerBase() {
|
||||
* @param ttsContent tts语音播报消息
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
fun showWarningV2X(
|
||||
v2xType: Int,
|
||||
alertContent: String?,
|
||||
ttsContent: String?,
|
||||
tag: String?,
|
||||
listenerIMoGo: IMoGoWarningStatusListener?
|
||||
) {
|
||||
waringProviderApi.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo)
|
||||
fun showWarningV2X(v2xType: Int, alertContent: String?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long = 5000L) {
|
||||
waringProviderApi.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo, playTts, expireTime)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,21 +236,17 @@ object CallerHmiManager : CallerBase() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示工控机下载状态信息
|
||||
* 展示工控机下载、升级状态信息
|
||||
* @param upgradeMode 升级模式(提示升级、静默升级)
|
||||
* @param downloadStatus 下载状态
|
||||
* @param currentProgress 当前已经下载包体大小
|
||||
* @param totalProgress 下载包体总大小
|
||||
* @param downloadVersion 下载版本
|
||||
* @param downloadStatus 下载状态(0:下载完成;1:正在下载;2:下载失败)
|
||||
* @param downloadProgress 下载进度
|
||||
* @param upgradeStatus 升级状态
|
||||
*/
|
||||
fun showAdDownloadStatus(downloadVersion : String,downloadStatus : Int,downloadProgress : Int){
|
||||
waringProviderApi.showAdDownloadStatus(downloadVersion,downloadStatus,downloadProgress)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示工控机升级状态信息
|
||||
* @param upgradeStatus 升级状态(true代表升级成功、false代表升级不成功)
|
||||
*/
|
||||
fun showAdUpgradeStatus(upgradeStatus : Boolean){
|
||||
waringProviderApi.showAdUpgradeStatus(upgradeStatus)
|
||||
fun showAdUpgradeStatus(upgradeMode : Int, downloadStatus : Int,currentProgress : Int,totalProgress : Int
|
||||
,downloadVersion : String,upgradeStatus : Int){
|
||||
waringProviderApi.showAdUpgradeStatus(upgradeMode,downloadStatus, currentProgress, totalProgress, downloadVersion, upgradeStatus)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/11/18
|
||||
*
|
||||
* 将HOST转换为HttpDNS的ip
|
||||
*/
|
||||
interface HttpDns {
|
||||
|
||||
List< InetAddress > lookup( String hostname ) throws UnknownHostException;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
import com.mogo.cloud.network.RetrofitFactory;
|
||||
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public final class MoGoRetrofitFactory {
|
||||
|
||||
private MoGoRetrofitFactory() {
|
||||
}
|
||||
|
||||
public static synchronized Retrofit getInstance(String baseUrl) {
|
||||
return RetrofitFactory.INSTANCE.getInstance(baseUrl);
|
||||
}
|
||||
|
||||
public static synchronized Retrofit getInstanceNoCallAdapter(String baseUrl) {
|
||||
return RetrofitFactory.INSTANCE.getInstanceNoCallAdapter(baseUrl);
|
||||
}
|
||||
}
|
||||
@@ -49,8 +49,6 @@ public final class NetConfig {
|
||||
|
||||
private SSLContext sslContext;
|
||||
|
||||
private HttpDns httpDns;
|
||||
|
||||
private NetConfig() {
|
||||
}
|
||||
|
||||
@@ -90,14 +88,6 @@ public final class NetConfig {
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized HostnameVerifier getHostnameVerifier() {
|
||||
return hostnameVerifier;
|
||||
}
|
||||
|
||||
public synchronized NetConfig setHostnameVerifier( HostnameVerifier hostnameVerifier ) {
|
||||
this.hostnameVerifier = hostnameVerifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized NetConfig setSignaturePrefix( String prefix ) {
|
||||
this.signaturePrefix = prefix;
|
||||
@@ -108,24 +98,6 @@ public final class NetConfig {
|
||||
return signaturePrefix;
|
||||
}
|
||||
|
||||
public synchronized Set< Interceptor > getInterceptors() {
|
||||
return interceptors;
|
||||
}
|
||||
|
||||
public synchronized NetConfig addInterceptor( Interceptor interceptor ) {
|
||||
interceptors.add( interceptor );
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized Set< Interceptor > getNetworkInterceptors() {
|
||||
return networkInterceptors;
|
||||
}
|
||||
|
||||
public synchronized NetConfig addNetworkInterceptor( Interceptor networkInterceptor ) {
|
||||
networkInterceptors.add( networkInterceptor );
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized NetConfig setPublicParams( Map< String, Object > publicParams ) {
|
||||
this.publicParams = publicParams;
|
||||
return this;
|
||||
@@ -172,12 +144,4 @@ public final class NetConfig {
|
||||
this.sslContext = sslContext;
|
||||
}
|
||||
|
||||
public HttpDns getHttpDns() {
|
||||
return httpDns;
|
||||
}
|
||||
|
||||
public NetConfig setHttpDns( HttpDns httpDns ) {
|
||||
this.httpDns = httpDns;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.eagle.core.network;
|
||||
|
||||
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public final class RetrofitFactory {
|
||||
|
||||
private RetrofitFactory() {
|
||||
}
|
||||
|
||||
public static synchronized Retrofit getInstance(String baseUrl) {
|
||||
return com.mogo.cloud.network.RetrofitFactory.INSTANCE.getInstance(baseUrl);
|
||||
}
|
||||
|
||||
public static synchronized Retrofit getInstanceNoCallAdapter(String baseUrl) {
|
||||
return com.mogo.cloud.network.RetrofitFactory.INSTANCE.getInstanceNoCallAdapter(baseUrl);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user