aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt
diff options
context:
space:
mode:
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.kt13
1 files changed, 6 insertions, 7 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..04ee7f3c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt
@@ -29,7 +29,6 @@ import com.pitchedapps.frost.contracts.FrostContentParent
import com.pitchedapps.frost.fragments.RecyclerContentContract
import com.pitchedapps.frost.prefs.Prefs
import dagger.hilt.android.AndroidEntryPoint
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.launch
import javax.inject.Inject
@@ -37,7 +36,6 @@ import javax.inject.Inject
* Created by Allan Wang on 2017-05-29.
*
*/
-@UseExperimental(ExperimentalCoroutinesApi::class)
@AndroidEntryPoint
class FrostRecyclerView @JvmOverloads constructor(
context: Context,
@@ -61,7 +59,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 +77,10 @@ class FrostRecyclerView @JvmOverloads constructor(
override fun reloadBase(animate: Boolean) {
if (prefs.animate) fadeOut(onFinish = onReloadClear)
scope.launch {
- parent.refreshChannel.offer(true)
- recyclerContract.reload { parent.progressChannel.offer(it) }
- parent.progressChannel.offer(100)
- parent.refreshChannel.offer(false)
+ parent.refreshEmit(true)
+ recyclerContract.reload { parent.progressEmit(it) }
+ parent.progressEmit(100)
+ parent.refreshEmit(false)
if (prefs.animate) circularReveal()
}
}