Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f41853a8 authored by Kelly's avatar Kelly
Browse files

Fix highlight animation bug.

Test: manually on device
Bug: 253536111
Change-Id: I52b80080b2af570ee7012f71d7178cbf9e990b68
parent 27c8aa6b
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -36,14 +36,15 @@ import com.android.settingslib.spa.framework.theme.SettingsTheme
@Composable
internal fun EntryHighlight(UiLayoutFn: @Composable () -> Unit) {
    val entryData = LocalEntryDataProvider.current
    var isHighlighted by rememberSaveable { mutableStateOf(false) }
    val entryIsHighlighted = rememberSaveable { entryData.isHighlighted }
    var localHighlighted by rememberSaveable { mutableStateOf(false) }
    SideEffect {
        isHighlighted = entryData.isHighlighted
        localHighlighted = entryIsHighlighted
    }

    val backgroundColor by animateColorAsState(
        targetValue = when {
            isHighlighted -> MaterialTheme.colorScheme.surfaceVariant
            localHighlighted -> MaterialTheme.colorScheme.surfaceVariant
            else -> SettingsTheme.colorScheme.background
        },
        animationSpec = repeatable(