添加四个角渐变弹窗+动画;弹窗重复弹出修改
This commit is contained in:
@@ -3,11 +3,12 @@ package com.mogo.eagle.core.function.hmi.ui
|
||||
import android.animation.Animator
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.view.WindowManager.LayoutParams
|
||||
import android.view.animation.OvershootInterpolator
|
||||
import android.view.animation.*
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
@@ -56,6 +57,7 @@ import kotlinx.coroutines.*
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.util.*
|
||||
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/8/3 2:40 下午
|
||||
@@ -393,11 +395,11 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
if (mDebugSettingView == null) {
|
||||
mDebugSettingView = DebugSettingView(it)
|
||||
}
|
||||
var side =SidePattern.RIGHT
|
||||
var side = SidePattern.RIGHT
|
||||
var gravity = Gravity.RIGHT
|
||||
//调试窗默认靠右显示,Bus的乘客端右端有视图覆盖,调试窗靠左显示
|
||||
if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
|
||||
AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)){
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
|
||||
AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||
side = SidePattern.LEFT
|
||||
gravity = Gravity.LEFT
|
||||
}
|
||||
@@ -490,9 +492,8 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
if (mWarningFloat != null && !TextUtils.isEmpty(ttsContent) && playTts) {
|
||||
CallerLogger.d("$M_HMI$TAG", "---> ttsContent = $ttsContent")
|
||||
AIAssist.getInstance(activity)
|
||||
.speakTTSVoice(ttsContent)
|
||||
.speakTTSVoice(ttsContent)
|
||||
}
|
||||
showWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
|
||||
}
|
||||
|
||||
override fun onDismiss() {
|
||||
@@ -622,7 +623,25 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
* @see WarningDirectionEnum
|
||||
*/
|
||||
override fun showWarning(direction: WarningDirectionEnum) {
|
||||
Log.d(TAG,"showWarning====")
|
||||
flV2XWarningView?.showWarning(direction)
|
||||
flicker(flV2XWarningView)
|
||||
}
|
||||
|
||||
/**
|
||||
* 闪动动画
|
||||
*/
|
||||
fun flicker(view: View) {
|
||||
val alphaAnimation = AlphaAnimation(0f, 1.0f)
|
||||
alphaAnimation.setDuration(600)
|
||||
alphaAnimation.setInterpolator(LinearInterpolator())
|
||||
alphaAnimation.setRepeatCount(Animation.INFINITE)
|
||||
alphaAnimation.setRepeatMode(Animation.REVERSE)
|
||||
view.startAnimation(alphaAnimation)
|
||||
}
|
||||
|
||||
fun clearAnimation(view: View) {
|
||||
view.clearAnimation()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -633,10 +652,12 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
*/
|
||||
override fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
|
||||
flV2XWarningView?.showWarning(direction, closeTime)
|
||||
flicker(flV2XWarningView)
|
||||
}
|
||||
|
||||
override fun dismissWarning(direction: WarningDirectionEnum) {
|
||||
flV2XWarningView?.dismissWarning(direction)
|
||||
clearAnimation(flV2XWarningView)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,15 +53,15 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
* @param closeTime 倒计时
|
||||
*/
|
||||
fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
|
||||
CallerLogger.d("$M_HMI$TAG", "预警红边:预警方向->$direction 预警倒计时->$closeTime")
|
||||
// CallerLogger.d("$M_HMI$TAG", "预警红边:预警方向->$direction 预警倒计时->$closeTime")
|
||||
Log.d(TAG, "预警红边:预警方向->$direction 预警倒计时->$closeTime")
|
||||
UiThreadHandler.post {
|
||||
|
||||
// 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
|
||||
if (direction != ALERT_WARNING_NON) {
|
||||
removeCallbacks(closeWarningTask)
|
||||
postDelayed(closeWarningTask, closeTime)
|
||||
}
|
||||
when (ALERT_WARNING_TOP_RIGHT) {
|
||||
when (direction) {
|
||||
ALERT_WARNING_NON -> {
|
||||
removeCallbacks(closeWarningTask)
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
@@ -144,7 +144,7 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
hmiWarningRightBottomImg.visibility = View.GONE
|
||||
}
|
||||
ALERT_WARNING_TOP_LEFT -> {
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
@@ -154,14 +154,14 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
hmiWarningRightBottomImg.visibility = View.GONE
|
||||
}
|
||||
ALERT_WARNING_ALL -> {
|
||||
hmiWarningTopImg.visibility = View.GONE
|
||||
hmiWarningTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightImg.visibility = View.GONE
|
||||
hmiWarningBottomImg.visibility = View.GONE
|
||||
hmiWarningLeftImg.visibility = View.GONE
|
||||
hmiWarningLeftTopImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningRightTopImg.visibility = View.VISIBLE
|
||||
hmiWarningRightBottomImg.visibility = View.VISIBLE
|
||||
hmiWarningLeftTopImg.visibility = View.GONE
|
||||
hmiWarningLeftBottomImg.visibility = View.GONE
|
||||
hmiWarningRightTopImg.visibility = View.GONE
|
||||
hmiWarningRightBottomImg.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<!--右上角-->
|
||||
<ImageView
|
||||
android:id="@+id/hmiWarningRightTopImg"
|
||||
android:layout_width="@dimen/dp_730"
|
||||
android:layout_width="@dimen/dp_1600"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:background="@drawable/module_hmi_warning_bkg_right_top"
|
||||
@@ -64,7 +64,7 @@
|
||||
<ImageView
|
||||
android:id="@+id/hmiWarningRightBottomImg"
|
||||
android:layout_width="@dimen/dp_730"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="@dimen/dp_730"
|
||||
android:layout_gravity="end"
|
||||
android:background="@drawable/module_hmi_warning_bkg_right_bottom"
|
||||
android:visibility="gone"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
],
|
||||
"from": 1,
|
||||
"angle": 220,
|
||||
"direction": 3,
|
||||
"direction": 2,
|
||||
"speed": 11.108121,
|
||||
"targetColor": "#FF4040",
|
||||
"stopLineDistance": 60,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
],
|
||||
"from": 1,
|
||||
"angle": 240,
|
||||
"direction": 1,
|
||||
"direction": 3,
|
||||
"speed": 11.108121,
|
||||
"stopLineDistance": 60,
|
||||
"warningContent": "小心行人",
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<size
|
||||
android:width="@dimen/dp_1600"
|
||||
android:height="@dimen/dp_1600" />
|
||||
<gradient
|
||||
android:angle="45"
|
||||
android:centerX="0"
|
||||
android:centerY="1"
|
||||
android:endColor="#00F03232"
|
||||
android:gradientRadius="@dimen/dp_1200"
|
||||
android:startColor="@color/module_hmi_warning_bg_color"
|
||||
android:type="linear"/>
|
||||
android:type="radial" />
|
||||
</shape>
|
||||
@@ -1,8 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<size
|
||||
android:width="@dimen/dp_1600"
|
||||
android:height="@dimen/dp_1600" />
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:endColor="@color/module_hmi_warning_bg_color"
|
||||
android:startColor="#00F03232"
|
||||
android:type="linear"/>
|
||||
android:angle="315"
|
||||
android:centerX="0"
|
||||
android:centerY="0"
|
||||
android:endColor="@color/module_hmi_warning_bg_color_end"
|
||||
android:gradientRadius="@dimen/dp_1200"
|
||||
android:startColor="@color/module_hmi_warning_bg_color"
|
||||
android:type="radial" />
|
||||
</shape>
|
||||
@@ -1,8 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<size
|
||||
android:width="@dimen/dp_1600"
|
||||
android:height="@dimen/dp_1600" />
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:endColor="#00F03232"
|
||||
android:centerX="0"
|
||||
android:centerY="1"
|
||||
android:endColor="@color/module_hmi_warning_bg_color_end"
|
||||
android:gradientRadius="@dimen/dp_1200"
|
||||
android:startColor="@color/module_hmi_warning_bg_color"
|
||||
android:type="linear"/>
|
||||
android:type="radial" />
|
||||
</shape>
|
||||
@@ -1,8 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<size
|
||||
android:width="@dimen/dp_1600"
|
||||
android:height="@dimen/dp_1600" />
|
||||
<gradient
|
||||
android:angle="225"
|
||||
android:endColor="#00F03232"
|
||||
android:angle="45"
|
||||
android:centerX="1"
|
||||
android:centerY="0"
|
||||
android:endColor="@color/module_hmi_warning_bg_color_end"
|
||||
android:gradientRadius="@dimen/dp_1200"
|
||||
android:startColor="@color/module_hmi_warning_bg_color"
|
||||
android:type="linear"/>
|
||||
android:type="radial" />
|
||||
</shape>
|
||||
@@ -6,7 +6,8 @@
|
||||
<color name="module_switch_map_bg">#323C6F</color>
|
||||
|
||||
<color name="module_ext_color_voice_text">#FFFFFF</color>
|
||||
<color name="module_hmi_warning_bg_color">#8C7F2503</color>
|
||||
<color name="module_hmi_warning_bg_color">#727F2503</color>
|
||||
<color name="module_hmi_warning_bg_color_end">#007F2503</color>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -6,6 +6,8 @@
|
||||
<dimen name="dp_65">65px</dimen>
|
||||
<dimen name="dp_200">200px</dimen>
|
||||
<dimen name="dp_100">100px</dimen>
|
||||
<dimen name="dp_1200">1200px</dimen>
|
||||
<dimen name="dp_1600">1600px</dimen>
|
||||
<dimen name="module_ext_speed_width">300px</dimen>
|
||||
<dimen name="module_ext_speed_height">300px</dimen>
|
||||
<dimen name="module_ext_speed_padding">60px</dimen>
|
||||
|
||||
@@ -15,4 +15,6 @@
|
||||
<dimen name="dp_144">144px</dimen>
|
||||
<dimen name="dp_186">186px</dimen>
|
||||
<dimen name="dp_300">300px</dimen>
|
||||
<dimen name="dp_730">730px</dimen>
|
||||
<dimen name="dp_1600">1600px</dimen>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user