diff options
author | Allan Wang <me@allanwang.ca> | 2021-04-18 18:30:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-18 18:30:03 -0700 |
commit | bf55dbf9b46cd8826987ee6e556307e24f3d46cc (patch) | |
tree | aaca512641e6e4503859c4cb97a29a9296669f9d /app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt | |
parent | 88a5d17814ff9f7c44f79216510d405f057ae454 (diff) | |
parent | 997362de5aab00f8d258b6fe8a058a8b3e018694 (diff) | |
download | frost-bf55dbf9b46cd8826987ee6e556307e24f3d46cc.tar.gz frost-bf55dbf9b46cd8826987ee6e556307e24f3d46cc.tar.bz2 frost-bf55dbf9b46cd8826987ee6e556307e24f3d46cc.zip |
Merge pull request #1770 from AllanWang/hilt
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt index 47496d6d..b024b2d3 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/ThemePrefs.kt @@ -19,11 +19,9 @@ package com.pitchedapps.frost.prefs.sections import ca.allanwang.kau.kpref.KPref import ca.allanwang.kau.kpref.KPrefFactory import com.pitchedapps.frost.BuildConfig -import com.pitchedapps.frost.injectors.ThemeProvider import com.pitchedapps.frost.prefs.OldPrefs import com.pitchedapps.frost.prefs.PrefsBase -import org.koin.core.component.KoinComponent -import org.koin.core.component.inject +import javax.inject.Inject interface ThemePrefs : PrefsBase { var theme: Int @@ -41,17 +39,16 @@ interface ThemePrefs : PrefsBase { var tintNavBar: Boolean } -class ThemePrefsImpl( - factory: KPrefFactory -) : KPref("${BuildConfig.APPLICATION_ID}.prefs.theme", factory), - ThemePrefs, KoinComponent { +class ThemePrefsImpl @Inject internal constructor( + factory: KPrefFactory, + oldPrefs: OldPrefs, +) : KPref("${BuildConfig.APPLICATION_ID}.prefs.theme", factory), ThemePrefs { - private val oldPrefs: OldPrefs by inject() - private val themeProvider: ThemeProvider by inject() - - override var theme: Int by kpref("theme", oldPrefs.theme /* 0 */) { - themeProvider.setTheme(it) - } + /** + * Note that this is purely for the pref storage. Updating themes should use + * ThemeProvider + */ + override var theme: Int by kpref("theme", oldPrefs.theme /* 0 */) override var customTextColor: Int by kpref( "color_text", |