Skip to content

Commit 9f44541

Browse files
brossshoSumAtrIX
authored andcommitted
fix: Reset cached theme on theme change to avoid broken colors (#2527)
1 parent 02d2153 commit 9f44541

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

app/src/main/java/app/revanced/manager/ui/viewmodel/GeneralSettingsViewModel.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import androidx.lifecycle.ViewModel
44
import androidx.lifecycle.viewModelScope
55
import app.revanced.manager.domain.manager.PreferencesManager
66
import app.revanced.manager.ui.theme.Theme
7+
import app.revanced.manager.util.resetListItemColorsCached
78
import kotlinx.coroutines.launch
89

910
class GeneralSettingsViewModel(
1011
val prefs: PreferencesManager
1112
) : ViewModel() {
1213
fun setTheme(theme: Theme) = viewModelScope.launch {
1314
prefs.theme.update(theme)
15+
resetListItemColorsCached()
1416
}
1517
}

app/src/main/java/app/revanced/manager/util/Util.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ fun LocalDateTime.relativeTime(context: Context): String {
180180

181181
private var transparentListItemColorsCached: ListItemColors? = null
182182

183+
fun resetListItemColorsCached() {
184+
transparentListItemColorsCached = null
185+
}
186+
183187
/**
184188
* The default ListItem colors, but with [ListItemColors.containerColor] set to [Color.Transparent].
185189
*/

0 commit comments

Comments
 (0)