Loading packages/SystemUI/compose/core/src/com/android/compose/modifiers/FadingBackground.kt +3 −7 Original line number Diff line number Diff line Loading @@ -39,11 +39,7 @@ import androidx.compose.ui.unit.LayoutDirection * @param alpha alpha of the background * @param shape desired shape of the background */ fun Modifier.background( color: Color, alpha: () -> Float, shape: Shape = RectangleShape, ) = fun Modifier.fadingBackground(color: Color, alpha: () -> Float, shape: Shape = RectangleShape) = this.then( FadingBackground( brush = SolidColor(color), Loading @@ -56,7 +52,7 @@ fun Modifier.background( properties["color"] = color properties["alpha"] = alpha properties["shape"] = shape } }, ) ) Loading @@ -65,7 +61,7 @@ constructor( private val brush: Brush, private val shape: Shape, private val alpha: () -> Float, inspectorInfo: InspectorInfo.() -> Unit inspectorInfo: InspectorInfo.() -> Unit, ) : DrawModifier, InspectorValueInfo(inspectorInfo) { // naive cache outline calculation if size is the same private var lastSize: Size? = null Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/AlternateBouncer.kt +8 −16 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import androidx.compose.animation.Crossfade import androidx.compose.animation.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.background import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxHeight Loading @@ -40,7 +41,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.viewinterop.AndroidView import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.compose.modifiers.background import com.android.compose.modifiers.height import com.android.compose.modifiers.width import com.android.systemui.deviceentry.shared.model.BiometricMessage Loading Loading @@ -82,16 +82,13 @@ fun AlternateBouncer( Box( contentAlignment = Alignment.TopCenter, modifier = Modifier.background(color = Colors.AlternateBouncerBackgroundColor, alpha = { 1f }) .pointerInput(Unit) { detectTapGestures( onTap = { alternateBouncerDependencies.viewModel.onTapped() } ) Modifier.background(color = Colors.AlternateBouncerBackgroundColor).pointerInput( Unit ) { detectTapGestures(onTap = { alternateBouncerDependencies.viewModel.onTapped() }) }, ) { StatusMessage( viewModel = alternateBouncerDependencies.messageAreaViewModel, ) StatusMessage(viewModel = alternateBouncerDependencies.messageAreaViewModel) } udfpsIconLocation?.let { udfpsLocation -> Loading @@ -103,12 +100,7 @@ fun AlternateBouncer( Modifier.width { udfpsLocation.width } .height { udfpsLocation.height } .fillMaxHeight() .offset { IntOffset( x = udfpsLocation.left, y = udfpsLocation.top, ) }, .offset { IntOffset(x = udfpsLocation.left, y = udfpsLocation.top) }, ) } Loading packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt +10 −32 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.compose.animation.Expandable import com.android.compose.animation.scene.SceneScope import com.android.compose.modifiers.background import com.android.compose.modifiers.fadingBackground import com.android.compose.theme.colorAttr import com.android.systemui.animation.Expandable import com.android.systemui.common.shared.model.Icon Loading Loading @@ -107,7 +107,7 @@ fun SceneScope.FooterActionsWithAnimatedVisibility( animationSpec = tween(customizingAnimationDuration), targetHeight = { 0 }, ) + fadeOut(tween(customizingAnimationDuration)), modifier = modifier.fillMaxWidth() modifier = modifier.fillMaxWidth(), ) { QuickSettingsTheme { // This view has its own horizontal padding Loading Loading @@ -165,12 +165,8 @@ fun FooterActions( val contentColor = MaterialTheme.colorScheme.onSurface val backgroundTopRadius = dimensionResource(R.dimen.qs_corner_radius) val backgroundModifier = remember( backgroundColor, backgroundAlpha, backgroundTopRadius, ) { Modifier.background( remember(backgroundColor, backgroundAlpha, backgroundTopRadius) { Modifier.fadingBackground( backgroundColor, backgroundAlpha::value, RoundedCornerShape(topStart = backgroundTopRadius, topEnd = backgroundTopRadius), Loading Loading @@ -210,9 +206,7 @@ fun FooterActions( }, verticalAlignment = Alignment.CenterVertically, ) { CompositionLocalProvider( LocalContentColor provides contentColor, ) { CompositionLocalProvider(LocalContentColor provides contentColor) { if (security == null && foregroundServices == null) { Spacer(Modifier.weight(1f)) } Loading @@ -238,19 +232,13 @@ private fun SecurityButton( { expandable -> onClick(context, expandable) } } TextButton( model.icon, model.text, showNewDot = false, onClick = onClick, modifier, ) TextButton(model.icon, model.text, showNewDot = false, onClick = onClick, modifier) } /** The foreground services button. */ @Composable private fun RowScope.ForegroundServicesButton( model: FooterActionsForegroundServicesButtonViewModel, model: FooterActionsForegroundServicesButtonViewModel ) { if (model.displayText) { TextButton( Loading @@ -271,10 +259,7 @@ private fun RowScope.ForegroundServicesButton( /** A button with an icon. */ @Composable private fun IconButton( model: FooterActionsButtonViewModel, modifier: Modifier = Modifier, ) { private fun IconButton(model: FooterActionsButtonViewModel, modifier: Modifier = Modifier) { Expandable( color = colorAttr(model.backgroundColor), shape = CircleShape, Loading @@ -282,11 +267,7 @@ private fun IconButton( modifier = modifier, ) { val tint = model.iconTint?.let { Color(it) } ?: Color.Unspecified Icon( model.icon, tint = tint, modifier = Modifier.size(20.dp), ) Icon(model.icon, tint = tint, modifier = Modifier.size(20.dp)) } } Loading Loading @@ -316,10 +297,7 @@ private fun NumberButton( Box( Modifier.fillMaxSize() .clip(CircleShape) .indication( interactionSource, LocalIndication.current, ) .indication(interactionSource, LocalIndication.current) ) { Text( number.toString(), Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/CommonTile.kt +2 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import androidx.compose.animation.graphics.res.animatedVectorResource import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter import androidx.compose.animation.graphics.vector.AnimatedImageVector import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box Loading Loading @@ -57,7 +58,6 @@ import androidx.compose.ui.semantics.stateDescription import androidx.compose.ui.semantics.toggleableState import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.android.compose.modifiers.background import com.android.compose.modifiers.thenIf import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.ui.compose.Icon Loading Loading @@ -92,7 +92,7 @@ fun LargeTileContent( Modifier.size(CommonTileDefaults.ToggleTargetSize).thenIf(toggleClick != null) { Modifier.clip(iconShape) .verticalSquish(squishiness) .background(colors.iconBackground, { 1f }) .background(colors.iconBackground) .combinedClickable( onClick = toggleClick!!, onLongClick = onLongClick, Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/EditTile.kt +4 −3 Original line number Diff line number Diff line Loading @@ -104,7 +104,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.util.fastMap import com.android.compose.animation.bounceable import com.android.compose.modifiers.background import com.android.compose.modifiers.height import com.android.systemui.common.ui.compose.load import com.android.systemui.qs.panels.shared.model.SizedTile Loading Loading @@ -435,8 +434,10 @@ fun LazyGridScope.EditTiles( // If the tile is being moved, replace it with a visible spacer SpacerGridCell( Modifier.background( color = MaterialTheme.colorScheme.secondary, alpha = { EditModeTileDefaults.PLACEHOLDER_ALPHA }, color = MaterialTheme.colorScheme.secondary.copy( alpha = EditModeTileDefaults.PLACEHOLDER_ALPHA ), shape = RoundedCornerShape(InactiveCornerRadius), ) .animateItem() Loading Loading
packages/SystemUI/compose/core/src/com/android/compose/modifiers/FadingBackground.kt +3 −7 Original line number Diff line number Diff line Loading @@ -39,11 +39,7 @@ import androidx.compose.ui.unit.LayoutDirection * @param alpha alpha of the background * @param shape desired shape of the background */ fun Modifier.background( color: Color, alpha: () -> Float, shape: Shape = RectangleShape, ) = fun Modifier.fadingBackground(color: Color, alpha: () -> Float, shape: Shape = RectangleShape) = this.then( FadingBackground( brush = SolidColor(color), Loading @@ -56,7 +52,7 @@ fun Modifier.background( properties["color"] = color properties["alpha"] = alpha properties["shape"] = shape } }, ) ) Loading @@ -65,7 +61,7 @@ constructor( private val brush: Brush, private val shape: Shape, private val alpha: () -> Float, inspectorInfo: InspectorInfo.() -> Unit inspectorInfo: InspectorInfo.() -> Unit, ) : DrawModifier, InspectorValueInfo(inspectorInfo) { // naive cache outline calculation if size is the same private var lastSize: Size? = null Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/AlternateBouncer.kt +8 −16 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import androidx.compose.animation.Crossfade import androidx.compose.animation.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.background import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxHeight Loading @@ -40,7 +41,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.viewinterop.AndroidView import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.compose.modifiers.background import com.android.compose.modifiers.height import com.android.compose.modifiers.width import com.android.systemui.deviceentry.shared.model.BiometricMessage Loading Loading @@ -82,16 +82,13 @@ fun AlternateBouncer( Box( contentAlignment = Alignment.TopCenter, modifier = Modifier.background(color = Colors.AlternateBouncerBackgroundColor, alpha = { 1f }) .pointerInput(Unit) { detectTapGestures( onTap = { alternateBouncerDependencies.viewModel.onTapped() } ) Modifier.background(color = Colors.AlternateBouncerBackgroundColor).pointerInput( Unit ) { detectTapGestures(onTap = { alternateBouncerDependencies.viewModel.onTapped() }) }, ) { StatusMessage( viewModel = alternateBouncerDependencies.messageAreaViewModel, ) StatusMessage(viewModel = alternateBouncerDependencies.messageAreaViewModel) } udfpsIconLocation?.let { udfpsLocation -> Loading @@ -103,12 +100,7 @@ fun AlternateBouncer( Modifier.width { udfpsLocation.width } .height { udfpsLocation.height } .fillMaxHeight() .offset { IntOffset( x = udfpsLocation.left, y = udfpsLocation.top, ) }, .offset { IntOffset(x = udfpsLocation.left, y = udfpsLocation.top) }, ) } Loading
packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt +10 −32 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.compose.animation.Expandable import com.android.compose.animation.scene.SceneScope import com.android.compose.modifiers.background import com.android.compose.modifiers.fadingBackground import com.android.compose.theme.colorAttr import com.android.systemui.animation.Expandable import com.android.systemui.common.shared.model.Icon Loading Loading @@ -107,7 +107,7 @@ fun SceneScope.FooterActionsWithAnimatedVisibility( animationSpec = tween(customizingAnimationDuration), targetHeight = { 0 }, ) + fadeOut(tween(customizingAnimationDuration)), modifier = modifier.fillMaxWidth() modifier = modifier.fillMaxWidth(), ) { QuickSettingsTheme { // This view has its own horizontal padding Loading Loading @@ -165,12 +165,8 @@ fun FooterActions( val contentColor = MaterialTheme.colorScheme.onSurface val backgroundTopRadius = dimensionResource(R.dimen.qs_corner_radius) val backgroundModifier = remember( backgroundColor, backgroundAlpha, backgroundTopRadius, ) { Modifier.background( remember(backgroundColor, backgroundAlpha, backgroundTopRadius) { Modifier.fadingBackground( backgroundColor, backgroundAlpha::value, RoundedCornerShape(topStart = backgroundTopRadius, topEnd = backgroundTopRadius), Loading Loading @@ -210,9 +206,7 @@ fun FooterActions( }, verticalAlignment = Alignment.CenterVertically, ) { CompositionLocalProvider( LocalContentColor provides contentColor, ) { CompositionLocalProvider(LocalContentColor provides contentColor) { if (security == null && foregroundServices == null) { Spacer(Modifier.weight(1f)) } Loading @@ -238,19 +232,13 @@ private fun SecurityButton( { expandable -> onClick(context, expandable) } } TextButton( model.icon, model.text, showNewDot = false, onClick = onClick, modifier, ) TextButton(model.icon, model.text, showNewDot = false, onClick = onClick, modifier) } /** The foreground services button. */ @Composable private fun RowScope.ForegroundServicesButton( model: FooterActionsForegroundServicesButtonViewModel, model: FooterActionsForegroundServicesButtonViewModel ) { if (model.displayText) { TextButton( Loading @@ -271,10 +259,7 @@ private fun RowScope.ForegroundServicesButton( /** A button with an icon. */ @Composable private fun IconButton( model: FooterActionsButtonViewModel, modifier: Modifier = Modifier, ) { private fun IconButton(model: FooterActionsButtonViewModel, modifier: Modifier = Modifier) { Expandable( color = colorAttr(model.backgroundColor), shape = CircleShape, Loading @@ -282,11 +267,7 @@ private fun IconButton( modifier = modifier, ) { val tint = model.iconTint?.let { Color(it) } ?: Color.Unspecified Icon( model.icon, tint = tint, modifier = Modifier.size(20.dp), ) Icon(model.icon, tint = tint, modifier = Modifier.size(20.dp)) } } Loading Loading @@ -316,10 +297,7 @@ private fun NumberButton( Box( Modifier.fillMaxSize() .clip(CircleShape) .indication( interactionSource, LocalIndication.current, ) .indication(interactionSource, LocalIndication.current) ) { Text( number.toString(), Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/CommonTile.kt +2 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import androidx.compose.animation.graphics.res.animatedVectorResource import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter import androidx.compose.animation.graphics.vector.AnimatedImageVector import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box Loading Loading @@ -57,7 +58,6 @@ import androidx.compose.ui.semantics.stateDescription import androidx.compose.ui.semantics.toggleableState import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.android.compose.modifiers.background import com.android.compose.modifiers.thenIf import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.ui.compose.Icon Loading Loading @@ -92,7 +92,7 @@ fun LargeTileContent( Modifier.size(CommonTileDefaults.ToggleTargetSize).thenIf(toggleClick != null) { Modifier.clip(iconShape) .verticalSquish(squishiness) .background(colors.iconBackground, { 1f }) .background(colors.iconBackground) .combinedClickable( onClick = toggleClick!!, onLongClick = onLongClick, Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/EditTile.kt +4 −3 Original line number Diff line number Diff line Loading @@ -104,7 +104,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.util.fastMap import com.android.compose.animation.bounceable import com.android.compose.modifiers.background import com.android.compose.modifiers.height import com.android.systemui.common.ui.compose.load import com.android.systemui.qs.panels.shared.model.SizedTile Loading Loading @@ -435,8 +434,10 @@ fun LazyGridScope.EditTiles( // If the tile is being moved, replace it with a visible spacer SpacerGridCell( Modifier.background( color = MaterialTheme.colorScheme.secondary, alpha = { EditModeTileDefaults.PLACEHOLDER_ALPHA }, color = MaterialTheme.colorScheme.secondary.copy( alpha = EditModeTileDefaults.PLACEHOLDER_ALPHA ), shape = RoundedCornerShape(InactiveCornerRadius), ) .animateItem() Loading