修复迈速表更新导致的ANR问题,
同样修改来了HMI中的UI更新线程为主线程 Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.hmi.ui.setting
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
@@ -23,7 +24,9 @@ import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.map.MogoMap
|
||||
import com.mogo.service.statusmanager.StatusDescriptor
|
||||
import com.mogo.utils.DeviceIdUtils
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.*
|
||||
@@ -158,7 +161,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
* OBU状态回调
|
||||
*/
|
||||
override fun onObuStatusResponse(obuStatusInfo: ObuStatusInfo) {
|
||||
tvObuInfo.post {
|
||||
UiThreadHandler.post {
|
||||
tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
|
||||
}
|
||||
}
|
||||
@@ -167,8 +170,10 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
* 自动驾驶状态回调
|
||||
*/
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
tvAutopilotInfo.post {
|
||||
tvAutopilotInfo.text = GsonUtils.toJson(autoPilotStatusInfo)
|
||||
UiThreadHandler.post {
|
||||
tvAutopilotInfo.post {
|
||||
tvAutopilotInfo.text = GsonUtils.toJson(autoPilotStatusInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.view_autopilot_status.view.*
|
||||
|
||||
/**
|
||||
@@ -20,8 +21,8 @@ import kotlinx.android.synthetic.main.view_autopilot_status.view.*
|
||||
* 自动驾驶状态按钮
|
||||
*/
|
||||
class AutoPilotStatusView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet
|
||||
context: Context,
|
||||
attrs: AttributeSet
|
||||
) : ConstraintLayout(context, attrs), View.OnClickListener, IMogoAdasOCHCallback {
|
||||
|
||||
private val TAG = "AutopilotStatusView"
|
||||
@@ -66,12 +67,15 @@ class AutoPilotStatusView @JvmOverloads constructor(
|
||||
}
|
||||
startAutoPilot();
|
||||
}
|
||||
|
||||
private fun startAutoPilot() {
|
||||
val currentAutopilot =
|
||||
AutopilotControlParameters()
|
||||
currentAutopilot.isSpeakVoice = false
|
||||
currentAutopilot.startLatLon = AutopilotControlParameters.AutoPilotLonLat(40.199157289445921,116.73675895051454);
|
||||
currentAutopilot.endLatLon = AutopilotControlParameters.AutoPilotLonLat(40.199255159538758,116.73274535677977);
|
||||
currentAutopilot.startLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(40.199157289445921, 116.73675895051454);
|
||||
currentAutopilot.endLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(40.199255159538758, 116.73274535677977);
|
||||
currentAutopilot.vehicleType = 10
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.aiCloudToAdasData(currentAutopilot)
|
||||
}
|
||||
@@ -83,22 +87,24 @@ class AutoPilotStatusView @JvmOverloads constructor(
|
||||
* 2-// 自动驾驶中
|
||||
*/
|
||||
private fun setAutoPilotStatus(autopilotStatus: Int) {
|
||||
mAutopilotStatus = autopilotStatus
|
||||
when (autopilotStatus) {
|
||||
0 -> {// 不可自动驾驶,adas与工控机没有链接,或工控机异常
|
||||
clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_disabled_bg)
|
||||
tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_disable))
|
||||
ivStatusIcon.setImageResource(R.drawable.icon_autopilot_status_disabled)
|
||||
}
|
||||
1 -> {// 可自动驾驶,目前处于人工干预状态
|
||||
clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_enable_bg)
|
||||
tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_enable))
|
||||
ivStatusIcon.setImageResource(R.drawable.icon_autopilot_status)
|
||||
}
|
||||
2 -> {// 自动驾驶中
|
||||
clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_checked_bg)
|
||||
tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_enable))
|
||||
ivStatusIcon.setImageResource(R.drawable.icon_autopilot_status)
|
||||
UiThreadHandler.post {
|
||||
mAutopilotStatus = autopilotStatus
|
||||
when (autopilotStatus) {
|
||||
0 -> {// 不可自动驾驶,adas与工控机没有链接,或工控机异常
|
||||
clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_disabled_bg)
|
||||
tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_disable))
|
||||
ivStatusIcon.setImageResource(R.drawable.icon_autopilot_status_disabled)
|
||||
}
|
||||
1 -> {// 可自动驾驶,目前处于人工干预状态
|
||||
clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_enable_bg)
|
||||
tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_enable))
|
||||
ivStatusIcon.setImageResource(R.drawable.icon_autopilot_status)
|
||||
}
|
||||
2 -> {// 自动驾驶中
|
||||
clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_checked_bg)
|
||||
tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_enable))
|
||||
ivStatusIcon.setImageResource(R.drawable.icon_autopilot_status)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,20 +130,21 @@ public class SpeedChartView extends View {
|
||||
* @param time 动画执行的时长
|
||||
*/
|
||||
private void setAnimation(float startAngle, float currentAngle, int time) {
|
||||
//绘制当前数据对应的圆弧的动画效果
|
||||
ValueAnimator progressAnimator = ValueAnimator.ofFloat(startAngle, currentAngle);
|
||||
progressAnimator.setDuration(time);
|
||||
progressAnimator.setTarget(mIncludedAngle);
|
||||
progressAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
mIncludedAngle = (float) animation.getAnimatedValue();
|
||||
//重新绘制,不然不会出现效果
|
||||
postInvalidate();
|
||||
}
|
||||
});
|
||||
//开始执行动画
|
||||
progressAnimator.start();
|
||||
// //绘制当前数据对应的圆弧的动画效果
|
||||
// ValueAnimator progressAnimator = ValueAnimator.ofFloat(startAngle, currentAngle);
|
||||
// progressAnimator.setDuration(time);
|
||||
// progressAnimator.setTarget(mIncludedAngle);
|
||||
// progressAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
// @Override
|
||||
// public void onAnimationUpdate(ValueAnimator animation) {
|
||||
// mIncludedAngle = (float) animation.getAnimatedValue();
|
||||
// //重新绘制,不然不会出现效果
|
||||
// postInvalidate();
|
||||
// }
|
||||
// });
|
||||
// //开始执行动画
|
||||
// progressAnimator.start();
|
||||
mIncludedAngle = currentAngle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ import com.mogo.map.navi.IMogoCarLocationChangedListener2
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
||||
import com.mogo.service.statusmanager.StatusDescriptor
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -45,6 +47,8 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
var mDebugSettingViewFloat: WarningFloat.Builder? = null
|
||||
var mDebugSettingView: DebugSettingView? = null
|
||||
|
||||
var mLatLng: Location? = null
|
||||
|
||||
init {
|
||||
setOnLongClickListener {
|
||||
Log.d(TAG, "长按显示状态工具栏")
|
||||
@@ -101,7 +105,23 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
layoutParams.gravity = Gravity.CENTER
|
||||
mSpeedChartView.layoutParams = layoutParams
|
||||
addView(mSpeedChartView)
|
||||
}
|
||||
|
||||
private val timerTask = object : TimerTask() {
|
||||
override fun run() {
|
||||
if (mLatLng != null) {
|
||||
UiThreadHandler.post {
|
||||
val speed = (mLatLng!!.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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
// 注册位置回调
|
||||
mMogoServiceApis.registerCenterApi
|
||||
.registerCarLocationChangedListener(TAG, this)
|
||||
@@ -109,6 +129,8 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
mMogoServiceApis.statusManagerApi
|
||||
.registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this)
|
||||
|
||||
// 开启定时查询速度
|
||||
Timer().schedule(timerTask, Date(), 100)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
@@ -118,6 +140,11 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
.unregisterMogoLocationListener(TAG)
|
||||
mMogoServiceApis.statusManagerApi
|
||||
.unregisterStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this)
|
||||
try {
|
||||
timerTask.cancel()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,24 +153,27 @@ class SpeedPanelView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onCarLocationChanged2(latLng: Location) {
|
||||
mSpeedChartView.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)
|
||||
}
|
||||
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)
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {
|
||||
if (descriptor == StatusDescriptor.VR_MODE) {
|
||||
try {
|
||||
visibility = if (isTrue) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
UiThreadHandler.post {
|
||||
if (descriptor == StatusDescriptor.VR_MODE) {
|
||||
try {
|
||||
visibility = if (isTrue) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.view_traffic_light_vr.view.*
|
||||
|
||||
/**
|
||||
@@ -30,27 +31,29 @@ class TrafficLightView @JvmOverloads constructor(
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
fun showWarningTrafficLight(checkLightId: Int) {
|
||||
visibility = View.VISIBLE
|
||||
when (checkLightId) {
|
||||
0 -> {
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
}
|
||||
1 -> {
|
||||
ctvRedTrafficLight.isChecked = true
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
}
|
||||
2 -> {
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = true
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
}
|
||||
3 -> {
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = true
|
||||
UiThreadHandler.post {
|
||||
visibility = View.VISIBLE
|
||||
when (checkLightId) {
|
||||
0 -> {
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
}
|
||||
1 -> {
|
||||
ctvRedTrafficLight.isChecked = true
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
}
|
||||
2 -> {
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = true
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
}
|
||||
3 -> {
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,13 +62,15 @@ class TrafficLightView @JvmOverloads constructor(
|
||||
* 关闭红绿灯预警展示,并重制灯态
|
||||
*/
|
||||
fun disableWarningTrafficLight() {
|
||||
visibility = View.GONE
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
ctvRedTrafficLight.text = ""
|
||||
ctvYellowTrafficLight.text = ""
|
||||
ctvGreenTrafficLight.text = ""
|
||||
UiThreadHandler.post {
|
||||
visibility = View.GONE
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
ctvRedTrafficLight.text = ""
|
||||
ctvYellowTrafficLight.text = ""
|
||||
ctvGreenTrafficLight.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,32 +80,40 @@ class TrafficLightView @JvmOverloads constructor(
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
changeCountdownGreen(readNum)
|
||||
changeCountdownYellow(yellowNum)
|
||||
changeCountdownRed(greenNum)
|
||||
UiThreadHandler.post {
|
||||
changeCountdownGreen(readNum)
|
||||
changeCountdownYellow(yellowNum)
|
||||
changeCountdownRed(greenNum)
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownGreen(greenNum: Int) {
|
||||
if (greenNum > 0) {
|
||||
ctvGreenTrafficLight.text = "$greenNum"
|
||||
} else {
|
||||
ctvGreenTrafficLight.text = ""
|
||||
UiThreadHandler.post {
|
||||
if (greenNum > 0) {
|
||||
ctvGreenTrafficLight.text = "$greenNum"
|
||||
} else {
|
||||
ctvGreenTrafficLight.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownYellow(yellowNum: Int) {
|
||||
if (yellowNum > 0) {
|
||||
ctvYellowTrafficLight.text = "$yellowNum"
|
||||
} else {
|
||||
ctvYellowTrafficLight.text = ""
|
||||
UiThreadHandler.post {
|
||||
if (yellowNum > 0) {
|
||||
ctvYellowTrafficLight.text = "$yellowNum"
|
||||
} else {
|
||||
ctvYellowTrafficLight.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownRed(redNum: Int) {
|
||||
if (redNum > 0) {
|
||||
ctvRedTrafficLight.text = "$redNum"
|
||||
} else {
|
||||
ctvRedTrafficLight.text = ""
|
||||
UiThreadHandler.post {
|
||||
if (redNum > 0) {
|
||||
ctvRedTrafficLight.text = "$redNum"
|
||||
} else {
|
||||
ctvRedTrafficLight.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.annotation.Nullable
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.notification_v2x_msg_vr.view.*
|
||||
|
||||
/**
|
||||
@@ -27,18 +28,26 @@ class V2XNotificationView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
fun setWarningIcon(@DrawableRes warningIcon: Int) {
|
||||
ivWaringIcon.setImageResource(warningIcon)
|
||||
UiThreadHandler.post {
|
||||
ivWaringIcon.setImageResource(warningIcon)
|
||||
}
|
||||
}
|
||||
|
||||
fun setWarningIcon(@Nullable drawable: Drawable) {
|
||||
ivWaringIcon.setImageDrawable(drawable)
|
||||
UiThreadHandler.post {
|
||||
ivWaringIcon.setImageDrawable(drawable)
|
||||
}
|
||||
}
|
||||
|
||||
fun setWarningContent(@Nullable warningContent: String) {
|
||||
tvWaringContent.text = warningContent
|
||||
UiThreadHandler.post {
|
||||
tvWaringContent.text = warningContent
|
||||
}
|
||||
}
|
||||
|
||||
fun setWarningContent(@StringRes warningContentId: Int) {
|
||||
tvWaringContent.setText(warningContentId)
|
||||
UiThreadHandler.post {
|
||||
tvWaringContent.setText(warningContentId)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.android.synthetic.main.module_hmi_warning_v2x.view.*
|
||||
|
||||
@@ -48,72 +49,75 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
*/
|
||||
fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
|
||||
Logger.d("V2XWarningView", "预警红边:预警方向->$direction 预警倒计时->$closeTime")
|
||||
// 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
|
||||
if (direction != WarningDirectionEnum.ALERT_WARNING_NON) {
|
||||
removeCallbacks(closeWarningTask)
|
||||
postDelayed(closeWarningTask, closeTime)
|
||||
}
|
||||
when (direction) {
|
||||
WarningDirectionEnum.ALERT_WARNING_NON -> {
|
||||
UiThreadHandler.post {
|
||||
|
||||
// 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
|
||||
if (direction != WarningDirectionEnum.ALERT_WARNING_NON) {
|
||||
removeCallbacks(closeWarningTask)
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
postDelayed(closeWarningTask, closeTime)
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_TOP -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_RIGHT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_BOTTOM -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_LEFT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.VISIBLE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftImg.visibility = View.VISIBLE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_TOP_LEFT -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.VISIBLE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_ALL -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftImg.visibility = View.VISIBLE
|
||||
when (direction) {
|
||||
WarningDirectionEnum.ALERT_WARNING_NON -> {
|
||||
removeCallbacks(closeWarningTask)
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_TOP -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_RIGHT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_BOTTOM -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_LEFT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.VISIBLE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftImg.visibility = View.VISIBLE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_TOP_LEFT -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.VISIBLE
|
||||
}
|
||||
WarningDirectionEnum.ALERT_WARNING_ALL -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.VISIBLE
|
||||
hmiWarningBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftImg.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user