diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2024-07-15 23:52:28 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2024-07-16 00:25:07 +0200 |
| commit | 42564c71cfb70c28831c662a3b6bf4084e079353 (patch) | |
| tree | 111456fd3e8dce884d0380a81d70950062c7d212 /app/src/main/java/org/the_jk/cleversync/LiveDataUtils.kt | |
| parent | 4a8f6807c9d3ee6bcfac25aee832163036b4e6fe (diff) | |
Break out io code in libs
Preparing for adding more io implementations.
Really tried writing the convention plugins in kotlin dsl but could
not find the exact right hacks to get it to work.
Diffstat (limited to 'app/src/main/java/org/the_jk/cleversync/LiveDataUtils.kt')
| -rw-r--r-- | app/src/main/java/org/the_jk/cleversync/LiveDataUtils.kt | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/app/src/main/java/org/the_jk/cleversync/LiveDataUtils.kt b/app/src/main/java/org/the_jk/cleversync/LiveDataUtils.kt deleted file mode 100644 index 7f6ab1f..0000000 --- a/app/src/main/java/org/the_jk/cleversync/LiveDataUtils.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.the_jk.cleversync - -import androidx.lifecycle.LiveData -import androidx.lifecycle.Observer - -fun <T> LiveData<T>.safeValue(): T? { - if (this.hasActiveObservers()) - return value - var ret: T? = null - val observer = Observer<T> { value -> ret = value } - this.observeForever(observer) - this.removeObserver(observer) - return ret -} |
