Loading packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt +4 −39 Original line number Diff line number Diff line Loading @@ -22,14 +22,11 @@ import android.view.ViewGroup import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.CubicBezierEasing import androidx.compose.animation.core.tween import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.fillMaxSize Loading @@ -39,7 +36,6 @@ import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect Loading @@ -50,7 +46,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.TransformOrigin import androidx.compose.ui.graphics.graphicsLayer Loading Loading @@ -94,8 +89,6 @@ import com.android.systemui.privacy.PrivacyItem import com.android.systemui.res.R import com.android.systemui.scene.shared.model.DualShadeEducationElement import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingHorizontal import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingVertical import com.android.systemui.shade.ui.composable.ShadeHeader.Values.ClockScale import com.android.systemui.shade.ui.viewmodel.ShadeHeaderViewModel import com.android.systemui.statusbar.core.NewStatusBarIcons Loading Loading @@ -234,7 +227,7 @@ fun ContentScope.CollapsedShadeHeader( if (isSplitShade) { ShadeCarrierGroup(viewModel = viewModel) } HighlightChip( ShadeHighlightChip( onClick = { if (isSplitShade) { viewModel.onSystemIconChipClicked() Loading Loading @@ -317,7 +310,7 @@ fun ContentScope.ExpandedShadeHeader( textColor = colorAttr(android.R.attr.textColorPrimary), modifier = Modifier.widthIn(max = 90.dp), ) HighlightChip { ShadeHighlightChip { val paddingEnd = with(LocalDensity.current) { (if (NewStatusBarIcons.isEnabled) 3.sp else 6.sp).toDp() Loading Loading @@ -359,7 +352,7 @@ fun ContentScope.OverlayShadeHeader( modifier = modifier, startContent = { Box(modifier = Modifier.padding(horizontal = horizontalPadding)) { HighlightChip( ShadeHighlightChip( backgroundColor = notificationsHighlight.backgroundColor, horizontalArrangement = Arrangement.spacedBy(5.dp), onClick = viewModel::onNotificationIconChipClicked, Loading Loading @@ -392,7 +385,7 @@ fun ContentScope.OverlayShadeHeader( verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(horizontal = horizontalPadding), ) { HighlightChip( ShadeHighlightChip( backgroundColor = quickSettingsHighlight.backgroundColor, onClick = viewModel::onSystemIconChipClicked, modifier = Loading Loading @@ -785,34 +778,6 @@ private fun ContentScope.StatusIcons( ) } @Composable private fun HighlightChip( modifier: Modifier = Modifier, backgroundColor: Color = Color.Unspecified, horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, onClick: () -> Unit = {}, content: @Composable RowScope.() -> Unit, ) { val interactionSource = remember { MutableInteractionSource() } Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = horizontalArrangement, modifier = modifier .clip(RoundedCornerShape(25.dp)) .clickable( interactionSource = interactionSource, indication = null, onClick = onClick, ) .thenIf(backgroundColor != Color.Unspecified) { Modifier.background(backgroundColor) .padding(horizontal = ChipPaddingHorizontal, vertical = ChipPaddingVertical) }, content = content, ) } @Composable private fun ContentScope.PrivacyChip( privacyList: List<PrivacyItem>, Loading packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHighlightChip.kt 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.shade.ui.composable import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import com.android.compose.modifiers.thenIf import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingHorizontal import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingVertical /** A chip with a colored highlight. Used as an entry point for the shade. */ @Composable fun ShadeHighlightChip( modifier: Modifier = Modifier, backgroundColor: Color = Color.Unspecified, horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, onClick: () -> Unit = {}, content: @Composable RowScope.() -> Unit, ) { val interactionSource = remember { MutableInteractionSource() } Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = horizontalArrangement, modifier = modifier .clip(RoundedCornerShape(25.dp)) .clickable( interactionSource = interactionSource, indication = null, onClick = onClick, ) .thenIf(backgroundColor != Color.Unspecified) { Modifier.background(backgroundColor) .padding(horizontal = ChipPaddingHorizontal, vertical = ChipPaddingVertical) }, content = content, ) } Loading
packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt +4 −39 Original line number Diff line number Diff line Loading @@ -22,14 +22,11 @@ import android.view.ViewGroup import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.CubicBezierEasing import androidx.compose.animation.core.tween import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.fillMaxSize Loading @@ -39,7 +36,6 @@ import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect Loading @@ -50,7 +46,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.TransformOrigin import androidx.compose.ui.graphics.graphicsLayer Loading Loading @@ -94,8 +89,6 @@ import com.android.systemui.privacy.PrivacyItem import com.android.systemui.res.R import com.android.systemui.scene.shared.model.DualShadeEducationElement import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingHorizontal import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingVertical import com.android.systemui.shade.ui.composable.ShadeHeader.Values.ClockScale import com.android.systemui.shade.ui.viewmodel.ShadeHeaderViewModel import com.android.systemui.statusbar.core.NewStatusBarIcons Loading Loading @@ -234,7 +227,7 @@ fun ContentScope.CollapsedShadeHeader( if (isSplitShade) { ShadeCarrierGroup(viewModel = viewModel) } HighlightChip( ShadeHighlightChip( onClick = { if (isSplitShade) { viewModel.onSystemIconChipClicked() Loading Loading @@ -317,7 +310,7 @@ fun ContentScope.ExpandedShadeHeader( textColor = colorAttr(android.R.attr.textColorPrimary), modifier = Modifier.widthIn(max = 90.dp), ) HighlightChip { ShadeHighlightChip { val paddingEnd = with(LocalDensity.current) { (if (NewStatusBarIcons.isEnabled) 3.sp else 6.sp).toDp() Loading Loading @@ -359,7 +352,7 @@ fun ContentScope.OverlayShadeHeader( modifier = modifier, startContent = { Box(modifier = Modifier.padding(horizontal = horizontalPadding)) { HighlightChip( ShadeHighlightChip( backgroundColor = notificationsHighlight.backgroundColor, horizontalArrangement = Arrangement.spacedBy(5.dp), onClick = viewModel::onNotificationIconChipClicked, Loading Loading @@ -392,7 +385,7 @@ fun ContentScope.OverlayShadeHeader( verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(horizontal = horizontalPadding), ) { HighlightChip( ShadeHighlightChip( backgroundColor = quickSettingsHighlight.backgroundColor, onClick = viewModel::onSystemIconChipClicked, modifier = Loading Loading @@ -785,34 +778,6 @@ private fun ContentScope.StatusIcons( ) } @Composable private fun HighlightChip( modifier: Modifier = Modifier, backgroundColor: Color = Color.Unspecified, horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, onClick: () -> Unit = {}, content: @Composable RowScope.() -> Unit, ) { val interactionSource = remember { MutableInteractionSource() } Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = horizontalArrangement, modifier = modifier .clip(RoundedCornerShape(25.dp)) .clickable( interactionSource = interactionSource, indication = null, onClick = onClick, ) .thenIf(backgroundColor != Color.Unspecified) { Modifier.background(backgroundColor) .padding(horizontal = ChipPaddingHorizontal, vertical = ChipPaddingVertical) }, content = content, ) } @Composable private fun ContentScope.PrivacyChip( privacyList: List<PrivacyItem>, Loading
packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHighlightChip.kt 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.shade.ui.composable import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import com.android.compose.modifiers.thenIf import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingHorizontal import com.android.systemui.shade.ui.composable.ShadeHeader.Dimensions.ChipPaddingVertical /** A chip with a colored highlight. Used as an entry point for the shade. */ @Composable fun ShadeHighlightChip( modifier: Modifier = Modifier, backgroundColor: Color = Color.Unspecified, horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, onClick: () -> Unit = {}, content: @Composable RowScope.() -> Unit, ) { val interactionSource = remember { MutableInteractionSource() } Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = horizontalArrangement, modifier = modifier .clip(RoundedCornerShape(25.dp)) .clickable( interactionSource = interactionSource, indication = null, onClick = onClick, ) .thenIf(backgroundColor != Color.Unspecified) { Modifier.background(backgroundColor) .padding(horizontal = ChipPaddingHorizontal, vertical = ChipPaddingVertical) }, content = content, ) }