@@ -12,7 +12,6 @@ import androidx.annotation.ColorInt
12
12
import androidx.collection.LruCache
13
13
import androidx.core.math.MathUtils
14
14
import com.osfans.trime.data.base.DataManager
15
- import com.osfans.trime.data.prefs.AppPrefs
16
15
import com.osfans.trime.util.ColorUtils
17
16
import com.osfans.trime.util.WeakHashSet
18
17
import com.osfans.trime.util.bitmapDrawable
@@ -21,8 +20,8 @@ import timber.log.Timber
21
20
22
21
object ColorManager {
23
22
private lateinit var theme: Theme
24
- private val prefs = AppPrefs .defaultInstance().theme
25
- private var prefsSelectedColor by prefs.selectedColor
23
+ private val prefs = ThemeManager .prefs
24
+ private var normalModeColor by prefs.normalModeColor
26
25
private val followSystemDayNight by prefs.followSystemDayNight
27
26
private val backgroundFolder get() = theme.generalStyle.backgroundFolder
28
27
@@ -39,7 +38,7 @@ object ColorManager {
39
38
initialColors[" dark_scheme" ] ? : lastDarkColorScheme
40
39
} else {
41
40
initialColors[" light_scheme" ] ? : lastLightColorScheme
42
- } ? : prefsSelectedColor
41
+ } ? : normalModeColor
43
42
}
44
43
45
44
private val defaultFallbackColors =
@@ -124,23 +123,23 @@ object ColorManager {
124
123
125
124
this .theme = theme
126
125
127
- initialColors = theme.presetColorSchemes[prefsSelectedColor ] ? : mapOf ()
126
+ initialColors = theme.presetColorSchemes[normalModeColor ] ? : mapOf ()
128
127
fallbackRules = theme.fallbackColors + defaultFallbackColors
129
128
130
129
switchNightMode(isNightMode)
131
130
}
132
131
133
132
fun setColorScheme (scheme : String ) {
134
133
switchColorScheme(scheme)
135
- prefsSelectedColor = scheme
134
+ normalModeColor = scheme
136
135
}
137
136
138
137
private fun switchColorScheme (scheme : String ) {
139
138
if (! theme.presetColorSchemes.containsKey(scheme)) {
140
139
Timber .w(" Color scheme $scheme not found" , scheme)
141
140
return
142
141
}
143
- Timber .d(" switch color scheme from $prefsSelectedColor to $scheme " )
142
+ Timber .d(" switch color scheme from $normalModeColor to $scheme " )
144
143
// 刷新配色
145
144
val isFirst = colorCache.size() == 0 || drawableCache.size() == 0
146
145
refreshColorValues(scheme)
0 commit comments