[6.7.0][运营面板] 优化自动驾驶速度阈值设置逻辑

This commit is contained in:
renwj
2024-09-30 17:21:58 +08:00
parent 769175ecbd
commit 2e75e72df3
4 changed files with 33 additions and 14 deletions

View File

@@ -109,6 +109,16 @@ fun View.onClick(block: (View) -> Unit) {
}
}
fun View.onClickWidthDuration(duration: Int, block: (View) -> Unit) {
this.setOnClickListener {
if (ClickUtils.isClickTooFrequent(this, duration)) {
return@setOnClickListener
}
block(it)
}
}
val <T: Context> T.lifeCycleScope: LifecycleCoroutineScope
get() = (this as? LifecycleOwner)?.lifecycleScope ?: ProcessLifecycleOwner.get().lifecycleScope