fix: Reset cached theme on theme change to avoid broken colors (#2527)

This commit is contained in:
Brosssh 2025-05-08 15:31:34 +02:00 committed by oSumAtrIX
parent 02d2153195
commit 9f44541bbd
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 6 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import app.revanced.manager.domain.manager.PreferencesManager import app.revanced.manager.domain.manager.PreferencesManager
import app.revanced.manager.ui.theme.Theme import app.revanced.manager.ui.theme.Theme
import app.revanced.manager.util.resetListItemColorsCached
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
class GeneralSettingsViewModel( class GeneralSettingsViewModel(
@ -11,5 +12,6 @@ class GeneralSettingsViewModel(
) : ViewModel() { ) : ViewModel() {
fun setTheme(theme: Theme) = viewModelScope.launch { fun setTheme(theme: Theme) = viewModelScope.launch {
prefs.theme.update(theme) prefs.theme.update(theme)
resetListItemColorsCached()
} }
} }

View File

@ -180,6 +180,10 @@ fun LocalDateTime.relativeTime(context: Context): String {
private var transparentListItemColorsCached: ListItemColors? = null private var transparentListItemColorsCached: ListItemColors? = null
fun resetListItemColorsCached() {
transparentListItemColorsCached = null
}
/** /**
* The default ListItem colors, but with [ListItemColors.containerColor] set to [Color.Transparent]. * The default ListItem colors, but with [ListItemColors.containerColor] set to [Color.Transparent].
*/ */