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

Commit 1bfc06ed authored by Kelly Zhang's avatar Kelly Zhang Committed by Android (Google) Code Review
Browse files

Merge "Fix highlight animation bug."

parents 1328cadf f41853a8
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(