修复同一类型弹窗展示时长重置
This commit is contained in:
1
.idea/vcs.xml
generated
1
.idea/vcs.xml
generated
@@ -2,5 +2,6 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/MoGoAiCloudSdk" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -7,6 +7,7 @@ import android.app.Service
|
||||
import android.content.Context
|
||||
import android.graphics.PixelFormat
|
||||
import android.graphics.Rect
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -117,6 +118,18 @@ internal class WarningFloatWindowHelper(
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重置倒计时
|
||||
*/
|
||||
fun resetDownTime() {
|
||||
// 设置倒计时指定秒数后自动关闭Window
|
||||
if (config.countDownTime > 0) {
|
||||
Log.d(TAG, "重置弹窗时常")
|
||||
frameLayout?.removeCallbacks(closeWarningTask)
|
||||
frameLayout?.postDelayed(closeWarningTask, config.countDownTime)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 入场动画
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.hmi.notification
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
@@ -8,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
* @date 2021/8/5 5:17 下午
|
||||
*/
|
||||
internal object WarningFloatWindowManager {
|
||||
private val TAG: String = "WarningFloatWindowManager"
|
||||
private const val TAG = "WarningFloat"
|
||||
private const val DEFAULT_TAG = "default"
|
||||
|
||||
private val windowMap = ConcurrentHashMap<String, WarningFloatWindowHelper>()
|
||||
@@ -22,8 +23,10 @@ internal object WarningFloatWindowManager {
|
||||
val helper = WarningFloatWindowHelper(context, config)
|
||||
if (helper.createWindow()) windowMap[config.floatTag!!] = helper
|
||||
} else {
|
||||
Log.w(TAG, "存在相同的tag,延长弹窗时间")
|
||||
// 存在相同的tag,直接创建失败
|
||||
config.callbacks?.createdResult(false, "存在相同的tag,直接创建失败", null)
|
||||
config.callbacks?.createdResult(false, "存在相同的tag,延长弹窗时间", null)
|
||||
windowMap[config.floatTag!!]?.resetDownTime()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user