Files
AutoJs6/common/src/main/java/com/stardust/ext/Common.kt
hyb1996 863af6badf 修复 画布canvas默认白色改成默认透明
修复 画布canvas会覆盖其他View的问题
2019-01-14 23:39:47 +08:00

13 lines
283 B
Kotlin

package com.stardust.ext
import kotlin.reflect.KMutableProperty0
fun <R, T : KMutableProperty0<R?>> T.ifNull(provider: () -> R): R {
val value = this.get()
if (value != null) {
return value
}
val newValue = provider()
set(newValue)
return newValue
}