mirror of https://git.sr.ht/~oppen/ariane
26 lines
588 B
Kotlin
26 lines
588 B
Kotlin
package oppen
|
|
|
|
import android.os.CountDownTimer
|
|
import android.view.View
|
|
|
|
|
|
fun View.visible(visible: Boolean) = when {
|
|
visible -> this.visibility = View.VISIBLE
|
|
else -> this.visibility = View.GONE
|
|
}
|
|
|
|
fun View.visibleRetainingSpace(visible: Boolean) = when {
|
|
visible -> this.visibility = View.VISIBLE
|
|
else -> this.visibility = View.INVISIBLE
|
|
}
|
|
|
|
fun delay(ms: Long, action: () -> Unit){
|
|
object : CountDownTimer(ms, ms/2) {
|
|
override fun onTick(millisUntilFinished: Long) {}
|
|
|
|
override fun onFinish() {
|
|
action.invoke()
|
|
}
|
|
}.start()
|
|
|
|
} |