Loading packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt +11 −17 Original line number Diff line number Diff line Loading @@ -41,8 +41,6 @@ import androidx.compose.ui.geometry.Rect import androidx.compose.ui.geometry.Size import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.layout.boundsInWindow import androidx.compose.ui.layout.onPlaced import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle Loading Loading @@ -86,6 +84,7 @@ import com.android.systemui.statusbar.notification.stack.ui.viewmodel.Notificati import com.android.systemui.volume.panel.component.volume.ui.composable.VolumeSlider import dagger.Lazy import javax.inject.Inject import kotlin.math.roundToInt import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.Flow Loading Loading @@ -135,8 +134,6 @@ constructor( notificationsPlaceholderViewModelFactory.create() } val panelCornerRadius = with(LocalDensity.current) { OverlayShade.Dimensions.PanelCornerRadius.toPx().toInt() } val showBrightnessMirror = quickSettingsContainerViewModel.brightnessSliderViewModel.showMirror val contentAlphaFromBrightnessMirror by Loading @@ -151,6 +148,15 @@ constructor( alignmentOnWideScreens = Alignment.TopEnd, enableTransparency = quickSettingsContainerViewModel.isTransparencyEnabled, onScrimClicked = contentViewModel::onScrimClicked, onBackgroundPlaced = { bounds, topCornerRadius, bottomCornerRadius -> contentViewModel.onPanelShapeChanged( ShadeScrimShape( bounds = ShadeScrimBounds(bounds), topRadius = topCornerRadius.roundToInt(), bottomRadius = bottomCornerRadius.roundToInt(), ) ) }, header = { OverlayShadeHeader( viewModel = quickSettingsContainerViewModel.shadeHeaderViewModel, Loading @@ -161,19 +167,7 @@ constructor( ) }, ) { QuickSettingsContainer( viewModel = quickSettingsContainerViewModel, modifier = Modifier.onPlaced { coordinates -> val shape = ShadeScrimShape( bounds = ShadeScrimBounds(coordinates.boundsInWindow()), topRadius = 0, bottomRadius = panelCornerRadius, ) contentViewModel.onPanelShapeChanged(shape) }, ) QuickSettingsContainer(viewModel = quickSettingsContainerViewModel) } SnoozeableHeadsUpNotificationSpace( stackScrollView = notificationStackScrollView.get(), Loading packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt +26 −2 Original line number Diff line number Diff line Loading @@ -35,8 +35,12 @@ import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Rect import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.boundsInWindow import androidx.compose.ui.layout.onPlaced import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import com.android.compose.animation.scene.ContentScope Loading @@ -50,6 +54,7 @@ import com.android.systemui.res.R import com.android.systemui.shade.ui.ShadeColors.shadePanel import com.android.systemui.shade.ui.ShadeColors.shadePanelScrimBehind import com.android.systemui.shade.ui.composable.OverlayShade.rememberShadeExpansionMotion import kotlin.math.min /** Renders a lightweight shade UI container, as an overlay. */ @Composable Loading @@ -59,10 +64,15 @@ fun ContentScope.OverlayShade( enableTransparency: Boolean, onScrimClicked: () -> Unit, modifier: Modifier = Modifier, onBackgroundPlaced: (bounds: Rect, topCornerRadius: Float, bottomCornerRadius: Float) -> Unit = { _, _, _ -> }, header: @Composable () -> Unit, content: @Composable () -> Unit, ) { val isFullWidth = isFullWidthShade() val panelSpec = rememberShadeExpansionMotion(isFullWidth) val panelCornerRadiusPx = with(LocalDensity.current) { panelSpec.radius.toPx() } Box(modifier) { Scrim(showBackgroundColor = enableTransparency, onClicked = onScrimClicked) Loading @@ -72,10 +82,23 @@ fun ContentScope.OverlayShade( ) { Panel( enableTransparency = enableTransparency, spec = panelSpec, modifier = Modifier.overscroll(verticalOverscrollEffect) .element(panelElement) .panelWidth(isFullWidth), .panelWidth(isFullWidth) .onPlaced { coordinates -> val bounds = coordinates.boundsInWindow() val isTopRounded = panelSpec.isFloating val bottomCornerRadius: Float = if (isTopRounded) { min(panelCornerRadiusPx, bounds.height / 2) } else { min(panelCornerRadiusPx, bounds.height) } val topCornerRadius = if (isTopRounded) bottomCornerRadius else 0f onBackgroundPlaced(bounds, topCornerRadius, bottomCornerRadius) }, header = header.takeIf { isFullWidth }, content = content, ) Loading Loading @@ -107,6 +130,7 @@ private fun ContentScope.Scrim( @Composable private fun ContentScope.Panel( enableTransparency: Boolean, spec: VerticalExpandContainerSpec, modifier: Modifier = Modifier, header: (@Composable () -> Unit)?, content: @Composable () -> Unit, Loading @@ -117,7 +141,7 @@ private fun ContentScope.Panel( .disableSwipesWhenScrolling() .verticalExpandContainerBackground( backgroundColor = OverlayShade.Colors.panelBackground(enableTransparency), spec = rememberShadeExpansionMotion(isFullWidthShade()), spec = spec, ) ) { Column { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +3 −1 Original line number Diff line number Diff line Loading @@ -5992,10 +5992,12 @@ public class NotificationStackScrollLayout mNegativeRoundedClipPath.reset(); if (shape != null) { ShadeScrimBounds bounds = shape.getBounds(); float topRadius = shape.getTopRadius(); float bottomRadius = shape.getBottomRadius(); mNegativeRoundedClipPath.addRoundRect( bounds.getLeft(), bounds.getTop(), bounds.getRight(), bounds.getBottom(), new float[]{0, 0, 0, 0, bottomRadius, bottomRadius, bottomRadius, bottomRadius}, new float[]{topRadius, topRadius, topRadius, topRadius, bottomRadius, bottomRadius, bottomRadius, bottomRadius}, Path.Direction.CW); } invalidate(); Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt +11 −17 Original line number Diff line number Diff line Loading @@ -41,8 +41,6 @@ import androidx.compose.ui.geometry.Rect import androidx.compose.ui.geometry.Size import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.layout.boundsInWindow import androidx.compose.ui.layout.onPlaced import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle Loading Loading @@ -86,6 +84,7 @@ import com.android.systemui.statusbar.notification.stack.ui.viewmodel.Notificati import com.android.systemui.volume.panel.component.volume.ui.composable.VolumeSlider import dagger.Lazy import javax.inject.Inject import kotlin.math.roundToInt import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.Flow Loading Loading @@ -135,8 +134,6 @@ constructor( notificationsPlaceholderViewModelFactory.create() } val panelCornerRadius = with(LocalDensity.current) { OverlayShade.Dimensions.PanelCornerRadius.toPx().toInt() } val showBrightnessMirror = quickSettingsContainerViewModel.brightnessSliderViewModel.showMirror val contentAlphaFromBrightnessMirror by Loading @@ -151,6 +148,15 @@ constructor( alignmentOnWideScreens = Alignment.TopEnd, enableTransparency = quickSettingsContainerViewModel.isTransparencyEnabled, onScrimClicked = contentViewModel::onScrimClicked, onBackgroundPlaced = { bounds, topCornerRadius, bottomCornerRadius -> contentViewModel.onPanelShapeChanged( ShadeScrimShape( bounds = ShadeScrimBounds(bounds), topRadius = topCornerRadius.roundToInt(), bottomRadius = bottomCornerRadius.roundToInt(), ) ) }, header = { OverlayShadeHeader( viewModel = quickSettingsContainerViewModel.shadeHeaderViewModel, Loading @@ -161,19 +167,7 @@ constructor( ) }, ) { QuickSettingsContainer( viewModel = quickSettingsContainerViewModel, modifier = Modifier.onPlaced { coordinates -> val shape = ShadeScrimShape( bounds = ShadeScrimBounds(coordinates.boundsInWindow()), topRadius = 0, bottomRadius = panelCornerRadius, ) contentViewModel.onPanelShapeChanged(shape) }, ) QuickSettingsContainer(viewModel = quickSettingsContainerViewModel) } SnoozeableHeadsUpNotificationSpace( stackScrollView = notificationStackScrollView.get(), Loading
packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/OverlayShade.kt +26 −2 Original line number Diff line number Diff line Loading @@ -35,8 +35,12 @@ import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Rect import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.boundsInWindow import androidx.compose.ui.layout.onPlaced import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.unit.Dp import com.android.compose.animation.scene.ContentScope Loading @@ -50,6 +54,7 @@ import com.android.systemui.res.R import com.android.systemui.shade.ui.ShadeColors.shadePanel import com.android.systemui.shade.ui.ShadeColors.shadePanelScrimBehind import com.android.systemui.shade.ui.composable.OverlayShade.rememberShadeExpansionMotion import kotlin.math.min /** Renders a lightweight shade UI container, as an overlay. */ @Composable Loading @@ -59,10 +64,15 @@ fun ContentScope.OverlayShade( enableTransparency: Boolean, onScrimClicked: () -> Unit, modifier: Modifier = Modifier, onBackgroundPlaced: (bounds: Rect, topCornerRadius: Float, bottomCornerRadius: Float) -> Unit = { _, _, _ -> }, header: @Composable () -> Unit, content: @Composable () -> Unit, ) { val isFullWidth = isFullWidthShade() val panelSpec = rememberShadeExpansionMotion(isFullWidth) val panelCornerRadiusPx = with(LocalDensity.current) { panelSpec.radius.toPx() } Box(modifier) { Scrim(showBackgroundColor = enableTransparency, onClicked = onScrimClicked) Loading @@ -72,10 +82,23 @@ fun ContentScope.OverlayShade( ) { Panel( enableTransparency = enableTransparency, spec = panelSpec, modifier = Modifier.overscroll(verticalOverscrollEffect) .element(panelElement) .panelWidth(isFullWidth), .panelWidth(isFullWidth) .onPlaced { coordinates -> val bounds = coordinates.boundsInWindow() val isTopRounded = panelSpec.isFloating val bottomCornerRadius: Float = if (isTopRounded) { min(panelCornerRadiusPx, bounds.height / 2) } else { min(panelCornerRadiusPx, bounds.height) } val topCornerRadius = if (isTopRounded) bottomCornerRadius else 0f onBackgroundPlaced(bounds, topCornerRadius, bottomCornerRadius) }, header = header.takeIf { isFullWidth }, content = content, ) Loading Loading @@ -107,6 +130,7 @@ private fun ContentScope.Scrim( @Composable private fun ContentScope.Panel( enableTransparency: Boolean, spec: VerticalExpandContainerSpec, modifier: Modifier = Modifier, header: (@Composable () -> Unit)?, content: @Composable () -> Unit, Loading @@ -117,7 +141,7 @@ private fun ContentScope.Panel( .disableSwipesWhenScrolling() .verticalExpandContainerBackground( backgroundColor = OverlayShade.Colors.panelBackground(enableTransparency), spec = rememberShadeExpansionMotion(isFullWidthShade()), spec = spec, ) ) { Column { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +3 −1 Original line number Diff line number Diff line Loading @@ -5992,10 +5992,12 @@ public class NotificationStackScrollLayout mNegativeRoundedClipPath.reset(); if (shape != null) { ShadeScrimBounds bounds = shape.getBounds(); float topRadius = shape.getTopRadius(); float bottomRadius = shape.getBottomRadius(); mNegativeRoundedClipPath.addRoundRect( bounds.getLeft(), bounds.getTop(), bounds.getRight(), bounds.getBottom(), new float[]{0, 0, 0, 0, bottomRadius, bottomRadius, bottomRadius, bottomRadius}, new float[]{topRadius, topRadius, topRadius, topRadius, bottomRadius, bottomRadius, bottomRadius, bottomRadius}, Path.Direction.CW); } invalidate(); Loading