aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.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/enums/Theme.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/enums/Theme.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt b/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt
index 6c911e9c..a4f7525d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt
@@ -23,6 +23,8 @@ import com.pitchedapps.frost.injectors.CssAssets
import com.pitchedapps.frost.injectors.InjectorContract
import com.pitchedapps.frost.injectors.JsActions
import com.pitchedapps.frost.utils.Prefs
+import org.koin.core.KoinComponent
+import org.koin.core.inject
/**
* Created by Allan Wang on 2017-06-14.
@@ -82,11 +84,11 @@ enum class Theme(
CUSTOM(R.string.kau_custom,
CssAssets.CUSTOM,
- { Prefs.customTextColor },
- { Prefs.customAccentColor },
- { Prefs.customBackgroundColor },
- { Prefs.customHeaderColor },
- { Prefs.customIconColor });
+ { prefs.customTextColor },
+ { prefs.customAccentColor },
+ { prefs.customBackgroundColor },
+ { prefs.customHeaderColor },
+ { prefs.customIconColor });
val textColor: Int
get() = textColorGetter()
@@ -103,7 +105,8 @@ enum class Theme(
val iconColor: Int
get() = iconColorGetter()
- companion object {
+ companion object:KoinComponent {
+ private val prefs: Prefs by inject()
val values = values() // save one instance
operator fun invoke(index: Int) = values[index]
}