aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-02-23 16:06:45 -0800
committerAllan Wang <me@allanwang.ca>2020-02-23 16:06:45 -0800
commitc8b54fd10a08ed53eb7d21578a4fe990fe14e3bc (patch)
tree0841d112c8c00504ce10ca72ef39e403b69c595c /app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt
parent4d5aaf541dbfa7d521ebbc5f011a642c83c4b9c5 (diff)
downloadfrost-c8b54fd10a08ed53eb7d21578a4fe990fe14e3bc.tar.gz
frost-c8b54fd10a08ed53eb7d21578a4fe990fe14e3bc.tar.bz2
frost-c8b54fd10a08ed53eb7d21578a4fe990fe14e3bc.zip
Move prefs to service locator
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.kt9
1 files changed, 7 insertions, 2 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 5e82f0e9..6b156cc4 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt
@@ -30,6 +30,8 @@ import com.pitchedapps.frost.fragments.RecyclerContentContract
import com.pitchedapps.frost.utils.Prefs
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.launch
+import org.koin.core.KoinComponent
+import org.koin.core.inject
/**
* Created by Allan Wang on 2017-05-29.
@@ -41,8 +43,11 @@ class FrostRecyclerView @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : RecyclerView(context, attrs, defStyleAttr),
+ KoinComponent,
FrostContentCore {
+ private val prefs: Prefs by inject()
+
override fun reload(animate: Boolean) = reloadBase(animate)
override lateinit var parent: FrostContentParent
@@ -71,13 +76,13 @@ class FrostRecyclerView @JvmOverloads constructor(
var onReloadClear: () -> Unit = {}
override fun reloadBase(animate: Boolean) {
- if (Prefs.animate) fadeOut(onFinish = onReloadClear)
+ 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)
- if (Prefs.animate) circularReveal()
+ if (prefs.animate) circularReveal()
}
}