修复弹窗与红边不同步消失现象
This commit is contained in:
@@ -34,6 +34,10 @@ internal class WarningFloatWindowHelper(
|
||||
var frameLayout: ParentFrameLayout? = null
|
||||
private var enterAnimator: Animator? = null
|
||||
|
||||
private val closeWarningTask: Runnable = Runnable {
|
||||
exitAnim()
|
||||
}
|
||||
|
||||
fun createWindow(): Boolean {
|
||||
return if (context is Activity) {
|
||||
initParams()
|
||||
@@ -108,9 +112,7 @@ internal class WarningFloatWindowHelper(
|
||||
|
||||
// 设置倒计时指定秒数后自动关闭Window
|
||||
if (config.countDownTime > 0) {
|
||||
frameLayout?.postDelayed({
|
||||
exitAnim()
|
||||
}, config.countDownTime)
|
||||
frameLayout?.postDelayed(closeWarningTask, config.countDownTime)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,6 +192,7 @@ internal class WarningFloatWindowHelper(
|
||||
* 退出动画执行结束/没有退出动画,进行回调、移除等操作
|
||||
*/
|
||||
fun remove(force: Boolean = false) = try {
|
||||
frameLayout?.removeCallbacks(closeWarningTask)
|
||||
config.isAnim = false
|
||||
WarningFloatWindowManager.remove(config.floatTag)
|
||||
// removeView是异步删除,在Activity销毁的时候会导致窗口泄漏,所以使用removeViewImmediate直接删除view
|
||||
|
||||
@@ -23,6 +23,7 @@ class V2XWarningView @JvmOverloads constructor(
|
||||
private val ALL_CLOSE_TIMER = 10000L
|
||||
|
||||
private val closeWarningTask: Runnable = Runnable {
|
||||
Logger.d("V2XWarningView", "预警红边:倒计时结束")
|
||||
showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user