Files
Juha Heinanen 06dd814a27 Use LiveData to observe service events
Avoid bluetooth related error
2022-01-27 18:30:44 +02:00

15 lines
372 B
Kotlin

package com.tutpro.baresip
import java.util.concurrent.atomic.AtomicBoolean
open class Event<out T>(private val content: T) {
private val hasBeenHandled = AtomicBoolean(false)
fun getContentIfNotHandled(): T? {
return if (hasBeenHandled.get()) {
null
} else {
hasBeenHandled.set(true)
content
}
}
}