diff options
author | Allan Wang <me@allanwang.ca> | 2018-12-28 21:43:49 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-28 21:43:49 -0500 |
commit | 8c4db7d79d4f9557d0eef2ef707663c5e8a7aac6 (patch) | |
tree | 8e6202efb768d954145038cb8642453c62650c5e /app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt | |
parent | 7d85262ada198501d2d5844e1196c9b45f4a38f5 (diff) | |
parent | 66a6657b81e6274e1eac33c4c7379d3db2c463fb (diff) | |
download | frost-8c4db7d79d4f9557d0eef2ef707663c5e8a7aac6.tar.gz frost-8c4db7d79d4f9557d0eef2ef707663c5e8a7aac6.tar.bz2 frost-8c4db7d79d4f9557d0eef2ef707663c5e8a7aac6.zip |
Merge pull request #1265 from AllanWang/enhancement/coroutine-ui
Replace coroutines in view logic
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt index 2b9e8f9c..f7cb2214 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt @@ -28,6 +28,7 @@ import com.pitchedapps.frost.contracts.FrostContentCore import com.pitchedapps.frost.contracts.FrostContentParent import com.pitchedapps.frost.fragments.RecyclerContentContract import com.pitchedapps.frost.utils.Prefs +import kotlinx.coroutines.launch /** * Created by Allan Wang on 2017-05-29. @@ -69,11 +70,12 @@ class FrostRecyclerView @JvmOverloads constructor( override fun reloadBase(animate: Boolean) { if (Prefs.animate) fadeOut(onFinish = onReloadClear) - parent.refreshObservable.onNext(true) - recyclerContract.reload({ parent.progressObservable.onNext(it) }) { - parent.progressObservable.onNext(100) - parent.refreshObservable.onNext(false) - if (Prefs.animate) post { circularReveal() } + scope.launch { + parent.refreshChannel.offer(true) + val loaded = recyclerContract.reload { parent.progressChannel.offer(it) } + parent.progressChannel.offer(100) + parent.refreshChannel.offer(false) + if (Prefs.animate) circularReveal() } } |