diff options
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/enums')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/enums/MainActivityLayout.kt | 12 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt | 35 |
2 files changed, 16 insertions, 31 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/enums/MainActivityLayout.kt b/app/src/main/kotlin/com/pitchedapps/frost/enums/MainActivityLayout.kt index 92aa93ab..4f6d6a29 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/enums/MainActivityLayout.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/enums/MainActivityLayout.kt @@ -24,17 +24,17 @@ import com.pitchedapps.frost.utils.Prefs */ enum class MainActivityLayout( val titleRes: Int, - val backgroundColor: () -> Int, - val iconColor: () -> Int + val backgroundColor: (Prefs) -> Int, + val iconColor: (Prefs) -> Int ) { TOP_BAR(R.string.top_bar, - { Prefs.headerColor }, - { Prefs.iconColor }), + { it.headerColor }, + { it.iconColor }), BOTTOM_BAR(R.string.bottom_bar, - { Prefs.bgColor }, - { Prefs.textColor }); + { it.bgColor }, + { it.textColor }); companion object { val values = values() // save one instance 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..23fa2ebf 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/enums/Theme.kt @@ -33,11 +33,11 @@ const val BLUE_LIGHT = 0xff5d86dd.toInt() enum class Theme( @StringRes val textRes: Int, val injector: InjectorContract, - private val textColorGetter: () -> Int, - private val accentColorGetter: () -> Int, - private val backgroundColorGetter: () -> Int, - private val headerColorGetter: () -> Int, - private val iconColorGetter: () -> Int + val textColorGetter: (Prefs) -> Int, + val accentColorGetter: (Prefs) -> Int, + val backgroundColorGetter: (Prefs) -> Int, + val headerColorGetter: (Prefs) -> Int, + val iconColorGetter: (Prefs) -> Int ) { DEFAULT(R.string.kau_default, @@ -82,26 +82,11 @@ enum class Theme( CUSTOM(R.string.kau_custom, CssAssets.CUSTOM, - { Prefs.customTextColor }, - { Prefs.customAccentColor }, - { Prefs.customBackgroundColor }, - { Prefs.customHeaderColor }, - { Prefs.customIconColor }); - - val textColor: Int - get() = textColorGetter() - - val accentColor: Int - get() = accentColorGetter() - - val bgColor: Int - get() = backgroundColorGetter() - - val headerColor: Int - get() = headerColorGetter() - - val iconColor: Int - get() = iconColorGetter() + { it.customTextColor }, + { it.customAccentColor }, + { it.customBackgroundColor }, + { it.customHeaderColor }, + { it.customIconColor }); companion object { val values = values() // save one instance |