完成HMI弹窗功能
1
.idea/misc.xml
generated
@@ -15,6 +15,7 @@
|
||||
<entry key="modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml" value="0.2953125" />
|
||||
<entry key="modules/mogo-module-hmi/src/main/res/drawable/bg_waring_traffic_light_vr.xml" value="0.3359375" />
|
||||
<entry key="modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml" value="0.3104166666666667" />
|
||||
<entry key="modules/mogo-module-hmi/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.28177083333333336" />
|
||||
<entry key="modules/mogo-module-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="1.0" />
|
||||
<entry key="modules/mogo-module-left-panel/src/main/res/layout/module_left_panel_simple_speed.xml" value="0.202734375" />
|
||||
<entry key="modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml" value="0.25" />
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mogo.module.common.enum
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-1514:47
|
||||
* desc : 车机启动状态
|
||||
* version: 1.0
|
||||
*/
|
||||
interface WarningTypeEnum {
|
||||
|
||||
companion object {
|
||||
const val WARNING_PRIOR_COLLISION = 20001//前向碰撞
|
||||
const val WARNING_INTERSECTION_COLLISION = 20002//交叉路口碰撞
|
||||
const val WARNING_LEFT_AUXILIARY = 20003//左转辅助
|
||||
const val WARNING_BLIND_AREA_COLLISION = 20004//盲区/变道辅助
|
||||
const val WARNING_REVERSE_OVERTAKING = 20005//逆向超车
|
||||
const val WARNING_VEHICLE_BRAKES = 20006//紧急制动-前车急刹
|
||||
const val WARNING_ABNORMAL_VEHICLE = 20007//异常车辆提醒
|
||||
const val WARNING_VEHICLE_CONTROL = 20008//车辆失控预警
|
||||
const val WARNING_SPECIAL_VEHICLE_ACCESS = 20009//特种车辆通行
|
||||
const val WARNING_SPEED_LIMIT = 20010//限速预警
|
||||
const val WARNING_RED_LIGHT = 20011//闯红灯预警
|
||||
const val warning_congestion = 20012//前方道路拥堵
|
||||
const val WARNING_TRAFFIC_SPEED_GUIDE = 20013//绿波通行车速引导
|
||||
const val WARNING_CAR_PLATE = 20014//车内标牌
|
||||
|
||||
const val WARNING_VULNERABLE_TRANSPORT_PARTICIPANT = 20015//弱势交通参与者预警
|
||||
|
||||
|
||||
const val WARNING_ROAD_HAZARDS = 20016//道路危险情况预警
|
||||
|
||||
const val WARNING_OVER_SPEED = 20017//超速预警
|
||||
const val WARNING_ROUNDABOUT = 20019//环岛
|
||||
const val WARNING_GIVE_WAY = 20020//减速让行
|
||||
const val WARNING_BAN_ASTERN = 20021//禁止倒车
|
||||
const val WARNING_TURN_LEFT_SHARP = 20022//左转急弯
|
||||
const val WARNING_TURN_RIGHT_SHARP = 20023//左转急弯
|
||||
const val WARNING_TRAMCAR = 20024//有轨电车
|
||||
const val WARNING_TEST_SECTION = 20025//考试路段
|
||||
const val WARNING_ACCIDENT_PRONE_ROAD_SECTION = 20026//事故易发路段
|
||||
const val WARNING_HUMP_BRIDGE = 20027//驼峰桥
|
||||
const val WARNING_SCHOOL = 20028// 学校
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,9 @@ package com.mogo.module.hmi;
|
||||
public class WaringConst {
|
||||
public static String MODULE_NAME = "MODULE_LEFT_PANEL";
|
||||
|
||||
public static String BROADCAST_TEST_CONTROL_TYPE_EXTRA_KEY = "warningType";
|
||||
public static String BROADCAST_V2X_TYPE_EXTRA_KEY = "v2xType";
|
||||
public static String BROADCAST_V2X_ALERT_CONTENT_EXTRA_KEY = "alertContent";
|
||||
public static String BROADCAST_V2X_TTS_CONTENT_EXTRA_KEY = "ttsContent";
|
||||
public static String BROADCAST_V2X_TAG_EXTRA_KEY = "tag";
|
||||
|
||||
}
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
package com.mogo.module.hmi.enums
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-1514:47
|
||||
* desc : 车机启动状态
|
||||
* version: 1.0
|
||||
*/
|
||||
interface WarningTypeEnum {
|
||||
companion object {
|
||||
/**
|
||||
* 前向碰撞
|
||||
*/
|
||||
const val WARING_TYPE_PRIOR_COLLISION = 20001
|
||||
|
||||
/**
|
||||
* 交叉路口碰撞
|
||||
*/
|
||||
const val WARING_TYPE_INTERSECTION_COLLISION = 20002
|
||||
|
||||
/**
|
||||
* 左转辅助
|
||||
*/
|
||||
const val WARING_TYPE_LEFT_AUXILIARY = 20003
|
||||
|
||||
/**
|
||||
* 盲区/变道辅助
|
||||
*/
|
||||
const val WARING_TYPE_BLIND_AREA_COLLISION = 20004
|
||||
|
||||
/**
|
||||
* 逆向超车
|
||||
*/
|
||||
const val WARING_TYPE_REVERSE_OVERTAKING = 20005
|
||||
|
||||
/**
|
||||
* 紧急制动-前车急刹
|
||||
*/
|
||||
const val WARING_TYPE_VEHICLE_BRAKES = 20006
|
||||
|
||||
/**
|
||||
* 异常车辆提醒
|
||||
*/
|
||||
const val WARING_TYPE_ABNORMAL_VEHICLE = 20007
|
||||
|
||||
/**
|
||||
* 车辆失控预警
|
||||
*/
|
||||
const val WARING_TYPE_VEHICLE_CONTROL = 20008
|
||||
|
||||
/**
|
||||
* 道路危险情况预警
|
||||
*/
|
||||
const val WARING_TYPE_ROAD_HAZARDS = 20009
|
||||
|
||||
/**
|
||||
* 限速预警
|
||||
*/
|
||||
const val WARING_TYPE_SPEED_LIMIT = 20010
|
||||
|
||||
/**
|
||||
* 闯红灯预警
|
||||
*/
|
||||
const val WARING_TYPE_RED_LIGHT = 20011
|
||||
|
||||
/**
|
||||
* 弱势交通参与者预警
|
||||
*/
|
||||
const val WARING_TYPE_VULNERABLE_TRANSPORT_PARTICIPANT = 20012
|
||||
|
||||
/**
|
||||
* 绿波通行车速引导
|
||||
*/
|
||||
const val WARING_TYPE_TRAFFIC_SPEED_GUIDE = 20013
|
||||
|
||||
/**
|
||||
* 车内标牌
|
||||
*/
|
||||
const val WARING_TYPE_CAR_PLATE = 20014
|
||||
|
||||
/**
|
||||
* 前方道路拥堵
|
||||
*/
|
||||
const val WARING_TYPE_TRAFFIC_JAM_AHEAD = 20015
|
||||
|
||||
/**
|
||||
* 特种车辆通行
|
||||
*/
|
||||
const val WARING_TYPE_SPECIAL_VEHICLE_ACCESS = 20016
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,11 @@ class WarningFloat {
|
||||
*/
|
||||
fun setSidePattern(sidePattern: SidePattern) = apply { config.sidePattern = sidePattern }
|
||||
|
||||
/**
|
||||
* 设置倒计时关闭
|
||||
* @param countDownTime 倒计时时间
|
||||
*/
|
||||
fun setCountDownTime(countDownTime: Long) = apply { config.countDownTime = countDownTime }
|
||||
|
||||
/**
|
||||
* 设置浮窗的布局文件,以及布局的操作接口
|
||||
|
||||
@@ -34,13 +34,15 @@ internal class WarningFloatWindowHelper(
|
||||
var frameLayout: ParentFrameLayout? = null
|
||||
private var enterAnimator: Animator? = null
|
||||
|
||||
fun createWindow() {
|
||||
if (context is Activity) {
|
||||
fun createWindow(): Boolean {
|
||||
return if (context is Activity) {
|
||||
initParams()
|
||||
addView()
|
||||
config.isShow = true
|
||||
true
|
||||
} else {
|
||||
Logger.e(TAG, "activity 必须是 Activity 的实现")
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,6 +176,13 @@ internal class WarningFloatWindowHelper(
|
||||
exitAnim()
|
||||
false
|
||||
}
|
||||
|
||||
// 设置倒计时指定秒数后自动关闭Window
|
||||
if (config.countDownTime > 0) {
|
||||
frameLayout?.postDelayed({
|
||||
exitAnim()
|
||||
}, config.countDownTime)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.module.hmi.notification
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
@@ -9,18 +8,30 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
* @date 2021/8/5 5:17 下午
|
||||
*/
|
||||
internal object WarningFloatWindowManager {
|
||||
private val TAG: String = "WarningFloatWindowManager"
|
||||
private const val DEFAULT_TAG = "default"
|
||||
|
||||
val windowMap = ConcurrentHashMap<String, View>()
|
||||
private val windowMap = ConcurrentHashMap<String, WarningFloatWindowHelper>()
|
||||
|
||||
fun create(activity: Context, config: WarningNotificationConfig) {
|
||||
WarningFloatWindowHelper(activity, config).createWindow()
|
||||
/**
|
||||
* 创建浮窗,tag不存在创建,tag存在创建失败
|
||||
* 创建结果通过tag添加到相应的map进行管理
|
||||
*/
|
||||
fun create(context: Context, config: WarningNotificationConfig) {
|
||||
if (!checkTag(config)) {
|
||||
val helper = WarningFloatWindowHelper(context, config)
|
||||
if (helper.createWindow()) windowMap[config.floatTag!!] = helper
|
||||
} else {
|
||||
// 存在相同的tag,直接创建失败
|
||||
config.callbacks?.createdResult(false, "存在相同的tag,直接创建失败", null)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun dismiss(tag: String? = null, force: Boolean) {
|
||||
|
||||
}
|
||||
/**
|
||||
* 关闭浮窗,执行浮窗的退出动画
|
||||
*/
|
||||
fun dismiss(tag: String? = null, force: Boolean = false) =
|
||||
getHelper(tag)?.run { if (force) remove(force) else exitAnim() }
|
||||
|
||||
/**
|
||||
* 移除当条浮窗信息,在退出完成后调用
|
||||
@@ -32,6 +43,15 @@ internal object WarningFloatWindowManager {
|
||||
*/
|
||||
private fun getTag(tag: String?) = tag ?: DEFAULT_TAG
|
||||
|
||||
/**
|
||||
* 检测浮窗的tag是否有效,不同的浮窗必须设置不同的tag
|
||||
*/
|
||||
private fun checkTag(config: WarningNotificationConfig): Boolean {
|
||||
// 如果未设置tag,设置默认tag
|
||||
config.floatTag = getTag(config.floatTag)
|
||||
return windowMap.containsKey(config.floatTag!!)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取具体的系统浮窗管理类
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,9 @@ data class WarningNotificationConfig(
|
||||
// 浮窗显示类型(默认只在当前页显示)
|
||||
var showPattern: ShowPattern = ShowPattern.CURRENT_ACTIVITY,
|
||||
|
||||
// 倒计时关闭window,-1 表示不自动关闭, 单位毫秒。1s = 1000ms
|
||||
var countDownTime: Long = 0,
|
||||
|
||||
// 浮窗的摆放方式,使用系统的Gravity属性
|
||||
var gravity: Int = 0,
|
||||
// 坐标的偏移量
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.module.hmi.WaringConst
|
||||
import com.mogo.module.hmi.enums.WarningTypeEnum
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.warning.IMoGoWaringProvider
|
||||
@@ -25,12 +24,15 @@ class WarningBroadcastReceiver : BroadcastReceiver() {
|
||||
.navigation(context) as IMogoServiceApis
|
||||
mIMoGoWaringProvider = mMogoServiceApis!!.waringProviderApi
|
||||
mContext = context
|
||||
val warningType =
|
||||
intent.getIntExtra(WaringConst.BROADCAST_TEST_CONTROL_TYPE_EXTRA_KEY, 0)
|
||||
Logger.d(TAG, "warningType:$warningType")
|
||||
|
||||
val v2xType =
|
||||
intent.getIntExtra(WaringConst.BROADCAST_V2X_TYPE_EXTRA_KEY, 0)
|
||||
val alertContent =
|
||||
intent.getStringExtra(WaringConst.BROADCAST_V2X_ALERT_CONTENT_EXTRA_KEY)
|
||||
val ttsContent =
|
||||
intent.getStringExtra(WaringConst.BROADCAST_V2X_TTS_CONTENT_EXTRA_KEY)
|
||||
Logger.d(TAG, "v2xType:$v2xType alertContent:$alertContent ttsContent:$ttsContent")
|
||||
// 分发场景
|
||||
dispatchWaring(warningType)
|
||||
dispatchWaring(v2xType, alertContent, ttsContent, Random.nextDouble().toString())
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
@@ -39,44 +41,24 @@ class WarningBroadcastReceiver : BroadcastReceiver() {
|
||||
/**
|
||||
* 分发处理场景
|
||||
*
|
||||
* @param warningType 场景类型
|
||||
* @param v2xType V2X类型
|
||||
* @param alertContent 提醒文本
|
||||
* @param ttsContent tts语音播报消息
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
private fun dispatchWaring(warningType: Int) {
|
||||
mIMoGoWaringProvider!!.showWarningV2X(warningType, "预警消息", Random.nextDouble().toString())
|
||||
when (warningType) {
|
||||
WarningTypeEnum.WARING_TYPE_PRIOR_COLLISION -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_INTERSECTION_COLLISION -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_LEFT_AUXILIARY -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_BLIND_AREA_COLLISION -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_REVERSE_OVERTAKING -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_VEHICLE_BRAKES -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_ABNORMAL_VEHICLE -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_VEHICLE_CONTROL -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_ROAD_HAZARDS -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_SPEED_LIMIT -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_RED_LIGHT -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_VULNERABLE_TRANSPORT_PARTICIPANT -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_TRAFFIC_SPEED_GUIDE -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_CAR_PLATE -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_TRAFFIC_JAM_AHEAD -> {
|
||||
}
|
||||
WarningTypeEnum.WARING_TYPE_SPECIAL_VEHICLE_ACCESS -> {
|
||||
}
|
||||
}
|
||||
private fun dispatchWaring(
|
||||
v2xType: Int,
|
||||
alertContent: String?,
|
||||
ttsContent: String?,
|
||||
tag: String?
|
||||
) {
|
||||
mIMoGoWaringProvider!!.showWarningV2X(
|
||||
v2xType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
tag
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -19,9 +19,16 @@ interface MoGoWarningContract {
|
||||
* 展示VR下V2X预警
|
||||
*
|
||||
* @param v2xType V2X类型
|
||||
* @param alertMessage 提醒文本
|
||||
* @param alertContent 提醒文本
|
||||
* @param ttsContent tts语音播报消息
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
fun showWarningV2X(v2xType: Int, alertMessage: String, tag: String)
|
||||
fun showWarningV2X(
|
||||
v2xType: Int,
|
||||
alertContent: String? = null,
|
||||
ttsContent: String? = null,
|
||||
tag: String? = null
|
||||
)
|
||||
|
||||
/**
|
||||
* 关闭指定floatTag 的 VR下V2X预警弹窗
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.mogo.module.hmi.R
|
||||
import com.mogo.module.hmi.notification.WarningFloat
|
||||
import com.mogo.module.hmi.notification.anim.DefaultAnimator
|
||||
import com.mogo.module.hmi.notification.enums.SidePattern
|
||||
import com.mogo.module.hmi.ui.widget.ViewV2XNotification
|
||||
import com.mogo.module.hmi.utils.WarningUtils
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -29,13 +31,36 @@ class MoGoWarningFragment : MvpFragment<MoGoWarningContract.View?, WaringPresent
|
||||
return WaringPresenter(this)
|
||||
}
|
||||
|
||||
override fun showWarningV2X(v2xType: Int, alertMessage: String, tag: String) {
|
||||
/**
|
||||
* 展示VR下V2X预警
|
||||
*
|
||||
* @param v2xType V2X类型
|
||||
* @param alertContent 提醒文本
|
||||
* @param ttsContent tts语音播报消息
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
override fun showWarningV2X(
|
||||
v2xType: Int,
|
||||
alertContent: String?,
|
||||
ttsContent: String?,
|
||||
tag: String?
|
||||
) {
|
||||
|
||||
activity?.let {
|
||||
|
||||
val notificationView = ViewV2XNotification(activity)
|
||||
notificationView.setWarningIcon(WarningUtils.getWarningIcon(v2xType)[0] as Int)
|
||||
if (alertContent != null) {
|
||||
notificationView.setWarningContent(alertContent)
|
||||
}else{
|
||||
notificationView.setWarningContent(WarningUtils.getWarningIcon(v2xType)[1] as String)
|
||||
}
|
||||
|
||||
WarningFloat.with(it)
|
||||
.setTag(tag)
|
||||
.setLayout(R.layout.notification_v2x_msg_vr)
|
||||
.setLayout(notificationView)
|
||||
.setSidePattern(SidePattern.TOP)
|
||||
.setCountDownTime(20000)
|
||||
.setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110)
|
||||
.setAnimator(object : DefaultAnimator() {
|
||||
override fun enterAnim(
|
||||
|
||||
@@ -11,7 +11,7 @@ class WaringPresenter(view: MoGoWarningContract.View?) :
|
||||
|
||||
|
||||
fun showWarningV2X(v2xType: Int, alertMessage: String, tag: String) {
|
||||
mView?.showWarningV2X(v2xType, alertMessage, tag)
|
||||
|
||||
}
|
||||
|
||||
fun disableWarningV2X(tag: String) {
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.mogo.module.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.Nullable
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.module.hmi.R
|
||||
import kotlinx.android.synthetic.main.notification_v2x_msg_vr.view.*
|
||||
|
||||
/**
|
||||
*@author xiaoyuzhou
|
||||
*@date 2021/8/6 12:25 下午
|
||||
*/
|
||||
class ViewV2XNotification @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.notification_v2x_msg_vr, this, true)
|
||||
}
|
||||
|
||||
fun setWarningIcon(@DrawableRes warningIcon: Int) {
|
||||
ivWaringIcon.setImageResource(warningIcon)
|
||||
}
|
||||
|
||||
fun setWarningIcon(@Nullable drawable: Drawable) {
|
||||
ivWaringIcon.setImageDrawable(drawable)
|
||||
}
|
||||
|
||||
fun setWarningContent(@Nullable warningContent: String) {
|
||||
tvWaringContent.text = warningContent
|
||||
}
|
||||
|
||||
fun setWarningContent(@StringRes warningContentId: Int) {
|
||||
tvWaringContent.setText(warningContentId)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.mogo.module.hmi.utils
|
||||
|
||||
import com.mogo.module.common.enum.WarningTypeEnum
|
||||
import com.mogo.module.hmi.R
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/8/6 11:04 上午
|
||||
*/
|
||||
internal object WarningUtils {
|
||||
fun getWarningIcon(v2xType: Int): Array<Any> {
|
||||
var warningIconId = R.drawable.icon_warning_v2x_abnormal_vehicle
|
||||
var warningContent = "注意周边环境"
|
||||
var warningTts = "注意周边环境"
|
||||
|
||||
when (v2xType) {
|
||||
WarningTypeEnum.WARNING_PRIOR_COLLISION -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_collision_warning
|
||||
warningContent = "前车碰撞预警"
|
||||
warningTts = "前车碰撞预警"
|
||||
}//前向碰撞
|
||||
WarningTypeEnum.WARNING_INTERSECTION_COLLISION -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_collision_warning
|
||||
warningContent = "注意交叉路口车辆"
|
||||
warningTts = "注意交叉路口车辆"
|
||||
}//交叉路口碰撞
|
||||
WarningTypeEnum.WARNING_LEFT_AUXILIARY -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_collision_warning
|
||||
warningContent = "注意左前车辆"
|
||||
warningTts = "注意左前车辆"
|
||||
}//左转辅助
|
||||
WarningTypeEnum.WARNING_BLIND_AREA_COLLISION -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_blind_area_collision
|
||||
warningContent = "注意后方来车"
|
||||
warningTts = "注意后方来车"
|
||||
}//盲区/变道辅助
|
||||
WarningTypeEnum.WARNING_REVERSE_OVERTAKING -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_blind_area_collision
|
||||
warningContent = "注意逆向车道车辆"
|
||||
warningTts = "注意逆向车道车辆"
|
||||
}//逆向超车
|
||||
WarningTypeEnum.WARNING_VEHICLE_BRAKES -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_emergency_brake
|
||||
warningContent = "前车急刹车"
|
||||
warningTts = "前车急刹车"
|
||||
}//紧急制动-前车急刹
|
||||
WarningTypeEnum.WARNING_ABNORMAL_VEHICLE -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_abnormal_vehicle
|
||||
warningContent = "前车异常"
|
||||
warningTts = "前车异常"
|
||||
}//异常车辆提醒
|
||||
WarningTypeEnum.WARNING_VEHICLE_CONTROL -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_vehicle_control
|
||||
warningContent = "前车失控预警"
|
||||
warningTts = "前车失控预警"
|
||||
}//车辆失控预警
|
||||
WarningTypeEnum.WARNING_SPECIAL_VEHICLE_ACCESS -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_special_vehicle_access
|
||||
warningContent = "请避让特种车辆"
|
||||
warningTts = "后方存在特殊车辆,请安排避让"
|
||||
}//特种车辆通行
|
||||
WarningTypeEnum.WARNING_SPEED_LIMIT -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_traffic_lights_red
|
||||
warningContent = "路口红灯,禁止通行"
|
||||
warningTts = "路口红灯,禁止通行"
|
||||
}//闯红灯预警
|
||||
WarningTypeEnum.WARNING_VULNERABLE_TRANSPORT_PARTICIPANT -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_pedestrian_crossing
|
||||
warningContent = "行人碰撞预警"
|
||||
warningTts = "行人碰撞预警"
|
||||
}//弱势交通参与者碰撞预警
|
||||
WarningTypeEnum.WARNING_TRAFFIC_SPEED_GUIDE -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_traffic_lights_green
|
||||
warningContent = "绿波通行"
|
||||
warningTts = "绿波通行"
|
||||
}//绿波通行车速引导
|
||||
WarningTypeEnum.WARNING_CAR_PLATE -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_road_construction
|
||||
warningContent = "前方施工"
|
||||
warningTts = "前方施工"
|
||||
}//车内标牌
|
||||
WarningTypeEnum.warning_congestion -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_congestion
|
||||
warningContent = "前方道路拥堵"
|
||||
warningTts = "前方道路拥堵"
|
||||
}//前方道路拥堵
|
||||
WarningTypeEnum.WARNING_OVER_SPEED -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_over_speed
|
||||
warningContent = "您已超速"
|
||||
warningTts = "您已超速"
|
||||
}//超速预警
|
||||
WarningTypeEnum.WARNING_ROAD_HAZARDS -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_road_dangerous
|
||||
warningContent = "道路危险情况预警"
|
||||
warningTts = "道路危险情况预警"
|
||||
}//道路危险情况预警
|
||||
WarningTypeEnum.WARNING_ROUNDABOUT -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_roundaboutpng
|
||||
warningContent = "前方驶入环岛"
|
||||
warningTts = "前方驶入环岛"
|
||||
}//环岛
|
||||
WarningTypeEnum.WARNING_GIVE_WAY -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_over_speed
|
||||
warningContent = "有车出入,减速慢行"
|
||||
warningTts = "有车出入,减速慢行"
|
||||
}//减速让行
|
||||
WarningTypeEnum.WARNING_BAN_ASTERN -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_ban_astern
|
||||
warningContent = "当前路段禁止停车"
|
||||
warningTts = "当前路段禁止停车"
|
||||
}//禁止停车
|
||||
WarningTypeEnum.WARNING_TURN_LEFT_SHARP -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_turn_left_sharp
|
||||
warningContent = "前方左转急弯"
|
||||
warningTts = "前方路口左转急弯,请减速慢行"
|
||||
}//左转急弯
|
||||
WarningTypeEnum.WARNING_TURN_RIGHT_SHARP -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_turn_left_sharp
|
||||
warningContent = "前方右转急弯"
|
||||
warningTts = "前方路口右转急弯,请减速慢行"
|
||||
}//右转急弯
|
||||
WarningTypeEnum.WARNING_TRAMCAR -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_tramcar
|
||||
warningContent = "前方有轨电车提醒"
|
||||
warningTts = "前方有轨电车经过,请注意行驶安全"
|
||||
}//有轨电车
|
||||
WarningTypeEnum.WARNING_TEST_SECTION -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_test_section
|
||||
warningContent = "前方考试路段"
|
||||
warningTts = "前方考试路段,减速慢行"
|
||||
}//考试路段
|
||||
WarningTypeEnum.WARNING_ACCIDENT_PRONE_ROAD_SECTION -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_accident_prone_road_section
|
||||
warningContent = "当前路段事故多发"
|
||||
warningTts = "当前路段事故多发,请谨慎行驶"
|
||||
}//事故易发路段
|
||||
WarningTypeEnum.WARNING_HUMP_BRIDGE -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_hump_bridge
|
||||
warningContent = "前方驼峰桥"
|
||||
warningTts = "即将驶入桥梁,请减速慢行"
|
||||
}//驼峰桥
|
||||
WarningTypeEnum.WARNING_SCHOOL -> {
|
||||
warningIconId = R.drawable.icon_warning_v2x_school
|
||||
warningContent = "前方学校,减速慢行"
|
||||
warningTts = "前方人行横道,请减速慢"
|
||||
}// 学校
|
||||
}
|
||||
|
||||
return arrayOf(warningIconId, warningContent, warningTts)
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
@@ -70,13 +71,13 @@ public class MoGoWarningProvider implements IMoGoWaringProvider {
|
||||
mMoGoWarningFragment.disableLimitingVelocity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarningV2X(int v2xType, @NonNull String alertMessage, @NonNull String tag) {
|
||||
mMoGoWarningFragment.showWarningV2X(v2xType, alertMessage, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableWarningV2X(@NonNull String tag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarningV2X(int v2xType, @Nullable String alertContent, @Nullable String ttsContent, @Nullable String tag) {
|
||||
mMoGoWarningFragment.showWarningV2X(v2xType, alertContent, ttsContent, tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<gradient
|
||||
android:endColor="#1C2656"
|
||||
android:startColor="#1C2656" />
|
||||
</shape>
|
||||
@@ -1,13 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="oval">
|
||||
<gradient android:endColor="#00FF6C" android:startColor="#00CF57" />
|
||||
<size android:width="@dimen/dp_52" android:height="@dimen/dp_52" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_checked="true" android:drawable="@drawable/icon_warning_v2x_traffic_light_green" />
|
||||
|
||||
<item android:drawable="@drawable/icon_waring_traffic_light_default_vr" android:state_checked="false"/>
|
||||
<item android:drawable="@drawable/icon_warning_v2x_traffic_light_gray" android:state_checked="false"/>
|
||||
|
||||
</selector>
|
||||
@@ -1,12 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="oval">
|
||||
<gradient android:endColor="#FF0030" android:startColor="#CF2E00" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_checked="true" android:drawable="@drawable/icon_warning_v2x_traffic_light_red" />
|
||||
|
||||
<item android:drawable="@drawable/icon_waring_traffic_light_default_vr" android:state_checked="false" />
|
||||
<item android:drawable="@drawable/icon_warning_v2x_traffic_light_gray" android:state_checked="false"/>
|
||||
|
||||
</selector>
|
||||
@@ -1,13 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_checked="true">
|
||||
<item android:state_checked="true" android:drawable="@drawable/icon_warning_v2x_traffic_light_yellow" />
|
||||
|
||||
<shape android:shape="oval">
|
||||
<gradient android:endColor="#FFDB00" android:startColor="#F2A902" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:drawable="@drawable/icon_waring_traffic_light_default_vr" android:state_checked="false" />
|
||||
<item android:drawable="@drawable/icon_warning_v2x_traffic_light_gray" android:state_checked="false"/>
|
||||
|
||||
</selector>
|
||||
|
||||
@@ -13,25 +13,25 @@
|
||||
android:paddingBottom="27px">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_waring_icon"
|
||||
android:id="@+id/ivWaringIcon"
|
||||
android:layout_width="132px"
|
||||
android:layout_height="132px"
|
||||
android:src="@drawable/icon_waring_v2x_abnormal_vehicle"
|
||||
android:src="@drawable/icon_warning_v2x_abnormal_vehicle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_waring_content"
|
||||
android:id="@+id/tvWaringContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="26px"
|
||||
android:text="预警信息"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="42px"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_waring_icon"
|
||||
app:layout_constraintLeft_toRightOf="@+id/iv_waring_icon"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_waring_icon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivWaringIcon"
|
||||
app:layout_constraintLeft_toRightOf="@+id/ivWaringIcon"
|
||||
app:layout_constraintTop_toTopOf="@+id/ivWaringIcon"
|
||||
tools:text="前车碰撞预警" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -6,15 +6,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_waring_traffic_light_vr"
|
||||
android:paddingStart="38px"
|
||||
android:paddingTop="30px"
|
||||
android:paddingEnd="38px"
|
||||
android:paddingBottom="30px">
|
||||
android:paddingStart="18px"
|
||||
android:paddingTop="10px"
|
||||
android:paddingEnd="18px"
|
||||
android:paddingBottom="10px">
|
||||
|
||||
<CheckedTextView
|
||||
android:id="@+id/ctvRedTrafficLight"
|
||||
android:layout_width="70px"
|
||||
android:layout_height="70px"
|
||||
android:layout_width="110px"
|
||||
android:layout_height="110px"
|
||||
android:background="@drawable/icon_waring_traffic_light_red_vr"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
@@ -29,10 +29,8 @@
|
||||
|
||||
<CheckedTextView
|
||||
android:id="@+id/ctvYellowTrafficLight"
|
||||
android:layout_width="70px"
|
||||
android:layout_height="70px"
|
||||
android:layout_marginStart="18px"
|
||||
android:layout_marginEnd="18px"
|
||||
android:layout_width="110px"
|
||||
android:layout_height="110px"
|
||||
android:background="@drawable/icon_waring_traffic_light_yellow_vr"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
@@ -47,8 +45,8 @@
|
||||
|
||||
<CheckedTextView
|
||||
android:id="@+id/ctvGreenTrafficLight"
|
||||
android:layout_width="70px"
|
||||
android:layout_height="70px"
|
||||
android:layout_width="110px"
|
||||
android:layout_height="110px"
|
||||
android:background="@drawable/icon_waring_traffic_light_green_vr"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
|
||||
@@ -11,9 +11,16 @@ interface IMoGoWaringProvider : IMogoModuleProvider {
|
||||
* 展示VR下V2X预警
|
||||
*
|
||||
* @param v2xType V2X类型
|
||||
* @param alertMessage 提醒文本
|
||||
* @param alertContent 提醒文本
|
||||
* @param ttsContent tts语音播报消息
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
fun showWarningV2X(v2xType: Int, alertMessage: String, tag: String)
|
||||
fun showWarningV2X(
|
||||
v2xType: Int,
|
||||
alertContent: String?,
|
||||
ttsContent: String?,
|
||||
tag: String?
|
||||
)
|
||||
|
||||
/**
|
||||
* 关闭指定floatTag 的 VR下V2X预警弹窗
|
||||
|
||||