diff options
author | Allan Wang <me@allanwang.ca> | 2021-11-22 22:24:17 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2021-11-22 22:24:17 -0800 |
commit | 1dd7be9174f1740aa1cae29f6d62d6f83f5917ba (patch) | |
tree | 5734afee77ddd8ea498df7065a1ec3de28a387f7 /app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt | |
parent | eb2e0d07f278eb2079666ffabcbee007173c17af (diff) | |
download | frost-1dd7be9174f1740aa1cae29f6d62d6f83f5917ba.tar.gz frost-1dd7be9174f1740aa1cae29f6d62d6f83f5917ba.tar.bz2 frost-1dd7be9174f1740aa1cae29f6d62d6f83f5917ba.zip |
Migrate refresh channel to flow
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 | 7 |
1 files changed, 4 insertions, 3 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 2ab00916..a2b71572 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt @@ -61,7 +61,8 @@ class FrostRecyclerView @JvmOverloads constructor( layoutManager = LinearLayoutManager(context) } - override fun bind(container: FrostContentContainer): View { + override fun bind(parent: FrostContentParent, container: FrostContentContainer): View { + this.parent = parent if (container !is RecyclerContentContract) throw IllegalStateException("FrostRecyclerView must bind to a container that is a RecyclerContentContract") this.recyclerContract = container @@ -78,10 +79,10 @@ class FrostRecyclerView @JvmOverloads constructor( override fun reloadBase(animate: Boolean) { if (prefs.animate) fadeOut(onFinish = onReloadClear) scope.launch { - parent.refreshChannel.offer(true) + parent.refreshEmit(true) recyclerContract.reload { parent.progressChannel.offer(it) } parent.progressChannel.offer(100) - parent.refreshChannel.offer(false) + parent.refreshEmit(false) if (prefs.animate) circularReveal() } } |