Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/BackgroundGlow.kt +8 −2 Original line number Diff line number Diff line Loading @@ -18,18 +18,20 @@ package com.android.systemui.ambientcue.ui.compose import android.graphics.RuntimeShader import androidx.compose.animation.core.LinearEasing import androidx.compose.animation.core.MutableTransitionState import androidx.compose.animation.core.RepeatMode import androidx.compose.animation.core.animateFloat import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.animateIntOffsetAsState import androidx.compose.animation.core.infiniteRepeatable import androidx.compose.animation.core.rememberInfiniteTransition import androidx.compose.animation.core.rememberTransition import androidx.compose.animation.core.tween import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.size import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.drawWithCache Loading @@ -53,7 +55,11 @@ fun BackgroundGlow( val turbulenceDisplacementPx = with(density) { Defaults.TURBULENCE_DISPLACEMENT_DP.dp.toPx() } val gradientRadiusPx = with(density) { Defaults.GRADIENT_RADIUS.dp.toPx() } val alpha by animateFloatAsState(if (visible) 1f else 0f, animationSpec = tween(750)) val visibleState = remember { MutableTransitionState(false) } visibleState.targetState = visible val transition = rememberTransition(visibleState) val alpha by transition.animateFloat(transitionSpec = { tween(750) }) { if (it) 1f else 0f } val verticalOffset by animateIntOffsetAsState(if (expanded) IntOffset.Zero else collapsedOffset, tween(350)) Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/NavBarPill.kt +12 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,10 @@ package com.android.systemui.ambientcue.ui.compose import androidx.compose.animation.core.MutableTransitionState import androidx.compose.animation.core.animateFloat import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.rememberTransition import androidx.compose.animation.core.tween import androidx.compose.foundation.Image import androidx.compose.foundation.background Loading Loading @@ -81,12 +84,17 @@ fun NavBarPill( val density = LocalDensity.current val collapsedWidthPx = with(density) { navBarWidth.toPx() } var expandedSize by remember { mutableStateOf(IntSize.Zero) } val visibleState = remember { MutableTransitionState(false) } visibleState.targetState = visible val transition = rememberTransition(visibleState) val enterProgress by animateFloatAsState( if (visible) 1f else 0f, animationSpec = tween(250, delayMillis = 200), transition.animateFloat( transitionSpec = { tween(250, delayMillis = 200) }, label = "enter", ) ) { if (it) 1f else 0f } val expansionAlpha by animateFloatAsState( if (expanded) 0f else 1f, Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ShortPill.kt +13 −7 Original line number Diff line number Diff line Loading @@ -16,8 +16,11 @@ package com.android.systemui.ambientcue.ui.compose import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.MutableTransitionState import androidx.compose.animation.core.TweenSpec import androidx.compose.animation.core.animateFloat import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.rememberTransition import androidx.compose.animation.core.tween import androidx.compose.foundation.Image import androidx.compose.foundation.background Loading @@ -39,6 +42,7 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip Loading Loading @@ -68,14 +72,16 @@ fun ShortPill( val backgroundColor = MaterialTheme.colorScheme.background val minSize = 48.dp val closeButtonSize = 28.dp val transitionTween: AnimationSpec<Float> = tween(250, delayMillis = 200) val transitionTween: TweenSpec<Float> = tween(250, delayMillis = 200) val visibleState = remember { MutableTransitionState(false) } visibleState.targetState = visible val transition = rememberTransition(visibleState) val enterProgress by animateFloatAsState( if (visible) 1f else 0f, animationSpec = transitionTween, label = "enter", ) transition.animateFloat(transitionSpec = { transitionTween }, label = "enter") { if (it) 1f else 0f } val expansionAlpha by animateFloatAsState( if (expanded) 0f else 1f, Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/BackgroundGlow.kt +8 −2 Original line number Diff line number Diff line Loading @@ -18,18 +18,20 @@ package com.android.systemui.ambientcue.ui.compose import android.graphics.RuntimeShader import androidx.compose.animation.core.LinearEasing import androidx.compose.animation.core.MutableTransitionState import androidx.compose.animation.core.RepeatMode import androidx.compose.animation.core.animateFloat import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.animateIntOffsetAsState import androidx.compose.animation.core.infiniteRepeatable import androidx.compose.animation.core.rememberInfiniteTransition import androidx.compose.animation.core.rememberTransition import androidx.compose.animation.core.tween import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.size import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.drawWithCache Loading @@ -53,7 +55,11 @@ fun BackgroundGlow( val turbulenceDisplacementPx = with(density) { Defaults.TURBULENCE_DISPLACEMENT_DP.dp.toPx() } val gradientRadiusPx = with(density) { Defaults.GRADIENT_RADIUS.dp.toPx() } val alpha by animateFloatAsState(if (visible) 1f else 0f, animationSpec = tween(750)) val visibleState = remember { MutableTransitionState(false) } visibleState.targetState = visible val transition = rememberTransition(visibleState) val alpha by transition.animateFloat(transitionSpec = { tween(750) }) { if (it) 1f else 0f } val verticalOffset by animateIntOffsetAsState(if (expanded) IntOffset.Zero else collapsedOffset, tween(350)) Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/NavBarPill.kt +12 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,10 @@ package com.android.systemui.ambientcue.ui.compose import androidx.compose.animation.core.MutableTransitionState import androidx.compose.animation.core.animateFloat import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.rememberTransition import androidx.compose.animation.core.tween import androidx.compose.foundation.Image import androidx.compose.foundation.background Loading Loading @@ -81,12 +84,17 @@ fun NavBarPill( val density = LocalDensity.current val collapsedWidthPx = with(density) { navBarWidth.toPx() } var expandedSize by remember { mutableStateOf(IntSize.Zero) } val visibleState = remember { MutableTransitionState(false) } visibleState.targetState = visible val transition = rememberTransition(visibleState) val enterProgress by animateFloatAsState( if (visible) 1f else 0f, animationSpec = tween(250, delayMillis = 200), transition.animateFloat( transitionSpec = { tween(250, delayMillis = 200) }, label = "enter", ) ) { if (it) 1f else 0f } val expansionAlpha by animateFloatAsState( if (expanded) 0f else 1f, Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ShortPill.kt +13 −7 Original line number Diff line number Diff line Loading @@ -16,8 +16,11 @@ package com.android.systemui.ambientcue.ui.compose import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.MutableTransitionState import androidx.compose.animation.core.TweenSpec import androidx.compose.animation.core.animateFloat import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.rememberTransition import androidx.compose.animation.core.tween import androidx.compose.foundation.Image import androidx.compose.foundation.background Loading @@ -39,6 +42,7 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip Loading Loading @@ -68,14 +72,16 @@ fun ShortPill( val backgroundColor = MaterialTheme.colorScheme.background val minSize = 48.dp val closeButtonSize = 28.dp val transitionTween: AnimationSpec<Float> = tween(250, delayMillis = 200) val transitionTween: TweenSpec<Float> = tween(250, delayMillis = 200) val visibleState = remember { MutableTransitionState(false) } visibleState.targetState = visible val transition = rememberTransition(visibleState) val enterProgress by animateFloatAsState( if (visible) 1f else 0f, animationSpec = transitionTween, label = "enter", ) transition.animateFloat(transitionSpec = { transitionTween }, label = "enter") { if (it) 1f else 0f } val expansionAlpha by animateFloatAsState( if (expanded) 0f else 1f, Loading