aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.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/FrostContentView.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/FrostContentView.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt13
1 files changed, 8 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt
index baf9421f..4fbf1482 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt
@@ -47,6 +47,8 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.BroadcastChannel
import kotlinx.coroutines.channels.ConflatedBroadcastChannel
import kotlinx.coroutines.channels.ReceiveChannel
+import org.koin.core.KoinComponent
+import org.koin.core.inject
class FrostContentWeb @JvmOverloads constructor(
context: Context,
@@ -75,8 +77,9 @@ abstract class FrostContentView<out T> @JvmOverloads constructor(
defStyleAttr: Int = 0,
defStyleRes: Int = 0
) : FrameLayout(context, attrs, defStyleAttr, defStyleRes),
- FrostContentParent where T : View, T : FrostContentCore {
+ FrostContentParent, KoinComponent where T : View, T : FrostContentCore {
+ private val prefs: Prefs by inject()
private val refresh: SwipeRefreshLayout by bindView(R.id.content_refresh)
private val progress: ProgressBar by bindView(R.id.content_progress)
val coreView: T by bindView(R.id.content_core)
@@ -153,9 +156,9 @@ abstract class FrostContentView<out T> @JvmOverloads constructor(
}
override fun reloadThemeSelf() {
- progress.tint(Prefs.textColor.withAlpha(180))
- refresh.setColorSchemeColors(Prefs.iconColor)
- refresh.setProgressBackgroundColorSchemeColor(Prefs.headerColor.withAlpha(255))
+ progress.tint(prefs.textColor.withAlpha(180))
+ refresh.setColorSchemeColors(prefs.iconColor)
+ refresh.setProgressBackgroundColorSchemeColor(prefs.headerColor.withAlpha(255))
}
override fun reloadTextSizeSelf() {
@@ -192,7 +195,7 @@ abstract class FrostContentView<out T> @JvmOverloads constructor(
if (isVisible)
fadeOut(duration = 200L)
} else if (loading) {
- if (animate && Prefs.animate) circularReveal(offset = WEB_LOAD_DELAY)
+ if (animate && prefs.animate) circularReveal(offset = WEB_LOAD_DELAY)
else fadeIn(duration = 200L, offset = WEB_LOAD_DELAY)
L.v { "Transition loaded in ${System.currentTimeMillis() - transitionStart} ms" }
receiver.cancel()