Resetting cached transparent color on theme update

This commit is contained in:
brosssh 2025-05-06 17:00:15 +02:00
parent 5555373deb
commit 3aa24fbbc1
2 changed files with 6 additions and 0 deletions

View file

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

View file

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