Loading packages/SystemUI/compose/core/src/com/android/compose/animation/scene/Key.kt +8 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,14 @@ sealed class Key(val name: String, val identity: Any) { } /** Key for a scene. */ class SceneKey(name: String, identity: Any = Object()) : Key(name, identity) { class SceneKey( name: String, identity: Any = Object(), ) : Key(name, identity) { /** The unique [ElementKey] identifying this scene's root element. */ val rootElementKey = ElementKey(name, identity) override fun toString(): String { return "SceneKey(name=$name)" } Loading packages/SystemUI/compose/core/src/com/android/compose/animation/scene/SceneTransitions.kt +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import com.android.compose.ui.util.fastMap /** The transitions configuration of a [SceneTransitionLayout]. */ class SceneTransitions( val transitionSpecs: List<TransitionSpec>, private val transitionSpecs: List<TransitionSpec>, ) { private val cache = mutableMapOf<SceneKey, MutableMap<SceneKey, TransitionSpec>>() Loading packages/SystemUI/compose/core/src/com/android/compose/animation/scene/TransitionDslImpl.kt +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ private class SceneTransitionsBuilderImpl : SceneTransitionsBuilder { } } private class TransitionBuilderImpl : TransitionBuilder { internal class TransitionBuilderImpl : TransitionBuilder { val transformations = mutableListOf<Transformation>() override var spec: AnimationSpec<Float> = spring(stiffness = Spring.StiffnessLow) Loading packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt +86 −72 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ import android.content.DialogInterface import androidx.compose.animation.Crossfade import androidx.compose.animation.core.snap import androidx.compose.animation.core.tween import androidx.compose.foundation.background import androidx.compose.foundation.Canvas import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column Loading @@ -46,6 +46,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.SceneScope import com.android.systemui.R import com.android.systemui.bouncer.ui.viewmodel.AuthMethodBouncerViewModel Loading @@ -63,6 +64,13 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow object Bouncer { object Elements { val Background = ElementKey("BouncerBackground") val Content = ElementKey("BouncerContent") } } /** The bouncer scene displays authentication challenges like PIN, password, or pattern. */ @SysUISingleton class BouncerScene Loading @@ -88,7 +96,7 @@ constructor( } @Composable private fun BouncerScene( private fun SceneScope.BouncerScene( viewModel: BouncerViewModel, dialogFactory: BouncerSceneDialogFactory, modifier: Modifier = Modifier, Loading @@ -97,14 +105,19 @@ private fun BouncerScene( val authMethodViewModel: AuthMethodBouncerViewModel? by viewModel.authMethod.collectAsState() val dialogMessage: String? by viewModel.throttlingDialogMessage.collectAsState() var dialog: Dialog? by remember { mutableStateOf(null) } val backgroundColor = MaterialTheme.colorScheme.surface Box(modifier) { Canvas(Modifier.element(Bouncer.Elements.Background).fillMaxSize()) { drawRect(color = backgroundColor) } Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(60.dp), modifier = modifier Modifier.element(Bouncer.Elements.Content) .fillMaxSize() .background(MaterialTheme.colorScheme.surface) .padding(start = 32.dp, top = 92.dp, end = 32.dp, bottom = 32.dp) ) { Crossfade( Loading Loading @@ -178,6 +191,7 @@ private fun BouncerScene( } } } } interface BouncerSceneDialogFactory { operator fun invoke(): AlertDialog Loading packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt +9 −1 Original line number Diff line number Diff line Loading @@ -31,9 +31,17 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.SceneScope object Notifications { object Elements { val Notifications = ElementKey("Notifications") } } @Composable fun Notifications( fun SceneScope.Notifications( modifier: Modifier = Modifier, ) { // TODO(b/272779828): implement. Loading Loading
packages/SystemUI/compose/core/src/com/android/compose/animation/scene/Key.kt +8 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,14 @@ sealed class Key(val name: String, val identity: Any) { } /** Key for a scene. */ class SceneKey(name: String, identity: Any = Object()) : Key(name, identity) { class SceneKey( name: String, identity: Any = Object(), ) : Key(name, identity) { /** The unique [ElementKey] identifying this scene's root element. */ val rootElementKey = ElementKey(name, identity) override fun toString(): String { return "SceneKey(name=$name)" } Loading
packages/SystemUI/compose/core/src/com/android/compose/animation/scene/SceneTransitions.kt +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import com.android.compose.ui.util.fastMap /** The transitions configuration of a [SceneTransitionLayout]. */ class SceneTransitions( val transitionSpecs: List<TransitionSpec>, private val transitionSpecs: List<TransitionSpec>, ) { private val cache = mutableMapOf<SceneKey, MutableMap<SceneKey, TransitionSpec>>() Loading
packages/SystemUI/compose/core/src/com/android/compose/animation/scene/TransitionDslImpl.kt +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ private class SceneTransitionsBuilderImpl : SceneTransitionsBuilder { } } private class TransitionBuilderImpl : TransitionBuilder { internal class TransitionBuilderImpl : TransitionBuilder { val transformations = mutableListOf<Transformation>() override var spec: AnimationSpec<Float> = spring(stiffness = Spring.StiffnessLow) Loading
packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt +86 −72 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ import android.content.DialogInterface import androidx.compose.animation.Crossfade import androidx.compose.animation.core.snap import androidx.compose.animation.core.tween import androidx.compose.foundation.background import androidx.compose.foundation.Canvas import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column Loading @@ -46,6 +46,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.SceneScope import com.android.systemui.R import com.android.systemui.bouncer.ui.viewmodel.AuthMethodBouncerViewModel Loading @@ -63,6 +64,13 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow object Bouncer { object Elements { val Background = ElementKey("BouncerBackground") val Content = ElementKey("BouncerContent") } } /** The bouncer scene displays authentication challenges like PIN, password, or pattern. */ @SysUISingleton class BouncerScene Loading @@ -88,7 +96,7 @@ constructor( } @Composable private fun BouncerScene( private fun SceneScope.BouncerScene( viewModel: BouncerViewModel, dialogFactory: BouncerSceneDialogFactory, modifier: Modifier = Modifier, Loading @@ -97,14 +105,19 @@ private fun BouncerScene( val authMethodViewModel: AuthMethodBouncerViewModel? by viewModel.authMethod.collectAsState() val dialogMessage: String? by viewModel.throttlingDialogMessage.collectAsState() var dialog: Dialog? by remember { mutableStateOf(null) } val backgroundColor = MaterialTheme.colorScheme.surface Box(modifier) { Canvas(Modifier.element(Bouncer.Elements.Background).fillMaxSize()) { drawRect(color = backgroundColor) } Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(60.dp), modifier = modifier Modifier.element(Bouncer.Elements.Content) .fillMaxSize() .background(MaterialTheme.colorScheme.surface) .padding(start = 32.dp, top = 92.dp, end = 32.dp, bottom = 32.dp) ) { Crossfade( Loading Loading @@ -178,6 +191,7 @@ private fun BouncerScene( } } } } interface BouncerSceneDialogFactory { operator fun invoke(): AlertDialog Loading
packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt +9 −1 Original line number Diff line number Diff line Loading @@ -31,9 +31,17 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.SceneScope object Notifications { object Elements { val Notifications = ElementKey("Notifications") } } @Composable fun Notifications( fun SceneScope.Notifications( modifier: Modifier = Modifier, ) { // TODO(b/272779828): implement. Loading