Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/QuickQuickSettings.kt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -82,6 +82,7 @@ fun ContentScope.QuickQuickSettings( viewModel.tileHapticsViewModelFactoryProvider, viewModel.tileHapticsViewModelFactoryProvider, // There should be no QuickQuickSettings when the details view is enabled. // There should be no QuickQuickSettings when the details view is enabled. detailsViewModel = null, detailsViewModel = null, isVisible = listening, ) ) } } } } Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/CommonTile.kt +38 −18 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,7 @@ import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue import androidx.compose.runtime.key import androidx.compose.runtime.key import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue Loading Loading @@ -102,6 +103,7 @@ fun LargeTileContent( sideDrawable: Drawable?, sideDrawable: Drawable?, colors: TileColors, colors: TileColors, squishiness: () -> Float, squishiness: () -> Float, isVisible: () -> Boolean = { true }, accessibilityUiState: AccessibilityUiState? = null, accessibilityUiState: AccessibilityUiState? = null, iconShape: RoundedCornerShape = RoundedCornerShape(CommonTileDefaults.InactiveCornerRadius), iconShape: RoundedCornerShape = RoundedCornerShape(CommonTileDefaults.InactiveCornerRadius), toggleClick: (() -> Unit)? = null, toggleClick: (() -> Unit)? = null, Loading Loading @@ -158,6 +160,7 @@ fun LargeTileContent( secondaryLabel = secondaryLabel, secondaryLabel = secondaryLabel, colors = colors, colors = colors, accessibilityUiState = accessibilityUiState, accessibilityUiState = accessibilityUiState, isVisible = isVisible, ) ) if (sideDrawable != null) { if (sideDrawable != null) { Loading @@ -176,6 +179,7 @@ fun LargeTileLabels( secondaryLabel: String?, secondaryLabel: String?, colors: TileColors, colors: TileColors, modifier: Modifier = Modifier, modifier: Modifier = Modifier, isVisible: () -> Boolean = { true }, accessibilityUiState: AccessibilityUiState? = null, accessibilityUiState: AccessibilityUiState? = null, ) { ) { val animatedLabelColor by animateColorAsState(colors.label, label = "QSTileLabelColor") val animatedLabelColor by animateColorAsState(colors.label, label = "QSTileLabelColor") Loading @@ -186,12 +190,14 @@ fun LargeTileLabels( text = label, text = label, style = MaterialTheme.typography.labelLarge, style = MaterialTheme.typography.labelLarge, color = { animatedLabelColor }, color = { animatedLabelColor }, isVisible = isVisible, ) ) if (!TextUtils.isEmpty(secondaryLabel)) { if (!TextUtils.isEmpty(secondaryLabel)) { TileLabel( TileLabel( secondaryLabel ?: "", secondaryLabel ?: "", color = { animatedSecondaryLabelColor }, color = { animatedSecondaryLabelColor }, style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium, isVisible = isVisible, modifier = modifier = Modifier.thenIf( Modifier.thenIf( accessibilityUiState?.stateDescription?.contains(secondaryLabel ?: "") == accessibilityUiState?.stateDescription?.contains(secondaryLabel ?: "") == Loading Loading @@ -277,18 +283,27 @@ private fun TileLabel( color: ColorProducer, color: ColorProducer, style: TextStyle, style: TextStyle, modifier: Modifier = Modifier, modifier: Modifier = Modifier, isVisible: () -> Boolean = { true }, ) { ) { var textSize by remember { mutableIntStateOf(0) } BasicText( BasicText( text = text, text = text, color = color, color = color, style = style, style = style, maxLines = 1, maxLines = 1, onTextLayout = { textSize = it.size.width }, modifier = modifier = modifier modifier .fillMaxWidth() .fillMaxWidth() .graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen } .graphicsLayer { if (textSize > size.width) { compositingStrategy = CompositingStrategy.Offscreen } } .drawWithContent { .drawWithContent { drawContent() drawContent() if (textSize > size.width) { // Draw a blur over the end of the text // Draw a blur over the end of the text val edgeWidthPx = TileLabelBlurWidth.toPx() val edgeWidthPx = TileLabelBlurWidth.toPx() drawRect( drawRect( Loading @@ -303,10 +318,15 @@ private fun TileLabel( blendMode = BlendMode.DstIn, blendMode = BlendMode.DstIn, ) ) } } .basicMarquee( } .thenIf(isVisible()) { // Only apply the marquee when the label is visible, which is needed for the // always composed QS Modifier.basicMarquee( iterations = TILE_MARQUEE_ITERATIONS, iterations = TILE_MARQUEE_ITERATIONS, initialDelayMillis = TILE_INITIAL_DELAY_MILLIS, initialDelayMillis = TILE_INITIAL_DELAY_MILLIS, ), ) }, ) ) } } Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/InfiniteGridLayout.kt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -119,6 +119,7 @@ constructor( isLastInRow = isLastInColumn, isLastInRow = isLastInColumn, ), ), detailsViewModel = detailsViewModel, detailsViewModel = detailsViewModel, isVisible = listening, ) ) } } } } Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/Tile.kt +2 −0 Original line number Original line Diff line number Diff line Loading @@ -139,6 +139,7 @@ fun Tile( bounceableInfo: BounceableInfo, bounceableInfo: BounceableInfo, tileHapticsViewModelFactoryProvider: TileHapticsViewModelFactoryProvider, tileHapticsViewModelFactoryProvider: TileHapticsViewModelFactoryProvider, modifier: Modifier = Modifier, modifier: Modifier = Modifier, isVisible: () -> Boolean = { true }, detailsViewModel: DetailsViewModel?, detailsViewModel: DetailsViewModel?, ) { ) { trace(tile.traceName) { trace(tile.traceName) { Loading Loading @@ -249,6 +250,7 @@ fun Tile( onLongClick = longClick, onLongClick = longClick, accessibilityUiState = uiState.accessibilityUiState, accessibilityUiState = uiState.accessibilityUiState, squishiness = squishiness, squishiness = squishiness, isVisible = isVisible, ) ) } } } } Loading Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/QuickQuickSettings.kt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -82,6 +82,7 @@ fun ContentScope.QuickQuickSettings( viewModel.tileHapticsViewModelFactoryProvider, viewModel.tileHapticsViewModelFactoryProvider, // There should be no QuickQuickSettings when the details view is enabled. // There should be no QuickQuickSettings when the details view is enabled. detailsViewModel = null, detailsViewModel = null, isVisible = listening, ) ) } } } } Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/CommonTile.kt +38 −18 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,7 @@ import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue import androidx.compose.runtime.key import androidx.compose.runtime.key import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue Loading Loading @@ -102,6 +103,7 @@ fun LargeTileContent( sideDrawable: Drawable?, sideDrawable: Drawable?, colors: TileColors, colors: TileColors, squishiness: () -> Float, squishiness: () -> Float, isVisible: () -> Boolean = { true }, accessibilityUiState: AccessibilityUiState? = null, accessibilityUiState: AccessibilityUiState? = null, iconShape: RoundedCornerShape = RoundedCornerShape(CommonTileDefaults.InactiveCornerRadius), iconShape: RoundedCornerShape = RoundedCornerShape(CommonTileDefaults.InactiveCornerRadius), toggleClick: (() -> Unit)? = null, toggleClick: (() -> Unit)? = null, Loading Loading @@ -158,6 +160,7 @@ fun LargeTileContent( secondaryLabel = secondaryLabel, secondaryLabel = secondaryLabel, colors = colors, colors = colors, accessibilityUiState = accessibilityUiState, accessibilityUiState = accessibilityUiState, isVisible = isVisible, ) ) if (sideDrawable != null) { if (sideDrawable != null) { Loading @@ -176,6 +179,7 @@ fun LargeTileLabels( secondaryLabel: String?, secondaryLabel: String?, colors: TileColors, colors: TileColors, modifier: Modifier = Modifier, modifier: Modifier = Modifier, isVisible: () -> Boolean = { true }, accessibilityUiState: AccessibilityUiState? = null, accessibilityUiState: AccessibilityUiState? = null, ) { ) { val animatedLabelColor by animateColorAsState(colors.label, label = "QSTileLabelColor") val animatedLabelColor by animateColorAsState(colors.label, label = "QSTileLabelColor") Loading @@ -186,12 +190,14 @@ fun LargeTileLabels( text = label, text = label, style = MaterialTheme.typography.labelLarge, style = MaterialTheme.typography.labelLarge, color = { animatedLabelColor }, color = { animatedLabelColor }, isVisible = isVisible, ) ) if (!TextUtils.isEmpty(secondaryLabel)) { if (!TextUtils.isEmpty(secondaryLabel)) { TileLabel( TileLabel( secondaryLabel ?: "", secondaryLabel ?: "", color = { animatedSecondaryLabelColor }, color = { animatedSecondaryLabelColor }, style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium, isVisible = isVisible, modifier = modifier = Modifier.thenIf( Modifier.thenIf( accessibilityUiState?.stateDescription?.contains(secondaryLabel ?: "") == accessibilityUiState?.stateDescription?.contains(secondaryLabel ?: "") == Loading Loading @@ -277,18 +283,27 @@ private fun TileLabel( color: ColorProducer, color: ColorProducer, style: TextStyle, style: TextStyle, modifier: Modifier = Modifier, modifier: Modifier = Modifier, isVisible: () -> Boolean = { true }, ) { ) { var textSize by remember { mutableIntStateOf(0) } BasicText( BasicText( text = text, text = text, color = color, color = color, style = style, style = style, maxLines = 1, maxLines = 1, onTextLayout = { textSize = it.size.width }, modifier = modifier = modifier modifier .fillMaxWidth() .fillMaxWidth() .graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen } .graphicsLayer { if (textSize > size.width) { compositingStrategy = CompositingStrategy.Offscreen } } .drawWithContent { .drawWithContent { drawContent() drawContent() if (textSize > size.width) { // Draw a blur over the end of the text // Draw a blur over the end of the text val edgeWidthPx = TileLabelBlurWidth.toPx() val edgeWidthPx = TileLabelBlurWidth.toPx() drawRect( drawRect( Loading @@ -303,10 +318,15 @@ private fun TileLabel( blendMode = BlendMode.DstIn, blendMode = BlendMode.DstIn, ) ) } } .basicMarquee( } .thenIf(isVisible()) { // Only apply the marquee when the label is visible, which is needed for the // always composed QS Modifier.basicMarquee( iterations = TILE_MARQUEE_ITERATIONS, iterations = TILE_MARQUEE_ITERATIONS, initialDelayMillis = TILE_INITIAL_DELAY_MILLIS, initialDelayMillis = TILE_INITIAL_DELAY_MILLIS, ), ) }, ) ) } } Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/InfiniteGridLayout.kt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -119,6 +119,7 @@ constructor( isLastInRow = isLastInColumn, isLastInRow = isLastInColumn, ), ), detailsViewModel = detailsViewModel, detailsViewModel = detailsViewModel, isVisible = listening, ) ) } } } } Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/Tile.kt +2 −0 Original line number Original line Diff line number Diff line Loading @@ -139,6 +139,7 @@ fun Tile( bounceableInfo: BounceableInfo, bounceableInfo: BounceableInfo, tileHapticsViewModelFactoryProvider: TileHapticsViewModelFactoryProvider, tileHapticsViewModelFactoryProvider: TileHapticsViewModelFactoryProvider, modifier: Modifier = Modifier, modifier: Modifier = Modifier, isVisible: () -> Boolean = { true }, detailsViewModel: DetailsViewModel?, detailsViewModel: DetailsViewModel?, ) { ) { trace(tile.traceName) { trace(tile.traceName) { Loading Loading @@ -249,6 +250,7 @@ fun Tile( onLongClick = longClick, onLongClick = longClick, accessibilityUiState = uiState.accessibilityUiState, accessibilityUiState = uiState.accessibilityUiState, squishiness = squishiness, squishiness = squishiness, isVisible = isVisible, ) ) } } } } Loading